:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;

  --bg: #f7f3ed;
  --surface: #ffffff;
  --surface-2: #fbf8f4;
  --ink: #2a2521;
  --ink-2: #5b524a;
  --muted: #958b81;
  --line: #e9e1d7;
  --line-strong: #ddd2c4;
  --accent: #b96a3c;
  --accent-ink: #8d4d28;
  --accent-soft: #f7e8db;
  --sage: #63856b;
  --sage-soft: #e8f0e8;
  --rose: #ad5148;
  --shadow-sm: 0 1px 2px rgba(60, 42, 26, 0.05);
  --shadow: 0 6px 24px -12px rgba(60, 42, 26, 0.22);
  --radius: 16px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #16130f;
  --surface: #201c17;
  --surface-2: #262119;
  --ink: #f1e9df;
  --ink-2: #cabfb3;
  --muted: #8e8377;
  --line: #332c25;
  --line-strong: #443a30;
  --accent: #e09a63;
  --accent-ink: #f0c39c;
  --accent-soft: #35271c;
  --sage: #8fb596;
  --sage-soft: #24302a;
  --rose: #d98a80;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 12% -10%, rgba(214, 158, 111, 0.13), transparent 62%),
    radial-gradient(900px 520px at 105% 0%, rgba(150, 175, 154, 0.1), transparent 58%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------- 布局 ---------------- */

.shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #cf8355, #a9572f);
  box-shadow: 0 4px 14px -6px rgba(160, 84, 45, 0.6);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-family: var(--font-serif); font-size: 19px; letter-spacing: 0.14em; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; margin-top: 2px; }

.rail-nav { display: flex; flex-direction: column; gap: 3px; }

.rail-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--ink-2); font-size: 14px;
  transition: background 0.16s ease, color 0.16s ease;
}
.rail-item svg { width: 19px; height: 19px; opacity: 0.85; }
.rail-item:hover { background: var(--surface-2); color: var(--ink); }
.rail-item.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.rail-item.is-active svg { opacity: 1; }

.topbar-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.topbar-tools .topbar-mode { display: none; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 7px; padding: 0 6px; }
.mode-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-2);
  padding: 5px 10px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line);
  width: fit-content; max-width: 100%;
}
.mode-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--sage); flex: none;
}
.mode-badge.is-demo::before { background: #d0a34c; }
.mode-badge.is-off::before { background: var(--rose); }
.rail-note { font-size: 11px; color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 28px 14px;
  width: 100%; max-width: 776px; margin: 0 auto;
}
.topbar-title { font-family: var(--font-serif); font-size: 21px; letter-spacing: 0.06em; }
.topbar-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; color: var(--ink-2);
  border: 1px solid transparent; flex: none;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#view-profile, #view-review, #view-settings { overflow-y: auto; padding: 4px 28px 40px; }
#profile-body, #review-body, #settings-body { width: 100%; max-width: 760px; margin: 0 auto; }

.tabbar { display: none; }

/* ---------------- 对话流 ---------------- */

.stream { flex: 1; overflow-y: auto; padding: 8px 28px 4px; scroll-behavior: smooth; }
.stream-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 12px; }

.hero-welcome { padding: 30px 4px 10px; }
.hero-welcome h1 {
  font-family: var(--font-serif); font-size: 25px; font-weight: 500;
  letter-spacing: 0.04em; margin: 0 0 10px; line-height: 1.45;
}
.hero-welcome p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.8; max-width: 46ch; }
.hero-prompts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.prompt-chip {
  padding: 8px 13px; border-radius: 99px; font-size: 13px;
  border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface);
  transition: all 0.16s ease;
}
.prompt-chip:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }

.date-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0 4px; color: var(--muted); font-size: 11.5px; letter-spacing: 0.1em;
}
.date-divider::before, .date-divider::after {
  content: ""; height: 1px; background: var(--line); flex: 1;
}

.msg { display: flex; gap: 9px; max-width: 88%; animation: rise 0.32s cubic-bezier(0.22, 0.8, 0.3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.ai { align-self: flex-start; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; margin-top: 3px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 11px; font-family: var(--font-serif);
}
.avatar svg { width: 13px; height: 13px; }

.bubble {
  padding: 11px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
}
.msg.ai .bubble {
  background: var(--surface); border: 1px solid var(--line);
  border-top-left-radius: 5px; box-shadow: var(--shadow-sm);
}
.msg.user .bubble {
  background: var(--accent-soft); color: var(--accent-ink);
  border-top-right-radius: 5px; border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

.msg-meta { font-size: 11px; color: var(--muted); margin-top: 6px; padding: 0 2px; display: flex; gap: 8px; align-items: center; }
.msg.user .msg-meta { justify-content: flex-end; }
.msg-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; }

.cursor::after {
  content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px;
  background: var(--accent); vertical-align: -0.15em; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.safety-note {
  align-self: center; max-width: 640px; text-align: center;
  font-size: 12px; color: var(--ink-2); line-height: 1.7;
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  border-radius: 12px; padding: 9px 14px;
}
.safety-note strong { color: var(--rose); }

/* ---------------- 输入区 ---------------- */

.composer-wrap { padding: 6px 28px 18px; flex: none; }
.composer {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 18px; padding: 7px 8px 7px 7px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); }
.composer textarea {
  flex: 1; border: none; background: none; resize: none; outline: none;
  padding: 7px 2px; font-size: 15px; line-height: 1.6; max-height: 150px;
}
.composer textarea::placeholder { color: var(--muted); }
.send-btn {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #c87b4c, #ac5c32);
  transition: transform 0.14s ease, opacity 0.14s ease;
}
.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.45; transform: none; cursor: default; }

.composer-hint {
  max-width: 720px; margin: 8px auto 0; text-align: center;
  font-size: 11px; color: var(--muted); letter-spacing: 0.02em;
}

.mood-picker {
  max-width: 720px; margin: 0 auto 8px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  animation: rise 0.24s ease both;
}
.mood-label { font-size: 12px; color: var(--muted); }
.mood-chips { display: flex; gap: 5px; flex: 1; flex-wrap: wrap; }
.mood-chip {
  padding: 5px 11px; border-radius: 99px; font-size: 12.5px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
}
.mood-chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.link-btn { font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- 通用块 ---------------- */

.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-title { font-family: var(--font-serif); font-size: 16.5px; letter-spacing: 0.05em; }
.section-sub { font-size: 12px; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
}

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 15px 16px; box-shadow: var(--shadow-sm);
}
.stat-num { font-family: var(--font-serif); font-size: 26px; line-height: 1.1; letter-spacing: 0.02em; }
.stat-num small { font-size: 12px; font-family: var(--font-sans); color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 7px; letter-spacing: 0.04em; }

.bar-list { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 74px 1fr 46px; align-items: center; gap: 12px; }
.bar-name { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #d29a70, var(--accent));
  animation: grow 0.6s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}
@keyframes grow { from { transform: scaleX(0); transform-origin: left; } }
.bar-fill.is-sage { background: linear-gradient(90deg, #a7c1ab, var(--sage)); }
.bar-val { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 148px; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.week-val { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; height: 13px; line-height: 13px; }
.week-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.week-bar { width: 58%; border-radius: 6px 6px 3px 3px; background: var(--accent-soft); position: relative; min-height: 4px; }
.week-bar i { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, #d9a179, var(--accent)); }
.week-bar.is-empty { background: var(--surface-2); border: 1px dashed var(--line-strong); }
.week-lbl { font-size: 11px; color: var(--muted); }

.trigger-list { display: flex; flex-direction: column; gap: 1px; }
.trigger-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 2px;
  border-bottom: 1px dashed var(--line);
}
.trigger-row:last-child { border-bottom: none; }
.trigger-rank {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  display: grid; place-items: center; font-size: 11px;
  background: var(--surface-2); color: var(--muted);
}
.trigger-text { flex: 1; font-size: 13.5px; line-height: 1.5; }
.trigger-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.pattern-card {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 13px 16px; background: var(--surface);
  margin-bottom: 9px; position: relative;
}
.pattern-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.pattern-detail { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.pattern-dismiss {
  position: absolute; top: 9px; right: 10px; font-size: 11px; color: var(--muted);
  opacity: 0; transition: opacity 0.15s;
}
.pattern-card:hover .pattern-dismiss { opacity: 1; }

.memory-item {
  display: flex; gap: 13px; padding: 14px 2px; border-bottom: 1px dashed var(--line);
}
.memory-item:last-child { border-bottom: none; }
.memory-kind {
  flex: none; font-size: 10.5px; padding: 3px 7px; border-radius: 5px; height: fit-content;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  letter-spacing: 0.03em; white-space: nowrap;
}
.memory-kind.k-strategy { background: var(--sage-soft); color: var(--sage); border-color: transparent; }
.memory-kind.k-milestone { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.memory-body { flex: 1; min-width: 0; }
.memory-title { font-size: 14px; line-height: 1.5; }
.memory-content { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.6; }
.memory-foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.memory-act { font-size: 11.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.memory-act:hover { color: var(--accent-ink); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 99px; font-size: 12.5px;
  border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface);
}
.chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
[data-theme="dark"] .chip.is-on { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 11px; font-size: 13.5px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: all 0.16s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-primary {
  background: linear-gradient(145deg, #c87b4c, #ac5c32); color: #fff; border-color: transparent;
  box-shadow: 0 6px 18px -10px rgba(160, 84, 45, 0.8);
}
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 30%, var(--line)); }
.btn:disabled { opacity: 0.5; cursor: default; }

.empty {
  text-align: center; padding: 44px 20px; color: var(--muted); font-size: 13.5px; line-height: 1.9;
}
.empty-mark { font-family: var(--font-serif); font-size: 28px; color: var(--line-strong); margin-bottom: 12px; letter-spacing: 0.2em; }

/* ---------------- 回看 ---------------- */

.review-card { padding: 22px 24px; margin-bottom: 14px; }
.review-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.review-title { font-family: var(--font-serif); font-size: 19px; letter-spacing: 0.05em; }
.review-range { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.review-summary { font-size: 14px; line-height: 1.85; color: var(--ink); }
.review-trend {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 12.5px; color: var(--accent-ink); background: var(--accent-soft);
  padding: 5px 11px; border-radius: 8px;
}
.review-patterns { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.review-pattern { padding-left: 13px; border-left: 2px solid var(--line-strong); }
.review-pattern .rp-obs { font-size: 13.5px; font-weight: 600; }
.review-pattern .rp-mean { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.7; }
.review-pattern .rp-exp {
  font-size: 13px; margin-top: 7px; line-height: 1.7;
  background: var(--sage-soft); color: var(--sage);
  padding: 8px 12px; border-radius: 8px;
}
.review-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.review-anchor { font-size: 13px; color: var(--sage); }
.review-question { font-size: 13px; color: var(--muted); font-style: italic; }
.review-actions { margin-top: 14px; display: flex; gap: 8px; }

/* ---------------- 设置 ---------------- */

.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 15px 2px; border-bottom: 1px dashed var(--line);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 13.5px; }
.setting-desc { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; max-width: 46ch; }
.setting-control { flex: none; }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segmented button { padding: 6px 13px; border-radius: 7px; font-size: 12.5px; color: var(--ink-2); }
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.text-input {
  padding: 8px 12px; border-radius: 9px; font-size: 13px;
  border: 1px solid var(--line-strong); background: var(--surface); width: 150px;
}

.key-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-form .text-input { width: 230px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.key-info { flex-direction: column; align-items: flex-start; gap: 10px; }
.key-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.key-mask {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 11px; letter-spacing: 0.05em;
}

.note {
  font-size: 12px; line-height: 1.85; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 16px;
}
.note strong { color: var(--ink); }
.note + .note { margin-top: 10px; }

.app-version {
  margin-top: 26px; text-align: center;
  font-size: 11px; color: var(--muted); letter-spacing: 0.12em;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 14px);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 99px; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: all 0.24s ease; z-index: 60;
  max-width: 88vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 移动端 ---------------- */

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { padding: 16px 18px 10px; }
  .topbar-sub { display: none; }
  .stream { padding: 4px 16px; }
  .composer-wrap { padding: 4px 14px 10px; }
  .composer { border-radius: 16px; }
  .composer-hint { display: none; }
  #view-profile, #view-review, #view-settings { padding: 4px 16px 30px; }

  .topbar-mode:not([hidden]) { display: inline-flex; }
  .hero-prompts { flex-direction: column; align-items: flex-start; }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(18px) saturate(1.2);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 0; font-size: 10.5px; color: var(--muted); border-radius: 10px;
  }
  .tab-item svg { width: 21px; height: 21px; }
  .tab-item.is-active { color: var(--accent-ink); }
  .tab-item.is-active svg { stroke-width: 1.9; }

  .msg { max-width: 94%; }
  .setting-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-control { align-self: stretch; display: flex; align-items: center; }
  .text-input { width: 100%; }
  .setting-control .segmented { width: fit-content; }
  .key-form { width: 100%; }
  .key-form .text-input { width: 100%; }
  .key-form .btn-primary { width: 100%; }
  .review-actions .btn, .gen-review { width: 100%; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 12px; }
  .stat-num { font-size: 21px; }
  .review-card { padding: 18px; }
  .bar-row { grid-template-columns: 62px 1fr 40px; gap: 8px; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
