:root {
  --ink: #eaf1ff;
  --muted: #9aaccb;
  --deep: #081321;
  --panel: #102238;
  --panel-light: #172d46;
  --line: rgba(168, 194, 229, .16);
  --cyan: #63d8d0;
  --gold: #f6bf69;
  --coral: #f48785;
  --violet: #ad9bff;
  --danger: #ff8f8b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 75% -10%, #1a3853 0, transparent 42%), var(--deep);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-width: 320px;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.app-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 80px; }
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 38px; }
.eyebrow { color: var(--cyan); font-size: .72rem; font-weight: 800; letter-spacing: .16em; margin: 0 0 10px; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2.55rem, 6vw, 5.1rem); letter-spacing: -.065em; line-height: .95; margin-bottom: 20px; max-width: 710px; }
h2 { font-size: clamp(1.2rem, 2vw, 1.55rem); letter-spacing: -.025em; margin-bottom: 0; }
.hero-copy { color: var(--muted); font-size: 1.05rem; line-height: 1.6; margin: 0; max-width: 580px; }
.session-pill { align-items: center; background: rgba(99, 216, 208, .08); border: 1px solid rgba(99, 216, 208, .23); border-radius: 999px; color: var(--muted); display: flex; flex-shrink: 0; gap: 10px; padding: 10px 15px; }
.session-pill strong { color: var(--ink); }
.session-dot { background: var(--cyan); border-radius: 50%; box-shadow: 0 0 0 5px rgba(99,216,208,.1); height: 8px; width: 8px; }
.recorder-panel, .sample-card { background: linear-gradient(145deg, rgba(23,45,70,.97), rgba(13,31,51,.97)); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 25px 80px rgba(0,0,0,.18); }
.recorder-panel { padding: 27px; margin-bottom: 62px; }
.panel-heading, .section-heading, .card-header, .card-meta { align-items: center; display: flex; justify-content: space-between; gap: 20px; }
.timer { color: var(--cyan); font-variant-numeric: tabular-nums; font-size: 1.7rem; font-weight: 700; letter-spacing: .05em; }
.status { color: var(--muted); min-height: 25px; margin: 21px 0 17px; }
.status.error { color: var(--danger); }
.recording-controls { align-items: center; display: flex; gap: 12px; flex-wrap: wrap; }
.button { border: 0; border-radius: 12px; font-weight: 800; padding: 13px 19px; transition: transform .2s, background .2s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { background: var(--cyan); color: #06222b; }
.button-secondary { background: rgba(234,241,255,.11); color: var(--ink); }
.record-icon { background: currentColor; border-radius: 50%; display: inline-block; height: 10px; margin-right: 7px; vertical-align: -1px; width: 10px; }
.shortcut-hint { color: var(--muted); font-size: .82rem; }
.meter { background: rgba(0,0,0,.25); border-radius: 999px; height: 5px; margin-top: 22px; overflow: hidden; }
.meter span { background: linear-gradient(90deg, var(--cyan), var(--gold)); border-radius: inherit; display: block; height: 100%; transform: scaleX(0); transform-origin: left; transition: transform .08s linear; width: 100%; }
.section-heading { align-items: end; margin-bottom: 24px; }
.section-note { color: var(--muted); font-size: .88rem; margin: 0; }
.empty-state { border: 1px dashed rgba(168,194,229,.27); border-radius: 20px; color: var(--muted); padding: 42px 20px; text-align: center; }
.empty-state p { margin-bottom: 0; }
.empty-wave { color: var(--cyan); font-size: 2.1rem; letter-spacing: .28em; margin-bottom: 12px; }
.sample-list { display: grid; gap: 24px; }
.sample-card { overflow: hidden; padding: 23px; }
.card-header { align-items: flex-start; margin-bottom: 20px; }
.card-number { color: var(--gold); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.card-title { margin: 6px 0 0; font-size: 1.15rem; }
.card-meta { color: var(--muted); font-size: .8rem; justify-content: flex-end; }
.audio-row { align-items: center; display: flex; gap: 14px; margin-bottom: 18px; }
.audio-row audio { min-width: 0; width: 100%; }
.delete-button { background: transparent; border: 1px solid rgba(244,135,133,.35); border-radius: 10px; color: var(--coral); padding: 8px 11px; }
.delete-button:hover { background: rgba(244,135,133,.1); }
.transcript-band { background: rgba(99,216,208,.08); border-left: 3px solid var(--cyan); border-radius: 0 9px 9px 0; color: var(--ink); line-height: 1.45; margin-bottom: 20px; min-height: 43px; padding: 10px 13px; }
.transcript-band.empty { color: var(--muted); font-style: italic; }
.transcript-form { display: flex; gap: 8px; }
.transcript-form input { background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); flex: 1; min-width: 0; padding: 9px 11px; }
.transcript-form button { background: var(--panel-light); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); padding: 8px 12px; }
.visual-wrap { background: #07111f; border: 1px solid rgba(168,194,229,.16); border-radius: 15px; overflow: hidden; }
.visual-wrap canvas { display: block; height: auto; max-width: 100%; width: 100%; }
.transcript-timeline { background: rgba(7,17,31,.72); border: 1px solid rgba(168,194,229,.16); border-top: 0; border-radius: 0 0 12px 12px; color: var(--ink); min-height: 36px; overflow: hidden; padding: 8px 2% 7px 5.8%; }
.transcript-timeline.empty { color: var(--muted); font-size: .75rem; font-style: italic; }
.transcript-letters { display: grid; grid-template-columns: repeat(var(--character-count), minmax(0, 1fr)); line-height: 1.2; text-align: center; white-space: pre; }
.transcript-letters span { font-size: clamp(.58rem, 1.25vw, .78rem); min-width: 0; overflow: hidden; }
.transcript-alignment-note { color: var(--muted); font-size: .68rem; margin: 6px 2px 0; }
.visual-caption { color: var(--muted); font-size: .74rem; margin: 10px 2px 0; }
.formant-controls { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.formant-controls-label { color: var(--muted); font-size: .76rem; margin-right: 2px; }
.formant-toggle { align-items: center; background: rgba(234,241,255,.07); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; display: inline-flex; font-size: .75rem; gap: 6px; padding: 6px 9px; }
.formant-toggle:has(input:checked) { background: rgba(99,216,208,.1); color: var(--ink); }
.formant-toggle input { accent-color: var(--cyan); margin: 0; }
.formant-toggle.f1 { --formant-color: var(--gold); }
.formant-toggle.f2 { --formant-color: var(--coral); }
.formant-toggle.f3 { --formant-color: var(--violet); }
.formant-toggle span::before { background: var(--formant-color); border-radius: 50%; content: ''; display: inline-block; height: 7px; margin-right: 5px; width: 7px; }
.legend { align-items: center; display: flex; flex-wrap: wrap; gap: 13px; margin-top: 12px; }
.legend span { align-items: center; color: var(--muted); display: inline-flex; font-size: .77rem; gap: 6px; }
.legend i { border-radius: 99px; display: inline-block; height: 4px; width: 18px; }
.legend .f1 { background: var(--gold); } .legend .f2 { background: var(--coral); } .legend .f3 { background: var(--violet); }
.processing { color: var(--gold); font-size: .82rem; }
.sr-only { border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; }

@media (max-width: 680px) {
  .app-shell { width: min(100% - 24px, 1120px); padding-top: 35px; }
  .hero, .section-heading { align-items: flex-start; flex-direction: column; }
  .hero { margin-bottom: 28px; }
  .session-pill { align-self: flex-start; }
  .recorder-panel { padding: 20px; margin-bottom: 42px; }
  .card-header { flex-direction: column; }
  .card-meta { justify-content: flex-start; }
  .audio-row { align-items: stretch; flex-direction: column; }
  .delete-button { align-self: flex-start; }
}
