/* MOB — one question, one input, the conversation in place. */
:root {
  --bg: #0a0a0b;
  --fg: #f2f1ec;
  --muted: #8b8a85;
  --faint: #2a2a2d;
  --line: #222225;
  --field: #121214;
  --accent: #ff5a1f;
  --accent-ink: #0a0a0b;
  --you: #1b1b1e;
  --ok: #9be36a;
  --no: #ff6b5a;
  --sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f3ee;
    --fg: #111112;
    --muted: #6e6d68;
    --faint: #d9d8d2;
    --line: #dddcd6;
    --field: #ffffff;
    --you: #e8e7e1;
    --accent-ink: #ffffff;
    --ok: #2f7d12;
    --no: #c2321f;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }

/* A faint engineering grid, fading out from the centre. */
.grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(var(--faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--faint) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: .35;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 42%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 55% at 50% 42%, #000 0%, transparent 75%);
}

.top, .stage, .fold, .foot { position: relative; z-index: 1; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(16px, 4vw, 40px);
}
.mark { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; }
.mark-word { font-weight: 700; font-size: 22px; letter-spacing: -0.04em; }
.mark-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.status { font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,90,31,.55); } 70% { box-shadow: 0 0 0 9px rgba(255,90,31,0); } 100% { box-shadow: 0 0 0 0 rgba(255,90,31,0); } }

/* The stage: the question, then the thread grows under it. */
.stage {
  flex: 1;
  min-height: calc(100svh - 72px);
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(48px, 14vh, 150px) clamp(16px, 4vw, 24px) 40px;
  display: flex; flex-direction: column;
}
.ask {
  margin: 0 0 clamp(28px, 5vh, 44px);
  font-weight: 600;
  font-size: clamp(40px, 7.4vw, 84px);
  line-height: .98;
  letter-spacing: -0.045em;
  transition: font-size .35s ease, margin .35s ease, color .35s ease;
}
.stage[data-state="talking"] .ask,
.stage[data-state="done"] .ask {
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.03em;
  color: var(--muted);
  margin-bottom: 28px;
}
.stage[data-state="talking"] .ask br,
.stage[data-state="done"] .ask br { display: none; }

.prompt {
  display: flex; align-items: center; gap: 8px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 8px 8px 22px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.prompt:focus-within { border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.prompt input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--fg);
  font: inherit; font-size: clamp(18px, 2.2vw, 22px);
  padding: 14px 0;
}
.prompt input::placeholder { color: var(--muted); opacity: .75; }
.prompt button {
  flex: none;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 11px;
  font: inherit; font-weight: 600; font-size: 16px;
  padding: 15px 20px;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease, opacity .15s ease;
}
.prompt button svg { width: 18px; height: 18px; }
.prompt button:hover { filter: brightness(1.08); }
.prompt button:active { transform: translateY(1px); }
.prompt button:disabled { opacity: .5; cursor: progress; }
.stage[data-state="talking"] .prompt button span { display: none; }
.stage[data-state="talking"] .prompt button { padding: 15px; }

.hint { margin: 14px 2px 0; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

/* The conversation. */
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.thread:not(:empty) { margin-bottom: 18px; }
.msg { max-width: 88%; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-you {
  align-self: flex-end;
  background: var(--you);
  border-radius: 14px 14px 4px 14px;
  padding: 11px 16px;
}
.msg-mob { align-self: flex-start; padding: 2px 0; }
.msg-mob::before {
  content: "MOB"; display: block;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--accent);
  margin-bottom: 4px;
}
.msg-mob.wait::after { content: ""; display: inline-block; width: 22px; height: 10px; background: radial-gradient(circle, var(--muted) 2px, transparent 2.5px) 0 50%/7px 10px repeat-x; animation: dots 1s steps(4) infinite; vertical-align: middle; }
@keyframes dots { from { width: 0; } to { width: 28px; } }

.verdict {
  align-self: flex-start;
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  border: 1px solid currentColor; border-radius: 999px;
  padding: 4px 10px;
}
.verdict.ok { color: var(--ok); }
.verdict.no { color: var(--no); }

.end { margin-top: 22px; }
.again { background: none; border: 1px solid var(--line); color: var(--fg); border-radius: 10px; padding: 11px 16px; font: inherit; font-size: 15px; cursor: pointer; }
.again:hover { border-color: var(--muted); }

/* Below the fold, very lightly. */
.fold {
  max-width: 820px; width: 100%; margin: 0 auto;
  padding: clamp(80px, 18vh, 180px) clamp(16px, 4vw, 24px);
  border-top: 1px solid var(--line);
}
.line { margin: 0; font-size: clamp(26px, 4vw, 44px); line-height: 1.12; letter-spacing: -0.035em; font-weight: 500; }
.line span { color: var(--muted); }

.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 24px clamp(16px, 4vw, 40px);
  font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--line);
}
.foot .mono { font-size: 12px; }

@media (max-width: 560px) {
  .status { display: none; }
  .prompt { padding-left: 16px; border-radius: 14px; }
  .prompt button span { display: none; }
  .prompt button { padding: 14px; }
  .msg { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
