/* Concept: a field recorder's paper log. Bone paper, carbon ink, one tape-orange accent. */
:root {
  --bg: #f2eee5;
  --card: #fbf9f4;
  --ink: #1f1d19;
  --muted: #6f6a60;
  --line: #d9d2c3;
  --track: #e7e1d4;
  --accent: #c2531b;
  --accent-ink: #fffaf3;
  --ok: #4d6b2f;
  --warn: #a0641a;
  --h: 32px;
  --r: 4px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --card: #1f1d19;
    --ink: #ece6da;
    --muted: #9b9486;
    --line: #34312b;
    --track: #2a2823;
    --accent: #e0702f;
    --accent-ink: #1a120c;
    --ok: #8fae63;
    --warn: #d69a45;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
main { max-width: 760px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); font-weight: 400; }

header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.sub { color: var(--muted); }
.src { font-family: var(--mono); font-size: 12px; }

.status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-height: 20px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot.loading { background: var(--warn); }
.dot.ready { background: var(--ok); }
.dot.err { background: var(--accent); }
.bar { flex: 1; min-width: 80px; max-width: 220px; height: 4px; background: var(--track); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--ink); transition: width .1s linear; }
.status.done .bar { display: none; }
.chip { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); }

.tabs { display: flex; border-bottom: 1px solid var(--line); gap: 4px; }
.tab { height: var(--h); padding: 0 12px; border: 0; background: none; color: var(--muted); font: 500 14px var(--sans); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }

.panel[hidden] { display: none; }
.panel { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { height: var(--h); padding: 0 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--r); font: 500 13px var(--sans); cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary.rec { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.sel { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; height: var(--h); }
.sel select { height: var(--h); padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--ink); font: 13px var(--sans); }
.sel.small select, .sel.small { height: 26px; font-size: 12px; }
.meter { flex: 1; min-width: 60px; height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--ink); }

.now { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.now-lang { font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.now-lang .code { font: 500 14px var(--mono); color: var(--muted); margin-left: 6px; }
.now-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.now-meta .flag { color: var(--warn); }
.now-stats { color: var(--muted); text-align: right; white-space: pre; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bars li { display: grid; grid-template-columns: 116px 1fr 46px; align-items: center; gap: 8px; height: 22px; }
.bars .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bars .nm .c { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 4px; }
.bars .tr { display: block; height: 10px; background: var(--track); border-radius: 2px; overflow: hidden; }
.bars .fl { display: block; height: 100%; width: 0; transition: width .2s ease-out; }
.bars .pc { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--muted); }

.tl-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); gap: 8px; }
.timeline { position: relative; height: 40px; background: var(--track); border-radius: var(--r); overflow: hidden; }
.timeline .tk { position: absolute; top: 0; bottom: 0; }
.timeline .lab, .segs .lab { position: absolute; top: 3px; font: 500 11px var(--mono); color: #fff; padding-left: 4px; white-space: nowrap; pointer-events: none; }
.sil { background: repeating-linear-gradient(135deg, transparent 0 3px, var(--line) 3px 4px); }

.samples .lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
.drop { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 64px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); cursor: pointer; font-size: 13px; }
.drop b { color: var(--ink); font-weight: 500; }
.drop.over { border-color: var(--accent); }
.drop input { display: none; }

#fileOut { display: flex; flex-direction: column; gap: 12px; }
#fileOut[hidden] { display: none; }
.ftl { position: relative; height: 72px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; }
#wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 44px; }
.segs { position: absolute; left: 0; right: 0; top: 0; height: 22px; }
.segs .sg { position: absolute; top: 0; height: 22px; }
.playhead { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink); left: 0; pointer-events: none; }
audio { width: 100%; height: 36px; }

footer { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

@media (max-width: 520px) {
  .now-lang { font-size: 24px; }
  .bars li { grid-template-columns: 96px 1fr 42px; }
  .now { flex-direction: column; align-items: flex-start; }
  .now-stats { text-align: left; }
}
