:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #647184;
  --line: #dce2ea;
  --paper: #ffffff;
  --wash: #f3f6fa;
  --blue: #246bfd;
  --blue-dark: #1656d7;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -5%, rgba(36, 107, 253, .13), transparent 34rem),
    var(--wash);
}

button, textarea, input { font: inherit; }

.shell { width: min(850px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }

header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: 12px; font-weight: 750; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(32px, 7vw, 48px); letter-spacing: -.035em; }
.sub { margin: 12px 0 0; color: var(--muted); }

.status { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.75); font-size: 13px; white-space: nowrap; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #f0a124; }
.status.ready span { background: #20a365; }
.status.error span { background: #dc3f4d; }

.card { margin-top: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.92); box-shadow: 0 16px 45px rgba(22, 40, 72, .06); }
.controls { display: flex; flex-wrap: wrap; gap: 10px; }
button, .upload { border: 0; border-radius: 11px; padding: 11px 16px; cursor: pointer; font-weight: 700; transition: .15s ease; }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary { color: white; background: var(--ink); }
.primary.recording { background: #d93648; }
.stream { color: white; background: var(--blue); }
.stream.recording { background: #d93648; }
.upload { color: var(--ink); background: #e9eef6; }
.upload input { display: none; }
.quiet { color: var(--muted); background: transparent; }
.stream-note { margin: 14px 0 -4px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.stream-note b { margin-right: 5px; color: var(--blue); }
.submit { width: 100%; margin-top: 20px; color: #fff; background: var(--blue); }
.submit:not(:disabled):hover { background: var(--blue-dark); transform: translateY(-1px); }

.audio-state { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 16px; margin-top: 22px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 760; }
.meter { height: 8px; overflow: hidden; border-radius: 99px; background: #e7ebf1; }
.meter i { display: block; width: 3%; height: 100%; border-radius: inherit; background: var(--blue); transition: width .08s linear; }
.filename { max-width: 240px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
audio { width: 100%; margin-top: 20px; }

.settings label { display: grid; gap: 8px; color: #3d4958; font-size: 13px; font-weight: 700; }
textarea, input[type="number"] { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); background: #fbfcfe; outline: none; resize: vertical; }
textarea:focus, input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36, 107, 253, .1); }
details { margin-top: 16px; color: var(--muted); font-size: 13px; }
summary { cursor: pointer; font-weight: 700; }
.advanced { display: grid; grid-template-columns: 1fr 190px; gap: 14px; margin-top: 16px; }
.advanced label:first-child { grid-column: 1 / -1; }
.check { display: flex !important; align-items: center; align-self: end; grid-auto-flow: column; justify-content: start; }

.result-head { display: flex; align-items: center; justify-content: space-between; }
h2 { margin: 0; font-size: 17px; }
#latency { color: var(--muted); font-size: 12px; }
.answer { min-height: 96px; margin-top: 16px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.answer.empty { color: #97a0ad; }
.answer.busy::after { content: ""; display: inline-block; width: 6px; height: 1em; margin-left: 5px; vertical-align: -.15em; background: var(--blue); animation: blink .8s infinite; }
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 650px) {
  .shell { padding-top: 30px; }
  header { display: block; }
  .status { width: max-content; margin-top: 20px; }
  .audio-state { grid-template-columns: 70px 1fr; }
  .filename { grid-column: 1 / -1; }
  .advanced { grid-template-columns: 1fr; }
}
