:root {
  color-scheme: dark;
  --ink: #edf4ff;
  --subtle: #a7b5c9;
  --mint: #78f8d9;
  --border: #ffffff22;
  font-family: Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  background: #080e19;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(ellipse at 50% 35%, #15253c70, transparent 48%),
    linear-gradient(135deg, #080e19 10%, #0c1320 62%, #080e19);
}
.masthead, footer {
  width: min(1120px, calc(100% - 7rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.masthead { min-height: 5.2rem; border-bottom: 1px solid var(--border); }
.brand, .brand-mark, .audio-mark, .status-wrap, .status, footer > span, .controls, .form-actions, .button {
  display: flex;
  align-items: center;
}
.brand { gap: .7rem; font-size: 1.18rem; font-weight: 730; letter-spacing: .065em; }
.brand-mark { align-items: center; justify-content: center; gap: 3px; width: 2rem; height: 2rem; color: var(--mint); transform: skew(-9deg); }
.brand-mark i, .audio-mark i { display: block; background: currentColor; border-radius: 5px; width: 3px; height: 7px; }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-mark i:nth-child(3) { height: 28px; }
.brand-mark i:nth-child(4) { height: 21px; }
.brand-mark i:nth-child(5) { height: 10px; }
.status-wrap { gap: .85rem; }
.status { gap: .55rem; color: #ccd7e4; border: 1px solid var(--border); border-radius: 100px; padding: .38rem .8rem; font-size: .88rem; }
.dot { width: .48rem; height: .48rem; background: #8995a9; border-radius: 100%; }
body[data-phase="listening"] .dot, body[data-phase="user"] .dot { background: var(--mint); box-shadow: 0 0 10px #67f4cd99; }
body[data-phase="speaking"] .dot, body[data-phase="thinking"] .dot { background: #b6a2ff; box-shadow: 0 0 10px #a58aff99; }
body[data-phase="error"] .dot, body[data-phase="reconnecting"] .dot { background: #f4b28f; }
#timer { font: .88rem/1.3 "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; color: var(--subtle); }
main { display: grid; align-content: center; justify-items: center; padding: 1.6rem 1.25rem 2.6rem; }
.console { width: min(100%, 44rem); text-align: center; }
.orb {
  width: min(25rem, 89vw, 46vh);
  width: min(25rem, 89vw, 46svh);
  aspect-ratio: 1.35;
  margin: 0 auto 1.6rem;
  position: relative;
  background: radial-gradient(ellipse at center, #287e9140, transparent 67%);
}
.orb canvas { display: block; width: 100%; height: 100%; }
.category { margin: 0 0 .5rem; color: #a9c4cf; font-size: .88rem; font-weight: 600; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(4.1rem, 8vw, 6.4rem); line-height: .96; font-weight: 600; letter-spacing: -.083em; }
h1 span { color: var(--mint); }
.hint { margin: 1.15rem auto 1.65rem; max-width: 32rem; color: var(--subtle); line-height: 1.5; font-size: 1.04rem; text-wrap: balance; }
body[data-phase="error"] .hint { color: #ffcfb7; }
.controls, .form-actions { justify-content: center; gap: .7rem; flex-wrap: wrap; }
.button {
  min-height: 3.15rem; border: 1px solid transparent; border-radius: 99px; padding: .73rem 1.4rem;
  justify-content: center; gap: .67rem; cursor: pointer; font: inherit; font-size: 1rem; font-weight: 640;
  transition: background .16s, transform .16s, box-shadow .16s;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button:focus-visible, input:focus-visible { outline: 3px solid #bdacff; outline-offset: 4px; }
.button:disabled { opacity: .6; cursor: wait; }
.primary { background: var(--mint); color: #062921; box-shadow: 0 6px 30px #4de6bf1a; }
.primary:hover { background: #9cffdf; box-shadow: 0 8px 34px #4de6bf2e; }
.secondary { color: var(--ink); background: #1b2737; border-color: #384657; }
.secondary:hover { background: #273547; }
.end { color: #ffd3c9; background: #39272e; border-color: #b6756d66; }
.end:hover { background: #493139; }
.stop { width: .68rem; height: .68rem; border-radius: .14rem; background: currentColor; }
.mic { width: 1rem; height: 1.15rem; display: inline-block; position: relative; background: linear-gradient(currentColor, currentColor) center bottom / 2px .26rem no-repeat; }
.mic::before { content: ""; position: absolute; border: 1.7px solid currentColor; border-radius: 1rem; width: .31rem; height: .58rem; top: 0; left: 50%; transform: translateX(-50%); }
.mic::after { content: ""; position: absolute; border: 1.7px solid currentColor; border-top: none; border-radius: 0 0 1rem 1rem; width: .77rem; height: .44rem; left: 50%; bottom: .19rem; transform: translateX(-50%); }
footer { min-height: 4.1rem; border-top: 1px solid var(--border); color: #94a5bb; font-size: .85rem; }
footer > span { gap: .55rem; }
.audio-mark { gap: 2px; color: #87a8b8; }
.audio-mark i { width: 2px; }
.audio-mark i:nth-child(2) { height: 13px; }
dialog {
  width: min(calc(100% - 2rem), 27rem); padding: clamp(1.45rem, 5vw, 2rem); color: var(--ink);
  border: 1px solid #4c6777; border-radius: 1.5rem; background: #111c2b; box-shadow: 0 24px 70px #0008;
}
dialog::backdrop { background: #030711b8; backdrop-filter: blur(7px); }
dialog h2 { margin: 0; font-size: 1.7rem; letter-spacing: -.04em; }
dialog p { color: var(--subtle); line-height: 1.55; }
dialog label { display: block; font-size: .95rem; font-weight: 600; margin: 1.3rem 0 .45rem; }
dialog input { width: 100%; min-height: 2.9rem; border: 1px solid #4e6074; border-radius: .6rem; padding: .55rem .8rem; color: var(--ink); background: #091221; font: inherit; }
dialog .form-actions { justify-content: flex-end; margin-top: 1.35rem; }
.form-error, noscript { color: #ffbaa9; font-size: .94rem; }
@media (max-width: 590px) {
  .masthead, footer { width: calc(100% - 2.4rem); }
  .masthead { min-height: 4.25rem; }
  footer { min-height: 3.8rem; flex-wrap: wrap; gap: .3rem .8rem; padding: .85rem 0; }
  .status-wrap { gap: .5rem; }
  main { padding-block: 1.35rem 2.1rem; }
  .orb { margin-bottom: 1.45rem; }
}
@media (max-height: 580px) and (min-width: 620px) {
  .masthead, footer { min-height: 3.4rem; }
  main { padding-block: .9rem 1.3rem; }
  .orb { width: 9.5rem; margin-bottom: .55rem; }
  h1 { font-size: 3.6rem; }
  .hint { margin-block: .65rem .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
