:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #1d2420;
  --muted: #66706a;
  --line: #e2ded4;
  --accent: #3b6f5c;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --danger: #b4452f;
  --bubble: #e9e6de;
  --shadow: 0 1px 2px rgb(20 30 25 / 6%), 0 8px 30px rgb(20 30 25 / 6%);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --surface: #181e1b; --surface-2: #1f2723; --text: #e9eee9; --muted: #95a29a;
    --line: #2a332e; --bubble: #25302b; --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 30px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --surface: #181e1b; --surface-2: #1f2723; --text: #e9eee9; --muted: #95a29a;
  --line: #2a332e; --bubble: #25302b; --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 30px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, sans-serif; min-height: 100vh; }
button, input { font: inherit; }
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-family: Fraunces, Georgia, serif; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-size: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-weight: 400; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11.5px; font-weight: 600; color: var(--accent); margin: 0 0 10px; }
.lede { color: var(--muted); max-width: 60ch; margin: 10px 0 0; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

.top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 18px clamp(16px, 4vw, 40px); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand-sub { font-weight: 500; color: var(--muted); }
.mark { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--accent) 60%, white), var(--accent)); box-shadow: 0 0 0 4px var(--accent-soft); }
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }

main { padding: 0 clamp(16px, 4vw, 40px) 40px; max-width: 1280px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.pill.live { background: var(--accent-soft); color: var(--accent); }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
.pill.ghost { background: transparent; border: 1px solid var(--line); }
@keyframes blink { 50% { opacity: .3; } }

button { border: 0; border-radius: 12px; padding: 11px 18px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; transition: transform .08s, filter .15s; }
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--surface-2); color: var(--text); }
button.danger { background: var(--danger); }
button.link { background: none; color: var(--muted); padding: 4px 6px; font-weight: 500; }
button.wide { width: 100%; margin-top: 10px; }
input { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 11px 14px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* gate */
.gate { display: grid; place-items: center; min-height: calc(100vh - 140px); }
.gate-card { max-width: 560px; width: 100%; }
.gate form { margin-top: 28px; }
.gate label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.inline { display: flex; gap: 10px; }
.inline input { text-transform: uppercase; letter-spacing: .06em; }
.inline button { white-space: nowrap; }

/* studio */
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 8px 0 24px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); grid-template-areas: "stage convo" "stage phone"; }
.stage { grid-area: stage; display: flex; flex-direction: column; }
.convo { grid-area: convo; display: flex; flex-direction: column; min-height: 380px; }
.phone { grid-area: phone; }
.stage-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stage-top time { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.viz-wrap { position: relative; display: grid; place-items: center; margin: 6px auto 4px; width: 100%; max-width: 330px; aspect-ratio: 1; }
#viz { width: 100%; height: 100%; }
.viz-label { position: absolute; bottom: 2%; left: 0; right: 0; text-align: center; display: grid; gap: 2px; }
.viz-label strong { font-size: 16px; }
.viz-label span { color: var(--muted); font-size: 13px; }
.mobile { margin-top: 12px; }
.mobile label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.controls { display: flex; gap: 10px; margin-top: 16px; }
.controls button { flex: 1; }
.suggest { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.mini { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 6px 11px; font-size: 13px; color: var(--text); }

.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.section-title span { font-size: 13px; }
.transcript { flex: 1; overflow-y: auto; max-height: 460px; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.empty { color: var(--muted); margin: auto 0; text-align: center; padding: 30px 10px; }
.turn { max-width: 82%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 6px; }
.turn strong { display: block; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.turn p { margin: 0; }
.turn.caller { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-left-radius: 16px; border-bottom-right-radius: 6px; }
.turn.caller strong { color: rgb(255 255 255 / 80%); }
.turn.interim { opacity: .65; }
.text-form { display: flex; gap: 8px; margin-top: 12px; }

.texts { display: grid; gap: 12px; }
.sms { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; }
.sms-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sms-body { background: var(--bubble); border-radius: 14px 14px 14px 4px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.sms-body a { color: var(--accent); font-weight: 600; }
.sms-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 22px; }

@media (max-width: 860px) {
  .gate { min-height: auto; padding-top: 12vh; }
  .intro .pill { order: -1; }
  .grid { grid-template-columns: 1fr; grid-template-areas: "stage" "convo" "phone"; }
  .inline { flex-direction: column; }
  .turn { max-width: 92%; }
}
.test-number { margin: 12px 0 0; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.sms .preview { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.notice { color: var(--muted); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
