@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;700&family=IBM+Plex+Sans:wght@400;500;700&display=swap");

:root {
  --bg: #fff7df;
  --bg-soft: #fffdf5;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.88);
  --ink: #111111;
  --muted: #4c4c4c;
  --line: #101010;
  --accent-hot: #ff6b57;
  --accent-cool: #7af0ff;
  --accent-sun: #ffe169;
  --accent-lime: #c7ff7d;
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow: 10px 10px 0 0 rgba(0, 0, 0, 0.95);
  --shadow-soft: 6px 6px 0 0 rgba(0, 0, 0, 0.9);
  --max-auth: 760px;
  --max-chat: 920px;
  --max-shell: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 14%, rgba(255, 107, 87, 0.16), transparent 28%),
    radial-gradient(circle at 85% 8%, rgba(122, 240, 255, 0.2), transparent 24%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid rgba(255, 107, 87, 0.22);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  overflow: hidden;
  padding: 28px 18px 42px;
  position: relative;
}

.page-backdrop {
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.backdrop-orb {
  border-radius: 999px;
  filter: blur(36px);
  opacity: 0.6;
  position: absolute;
}

.backdrop-orb-one {
  background: rgba(255, 107, 87, 0.3);
  height: 260px;
  left: -50px;
  top: 120px;
  width: 260px;
}

.backdrop-orb-two {
  background: rgba(122, 240, 255, 0.28);
  height: 340px;
  right: -60px;
  top: 240px;
  width: 340px;
}

.backdrop-weave {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) 18px,
      rgba(0, 0, 0, 0.02) 18px,
      rgba(0, 0, 0, 0.02) 20px
    );
  inset: 0;
  opacity: 0.45;
  position: absolute;
}

.auth-shell,
.companion-shell {
  margin: 0 auto;
  max-width: var(--max-shell);
  position: relative;
  z-index: 1;
}

.companion-main {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gap-tight {
  gap: 8px;
}

.auth-header {
  margin: 0 auto 22px;
  max-width: var(--max-auth);
}

.auth-brand,
.app-bar-brand {
  align-items: center;
  display: flex;
  gap: 16px;
}

.brand-mark {
  align-items: center;
  background: var(--accent-sun);
  border: 4px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.7rem;
  font-weight: 700;
  height: 62px;
  justify-content: center;
  width: 62px;
}

.brand-mark-compact {
  font-size: 1.1rem;
  height: 42px;
  width: 42px;
}

.brand-title,
.hero-title,
.panel-title,
.drawer-title {
  letter-spacing: -0.04em;
  line-height: 0.94;
  margin: 0;
}

.brand-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2.1rem, 6vw, 3.9rem);
  font-weight: 700;
  max-width: 12ch;
}

.panel-title {
  font-size: clamp(1.55rem, 4vw, 2.5rem);
  font-weight: 700;
}

.brand-subtitle,
.field-label,
.eyebrow,
.message-role,
.memory-category,
.key-value-label,
.app-bar-label,
.status-pill,
.environment-pill,
.composer-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0;
  text-transform: uppercase;
}

.panel-copy,
.auth-copy,
.inline-alert-copy,
.composer-hint,
.message-meta,
.memory-meta,
.key-value-value,
.empty-state-copy,
.thread-copy,
.app-bar-copy {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.eyebrow,
.field-label,
.message-role,
.memory-category,
.key-value-label,
.composer-label {
  color: var(--ink);
}

.panel,
.auth-card {
  background: var(--panel);
  border: 4px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card {
  margin: 0 auto;
  max-width: var(--max-auth);
}

.auth-card-loading {
  min-height: 220px;
}

.auth-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 18px;
}

.panel-heading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading-split {
  align-items: flex-start;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
}

.toggle-row,
.button-row,
.app-bar-actions,
.composer-footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-button,
.primary-button,
.secondary-button,
.ghost-button,
.quiet-button {
  align-items: center;
  border: 3px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.toggle-button,
.ghost-button,
.quiet-button {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.toggle-button-active,
.quiet-button-active {
  background: var(--accent-cool);
}

.primary-button {
  background: var(--accent-hot);
  box-shadow: var(--shadow-soft);
}

.secondary-button {
  background: var(--accent-lime);
  box-shadow: var(--shadow-soft);
}

.ghost-button-muted {
  background: rgba(255, 255, 255, 0.84);
}

.toggle-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.quiet-button:hover {
  transform: translate(-1px, -1px);
}

.toggle-button:disabled,
.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.quiet-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.text-input,
.text-area,
.composer-input {
  appearance: none;
  background: rgba(255, 255, 255, 0.98);
  border: 3px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  padding: 14px 16px;
  width: 100%;
}

.text-area,
.composer-input {
  min-height: 116px;
  resize: vertical;
}

.text-input:focus,
.text-area:focus,
.composer-input:focus {
  outline: 3px solid rgba(255, 107, 87, 0.18);
  outline-offset: 2px;
}

.inline-alert {
  align-items: flex-start;
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 16px 18px;
}

.inline-alert-error {
  background: rgba(255, 107, 87, 0.18);
}

.inline-alert-success {
  background: rgba(199, 255, 125, 0.22);
}

.inline-alert-info {
  background: rgba(122, 240, 255, 0.22);
}

.inline-alert-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.app-bar {
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 4px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px 14px 12px 12px;
}

.app-bar-copy {
  font-size: 0.92rem;
}

.chat-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0 auto;
  max-width: var(--max-chat);
  width: 100%;
}

.profile-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
}

.thread-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 8px;
}

.welcome-panel,
.context-intro {
  background:
    linear-gradient(135deg, rgba(255, 225, 105, 0.5), rgba(255, 255, 255, 0.94)),
    var(--panel);
}

.status-panel {
  background:
    linear-gradient(135deg, rgba(122, 240, 255, 0.22), rgba(255, 255, 255, 0.92)),
    var(--panel);
  margin: 0 auto;
  max-width: 720px;
}

.transcript-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 520px;
}

.transcript-panel-focused {
  background: rgba(255, 255, 255, 0.97);
}

.transcript-header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
}

.transcript-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-bubble {
  border: 3px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  max-width: min(78ch, 88%);
  padding: 16px 18px;
}

.message-bubble-user {
  align-self: flex-end;
  background: rgba(122, 240, 255, 0.28);
}

.message-bubble-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.98);
}

.message-meta-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.message-meta {
  font-size: 0.82rem;
}

.message-body,
.memory-summary {
  line-height: 1.6;
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.empty-state {
  background: rgba(255, 255, 255, 0.7);
  border: 3px dashed var(--line);
  border-radius: 24px;
  padding: 18px;
}

.empty-state-soft {
  background: rgba(255, 253, 247, 0.86);
}

.bullet-list,
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.bullet-list li {
  line-height: 1.5;
}

.composer-form {
  background: rgba(255, 255, 255, 0.96);
  border-top: 3px solid rgba(16, 16, 16, 0.1);
  bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
  padding-top: 18px;
  position: sticky;
}

.composer-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer-footer {
  justify-content: space-between;
}

.composer-hint {
  flex: 1 1 260px;
}

.status-pill,
.environment-pill {
  background: var(--ink);
  border: 3px solid var(--line);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  min-height: 40px;
  padding: 0 14px;
  align-items: center;
}

.side-panel-muted {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 231, 0.92)),
    var(--panel-soft);
}

.memory-item {
  background: rgba(255, 255, 255, 0.74);
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  list-style: none;
  padding: 14px 16px;
}

.memory-list {
  padding-left: 0;
}

.key-value {
  border-top: 2px solid rgba(0, 0, 0, 0.18);
  padding-top: 12px;
}

.environment-footer {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 14px 30px;
  }

  .auth-card,
  .panel {
    padding: 18px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading-split,
  .app-bar,
  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .app-bar-actions {
    width: 100%;
  }

  .app-bar-actions > * {
    flex: 1 1 auto;
  }

  .message-bubble {
    max-width: 100%;
  }

  .environment-footer {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .toggle-button,
  .primary-button,
  .secondary-button,
  .ghost-button,
  .quiet-button {
    transition: none;
  }
}
