/* Rebound - style.css
   Light, warm, minimal. Navy type, muted electric-blue accent. */

:root {
  --bg: #faf8f4;
  --bg-2: #f3efe6;
  --surface: #ffffff;
  --ink: #0e1a3a;
  --ink-2: #47526f;
  --ink-3: #6f7a94;
  --line: #e6e0d4;
  --line-2: #d6cfbf;
  --accent: #3f62d6;
  --accent-2: #3050b8;
  --accent-soft: #e9eefc;
  --accent-line: #c5d2f5;
  --good: #2c7a58;
  --good-soft: #e5f2ec;
  --warn: #9a620f;
  --warn-soft: #fbf0d9;
  --bad: #ad3f38;
  --bad-soft: #f8e7e5;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(14, 26, 58, 0.05);
  --shadow: 0 1px 2px rgba(14, 26, 58, 0.04), 0 10px 28px rgba(14, 26, 58, 0.07);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.012em; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent-2); }
svg { flex: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 10px;
  z-index: 100; text-decoration: none;
}
.skip-link:focus { top: 10px; }

[data-lucide], .lucide { width: 18px; height: 18px; stroke-width: 2; flex: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 248, 244, 0.88);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  font-family: var(--font-serif); font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
}
.brand-mark { width: 30px; height: 30px; }
.site-nav { display: flex; gap: 4px; margin-left: 12px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 15px;
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover { background: var(--bg-2); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-2); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.mode-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13.5px; font-weight: 550; color: var(--ink-2);
}
.mode-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.mode-chip[data-tone="good"] .dot { background: var(--good); }
.mode-chip[data-tone="warn"] .dot { background: #d79a2b; }
.mode-chip[data-tone="demo"] .dot { background: var(--accent); }
.mode-chip:hover { border-color: var(--accent-line); background: var(--accent-soft); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface);
  display: inline-grid; place-items: center; color: var(--ink-2);
  transition: background 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: var(--bg-2); border-color: var(--line-2); color: var(--ink); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; flex: 1; }
.view { padding: 40px 0 72px; animation: view-in 0.35s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: 12.5px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.display { font-family: var(--font-serif); font-size: clamp(32px, 4.4vw, 48px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; }
.lead { color: var(--ink-2); font-size: 18px; max-width: 60ch; }
.view-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.view-head.row { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.section-title { font-size: 19px; margin-bottom: 14px; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }

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

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row-gap { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 600; font-size: 15px; line-height: 1.2;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s, color 0.2s;
  text-decoration: none; color: var(--ink);
}
.btn:hover:not(:disabled) { background: var(--bg-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(63, 98, 214, 0.28); }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #1a2a57; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-2); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: #e3bdb9; color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); }
.btn-lg { padding: 14px 24px; font-size: 16.5px; border-radius: 14px; }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn svg, .btn [data-lucide] { width: 18px; height: 18px; }

/* ---------- Chips and badges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line);
}
.chip-accent { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-line); }
.chip-good { background: var(--good-soft); color: var(--good); border-color: #bfe0d0; }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: #ecd6a6; }
.chip-bad { background: var(--bad-soft); color: var(--bad); border-color: #ebc4c0; }
.chip [data-lucide], .chip svg { width: 14px; height: 14px; }

/* ---------- Banners ---------- */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14.5px; color: var(--ink-2); margin-bottom: 16px;
}
.banner [data-lucide], .banner svg { margin-top: 2px; }
.banner strong { color: var(--ink); }
.banner-info { background: var(--accent-soft); border-color: var(--accent-line); }
.banner-demo { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }
.banner-warn { background: var(--warn-soft); border-color: #ecd6a6; }
.banner-error { background: var(--bad-soft); border-color: #ebc4c0; }
.banner .banner-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Empty and loading states ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 36px 20px; color: var(--ink-2);
}
.empty-icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); margin-bottom: 4px;
}
.empty-icon [data-lucide], .empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-size: 18px; color: var(--ink); }
.empty p { max-width: 42ch; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--accent-line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 56px 24px; text-align: center; }

/* ---------- Dashboard ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center;
  padding: 32px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.hero .lead { margin-top: 10px; }
.hero-cta { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.stat-value { font-family: var(--font-serif); font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.stat-value.text { font-size: 22px; line-height: 1.25; }
.stat-sub { font-size: 13px; color: var(--ink-3); }

.meter-row { display: grid; gap: 6px; margin-bottom: 18px; }
.meter-row:last-child { margin-bottom: 0; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.meter-name { font-weight: 600; }
.meter-val { font-variant-numeric: tabular-nums; font-weight: 650; }
.meter-track { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--accent); width: var(--w, 0%); animation: grow 0.9s cubic-bezier(.2,.7,.2,1) both; }
.meter-fill.c2 { background: #5b7fe8; }
.meter-fill.c3 { background: #8aa4f0; }
.meter-track.empty-track .meter-fill { width: 0; }
@keyframes grow { from { width: 0; } to { width: var(--w, 0%); } }

.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.session-row:hover { border-color: var(--accent-line); background: #fbfcff; transform: translateY(-1px); }
.session-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; }
.session-main { flex: 1; min-width: 0; }
.session-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-meta { font-size: 13.5px; color: var(--ink-3); }
.score-pill { font-variant-numeric: tabular-nums; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-size: 14px; }

/* ---------- Setup ---------- */
.mode-panel { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 28px; flex-wrap: wrap; }
.mode-panel .mp-text { flex: 1; min-width: 240px; }
.mode-panel .mp-title { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.seg-inline { display: inline-flex; padding: 4px; background: var(--bg-2); border-radius: 12px; gap: 2px; }
.seg-inline button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); }
.seg-inline button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

fieldset.field-group { border: 0; padding: 0; margin: 0 0 32px; min-width: 0; }
fieldset.field-group[disabled] { opacity: 0.45; pointer-events: none; }
fieldset.field-group legend { padding: 0; margin-bottom: 4px; font-size: 19px; font-weight: 650; letter-spacing: -0.012em; }
.field-help { color: var(--ink-3); font-size: 14.5px; margin-bottom: 14px; }

.choice-grid { display: grid; gap: 12px; }
.choice-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-grid.scenarios { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice-body {
  height: 100%;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.15s;
}
.choice:hover .choice-body { border-color: var(--accent-line); transform: translateY(-1px); }
.choice input:checked + .choice-body { border-color: var(--accent); background: #f7f9ff; box-shadow: 0 0 0 3px rgba(63, 98, 214, 0.14); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-title { font-weight: 650; }
.choice-desc { font-size: 14px; color: var(--ink-2); }
.choice-native { font-family: var(--font-serif); font-size: 22px; letter-spacing: -0.01em; }
.choice-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; margin-bottom: 4px; }
.choice-check { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: transparent; }
.choice input:checked + .choice-body .choice-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice-check [data-lucide], .choice-check svg { width: 12px; height: 12px; stroke-width: 3; }

.setup-footer {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; box-shadow: var(--shadow);
}
.setup-summary { font-weight: 600; }
.setup-summary span { color: var(--ink-3); font-weight: 500; }
.info-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 32px; }
.info-item { display: flex; gap: 12px; font-size: 14.5px; color: var(--ink-2); }
.info-item .ii { width: 34px; height: 34px; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.info-item strong { display: block; color: var(--ink); font-size: 15px; }

/* ---------- Conversation ---------- */
.convo-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.convo-title { font-family: var(--font-serif); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }
.convo-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.timer { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; font-variant-numeric: tabular-nums; font-weight: 650; }
.timer [data-lucide], .timer svg { color: var(--ink-3); }

.convo-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
.stage { padding: 28px 24px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; position: sticky; top: 84px; }

.avatar { position: relative; width: 176px; height: 176px; display: grid; place-items: center; }
.avatar .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--accent); opacity: 0; transform: scale(0.68); }
.avatar .orbit { position: absolute; inset: 4px; border-radius: 50%; opacity: 0; border: 1.5px dashed var(--accent-line); }
.avatar .orbit::after { content: ""; position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--accent); }
.avatar .core {
  position: relative; width: 116px; height: 116px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #2b418c 0%, #0e1a3a 72%);
  box-shadow: 0 14px 34px rgba(14, 26, 58, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid; place-items: center;
}
.avatar .bars { display: flex; align-items: center; gap: 5px; height: 52px; }
.avatar .bars i { display: block; width: 6px; height: 10px; border-radius: 3px; background: #a9bdff; }
.avatar .bars i:nth-child(2), .avatar .bars i:nth-child(4) { background: #c8d5ff; }

.avatar[data-state="idle"] .core { animation: breathe 5s ease-in-out infinite; }
.avatar[data-state="idle"] .bars i { height: 12px; }
.avatar[data-state="listening"] .ring { animation: ripple 2.1s ease-out infinite; }
.avatar[data-state="listening"] .ring.r2 { animation-delay: 0.7s; }
.avatar[data-state="listening"] .ring.r3 { animation-delay: 1.4s; }
.avatar[data-state="listening"] .bars i { height: 18px; animation: listen 1.4s ease-in-out infinite; }
.avatar[data-state="listening"] .bars i:nth-child(2) { animation-delay: 0.15s; }
.avatar[data-state="listening"] .bars i:nth-child(3) { animation-delay: 0.3s; }
.avatar[data-state="listening"] .bars i:nth-child(4) { animation-delay: 0.45s; }
.avatar[data-state="listening"] .bars i:nth-child(5) { animation-delay: 0.6s; }
.avatar[data-state="processing"] .orbit { opacity: 1; animation: spin 1.5s linear infinite; }
.avatar[data-state="processing"] .bars i { height: 8px; opacity: 0.7; }
.avatar[data-state="speaking"] .ring { animation: ripple 1.7s ease-out infinite; border-color: #7e98ee; }
.avatar[data-state="speaking"] .ring.r2 { animation-delay: 0.55s; }
.avatar[data-state="speaking"] .ring.r3 { animation-delay: 1.1s; }
.avatar[data-state="speaking"] .bars i { animation: talk 0.9s ease-in-out infinite; }
.avatar[data-state="speaking"] .bars i:nth-child(1) { animation-duration: 0.7s; }
.avatar[data-state="speaking"] .bars i:nth-child(2) { animation-duration: 0.95s; animation-delay: 0.1s; }
.avatar[data-state="speaking"] .bars i:nth-child(3) { animation-duration: 0.8s; animation-delay: 0.2s; }
.avatar[data-state="speaking"] .bars i:nth-child(4) { animation-duration: 1s; animation-delay: 0.05s; }
.avatar[data-state="speaking"] .bars i:nth-child(5) { animation-duration: 0.75s; animation-delay: 0.3s; }

@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes ripple { 0% { opacity: 0.55; transform: scale(0.66); } 100% { opacity: 0; transform: scale(1.04); } }
@keyframes listen { 0%, 100% { height: 14px; } 50% { height: 26px; } }
@keyframes talk { 0%, 100% { height: 10px; } 50% { height: 44px; } }

.persona { font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.state-label { font-family: var(--font-serif); font-size: 26px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; }
.state-hint { color: var(--ink-3); font-size: 14.5px; min-height: 22px; max-width: 34ch; }
.caption { width: 100%; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); text-align: left; min-height: 64px; }
.caption .cap-label { font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.caption .cap-text { font-size: 17px; line-height: 1.4; }
.caption .translation { margin-top: 6px; }

.mic-wrap { position: relative; margin: 6px 0 2px; }
.mic {
  position: relative; width: 96px; height: 96px; border-radius: 50%; border: 0;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(14, 26, 58, 0.28);
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}
.mic [data-lucide], .mic svg { width: 36px; height: 36px; }
.mic:hover:not(:disabled) { transform: translateY(-2px); background: #1a2a57; }
.mic:active:not(:disabled) { transform: scale(0.97); }
.mic[data-state="listening"] { background: var(--accent); box-shadow: 0 10px 28px rgba(63, 98, 214, 0.45); }
.mic[data-state="listening"]::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0.4; animation: pulse 1.5s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(0.92); opacity: 0.5; } 100% { transform: scale(1.18); opacity: 0; } }
.mic:disabled { background: #c9ccd8; box-shadow: none; cursor: not-allowed; }
.mic-note { font-size: 13px; color: var(--ink-3); max-width: 36ch; }
.interim { min-height: 24px; font-size: 16px; color: var(--accent-2); font-style: italic; max-width: 100%; overflow-wrap: anywhere; }

.stage-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.ctl {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--ink-2);
  transition: background 0.2s, border-color 0.2s;
}
.ctl:hover:not(:disabled) { background: var(--bg-2); color: var(--ink); }
.ctl:disabled { opacity: 0.45; cursor: not-allowed; }
.ctl[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.ctl.rescue-btn { background: var(--warn-soft); border-color: #ecd6a6; color: var(--warn); }
.ctl.rescue-btn:hover:not(:disabled) { background: #f7e7c2; }
.ctl [data-lucide], .ctl svg { width: 16px; height: 16px; }

.text-form { display: flex; gap: 8px; width: 100%; margin-top: 6px; }
.input, .textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 98, 214, 0.16); }
.input:disabled, .textarea:disabled { background: var(--bg-2); cursor: not-allowed; }
.textarea { min-height: 84px; resize: vertical; }

.rescue { width: 100%; text-align: left; border: 1px solid #ecd6a6; background: #fffaf0; border-radius: var(--radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rescue-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rescue-head strong { display: flex; align-items: center; gap: 8px; color: var(--warn); }
.pips { display: inline-flex; gap: 4px; margin-left: 6px; }
.pips i { width: 18px; height: 5px; border-radius: 3px; background: #ecd6a6; }
.pips i.on { background: #d79a2b; }
.rescue-note { font-size: 13.5px; color: var(--ink-2); }
.hint-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.hint-level { font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--warn); }
.hint-text { font-size: 17px; }
.hint-items { display: flex; flex-direction: column; gap: 4px; }
.hint-items li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.hint-items .ph { font-weight: 650; }
.hint-items .mn { color: var(--ink-3); font-size: 14px; }
.hint-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rescue-error { font-size: 14px; color: var(--bad); }

/* chat */
.chat { display: flex; flex-direction: column; height: min(78vh, 740px); min-height: 420px; overflow: hidden; }
.chat-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-head h2 { font-size: 17px; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.chat-empty { margin: auto; text-align: center; color: var(--ink-3); font-size: 14.5px; max-width: 30ch; }
.msg { display: flex; gap: 10px; max-width: 88%; animation: msg-in 0.3s ease both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-ai { align-self: flex-start; }
.msg-student { align-self: flex-end; flex-direction: row-reverse; }
.mini-av { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; flex: none; margin-top: 2px; }
.mini-av i { display: block; width: 3px; height: 10px; background: #a9bdff; border-radius: 2px; margin: 0 1.5px; }
.mini-av i:nth-child(2) { height: 14px; }
.bubble { padding: 11px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.msg-ai .bubble { border-top-left-radius: 6px; }
.msg-student .bubble { background: var(--accent-soft); border-color: var(--accent-line); border-top-right-radius: 6px; }
.msg-label { font-size: 12px; font-weight: 650; color: var(--ink-3); margin-bottom: 2px; }
.bubble p { overflow-wrap: anywhere; }
.translation { font-size: 14.5px; color: var(--ink-3); font-style: italic; margin-top: 4px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-error { margin: 0 16px 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bad-soft); border: 1px solid #ebc4c0; color: var(--ink); }
.chat-error strong { display: block; margin-bottom: 2px; }
.chat-error p { font-size: 14.5px; color: var(--ink-2); }
.chat-error .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.end-nudge { margin: 0 16px 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--good-soft); border: 1px solid #bfe0d0; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14.5px; }

/* ---------- Feedback ---------- */
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.report-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.scores-card { padding: 28px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px; align-items: center; margin-bottom: 20px; }
.ring-box { position: relative; display: grid; place-items: center; }
.ring-box.big { width: 168px; height: 168px; }
.ring-box.small { width: 96px; height: 96px; }
.ring-svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--bg-2); }
.ring-fg { fill: none; stroke-linecap: round; animation: ring-in 1.1s cubic-bezier(.2,.7,.2,1) both; }
@keyframes ring-in { from { stroke-dashoffset: var(--c); } }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-num { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.ring-box.big .ring-num { font-size: 46px; }
.ring-box.small .ring-num { font-size: 26px; }
.ring-cap { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }
.sub-scores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sub-score { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.sub-score .name { font-weight: 650; }
.sub-score .desc { font-size: 13px; color: var(--ink-3); max-width: 22ch; }
.approx-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); margin-bottom: 20px; }
.approx-note strong { color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.fact { padding: 14px 16px; }
.fact .fv { font-family: var(--font-serif); font-size: 24px; font-weight: 600; }
.fact .fl { font-size: 13px; color: var(--ink-3); }
.fb-card { padding: 20px; display: flex; flex-direction: column; gap: 8px; border-left: 4px solid var(--line-2); }
.fb-card.good { border-left-color: var(--good); }
.fb-card.improve { border-left-color: #d79a2b; }
.fb-card h3 { font-size: 16.5px; display: flex; gap: 8px; align-items: center; }
.fb-card p { color: var(--ink-2); font-size: 15px; }
.fb-card.good h3 [data-lucide] { color: var(--good); }
.fb-card.improve h3 [data-lucide] { color: #b97d14; }
.vocab-card { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.vocab-card .expr { font-family: var(--font-serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.vocab-card .mean { color: var(--ink-2); font-size: 15px; }
.vocab-card .ex { font-size: 14.5px; color: var(--ink-3); font-style: italic; }
.moment { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.quote { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); }
.quote .ql { font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.quote.better { background: var(--good-soft); border-color: #bfe0d0; }
.next-card { padding: 22px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.next-card .nc-main { display: flex; gap: 14px; align-items: center; min-width: 240px; flex: 1; }

.replay { display: flex; flex-direction: column; gap: 12px; }
.replay .turn { display: flex; flex-direction: column; gap: 6px; max-width: 86%; }
.replay .turn.t-ai { align-self: flex-start; }
.replay .turn.t-student { align-self: flex-end; }
.replay .bubble.flagged { border-color: #d79a2b; box-shadow: 0 0 0 3px rgba(215, 154, 43, 0.15); }
.replay .translation { display: none; }
.replay.show-tr .translation { display: block; }
.turn-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.t-student .turn-badges { justify-content: flex-end; }
.obstacle-note { font-size: 13px; color: var(--ink-3); }
.rewind-log { display: flex; flex-direction: column; gap: 10px; }
.rewind-item { padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); display: grid; gap: 6px; font-size: 15px; }

/* ---------- Progress ---------- */
.chart-card { padding: 22px; }
.chart-card h3 { font-size: 17px; margin-bottom: 4px; }
.chart-card .sub { color: var(--ink-3); font-size: 14px; margin-bottom: 14px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font-sans); fill: var(--ink-3); font-size: 11.5px; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis-label { text-anchor: end; }
.chart-svg .x-label { text-anchor: middle; }
.chart-svg .line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-svg .col { fill: #5b7fe8; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.hbar-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: 12px; align-items: center; margin-bottom: 12px; font-size: 14.5px; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--bg-2); position: relative; overflow: hidden; }
.hbar-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent-line); border-radius: 999px; width: var(--w, 0%); }
.hbar-fill.struggle { background: #d79a2b; }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 64px; text-align: right; }
.delta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.delta { padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); }
.delta .dn { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.delta .dv { font-family: var(--font-serif); font-size: 26px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.delta.up .dv { color: var(--good); }
.delta.down .dv { color: var(--bad); }
.delta.flat .dv { color: var(--ink-2); }
.delta .dd { font-size: 13px; color: var(--ink-3); }
.lang-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.lang-table th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.lang-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.lang-table tr:last-child td { border-bottom: 0; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; }

/* ---------- Dialogs ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--ink);
  width: calc(100% - 32px); max-width: 620px; max-height: calc(100vh - 32px);
  box-shadow: 0 30px 80px rgba(14, 26, 58, 0.3);
}
dialog.modal.wide { max-width: 720px; }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in 0.25s ease both; }
dialog.modal::backdrop { background: rgba(14, 26, 58, 0.42); backdrop-filter: blur(3px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; }
.modal-head h2 { font-size: 21px; font-family: var(--font-serif); font-weight: 600; }
.modal-body { padding: 4px 24px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { padding: 16px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-body p { color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-weight: 650; font-size: 15px; }
.help { font-size: 13.5px; color: var(--ink-3); }
.key-row { display: flex; gap: 8px; }
.status-line { font-size: 14px; min-height: 20px; }
.status-line.ok { color: var(--good); }
.status-line.err { color: var(--bad); }
.privacy-sec h3 { font-size: 16px; margin-bottom: 4px; }
.privacy-sec p { font-size: 15px; }
.rw-item {
  display: grid; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); transition: border-color 0.2s, background 0.2s;
}
.rw-item:hover { border-color: var(--accent-line); background: #fbfcff; }
.rw-item .rw-ai { font-size: 14px; color: var(--ink-3); }
.rw-item .rw-me { font-weight: 600; }
.rw-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.rw-group-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.verdict { padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); display: grid; gap: 6px; }
.verdict.clearer { background: var(--good-soft); border-color: #bfe0d0; }
.verdict.similar { background: var(--bg); }
.verdict.less_clear { background: var(--warn-soft); border-color: #ecd6a6; }
.verdict.sample { background: var(--accent-soft); border-color: var(--accent-line); }

/* ---------- Footer, toasts ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 20px 24px 28px; }
.footer-inner { max-width: 1120px; margin: 0 auto; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-3); align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

.toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14.5px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--bad); }
.toast-success { background: var(--good); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-grid.scenarios { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .convo-grid { grid-template-columns: 1fr; }
  .stage { position: static; }
  .chat { height: auto; min-height: 340px; max-height: none; }
  .chat-log { max-height: 55vh; min-height: 220px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .scores-card { grid-template-columns: 1fr; justify-items: center; gap: 24px; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .info-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner { padding: 10px 16px; gap: 10px; }
  .container { padding: 0 16px; }
  .view { padding: 24px 0 96px; }
  .site-nav {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 45;
    background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .nav-link { flex-direction: column; gap: 2px; font-size: 12px; padding: 6px 14px; }
  body[data-view="conversation"] .site-nav { display: none; }
  body[data-view="conversation"] .view { padding-bottom: 32px; }
  .mode-chip .mc-text { display: none; }
  .mode-chip { padding: 9px 11px; }
  .choice-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-grid.cols-3 { grid-template-columns: 1fr; }
  .choice-grid.scenarios { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sub-scores { grid-template-columns: 1fr; gap: 20px; }
  .hbar-row { grid-template-columns: 1fr auto; }
  .hbar-row .hbar-track { grid-column: 1 / -1; order: 3; }
  .msg { max-width: 94%; }
  .replay .turn { max-width: 96%; }
  .setup-footer { bottom: 76px; }
  .toasts { bottom: 84px; }
  .convo-title { font-size: 23px; }
  .stage { padding: 20px 16px; }
  .avatar { width: 150px; height: 150px; }
  .avatar .core { width: 100px; height: 100px; }
  dialog.modal { max-height: calc(100vh - 16px); width: calc(100% - 16px); }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 460px) {
  .stats { grid-template-columns: 1fr; }
  .delta-grid { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .spinner { animation: none; border-top-color: var(--accent); border-right-color: var(--accent); }
  /* Static state cues so the avatar still communicates state without motion */
  .avatar[data-state="listening"] .ring.r1 { opacity: 0.7; transform: scale(1); }
  .avatar[data-state="speaking"] .ring.r1 { opacity: 0.7; transform: scale(1); }
  .avatar[data-state="speaking"] .bars i { height: 30px; }
  .avatar[data-state="listening"] .bars i { height: 20px; }
  .avatar[data-state="processing"] .orbit { opacity: 1; }
  .meter-fill { width: var(--w, 0%); }
  .ring-fg { stroke-dashoffset: var(--final, 0); }
}

/* ---------- Simple landing hero ---------- */
.hero.simple {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 14px; padding: 64px 28px 56px; margin-bottom: 24px;
}
.hero.simple .lead { margin: 0 auto; }
.hero.simple .hero-cta { margin-top: 10px; min-width: min(320px, 100%); }
.hero.simple .btn-lg { padding: 18px 32px; font-size: 18px; border-radius: 16px; }
.hero-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.hero-fix { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; margin-top: 6px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); border: 1px solid #ecd6a6; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .stats.three { grid-template-columns: 1fr; } .hero.simple { padding: 44px 20px 40px; } }

/* ---------- API connection status ---------- */
.api-status { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); }
.api-status p { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.api-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--ink-3); }
.api-status.ok { background: var(--good-soft); border-color: #bfe0d0; }
.api-status.ok .api-dot { background: var(--good); }
.api-status.error { background: var(--bad-soft); border-color: #ebc4c0; }
.api-status.error .api-dot { background: var(--bad); }
.api-status.info .api-dot { background: #d79a2b; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--bg-2); padding: 1px 6px; border-radius: 6px; }

/* =====================================================================
   v3: simple flow. Quiet header, centered single column, airy type.
   ===================================================================== */
body {
  background:
    radial-gradient(900px 420px at 50% -80px, #e9eefc 0%, rgba(233, 238, 252, 0) 70%),
    var(--bg);
}
.site-header { background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; position: static; }
.header-inner { max-width: 960px; padding: 18px 24px; }
.brand { font-size: 21px; }
.container { max-width: 960px; }
.view { padding: 28px 0 72px; }

.mode-chip[data-tone="good"], .mode-chip[data-tone="idle"] { display: none; }

.hbtn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid #ebc4c0; background: var(--bad-soft); color: var(--bad);
  font-weight: 650; font-size: 14.5px; transition: background 0.2s;
}
.hbtn:hover:not(:disabled) { background: #f3d6d3; }
.hbtn:disabled { opacity: 0.45; cursor: not-allowed; }
.hbtn [data-lucide], .hbtn svg { width: 15px; height: 15px; }

/* landing */
.landing { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 44px 0 24px; }
.landing .display { font-size: clamp(34px, 5.6vw, 58px); max-width: 16ch; line-height: 1.06; }
.landing .lead { font-size: 18px; color: var(--ink-3); max-width: 38ch; }
.landing-main { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 18px; width: 100%; }
.prompt { font-family: var(--font-serif); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.link-btn.quiet { color: var(--ink-3); font-weight: 550; text-decoration-color: var(--line-2); margin-top: 8px; }
.landing .btn-lg { padding: 18px 34px; font-size: 18px; border-radius: 16px; }

/* steps */
.step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; padding-top: 6px; }
.step-title { font-family: var(--font-serif); font-size: clamp(28px, 4.4vw, 42px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 4px; color: var(--ink-3); font-weight: 600; font-size: 14.5px; }
.back-link:hover { color: var(--ink); }
.back-link [data-lucide], .back-link svg { width: 16px; height: 16px; }
.steps { display: inline-flex; gap: 6px; }
.steps i { width: 26px; height: 4px; border-radius: 3px; background: var(--line-2); transition: background 0.3s; }
.steps i.on { background: var(--ink); }

.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; width: 100%; max-width: 760px; }
.lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 10px 16px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.lang-btn:hover { transform: translateY(-2px); border-color: var(--accent-line); box-shadow: var(--shadow); }
.lang-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.lang-native { font-family: var(--font-serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.lang-name { font-size: 12.5px; color: var(--ink-3); font-weight: 550; }

.opt-group { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 10px; }
.opt-label { font-size: 13px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.opt-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.opt {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 16px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.opt:hover { border-color: var(--accent-line); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.opt-title { font-weight: 650; font-size: 16px; }
.opt-desc { font-size: 13.5px; color: var(--ink-3); line-height: 1.4; }
.begin-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 10px; }
.begin-wrap .btn-lg { min-width: 220px; padding: 18px 34px; font-size: 18px; border-radius: 16px; }

/* conversation: one calm column */
.convo { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.convo-head { text-align: center; }
.convo-title { font-size: 20px; margin: 0; }
.convo-meta { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.timer { display: inline; padding: 0; background: none; border: 0; border-radius: 0; font-weight: 500; }
.timer::before { content: "\00b7"; margin: 0 8px; }
.stage { position: static; padding: 6px 0 0; gap: 10px; background: none; border: 0; box-shadow: none; }
.state-label { font-size: 24px; }
.caption { background: var(--surface); border-color: var(--line); text-align: center; padding: 16px 18px; }
.caption .cap-label { display: none; }
.caption .cap-text { font-size: 19px; }
.mic { width: 88px; height: 88px; }
.mic-note { font-size: 12.5px; }
.stage-controls { gap: 6px; margin-top: 2px; }
.ctl { background: transparent; border-color: transparent; padding: 7px 10px; font-weight: 550; }
.ctl:hover:not(:disabled) { background: var(--surface); border-color: var(--line); }
.ctl.rescue-btn { background: var(--warn-soft); border-color: #ecd6a6; }
.chat-error, .end-nudge { margin: 0; width: 100%; text-align: left; }

.transcript { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.transcript summary { cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::after { content: "+"; color: var(--ink-3); font-size: 18px; line-height: 1; }
.transcript[open] summary::after { content: "\2212"; }
.transcript .chat-log { max-height: 340px; border-top: 1px solid var(--line); }

body[data-view="conversation"] .site-footer { display: none; }
.site-footer { border-top: 0; padding-top: 8px; }
.footer-inner { max-width: 960px; justify-content: center; }

/* settings extras */
.adv { border-top: 1px solid var(--line); padding-top: 14px; }
.adv summary { cursor: pointer; font-weight: 650; color: var(--ink-2); margin-bottom: 12px; }
.adv[open] summary { margin-bottom: 16px; }
.adv > .field, .adv > fieldset { margin-bottom: 18px; }

@media (max-width: 720px) {
  .opt-row { grid-template-columns: 1fr; }
  .lang-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing { padding-top: 24px; }
  .view { padding: 16px 0 48px; }
  .mode-chip .mc-text { display: inline; }
  .mode-chip { padding: 7px 12px; }
}

/* v3: keep the mic above the fold */
.mic-note { display: none; }
.avatar { width: 124px; height: 124px; }
.avatar .core { width: 88px; height: 88px; }
.avatar .bars { height: 40px; }
.stage { gap: 8px; }
.state-hint { min-height: 0; }
.persona { margin-top: 2px; }
.mic { width: 80px; height: 80px; }
.mic [data-lucide], .mic svg { width: 30px; height: 30px; }
.interim { min-height: 18px; }
@media (max-width: 720px) {
  .avatar { width: 112px; height: 112px; }
  .avatar .core { width: 80px; height: 80px; }
  .stage { padding: 0; }
}

/* =====================================================================
   v4: minimal. Monochrome, one font, no shadows, no decoration.
   ===================================================================== */
:root {
  --bg: #ffffff;
  --bg-2: #f4f4f5;
  --surface: #ffffff;
  --ink: #111111;
  --ink-2: #444444;
  --ink-3: #8a8a8a;
  --line: #ececec;
  --line-2: #dddddd;
  --accent: #111111;
  --accent-2: #111111;
  --accent-soft: #f4f4f5;
  --accent-line: #cccccc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: none;
  --shadow: none;
  --font-serif: var(--font-sans);
}
body { background: var(--bg); }
.display, .step-title, .prompt, .brand, .lang-native, .ring-num { font-family: var(--font-sans); letter-spacing: -0.03em; }
.brand { font-size: 18px; font-weight: 700; }
.card, .caption, .transcript { box-shadow: none; }

/* landing */
.landing { gap: 10px; padding-top: 64px; }
.landing .display { font-size: clamp(32px, 5vw, 48px); font-weight: 700; }
.prompt { font-size: 17px; font-weight: 500; color: var(--ink-3); }
.landing .btn-lg, .begin-wrap .btn-lg { border-radius: 999px; padding: 16px 32px; font-size: 16px; }

/* setup */
.step-title { font-size: clamp(24px, 3.6vw, 32px); font-weight: 700; }
.steps i { width: 18px; height: 3px; }
.lang-grid { gap: 8px; max-width: 640px; }
.lang-btn { padding: 14px 10px; border-radius: 12px; transition: border-color 0.15s, background 0.15s; }
.lang-btn:hover { transform: none; box-shadow: none; border-color: var(--ink); }
.lang-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--bg-2); }
.lang-native { font-size: 17px; font-weight: 600; }
.lang-name { font-size: 12px; }
.opt { padding: 14px; border-radius: 12px; }
.opt:hover { border-color: var(--ink); }
.opt[aria-pressed="true"] { border-color: var(--ink); background: var(--bg-2); box-shadow: none; }
.opt-label { letter-spacing: 0.04em; font-size: 12px; }

/* buttons */
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: none; }
.btn-primary:hover:not(:disabled) { background: #333; border-color: #333; }
.hbtn { background: transparent; border-color: var(--line-2); color: var(--ink); }
.hbtn:hover:not(:disabled) { background: var(--bg-2); }
.ctl.rescue-btn { background: transparent; border-color: var(--line-2); }

/* conversation */
.avatar .ring, .avatar .orbit { display: none; }
.avatar { width: 96px; height: 96px; }
.avatar .core { width: 72px; height: 72px; background: var(--ink); box-shadow: none; }
.avatar .bars i, .avatar .bars i:nth-child(2), .avatar .bars i:nth-child(4) { background: #fff; width: 4px; }
.avatar[data-state="processing"] .core { animation: breathe 1.2s ease-in-out infinite; }
.persona { display: none; }
.state-label { font-size: 18px; font-weight: 600; }
.state-hint { font-size: 14px; color: var(--ink-3); }
.caption { border-color: var(--line); }
.caption .cap-text { font-size: 18px; }
.mic { width: 72px; height: 72px; background: var(--ink); box-shadow: none; }
.mic:hover:not(:disabled) { background: #333; transform: none; }
.mic[data-state="listening"] { background: #d33; box-shadow: none; }
.mic[data-state="listening"]::after { border-color: #d33; }
.mic [data-lucide], .mic svg { width: 26px; height: 26px; }

/* footer */
.site-footer { padding: 12px 24px 20px; font-size: 12px; color: var(--ink-3); }

@media (max-width: 720px) {
  .landing { padding-top: 40px; }
  .avatar { width: 88px; height: 88px; }
  .avatar .core { width: 64px; height: 64px; }
}

/* ---------- Plans, usage and account (uses the existing tokens) ---------- */
#view-pricing, #view-account, #view-admin { max-width: 760px; margin: 0 auto; padding: 36px 0 48px; display: flex; flex-direction: column; gap: 18px; }
#view-pricing .view-head, #view-account .view-head, #view-admin .view-head { margin-bottom: 6px; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.plan-card { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.plan-card.featured { border-color: var(--accent-line); box-shadow: var(--shadow); }
.plan-name { font-size: 18px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price strong { font-family: var(--font-serif); font-size: 40px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.plan-price span { color: var(--ink-3); }
.plan-lines { display: grid; gap: 8px; }
.plan-lines li { display: flex; gap: 8px; align-items: center; }
.plan-lines svg, .plan-lines [data-lucide] { width: 18px; height: 18px; color: var(--good); }
.plan-action { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 6px; }
.plan-foot { text-align: center; max-width: 60ch; margin: 0 auto; }
.usage { display: grid; gap: 8px; width: 100%; }
.usage-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.usage .meter-fill.full { background: var(--warn); }
.usage.compact { max-width: 340px; }
.usage.compact .usage-top { justify-content: center; font-weight: 500; font-size: 14px; color: var(--ink-2); }
.usage-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.account-strip { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; width: 100%; }
.account-card { display: flex; flex-direction: column; gap: 12px; }
.limit-card { border-color: #ecd6a6; background: var(--warn-soft); display: flex; flex-direction: column; gap: 10px; }
.limit-card h2 { font-size: 20px; }
.auth-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 12px; }
#dlgAuth .modal-body .btn, #dlgNewPassword .modal-body .btn { width: 100%; justify-content: center; }
.kv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.kv th, .kv td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv th[scope="row"] { font-weight: 500; color: var(--ink-2); }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }
.admin-notes { margin-top: 12px; display: grid; gap: 4px; list-style: disc; padding-left: 18px; }
@media (max-width: 720px) {
  .plans { grid-template-columns: 1fr; }
  #view-pricing, #view-account, #view-admin { padding-top: 20px; }
  .kv th, .kv td { padding: 7px 6px; font-size: 13.5px; }
}
/* Account / usage chip: always visible so signed-in users can reach their plan */
.mode-chip[data-tone="plan"] .dot { background: var(--accent); }

/* ---------- Scenario Practice ---------- */
.opt-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scenario-input { min-height: 150px; line-height: 1.5; }
.scenario-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.scenario-meta .help { margin: 0; }
.scenario-meta .tiny { white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 2px; }
.scenario-brief .brief-text { margin-top: 8px; white-space: pre-wrap; color: var(--ink-2); overflow-wrap: anywhere; }
.fb-card.tip { border-left: 3px solid var(--accent); }
@media (max-width: 720px) {
  .opt-row.two { grid-template-columns: 1fr; }
  .scenario-meta { flex-direction: column; gap: 4px; }
}
.scenario-group { text-align: left; }
.scenario-group .opt-label { text-align: center; }

/* ---------- Legal pages (/privacy, /terms, /refunds, /contact) ---------- */
.legal { max-width: 720px; margin: 0 auto; padding: 40px 0 64px; }
.legal .display { margin: 6px 0 4px; }
.legal h2 { font-size: 19px; margin: 32px 0 10px; }
.legal p, .legal li { color: var(--ink-2); line-height: 1.65; }
.legal p + p { margin-top: 12px; }
.legal ul { list-style: disc; padding-left: 22px; display: grid; gap: 8px; margin-top: 10px; }
.legal a { color: var(--accent-2); }
.legal-links { justify-content: center; gap: 18px; }
.auth-legal { text-align: center; }
@media (max-width: 720px) { .legal { padding-top: 24px; } .legal h2 { font-size: 17.5px; } }

#iosBrowserBanner { flex-wrap: wrap; margin-top: 16px; }
#iosBrowserBanner > div:nth-child(2) { flex: 1 1 200px; }
