:root {
  --bg: #0d0f1a;
  --surface: #151827;
  --surface2: #1e2236;
  --surface3: #252a42;
  --accent: #3665b6;
  --accent-h: #81e2f8;
  --success: #70db97;
  --danger: #ef4444;
  --warn: #f59e0b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #5b515f;
  --r: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; }
[hidden] { display: none !important; }
a { color: var(--accent-h); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; background: var(--surface2); padding: 1px 6px; border-radius: 4px; }

header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; gap: 10px; }
header h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.pill { font-size: 0.7rem; padding: 2px 9px; border-radius: 20px; background: rgba(54,101,182,.22); color: var(--accent-h); font-weight: 600; }
.badge-local { font-size: 0.7rem; padding: 2px 9px; border-radius: 20px; background: rgba(112,219,151,.15); color: var(--success); font-weight: 600; white-space: nowrap; }
.gh-link { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: var(--muted); padding: 5px 12px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface2); }
.gh-link:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
@media (max-width: 700px) { .badge-local { display: none; } }

.container { max-width: 1200px; margin: 0 auto; padding: 20px 24px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.card-header { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-header .actions { display: flex; gap: 8px; }
.card-body { padding: 16px; }

.statusbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 16px; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.ready { background: var(--success); }
.dot.busy { background: var(--warn); animation: blink 1s infinite; }
.dot.fail { background: var(--danger); }
@keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
#statusText { font-size: 0.82rem; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 7px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; white-space: nowrap; font-family: inherit; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); color: #08121e; }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface3); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 26px 12px; border: 2px dashed var(--border); border-radius: var(--r); cursor: pointer; color: var(--muted); font-size: 0.85rem; text-align: center; }
.drop strong { color: var(--text); }
.drop:hover, .drop:focus, .drop.over { border-color: var(--accent-h); outline: none; background: var(--surface2); }
.info { margin-top: 12px; font-size: 0.82rem; color: var(--muted); }
.info b { color: var(--text); }
.issues { list-style: none; margin-top: 10px; font-size: 0.78rem; max-height: 220px; overflow: auto; }
.issues li { padding: 5px 9px; margin-bottom: 4px; border-radius: 6px; border-left: 3px solid var(--warn); background: var(--surface2); }
.issues li.fatal, .issues li.error { border-left-color: var(--danger); }
.issues li.skipped { border-left-color: var(--muted); }
.issues .ln { font-family: ui-monospace, Menlo, monospace; color: var(--accent-h); margin-right: 6px; }

.form { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 8px; }
.row { display: flex; gap: 8px; }
.row select { flex: 1; }
select { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; font-size: 0.85rem; font-family: inherit; width: 100%; }
.hint { font-size: 0.76rem; color: var(--muted); }
.hint.good { color: var(--success); }
.hint.caution { color: var(--warn); }
#dubBtn { margin-top: 14px; align-self: flex-start; }
#cancelBtn { align-self: flex-start; }
.progress { height: 6px; background: var(--surface3); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress div { height: 100%; width: 0; background: var(--accent-h); transition: width .15s; }

.banner { padding: 10px 14px; border-radius: 8px; font-size: 0.86rem; font-weight: 600; margin-bottom: 12px; border: 1px solid; }
.banner.ok { background: rgba(112,219,151,.12); border-color: var(--success); color: var(--success); }
.banner.fail { background: rgba(239,68,68,.14); border-color: var(--danger); color: #fca5a5; }
.banner small { display: block; font-weight: 400; color: var(--text); margin-top: 2px; }

audio { width: 100%; margin-bottom: 10px; }
.wave-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
#wave { display: block; width: 100%; height: 150px; cursor: pointer; }
.legend { display: flex; gap: 16px; font-size: 0.74rem; color: var(--muted); margin: 8px 0; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.sw.win { background: rgba(54,101,182,.45); }
.sw.over { background: rgba(245,158,11,.6); }
.sw.coll { background: rgba(239,68,68,.7); }

.table-wrap { overflow: auto; margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
th { text-align: left; background: var(--surface2); color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .05em; padding: 7px 9px; position: sticky; top: 0; }
td { padding: 6px 9px; border-top: 1px solid var(--surface3); vertical-align: top; font-variant-numeric: tabular-nums; }
td.text { min-width: 220px; color: var(--muted); }
tr.overrun td { background: rgba(245,158,11,.12); }
tr.collision td { background: rgba(239,68,68,.2); }
tr.truncated td, tr.negative_duration td, tr.zero_duration td, tr.overlap td { background: rgba(239,68,68,.12); }
tr.empty td { color: var(--muted); }
