:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --paper-2: #ebe7dc;
  --surface: #fbfaf6;
  --ink: #171714;
  --muted: #77746c;
  --line: #d8d3c8;
  --line-strong: #bdb7aa;
  --accent: #4f58f6;
  --accent-soft: #e6e7ff;
  --danger: #b53a31;
  --success: #3b6e4c;
  --sidebar: 278px;
  --topbar: 74px;
  --radius: 18px;
  --shadow: 0 24px 80px rgba(26, 24, 18, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

::selection { background: var(--accent); color: white; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 720;
  letter-spacing: -0.02em;
}
.brand-mark {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
.brand-mark i {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--ink);
  border-radius: 50%;
}
.brand-mark i:nth-child(1) { left: 7px; top: 0; }
.brand-mark i:nth-child(2) { right: 0; top: 7px; }
.brand-mark i:nth-child(3) { left: 7px; bottom: 0; }
.brand-mark i:nth-child(4) { left: 0; top: 7px; }
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: var(--ink);
  opacity: .55;
}
.brand-mark::before { left: 9px; top: 3px; width: 1px; height: 14px; }
.brand-mark::after { top: 9px; left: 3px; height: 1px; width: 14px; }
.brand-tag {
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font: 600 9px/1 var(--mono);
  letter-spacing: .08em;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font: 650 11px/1.2 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* AUTH */
.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
  background: var(--paper);
}
.auth-story {
  position: relative;
  min-height: 100vh;
  padding: clamp(30px, 4vw, 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
}
.auth-story::before,
.auth-story::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.auth-story::before {
  width: min(54vw, 720px);
  aspect-ratio: 1;
  border: 1px solid rgba(79, 88, 246, .22);
  border-radius: 50%;
  right: -22%;
  bottom: -35%;
  box-shadow:
    0 0 0 70px rgba(79, 88, 246, .045),
    0 0 0 140px rgba(79, 88, 246, .025);
}
.auth-story::after {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  right: 13%;
  bottom: 26%;
  box-shadow: 58px -80px 0 -2px rgba(79,88,246,.55), -64px -46px 0 -3px rgba(79,88,246,.35);
}
.brand--auth { position: relative; z-index: 1; }
.auth-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
  max-width: 760px;
  padding: 80px 0;
}
.auth-copy h1 {
  margin: 18px 0 24px;
  max-width: 760px;
  font-size: clamp(48px, 6.4vw, 92px);
  line-height: .98;
  letter-spacing: -0.062em;
  font-weight: 670;
}
.auth-lead {
  max-width: 620px;
  margin: 0;
  color: #555149;
  font-size: clamp(18px, 1.5vw, 23px);
  line-height: 1.48;
  letter-spacing: -0.018em;
}
.auth-principles {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.auth-principles div {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
}
.auth-principles span {
  color: var(--muted);
  font: 600 10px/1.5 var(--mono);
}
.auth-principles p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}
.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--surface);
}
.auth-card {
  width: min(100%, 430px);
  padding: 8px;
}
.auth-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 56px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.auth-tab {
  border: 0;
  background: transparent;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.auth-tab.is-active { background: var(--ink); color: white; }
.auth-heading h2 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.auth-heading p { margin: 0 0 30px; color: var(--muted); line-height: 1.5; }
.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 650;
}
.field input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 15px;
  background: #fff;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 23, 20, .06);
}
.primary-action {
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-weight: 680;
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease;
}
.primary-action:hover { transform: translateY(-1px); }
.primary-action:disabled { opacity: .55; cursor: wait; transform: none; }
.form-error { margin: -2px 0 12px; color: var(--danger); font-size: 13px; line-height: 1.45; }
.privacy-note { margin: 20px 0 0; color: #8a857a; font-size: 11px; line-height: 1.5; }

/* APP */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  background: var(--paper);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  border-right: 1px solid var(--line);
  background: #ece8de;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 22px;
}
.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
}
.icon-button:hover { background: rgba(23,23,20,.055); }
.sidebar-close { display: none; font-size: 24px; }
.new-chat-button {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--ink);
  border-radius: 11px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}
.plus { font: 400 21px/1 var(--font); transform: translateY(-1px); }
.main-nav {
  display: grid;
  gap: 2px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
}
.nav-item {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 0 10px;
  border-radius: 9px;
  color: #514f49;
  font-size: 13px;
  transition: background .16s ease, color .16s ease;
}
.nav-item:hover { background: rgba(255,255,255,.42); }
.nav-item.is-active { background: rgba(255,255,255,.65); color: var(--ink); font-weight: 650; }
.nav-icon { position: relative; width: 17px; height: 17px; display: block; }
.nav-icon--chat { border: 1.5px solid currentColor; border-radius: 5px; }
.nav-icon--chat::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: -3px;
  width: 5px;
  height: 5px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: skewY(-32deg);
  background: #ece8de;
}
.nav-item.is-active .nav-icon--chat::after { background: #f5f3ec; }
.nav-icon--memory::before,
.nav-icon--memory::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.nav-icon--memory::after { inset: 6px; background: currentColor; }
.nav-count {
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(23,23,20,.07);
  color: var(--muted);
  text-align: center;
  font: 600 10px/1.2 var(--mono);
}
.conversation-section {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 18px;
}
.section-kicker { padding: 0 10px 8px; }
.conversation-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.conversation-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  padding: 7px 6px 7px 10px;
  border-radius: 9px;
}
.conversation-open {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px 0;
  text-align: left;
  cursor: pointer;
}
.conversation-open span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #5d5a52;
  font-size: 12px;
}
.conversation-item.is-active { background: rgba(255,255,255,.6); }
.conversation-item.is-active .conversation-open span { color: var(--ink); font-weight: 650; }
.conversation-delete {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #9a9589;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease;
}
.conversation-item:hover .conversation-delete,
.conversation-delete:focus-visible { opacity: 1; }
.conversation-delete:hover { background: rgba(181,58,49,.08); color: var(--danger); }
.account-block {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 14px 10px 2px;
  border-top: 1px solid var(--line);
}
.account-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent); }
.account-copy { min-width: 0; display: grid; gap: 4px; }
.account-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #57544d;
  font-size: 11px;
}
.account-copy button {
  width: fit-content;
  border: 0;
  padding: 0;
  background: none;
  color: #918c81;
  font-size: 11px;
  cursor: pointer;
}
.account-copy button:hover { color: var(--ink); }

.main-area {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  background: var(--surface);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar);
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(251,250,246,.9);
  backdrop-filter: blur(16px);
}
.mobile-menu { display: none; }
.topbar-copy { min-width: 0; }
.topbar-copy p {
  margin: 0 0 3px;
  color: var(--muted);
  font: 600 9px/1.2 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.topbar-copy h2 {
  margin: 0;
  max-width: min(680px, 55vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: -0.015em;
}
.memory-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6f6b62;
  font-size: 11px;
}
.memory-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(59,110,76,.09);
}
.page-panel { min-height: 0; }

/* CHAT */
.chat-page {
  position: relative;
  min-height: calc(100vh - var(--topbar));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages {
  width: min(100%, 840px);
  margin: 0 auto;
  padding: 54px 30px 190px;
  display: grid;
  gap: 34px;
}

.messages:empty {
  padding-top: 0;
  padding-bottom: 0;
}
.message-row { display: flex; align-items: flex-start; gap: 13px; }
.message-row.user { justify-content: flex-end; }
.assistant-avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
}
.assistant-avatar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 -5px 0 -3px var(--accent), 0 5px 0 -3px var(--accent), 5px 0 0 -3px var(--accent), -5px 0 0 -3px var(--accent);
}
.message-body { max-width: min(690px, calc(100vw - 410px)); }
.message-label {
  margin-bottom: 8px;
  color: var(--muted);
  font: 600 10px/1 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.message-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.68;
  letter-spacing: -0.011em;
}
.message-row.user .message-body {
  max-width: min(610px, 78%);
  padding: 13px 16px;
  border-radius: 18px 18px 5px 18px;
  background: var(--ink);
  color: white;
}
.message-row.user .message-content { line-height: 1.55; }
.message-row.user .message-label { display: none; }
.empty-state {
  width: min(100% - 44px, 780px);
  margin: auto;
  padding: 84px 0 220px;
  text-align: center;
}
.empty-symbol {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.empty-symbol::before,
.empty-symbol::after {
  content: "";
  position: absolute;
  background: var(--line-strong);
}
.empty-symbol::before { left: 37px; top: 10px; width: 1px; height: 56px; }
.empty-symbol::after { top: 37px; left: 10px; height: 1px; width: 56px; }
.empty-symbol span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); z-index: 2; }
.empty-symbol span:nth-child(1) { top: 7px; left: 34px; }
.empty-symbol span:nth-child(2) { right: 7px; top: 34px; }
.empty-symbol span:nth-child(3) { bottom: 7px; left: 34px; }
.empty-symbol span:nth-child(4) { left: 7px; top: 34px; }
.empty-symbol b { position: absolute; width: 10px; height: 10px; top: 32px; left: 32px; border-radius: 50%; background: var(--accent); z-index: 3; }
.empty-state h1 {
  max-width: 720px;
  margin: 15px auto 18px;
  font-size: clamp(35px, 4.1vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.055em;
  font-weight: 650;
}
.empty-state > p:not(.eyebrow) {
  max-width: 600px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 9px;
  margin-top: 34px;
  text-align: left;
}
.prompt-grid button {
  min-height: 58px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.55);
  color: #555249;
  text-align: left;
  font-size: 12px;
  line-height: 1.38;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.prompt-grid button:hover { border-color: var(--line-strong); background: white; transform: translateY(-1px); }
.typing-row {
  width: min(100%, 840px);
  margin: -140px auto 160px;
  padding: 0 30px;
  display: flex;
  gap: 13px;
  align-items: center;
}
.typing-copy { display: flex; gap: 4px; }
.typing-copy span { width: 5px; height: 5px; border-radius: 50%; background: #8d897f; animation: blink 1.15s infinite ease-in-out; }
.typing-copy span:nth-child(2) { animation-delay: .12s; }
.typing-copy span:nth-child(3) { animation-delay: .24s; }
@keyframes blink { 0%, 70%, 100% { opacity: .28; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }
.composer-wrap {
  position: fixed;
  z-index: 18;
  left: var(--sidebar);
  right: 0;
  bottom: 0;
  padding: 22px 24px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(251,250,246,0), rgba(251,250,246,.94) 25%, var(--surface) 64%);
}
.composer {
  width: min(100%, 790px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0,1fr) 42px;
  gap: 10px;
  align-items: end;
  padding: 9px 9px 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 12px 38px rgba(27,24,17,.07);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.composer:focus-within { border-color: #9b968b; box-shadow: 0 14px 44px rgba(27,24,17,.1); }
.composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 180px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  padding: 10px 0 8px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.48;
}
.composer textarea::placeholder { color: #aaa59a; }
.send-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  transition: opacity .16s ease, transform .16s ease;
}
.send-button:hover { transform: translateY(-1px); }
.send-button:disabled { opacity: .35; cursor: default; transform: none; }
.send-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.composer-hint {
  width: min(100%, 790px);
  margin: 7px auto 0;
  padding: 0 4px;
  color: #a09b90;
  font-size: 9px;
  text-align: right;
}

/* MEMORY */
.memory-page {
  overflow-y: auto;
  padding: 66px 7vw 100px;
}
.memory-intro { max-width: 850px; margin-bottom: 64px; }
.memory-intro h1 {
  max-width: 780px;
  margin: 15px 0 20px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1;
  letter-spacing: -0.058em;
  font-weight: 650;
}
.memory-intro > p:not(.eyebrow) {
  max-width: 690px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.memory-groups { max-width: 980px; border-top: 1px solid var(--line-strong); }
.memory-group {
  display: grid;
  grid-template-columns: minmax(130px, 190px) minmax(0,1fr);
  gap: 36px;
  padding: 27px 0 29px;
  border-bottom: 1px solid var(--line);
}
.memory-group-title {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 680;
}
.memory-list { display: grid; gap: 0; }
.memory-item {
  display: grid;
  grid-template-columns: 9px minmax(0,1fr) 34px;
  gap: 12px;
  align-items: start;
  padding: 0 0 16px;
}
.memory-item:last-child { padding-bottom: 0; }
.memory-bullet { width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.memory-copy p { margin: 0; font-size: 14px; line-height: 1.52; }
.memory-copy span { display: block; margin-top: 4px; color: #9a958a; font: 500 9px/1.3 var(--mono); }
.memory-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #aaa499;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.memory-remove:hover { background: rgba(181,58,49,.07); color: var(--danger); }
.memory-empty {
  max-width: 650px;
  padding: 30px 0;
  border-top: 1px solid var(--line-strong);
}
.memory-empty p { margin: 0 0 7px; font-size: 19px; font-weight: 650; }
.memory-empty span { color: var(--muted); font-size: 13px; line-height: 1.55; }

/* FEEDBACK */
.toast-region {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
}
.toast {
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
  animation: toast-in .18s ease-out;
}
.toast.error { background: #6f2924; border-color: #6f2924; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  :root { --sidebar: 254px; }
  .auth-view { grid-template-columns: 1fr; }
  .auth-story { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 34px; }
  .auth-copy { margin: 80px 0 90px; padding: 0; }
  .auth-copy h1 { font-size: clamp(52px, 9vw, 82px); max-width: 780px; }
  .auth-panel { min-height: auto; padding: 80px 28px; }
  .message-body { max-width: min(690px, calc(100vw - 340px)); }
}

@media (max-width: 760px) {
  :root { --topbar: 66px; }
  .auth-story { padding: 24px 22px 26px; }
  .auth-copy { margin: 70px 0 64px; }
  .auth-copy h1 { font-size: clamp(43px, 12.5vw, 64px); }
  .auth-lead { font-size: 17px; }
  .auth-principles { grid-template-columns: 1fr; gap: 12px; }
  .auth-principles div { grid-template-columns: 28px 1fr; }
  .auth-panel { padding: 56px 22px; }
  .auth-tabs { margin-bottom: 42px; }

  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 310px);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 28px 0 70px rgba(23,23,20,.12);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-close { display: inline-grid; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    border: 0;
    background: rgba(23,23,20,.22);
    backdrop-filter: blur(2px);
  }
  .main-area { min-height: 100vh; }
  .topbar {
    grid-template-columns: 40px minmax(0,1fr) auto;
    padding: 0 13px 0 8px;
    gap: 8px;
  }
  .mobile-menu { display: inline-grid; }
  .mobile-menu span { width: 18px; height: 1px; background: currentColor; }
  .mobile-menu span + span { margin-top: 5px; }
  .topbar-copy h2 { max-width: 45vw; }
  .memory-status { font-size: 0; gap: 0; }
  .memory-status-dot { margin-right: 4px; }

  .messages { padding: 36px 17px 180px; gap: 28px; }
  .message-body { max-width: calc(100vw - 76px); }
  .message-row.user .message-body { max-width: 84%; }
  .message-content { font-size: 14px; line-height: 1.62; }
  .empty-state { margin: 0 auto; padding: 54px 0 170px; }
  .empty-symbol { width: 66px; height: 66px; margin-bottom: 30px; }
  .empty-symbol::before { left: 32px; top: 9px; height: 48px; }
  .empty-symbol::after { top: 32px; left: 9px; width: 48px; }
  .empty-symbol span:nth-child(1) { top: 6px; left: 29px; }
  .empty-symbol span:nth-child(2) { right: 6px; top: 29px; }
  .empty-symbol span:nth-child(3) { bottom: 6px; left: 29px; }
  .empty-symbol span:nth-child(4) { left: 6px; top: 29px; }
  .empty-symbol b { top: 27px; left: 27px; }
  .empty-state h1 { font-size: clamp(34px, 10.5vw, 48px); }
  .prompt-grid { grid-template-columns: 1fr; margin-top: 18px; gap: 7px; }
  .prompt-grid button { min-height: 52px; }
  .typing-row { padding: 0 17px; }
  .composer-wrap { left: 0; padding: 18px 12px max(13px, env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .composer { border-radius: 15px; padding-left: 14px; }

  .memory-page { padding: 44px 20px 80px; }
  .memory-intro { margin-bottom: 46px; }
  .memory-intro h1 { font-size: clamp(38px, 11vw, 56px); }
  .memory-group { grid-template-columns: 1fr; gap: 20px; }
  .memory-group-title { font: 650 10px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
}

@media (max-width: 430px) {
  .auth-copy h1 { font-size: 42px; }
  .auth-panel { padding: 48px 18px; }
  .empty-state { width: min(100% - 32px, 780px); }
  .message-row.user .message-body { max-width: 88%; }
  .memory-intro h1 { font-size: 39px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
