/* Design system: living gradient + frosted glass. Light = "Dawn", dark = "Nordlys".
   <html data-theme> is set before first paint (see index.html) from the saved choice or the OS setting.
   Every colour, font and material is a token; the two themes only swap values. */
:root {
  --base: #f8eee8;
  --b1: #ffb199; --b2: #ff8a6b; --b3: #cbbcff; --b4: #ffe0b8;
  --blob-blur: 46px;
  --grain: .07;

  --ink: #2b1c18;
  --muted: #86675e;
  --accent: #d9502f;
  --accent-ink: #fff;
  --live: #e0573f;
  --error: #c8102e;

  --glass: rgba(255, 255, 255, .44);
  --glass-strong: rgba(255, 255, 255, .62);
  --glass-line: rgba(255, 255, 255, .7);
  --glass-hi: rgba(255, 255, 255, .8);
  --glass-shadow: 0 18px 40px -18px rgba(150, 70, 40, .35);
  --seg-on: rgba(255, 255, 255, .9);
  --seg-on-ink: var(--ink);
  --inset: rgba(255, 255, 255, .5);
  --hair: rgba(120, 60, 40, .12);
  --bar: #e0573f;

  --tick: rgba(224, 87, 63, .6);
  --bot-body: radial-gradient(circle at 34% 28%, #fff 0 55%, #fbe9e3);
  --bot-eye: #e8743b;
  --bot-glow: rgba(224, 87, 63, .45);
  --bot-shadow: rgba(150, 70, 40, .28);
  --mic-bg: linear-gradient(160deg, #f07a5c, #d9452e);
  --mic-ink: #fff;
  --mic-glow: rgba(217, 69, 46, .7);
  --mic-idle: #2b1c18;
  --mic-idle-ink: #fff;

  --display: 'Instrument Serif', Georgia, serif;
  --display-weight: 400;
  --display-tracking: -0.01em;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;

  --blur: 26px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] {
  --base: #120a2e;
  --b1: #7b4dff; --b2: #ff5f8f; --b3: #ff9a5a; --b4: #2b6bff;
  --blob-blur: 54px;
  --grain: .1;

  --ink: #fff;
  --muted: rgba(235, 228, 255, .66);
  --accent: #ffb36b;
  --accent-ink: #2a1300;
  --live: #6bffb8;
  --error: #ff6b81;

  --glass: rgba(255, 255, 255, .1);
  --glass-strong: rgba(30, 16, 70, .55);
  --glass-line: rgba(255, 255, 255, .18);
  --glass-hi: rgba(255, 255, 255, .22);
  --glass-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6);
  --seg-on: rgba(255, 255, 255, .92);
  --seg-on-ink: #1a1040;
  --inset: rgba(255, 255, 255, .08);
  --hair: rgba(255, 255, 255, .1);
  --bar: #ffb36b;

  --tick: rgba(255, 255, 255, .55);
  --bot-body: radial-gradient(circle at 34% 28%, #fff 0 55%, #e4dcff);
  --bot-eye: #241458;
  --bot-glow: rgba(255, 95, 143, .5);
  --bot-shadow: rgba(0, 0, 0, .4);
  --mic-bg: linear-gradient(160deg, #ffc98f, #ff8a5a);
  --mic-ink: #2a1300;
  --mic-glow: rgba(255, 138, 90, .7);
  --mic-idle: rgba(255, 255, 255, .92);
  --mic-idle-ink: #1a1040;

  --display: 'Sora', system-ui, sans-serif;
  --display-weight: 600;
  --display-tracking: -0.035em;
  --sans: 'Sora', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Living background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; border-radius: 50%; filter: blur(var(--blob-blur)); animation: drift 20s ease-in-out infinite alternate; }
.bg .b1 { width: 75vmax; height: 75vmax; max-width: 520px; max-height: 520px; background: var(--b1); top: -18%; left: -25%; }
.bg .b2 { width: 65vmax; height: 65vmax; max-width: 460px; max-height: 460px; background: var(--b2); top: 25%; right: -35%; animation-duration: 24s; animation-delay: -7s; }
.bg .b3 { width: 80vmax; height: 80vmax; max-width: 560px; max-height: 560px; background: var(--b3); bottom: -30%; left: -20%; animation-duration: 28s; animation-delay: -13s; }
.bg .b4 { width: 45vmax; height: 45vmax; max-width: 320px; max-height: 320px; background: var(--b4); top: 50%; left: 20%; animation-duration: 18s; animation-delay: -4s; }
/* Film grain stops the big gradients from banding. */
.bg::after {
  content: ""; position: absolute; inset: 0; opacity: var(--grain); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
[data-theme="dark"] .bg { background: radial-gradient(120% 70% at 50% 0%, transparent 40%, rgba(5, 2, 20, .6)); }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8%, -5%) scale(1.08); }
  100% { transform: translate(-5%, 7%) scale(.94); }
}
body.just-found .bg { animation: found 1.4s var(--ease); }
@keyframes found { 25% { filter: saturate(1.5) brightness(1.08); } }

/* ---------- Glass ---------- */
.glass, .tiles div, .voice, .costs:not(:empty), .alts li {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  backdrop-filter: blur(var(--blur)) saturate(1.6);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .tiles div, .voice, .costs:not(:empty) { background: var(--glass-strong); }
}

/* ---------- Header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 6px; }
.brand { font-family: var(--display); font-weight: var(--display-weight); font-size: 24px; letter-spacing: var(--display-tracking); }
.tabs { margin-left: auto; display: flex; gap: 2px; border-radius: 999px; padding: 3px; }
.tab { border: 0; background: transparent; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); transition: background .2s, color .2s; }
.tab.is-active { background: var(--seg-on); color: var(--seg-on-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

.theme-toggle { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; padding: 0; color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:active { transform: scale(.92); }

/* ---------- Views ---------- */
main { flex: 1; overflow: hidden; display: flex; min-height: 0; }
.view { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding: 0 16px; scrollbar-width: none; }
/* Scrolls by wheel, trackpad or swipe, without a visible bar. */
.view::-webkit-scrollbar { display: none; }
.view.is-active { display: flex; }

/* Status eyebrow at the top of Live */
.status { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; }
.status.is-live .dot { background: var(--live); opacity: 1; box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 25%, transparent); animation: pulse 1.6s ease-in-out infinite; }
.status.is-error { color: var(--error); }
.status.is-error .dot { background: var(--error); opacity: 1; }
@keyframes pulse { 50% { opacity: .35; } }

.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; position: relative; padding: 8px 0; }

/* Empty / listening state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 320px; margin: 0 auto; }
.empty-title { font-family: var(--display); font-weight: var(--display-weight); font-size: 44px; line-height: 1.05; letter-spacing: var(--display-tracking); margin: 0; }
.empty-body { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; max-width: 250px; }
.empty-body em { font-style: normal; color: var(--ink); font-weight: 500; }
[data-theme="dark"] .empty-title { font-weight: 300; }

/* The bot: hops while listening, sleeps when the mic is off. Its tick ring follows the mic level. */
.orb-wrap { position: relative; width: 168px; height: 168px; margin: 44px 0 40px; }
.ticks {
  position: absolute; inset: -28px; border-radius: 50%;
  background: repeating-conic-gradient(var(--tick) 0 .9deg, transparent .9deg 5deg);
  -webkit-mask: radial-gradient(circle, transparent 63%, #000 64%, #000 71%, transparent 72%);
  mask: radial-gradient(circle, transparent 63%, #000 64%, #000 71%, transparent 72%);
  opacity: calc(.35 + var(--level, 0) * .65);
  transform: scale(calc(1 + var(--level, 0) * .1));
  transition: transform .08s linear, opacity .08s linear;
}
.bot-shadow {
  position: absolute; left: 44px; right: 44px; bottom: 14px; height: 12px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--bot-shadow), transparent);
  animation: hop-shadow .9s ease-in-out infinite;
}
.bot {
  position: absolute; left: 22px; top: 18px; width: 124px; height: 124px; border-radius: 50%;
  background: var(--bot-body);
  box-shadow: inset -8px -12px 24px rgba(0, 0, 0, .06), 0 18px 40px -14px var(--bot-glow);
  transform-origin: 50% 100%;
  animation: hop .9s ease-in-out infinite;
}
.bot-eye {
  position: absolute; top: 30px; width: 15px; height: 30px; border-radius: 8px;
  background: var(--bot-eye);
  transform: rotate(-24deg);
  transition: all .3s var(--ease);
  animation: blink 4s infinite;
}
.bot-eye:nth-child(1) { left: 54px; }
.bot-eye:nth-child(2) { left: 82px; top: 24px; }
.zzz { position: absolute; right: 2px; top: -6px; font-family: var(--display); font-size: 22px; color: var(--ink); pointer-events: none; display: none; }
.zzz b { position: absolute; font-weight: 400; opacity: 0; animation: snooze 3s ease-out infinite; }
.zzz b:nth-child(2) { animation-delay: 1s; font-size: .8em; }
.zzz b:nth-child(3) { animation-delay: 2s; font-size: .65em; }
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1.08, .92); }
  30% { transform: translateY(-22px) scale(.96, 1.04); }
  50% { transform: translateY(-28px) scale(1); }
  70% { transform: translateY(-22px) scale(.97, 1.03); }
}
@keyframes hop-shadow { 50% { transform: scale(.6); opacity: .5; } }
@keyframes blink { 0%, 94%, 100% { transform: rotate(-24deg) scaleY(1); } 97% { transform: rotate(-24deg) scaleY(.1); } }
@keyframes doze { 50% { transform: scale(1.04, .96); } }
@keyframes snooze {
  0% { opacity: 0; transform: translate(0, 0); }
  20% { opacity: .7; }
  100% { opacity: 0; transform: translate(18px, -34px); }
}
/* Idle: the bot sleeps, eyes shut, breathing slowly. */
body:not(:has(.mic[aria-pressed="true"])) .bot { animation: doze 4s ease-in-out infinite; }
body:not(:has(.mic[aria-pressed="true"])) .bot-shadow { animation: none; }
body:not(:has(.mic[aria-pressed="true"])) .bot-eye {
  top: 50px; width: 20px; height: 10px; border-radius: 0 0 12px 12px;
  background: transparent; border: 4px solid var(--bot-eye); border-top: 0;
  transform: none; animation: none;
}
body:not(:has(.mic[aria-pressed="true"])) .bot-eye:nth-child(1) { left: 38px; }
body:not(:has(.mic[aria-pressed="true"])) .bot-eye:nth-child(2) { left: 70px; }
body:not(:has(.mic[aria-pressed="true"])) .zzz { display: block; }

/* ---------- Word card ---------- */
.card { border-radius: 28px; padding: 22px 22px 20px; animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-english { margin: 0; color: var(--muted); font-size: 14px; }
.play { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 18px -8px var(--mic-glow); }
.play svg { width: 12px; height: 12px; margin-left: 2px; }
.play:active, .card-word:active { transform: scale(.96); }
.card-word {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  padding: 10px 0 4px;
  text-align: left;
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: 56px;
  line-height: 1;
  letter-spacing: var(--display-tracking);
  overflow-wrap: break-word;
  hyphens: auto;
  transition: transform .15s var(--ease);
}
.article { display: block; font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--accent); margin-bottom: 6px; }
.article:empty { display: none; }
.card-meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }
.card-meta span:empty { display: none; }
.card-example { margin: 16px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--inset); }
.card-example p { margin: 0; line-height: 1.4; }
.card-example p:first-child { font-size: 16px; cursor: pointer; }
.card-example p.muted { font-size: 13px; margin-top: 3px; }
.card-example:has(p:first-child:empty) { display: none; }
.card-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.card-note:empty { display: none; }
.alts { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.alts:empty { display: none; }
.alts li { border-radius: 999px; padding: 5px 11px; font-size: 12.5px; box-shadow: none; }
.alts li span { color: var(--muted); }

.thinking { align-self: center; margin: 16px 0 0; padding: 9px 16px; border-radius: 999px; font-size: 14px; color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
.thinking strong { color: var(--ink); font-weight: 600; }

.ticker {
  min-height: 2.9em;
  margin: 8px 6px 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ticker .interim { opacity: .55; }

/* ---------- Words ---------- */
.view-words h2, .view-usage h2 { font-family: var(--display); font-weight: var(--display-weight); font-size: 38px; line-height: 1.05; letter-spacing: var(--display-tracking); margin: 18px 0 4px; }
[data-theme="dark"] :is(.view-words, .view-usage) h2 { font-weight: 300; }
#words-empty { margin: 4px 0 0; font-size: 14px; }
.words { list-style: none; margin: 14px 0 16px; padding: 4px 16px; border-radius: 24px; }
.words:empty { display: none; }
.words li { display: flex; align-items: baseline; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.words li:last-child { border-bottom: 0; }
.words .w-da { font-family: var(--display); font-size: 22px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
.words .w-art { color: var(--accent); font-size: 12px; font-weight: 600; }
.words .w-en { color: var(--muted); margin-left: auto; text-align: right; font-size: 13.5px; }
.words .w-count { font-size: 11px; color: var(--muted); background: var(--inset); border-radius: 999px; padding: 1px 7px; }
.words button { border: 0; background: none; padding: 0; text-align: left; }

/* Voice picker */
.voice-wrap { margin: 8px 0 24px; }
.voice-wrap h3, .view-usage h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin: 22px 0 8px; }
.small { font-size: 13px; margin: 0 0 10px; }
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice { text-align: left; border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.voice span { font-size: 12px; color: var(--muted); }
.voice[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--glass-shadow); }

/* ---------- Usage ---------- */
.usage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.range { display: flex; gap: 2px; border-radius: 999px; padding: 3px; margin-bottom: 4px; }
.range button { border: 0; background: transparent; font-size: 12px; font-weight: 500; padding: 6px 10px; border-radius: 999px; color: var(--muted); }
.range button[aria-pressed="true"] { background: var(--seg-on); color: var(--seg-on-ink); }
.hero { margin: 22px 0 14px; }
.hero-num { font-family: var(--display); font-weight: var(--display-weight); font-size: 64px; line-height: 1; letter-spacing: var(--display-tracking); font-variant-numeric: tabular-nums; }
.hero-label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.tiles div { border-radius: 18px; padding: 12px 14px; }
.tiles dt { font-size: 12px; color: var(--muted); }
.tiles dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
#usage-empty { font-size: 14px; }
.costs { list-style: none; margin: 0; padding: 2px 16px; border-radius: 22px; }
.cost-row { padding: 12px 0; border-bottom: 1px solid var(--hair); }
.cost-row:last-child { border-bottom: 0; }
.cost-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.cost-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.cost-bar { height: 4px; margin: 7px 0 5px; border-radius: 4px; background: var(--bar); width: calc(var(--w, 0) * 100%); min-width: 2px; }
.cost-units { font-size: 12px; color: var(--muted); }
.fineprint { font-size: 12px; color: var(--muted); margin: 16px 0 24px; line-height: 1.45; }

/* ---------- Dock: speaker · type box · mic ---------- */
.dock { display: flex; align-items: center; gap: 6px; margin: 8px 16px 16px; padding: 5px; border-radius: 34px; }
[data-theme="dark"] .dock { background: rgba(18, 8, 46, .45); }
.speak-toggle { flex: none; width: 46px; height: 46px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--inset); color: var(--ink); }
.speak-toggle svg { width: 19px; height: 19px; }
.speak-toggle[aria-pressed="false"] { color: var(--muted); }
.ask { flex: 1; min-width: 0; display: flex; align-items: center; }
.ask input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 6px 12px 8px; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.ask input::placeholder { color: var(--muted); }
.ask button { border: 0; background: transparent; padding: 0 10px; height: 40px; font-size: 18px; color: var(--muted); }
.ask:not(:focus-within):has(input:placeholder-shown) button { display: none; }
.mic {
  flex: none;
  width: 56px; height: 56px;
  border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mic-idle);
  color: var(--mic-idle-ink);
  transition: transform .15s var(--ease), box-shadow .2s;
}
.mic:active { transform: scale(.94); }
.mic > * { grid-area: 1 / 1; }
.mic-icon { width: 22px; height: 22px; }
.mic[aria-pressed="true"] { background: var(--mic-bg); color: var(--mic-ink); box-shadow: 0 10px 22px -8px var(--mic-glow); }
.wave { display: none; align-items: center; gap: 3px; height: 22px; }
.mic[aria-pressed="true"] .wave { display: flex; }
.mic[aria-pressed="true"] .mic-icon { display: none; }
.wave i { width: 3px; border-radius: 3px; background: currentColor; animation: bar 1s ease-in-out infinite; }
.wave i:nth-child(1) { height: 8px; animation-delay: -.2s; }
.wave i:nth-child(2) { height: 16px; animation-delay: -.5s; }
.wave i:nth-child(3) { height: 22px; animation-delay: -.1s; }
.wave i:nth-child(4) { height: 12px; animation-delay: -.7s; }
.wave i:nth-child(5) { height: 7px; animation-delay: -.35s; }
@keyframes bar { 50% { transform: scaleY(.4); } }

.toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: var(--base);
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  box-shadow: var(--glass-shadow);
  animation: rise .35s var(--ease);
}

@media (min-width: 640px) {
  main, .top { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }
  .dock { width: calc(100% - 32px); max-width: 528px; margin-left: auto; margin-right: auto; }
  .toast { max-width: 528px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .zzz b { opacity: .6; transform: translate(calc(var(--i, 0) * 10px), calc(var(--i, 0) * -14px)); }
  .zzz b:nth-child(2) { --i: 1; }
  .zzz b:nth-child(3) { --i: 2; }
}

/* Passcode screen for test users */
.gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.gate-card { width: min(340px, 100%); border-radius: 28px; padding: 28px 22px 22px; display: flex; flex-direction: column; gap: 12px; text-align: center; animation: rise .5s var(--ease); }
.gate-card p { margin: 0; }
.gate-card input { border: 1px solid var(--hair); border-radius: 14px; background: var(--inset); padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink); outline: none; text-align: center; }
.gate-card input:focus { border-color: var(--accent); }
.gate-card button { border: 0; border-radius: 14px; padding: 12px; font: inherit; font-weight: 600; background: var(--accent); color: var(--base); }
.gate-card.is-wrong { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.flag { display: block; margin: 14px auto 0; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--muted); padding: 6px 10px; }
.flag:disabled { opacity: .7; }

.gate-card input + input { margin-top: -4px; }
.you input { width: 100%; border: 1px solid var(--hair); border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.you input:focus { border-color: var(--accent); }
.account { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 28px; }
.account p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.account strong { color: var(--ink); font-weight: 500; }
.signout { flex: none; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; }
.tester { width: 100%; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; padding: 0; cursor: pointer; }
.tester-words { list-style: none; margin: 10px 0 2px; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.tester-words li { display: flex; justify-content: space-between; gap: 10px; }
.tester-words .asked { color: var(--muted); }
.tester-words .is-wrong { color: var(--error); }
.tester .cost-units { white-space: pre-line; line-height: 1.5; }

/* ---------- Talk: the app as conversation partner ---------- */
.talk-setup { display: flex; flex-direction: column; padding: 18px 0 24px; }
.talk-intro { margin: 10px 0 0; line-height: 1.45; font-size: 14.5px; }
.talk-setup h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin: 22px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--glass-line); background: var(--glass); border-radius: 999px; padding: 8px 14px; font-size: 14px; transition: background .2s, border-color .2s; }
.chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.talk-custom { margin-top: 10px; width: 100%; border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.talk-custom:focus { border-color: var(--accent); }
.seg { display: flex; gap: 2px; border-radius: 999px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-checked="true"] { background: var(--seg-on); color: var(--seg-on-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.talk-start { margin-top: 26px; border: 0; border-radius: 18px; padding: 15px; font-weight: 600; font-size: 16px; background: var(--mic-bg); color: var(--mic-ink); box-shadow: 0 10px 22px -8px var(--mic-glow); transition: transform .15s var(--ease); }
.talk-start:active { transform: scale(.98); }

.talk-live { display: flex; flex-direction: column; min-height: 100%; }
.talk-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 12px 0 8px; }
.talk-bar .status { margin: 0; }
.talk-topic { flex: 1; min-width: 0; text-align: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.talk-ask { position: sticky; bottom: 12px; align-self: center; margin-top: auto; border-radius: 999px; padding: 10px 18px; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink); transition: transform .15s var(--ease); }
.talk-ask:active { transform: scale(.97); }
.talk-ask[aria-pressed="true"] { background: var(--mic-bg); color: var(--mic-ink); border-color: transparent; }
.talk-end { border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500; }
.status.is-speaking .dot { background: var(--accent); opacity: 1; }

.thread { list-style: none; margin: 0; padding: 4px 0 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 11px 15px; border-radius: 22px; line-height: 1.42; animation: rise .35s var(--ease); overflow-wrap: break-word; }
.msg-partner { align-self: flex-start; font-size: 18px; background: var(--glass-strong); border: 1px solid var(--glass-line); border-bottom-left-radius: 8px; box-shadow: var(--glass-shadow); }
.msg-partner .w { cursor: pointer; border-radius: 4px; transition: background .15s; }
.msg-partner .w:active { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.msg-me { align-self: flex-end; font-size: 15px; background: var(--inset); color: var(--muted); border-bottom-right-radius: 8px; }
.msg-me:empty { display: none; }
.msg-word { align-self: center; width: min(100%, 360px); max-width: none; border-radius: 22px; padding: 14px 18px; background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi); }
.msg-word p { margin: 0; }
.mw-label { color: var(--muted); font-size: 13px; }
.mw-word { display: block; border: 0; background: none; padding: 4px 0 0; text-align: left; font-family: var(--display); font-weight: var(--display-weight); font-size: 34px; line-height: 1.05; letter-spacing: var(--display-tracking); }
.mw-word:empty { display: none; }
.mw-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mw-ex { margin-top: 8px !important; font-size: 14.5px; }
.mw-ex-en { color: var(--muted); font-size: 12.5px; }
.msg-word p:empty { display: none; }

/* ---------- Sign-in and sharing ---------- */
.gate-card button:disabled { opacity: .6; }
.gate-error { min-height: 1.2em; font-size: 13.5px; color: var(--error); }
.gate-error:empty { display: none; }
.gate-links { font-size: 13.5px; color: var(--muted); }
.gate-card .link { background: none; border: 0; padding: 4px 2px; font: inherit; font-weight: 500; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.gate-card strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
#gate-digits { font-size: 24px; letter-spacing: .3em; }

.sheet { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; justify-items: center; padding: 16px; background: rgba(0, 0, 0, .25); }
.sheet-card { width: min(420px, 100%); border-radius: 28px; padding: 22px 18px 16px; display: flex; flex-direction: column; gap: 14px; text-align: center; animation: rise .35s var(--ease); background: var(--glass-strong); }
.sheet-card p { margin: 0; }
.sheet-title { font-family: var(--display); font-size: 28px; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.share-opt { display: block; border: 1px solid var(--glass-line); background: var(--glass); border-radius: 14px; padding: 13px 10px; font: inherit; font-size: 14.5px; font-weight: 500; color: var(--ink); text-decoration: none; cursor: pointer; }
.share-opt:active { transform: scale(.97); }
.sheet-close { border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--muted); padding: 8px; }

@media (max-width: 400px) {
  .top { gap: 8px; padding-left: 16px; padding-right: 16px; }
  .tab { padding: 7px 10px; }
}
