/* VoiceFirst playground — mobile-first, single column, no external assets. */

:root {
  --bg: #080c18;
  --bg-2: #0d1426;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #eaf0ff;
  --ink-2: #b6c3e2;
  --muted: #8492b8;
  --violet: #8b7bff;
  --violet-deep: #6a54ff;
  --mint: #35e0a1;
  --amber: #ffc561;
  --rose: #ff7a9a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.9);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1000px 620px at 12% -12%, rgba(139, 123, 255, 0.22), transparent 62%),
    radial-gradient(760px 520px at 92% 4%, rgba(53, 224, 161, 0.13), transparent 60%),
    radial-gradient(640px 480px at 50% 108%, rgba(255, 197, 97, 0.1), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

main, .topbar, .footer {
  width: min(100% - 2rem, 960px);
  margin-inline: auto;
}

h1, h2, h3 { line-height: 1.12; letter-spacing: -0.025em; margin: 0; }
p { margin: 0; }

a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: #fff; }

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--violet); color: #0b0d1a; padding: 0.7rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0; font-weight: 700; text-decoration: none;
}
.skip:focus { left: 0; }

:where(button, a, input):focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------------- topbar ---------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap;
  padding: 1.1rem 0 0.5rem;
}

.brand { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.brand-mark { color: var(--mint); font-size: 0.9rem; animation: pulse 3.4s ease-in-out infinite; }
.brand-name { font-weight: 750; letter-spacing: -0.03em; font-size: 1.05rem; }
.brand-tag {
  font: 600 0.62rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); border: 1px solid var(--line); padding: 0.3rem 0.45rem; border-radius: 99px;
}

.topbar-actions { display: flex; gap: 0.5rem; }

.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-2);
  border-radius: 99px; padding: 0.42rem 0.75rem; font: 600 0.78rem/1 var(--font);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed="false"] { color: var(--muted); }
.chip[aria-pressed="false"] .chip-icon { opacity: .45; }
.chip-icon { font-size: 0.9rem; }

/* ---------------- hero ---------------- */

.hero { padding: 2.6rem 0 2rem; max-width: 40ch; }

.eyebrow {
  font: 700 0.72rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--mint); margin-bottom: 1.1rem;
}

.hero h1 { font-size: clamp(2.1rem, 8.5vw, 4rem); font-weight: 800; }
.grad {
  background: linear-gradient(100deg, var(--violet) 0%, var(--mint) 78%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.lede { margin-top: 1.15rem; color: var(--ink-2); font-size: 1.05rem; max-width: 46ch; }

.hero-facts {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  list-style: none; padding: 0; margin: 1.6rem 0 0;
  color: var(--muted); font-size: 0.82rem;
}
.hero-facts strong { color: var(--ink); font-size: 1rem; display: block; letter-spacing: -0.02em; }

/* ---------------- progress ---------------- */

.progress {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.15rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.progress-head h2 { font-size: 1.05rem; font-weight: 700; }
.progress-count { font: 700 0.85rem/1 var(--mono); color: var(--mint); }

.meter {
  height: 6px; background: rgba(255, 255, 255, 0.07); border-radius: 99px;
  overflow: hidden; margin: 0.9rem 0 1.1rem;
}
.meter-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--mint));
  border-radius: 99px; transition: width .5s cubic-bezier(.22, 1, .36, 1);
}

.challenge-rail {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.4rem;
}
.challenge {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  text-align: center; min-width: 0;
}
.challenge-dot {
  width: 100%; max-width: 44px; aspect-ratio: 1; border-radius: 50%;
  border: 1.5px dashed var(--line-strong); background: transparent;
  display: grid; place-items: center; color: var(--muted);
  font: 700 0.8rem/1 var(--mono); transition: all .3s ease;
}
.challenge-label {
  font-size: 0.6rem; line-height: 1.25; color: var(--muted);
  overflow-wrap: anywhere; hyphens: auto;
}
.challenge.is-active .challenge-dot {
  border-style: solid; border-color: var(--violet); color: var(--violet);
  box-shadow: 0 0 0 4px rgba(139, 123, 255, 0.14);
}
.challenge.is-active .challenge-label { color: var(--ink-2); }
.challenge.is-done .challenge-dot {
  border-style: solid; border-color: var(--mint); background: var(--mint); color: #06140e;
}
.challenge.is-done .challenge-label { color: var(--ink-2); }

.next-up {
  margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line);
  color: var(--ink-2); font-size: 0.88rem; min-height: 2.6em;
}
.next-up strong { color: var(--ink); }
.next-up .k { color: var(--mint); }

/* ---------------- console ---------------- */

.console {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 2.5rem;
}
.console-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.15rem; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02);
}
.console-head h2 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.cap-note { font-size: 0.72rem; color: var(--amber); text-align: right; max-width: 30ch; }

.transcript {
  list-style: none; margin: 0; padding: 1.15rem;
  display: flex; flex-direction: column; gap: 0.85rem;
  max-height: min(62dvh, 640px); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}

.turn-user, .turn-agent { display: flex; }
.turn-user { justify-content: flex-end; }
.turn-agent { justify-content: flex-start; }

.bubble {
  max-width: 86%; padding: 0.7rem 0.95rem; border-radius: var(--radius-sm);
  font-size: 0.94rem; overflow-wrap: anywhere;
  animation: rise .32s cubic-bezier(.22, 1, .36, 1) both;
}
.turn-user .bubble {
  background: linear-gradient(135deg, var(--violet-deep), var(--violet));
  color: #fff; border-bottom-right-radius: 4px; font-weight: 500;
}
.turn-agent .bubble {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-bottom-left-radius: 4px;
}
.bubble .who {
  display: block; font: 700 0.6rem/1 var(--mono); letter-spacing: 0.14em;
  text-transform: uppercase; opacity: .6; margin-bottom: 0.35rem;
}
.bubble.interim { opacity: .6; font-style: italic; }
.bubble-aside { font-size: 0.78rem; color: var(--muted); margin-top: 0.4rem; }

.card {
  width: 100%; max-width: 92%; background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line); border-left: 3px solid var(--violet);
  border-radius: var(--radius-sm); padding: 0.9rem 1rem;
  animation: rise .34s cubic-bezier(.22, 1, .36, 1) both;
}
.card.tone-mint { border-left-color: var(--mint); }
.card.tone-amber { border-left-color: var(--amber); }
.card-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.7rem; }
.card-icon {
  width: 1.9rem; height: 1.9rem; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 9px; background: rgba(139, 123, 255, 0.18); color: var(--violet); font-size: 0.95rem;
}
.card.tone-mint .card-icon { background: rgba(53, 224, 161, 0.16); color: var(--mint); }
.card.tone-amber .card-icon { background: rgba(255, 197, 97, 0.16); color: var(--amber); }
.card-title { font-weight: 700; font-size: 0.98rem; letter-spacing: -0.015em; }
.card-rows { display: grid; gap: 0.4rem; }
.card-row {
  display: grid; grid-template-columns: minmax(4.5rem, 34%) minmax(0, 1fr); gap: 0.6rem;
  font-size: 0.85rem; padding-top: 0.4rem; border-top: 1px solid var(--line);
}
.card-row dt, .card-key { color: var(--muted); }
.card-row dd, .card-val { margin: 0; color: var(--ink-2); }
.card-row.is-running .card-val { color: var(--amber); }
.card-row.is-running .card-key::after { content: " …"; }
.card-foot { margin-top: 0.75rem; font-size: 0.76rem; color: var(--muted); font-style: italic; }

.choice-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
.choice {
  background: rgba(255, 197, 97, 0.1); border: 1px solid rgba(255, 197, 97, 0.35);
  color: var(--amber); border-radius: 99px; padding: 0.4rem 0.8rem;
  font: 600 0.8rem/1 var(--font); cursor: pointer; transition: background .15s ease;
}
.choice:hover { background: rgba(255, 197, 97, 0.2); }
.choice.is-typing {
  background: rgba(139, 123, 255, 0.12); border-color: rgba(139, 123, 255, 0.4); color: var(--violet);
}

.sys {
  align-self: center; font: 600 0.7rem/1.4 var(--mono); letter-spacing: 0.06em;
  color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line);
  border-radius: 99px; padding: 0.35rem 0.75rem; text-align: center;
  animation: rise .3s ease both;
}
.sys.win { color: var(--mint); border-color: rgba(53, 224, 161, 0.4); background: rgba(53, 224, 161, 0.09); }

/* ---------------- composer ---------------- */

.composer {
  border-top: 1px solid var(--line); padding: 0.9rem 1.15rem 1.15rem;
  padding-bottom: calc(1.15rem + var(--safe-b));
  background: rgba(255, 255, 255, 0.02);
}
.composer-row { display: flex; gap: 0.5rem; }

.typed {
  flex: 1 1 auto; min-width: 0;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 0.72rem 0.9rem;
  font: 400 1rem/1.3 var(--font); transition: border-color .16s ease;
}
.typed::placeholder { color: var(--muted); }
.typed:focus { border-color: var(--violet); outline: none; }

.send {
  flex: 0 0 auto; width: 46px; border: 1px solid var(--line); background: var(--panel-2);
  border-radius: var(--radius-sm); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; transition: background .15s ease, border-color .15s ease;
}
.send:hover { background: rgba(139, 123, 255, 0.2); border-color: rgba(139, 123, 255, 0.4); }
.send svg { width: 18px; height: 18px; fill: currentColor; }

.mic-row { display: flex; align-items: center; gap: 0.9rem; margin-top: 0.85rem; }

.mic {
  position: relative; flex: 0 0 auto; width: 66px; height: 66px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .14s ease, background .2s ease, border-color .2s ease;
  touch-action: manipulation;
}
.mic:hover { border-color: rgba(139, 123, 255, 0.5); }
.mic:active { transform: scale(0.95); }
.mic[disabled] { opacity: .45; cursor: not-allowed; }

.mic-glyph svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; position: relative; z-index: 2; }

.mic-wave {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 3px; opacity: 0; transition: opacity .2s ease; z-index: 1;
}
.mic-wave i {
  width: 3px; height: 8px; border-radius: 2px; background: var(--mint);
  animation: bar .82s ease-in-out infinite;
}
.mic-wave i:nth-child(2) { animation-delay: .1s; }
.mic-wave i:nth-child(3) { animation-delay: .2s; }
.mic-wave i:nth-child(4) { animation-delay: .3s; }
.mic-wave i:nth-child(5) { animation-delay: .4s; }
.mic-wave i:nth-child(6) { animation-delay: .5s; }
.mic-wave i:nth-child(7) { animation-delay: .6s; }

.mic-ring {
  position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--mint); opacity: 0; transition: opacity .2s ease;
}
.mic.is-listening { background: rgba(53, 224, 161, 0.14); border-color: var(--mint); color: var(--mint); }
.mic.is-listening .mic-glyph { opacity: 0; }
.mic.is-listening .mic-wave, .mic.is-listening .mic-ring { opacity: 1; }
.mic.is-listening .mic-ring { animation: halo 1.5s ease-out infinite; }

.mic.is-thinking { color: var(--amber); border-color: rgba(255, 197, 97, 0.5); background: rgba(255, 197, 97, 0.1); }
.mic.is-speaking { color: var(--violet); border-color: rgba(139, 123, 255, 0.55); background: rgba(139, 123, 255, 0.12); }
.mic.is-speaking .mic-ring { opacity: .55; animation: halo 1.5s ease-out infinite; border-color: var(--violet); }

.mic-side { min-width: 0; }
.mic-state { font-weight: 650; font-size: 0.92rem; }
.mic-sub { font-size: 0.76rem; color: var(--muted); margin-top: 0.1rem; overflow-wrap: anywhere; }

.thinking { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 0.3rem; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--amber); animation: dot 1s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }

/* ---------------- how + cta ---------------- */

.how { margin-bottom: 2.5rem; }
.how h2 { font-size: 1.35rem; margin-bottom: 1.1rem; }
.how-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.how-list li {
  display: flex; gap: 0.85rem; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.95rem 1rem;
}
.how-n {
  flex: 0 0 auto; width: 1.75rem; height: 1.75rem; border-radius: 8px;
  display: grid; place-items: center; background: rgba(139, 123, 255, 0.16);
  color: var(--violet); font: 700 0.8rem/1 var(--mono);
}
.how-list h3 { font-size: 0.96rem; margin-bottom: 0.2rem; }
.how-list p { font-size: 0.85rem; color: var(--muted); }
.how-list div { min-width: 0; }

.cta {
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.16), rgba(53, 224, 161, 0.1));
  border: 1px solid rgba(139, 123, 255, 0.3); border-radius: var(--radius);
  padding: 1.5rem 1.25rem; text-align: center; margin-bottom: 2.5rem;
  animation: rise .4s cubic-bezier(.22, 1, .36, 1) both;
}
.cta h2 { font-size: clamp(1.25rem, 4.5vw, 1.7rem); margin-bottom: 0.5rem; }
.cta p { color: var(--ink-2); font-size: 0.92rem; max-width: 42ch; margin-inline: auto; }
.cta-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }

.btn {
  border-radius: 99px; padding: 0.68rem 1.3rem; font: 650 0.88rem/1 var(--font);
  cursor: pointer; border: 1px solid transparent; transition: transform .14s ease, background .16s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--violet); color: #0b0d1a; }
.btn-primary:hover { background: #9d90ff; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); border-color: var(--violet); }

/* ---------------- footer ---------------- */

.footer {
  padding: 1.5rem 0 calc(2rem + var(--safe-b));
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.78rem;
  display: grid; gap: 0.35rem;
}
.footer-meta a { color: var(--ink-2); }

/* ---------------- motion ---------------- */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes bar { 0%, 100% { height: 7px; } 50% { height: 22px; } }
@keyframes dot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes halo { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------------- wider screens ---------------- */

@media (min-width: 720px) {
  main, .topbar, .footer { width: min(100% - 3rem, 900px); }
  .hero { padding: 4rem 0 2.75rem; max-width: none; }
  .lede { max-width: 56ch; }
  .transcript { padding: 1.4rem 1.5rem; max-height: min(56dvh, 560px); }
  .bubble { max-width: 70%; }
  .card { max-width: 78%; }
  .how-list { grid-template-columns: 1fr 1fr; }
  .challenge-rail { gap: 0.75rem; }
  .challenge-label { font-size: 0.68rem; }
  .console-head, .composer { padding-inline: 1.5rem; }
  .mic-row { justify-content: flex-start; }
}

@media (min-width: 1040px) {
  main, .topbar, .footer { width: min(100% - 4rem, 1080px); }
  .transcript { max-height: min(52dvh, 520px); }
  .challenge-rail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .challenge-label { font-size: 0.72rem; }
}