:root {
  --bg: #0f1220;
  --bg-soft: #171b30;
  --bg-soft2: #1e2340;
  --line: #2b3157;
  --text: #e7e9f5;
  --muted: #9aa0c8;
  --accent: #7c8cff;
  --good: #34d399;
  --mid: #fbbf24;
  --bad: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(35, 40, 80, 0.55) 0%, transparent 60%), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }

.site-header {
  text-align: center;
  padding: 40px 20px 8px;
}
.site-header h1 { margin: 0; font-size: 2.4rem; }
.tagline { color: var(--muted); max-width: 640px; margin: 8px auto 0; }
.tagline strong { color: var(--text); }

main { max-width: 860px; margin: 0 auto; padding: 20px; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 18px;
  background: var(--bg-soft);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); outline: none; }
.dropzone.dragging { border-color: var(--accent); background: var(--bg-soft2); transform: scale(1.01); }
.dropzone-icon { font-size: 2.6rem; }
.dropzone .hint { color: var(--muted); font-size: .88rem; margin-top: 6px; }

/* Status */
.status { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 30px; color: var(--muted); }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results { margin-top: 10px; }
.score-row {
  display: flex; gap: 22px; align-items: center;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
}
.score-badge {
  flex: 0 0 auto; width: 130px; height: 130px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: conic-gradient(var(--score-color, var(--accent)) calc(var(--score, 0) * 1%), var(--bg-soft2) 0);
  position: relative;
}
.score-badge::after {
  content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--bg-soft);
}
.score-number, .score-max { position: relative; z-index: 1; }
.score-number { font-size: 2.8rem; font-weight: 800; line-height: 1; }
.score-max { color: var(--muted); font-size: .8rem; }
.score-meta { flex: 1; }
.verdict { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.meta-line { color: var(--muted); margin: 3px 0; }
.meta-line strong { color: var(--text); }

.btn-jump, .btn-again {
  border: 1px solid var(--line); background: var(--bg-soft2); color: var(--text);
  padding: 5px 12px; border-radius: 9px; cursor: pointer; font-size: .85rem; margin-left: 8px;
}
.btn-jump:hover, .btn-again:hover { border-color: var(--accent); }
.btn-again { margin: 22px auto 40px; display: block; padding: 10px 18px; }

audio { width: 100%; margin: 18px 0 6px; }

/* Timeline */
.timeline-wrap { margin: 16px 0; }
.timeline-label { color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.timeline {
  position: relative; width: 100%; height: 74px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.tl-cell { position: absolute; top: 0; bottom: 0; }
.tl-cell .tl-note {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--muted); font-family: ui-monospace, monospace;
}
.tl-window {
  position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent); background: rgba(124, 140, 255, 0.12);
}
.tl-step-label {
  position: absolute; top: 3px; font-size: 10px; font-weight: 700;
  transform: translateX(-50%); color: var(--text);
}
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 6px #fff; display: none; }
.tl-cell.active { outline: 1px solid rgba(255,255,255,.5); }

/* Breakdown table */
.breakdown { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .92rem; }
.breakdown th, .breakdown td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.breakdown th { color: var(--muted); font-weight: 600; }
.breakdown tr.active td { background: rgba(124, 140, 255, 0.12); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill.good { background: rgba(52, 211, 153, .16); color: var(--good); }
.pill.mid  { background: rgba(251, 191, 36, .16); color: var(--mid); }
.pill.bad  { background: rgba(248, 113, 113, .16); color: var(--bad); }

.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px; }
.site-footer a { color: var(--accent); }

@media (max-width: 560px) {
  .score-row { flex-direction: column; text-align: center; }
}
