/* Dark, quiet, one thing at a time. The drill screen is deliberately bare:
   during a blind listen there must be nothing on it worth reading. */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --ink: #e7eaf0;
  --ink-dim: #98a0b0;
  --accent: #7dd3a0;
  --accent-ink: #05130c;
  --warn: #f0b46b;
  --bad: #f08a8a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .3px; }
.meta { color: var(--ink-dim); font-size: 13px; text-align: right; }

.view { flex: 1; overflow-y: auto; padding: 16px 16px 96px; max-width: 720px; width: 100%; margin: 0 auto; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #12141a; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  background: none; border: 0; color: var(--ink-dim);
  font: inherit; font-size: 12px; padding: 8px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
}
.tabbar button span { font-size: 20px; line-height: 1; }
.tabbar button.active { color: var(--accent); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card h3 { margin: 0 0 8px; font-size: 14px; color: var(--ink-dim); font-weight: 600; }
.dim { color: var(--ink-dim); }
.small { font-size: 13px; }
.center { text-align: center; }

button.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 10px; padding: 12px 16px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
}
button.btn:disabled { opacity: .45; cursor: not-allowed; }
button.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.btn.wide { width: 100%; }
button.btn.big { padding: 18px; font-size: 17px; }
button.btn.rec.on { background: var(--bad); color: #1a0606; border-color: transparent; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grow { flex: 1; }

/* step list on the session screen */
.steps { display: grid; gap: 8px; }
.step {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius); padding: 14px; font: inherit; cursor: pointer;
}
.step .ico { font-size: 22px; }
.step .t { font-weight: 600; }
.step .s { font-size: 12.5px; color: var(--ink-dim); }
.step.done { border-color: #2f5c44; }
.step.done .t::after { content: " ✓"; color: var(--accent); }

/* dictation */
.chunkbar { display: flex; gap: 5px; margin-bottom: 12px; }
.chunkbar i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.chunkbar i.now { background: var(--accent); }
.chunkbar i.past { background: #3d6b52; }

.listenwrap { padding: 22px 0 8px; text-align: center; }
.playbig {
  width: 96px; height: 96px; border-radius: 50%; font-size: 34px;
  border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.playbig:disabled { opacity: .5; }
.playcount { margin-top: 10px; color: var(--ink-dim); font-size: 13px; }

textarea.type {
  width: 100%; min-height: 84px; resize: vertical;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font: inherit; line-height: 1.5;
}
textarea.type:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* word bank */
.answer {
  min-height: 58px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
.answer .ph { color: var(--ink-dim); font-size: 14px; }
.pool { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* mode switch */
.modebar { display: flex; gap: 6px; margin-bottom: 14px; }
.modebar button {
  flex: 1; font: inherit; font-size: 13.5px; padding: 10px 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim); border-radius: 10px;
}
.modebar button.on { background: var(--panel-2); color: var(--ink); border-color: var(--accent); }
.modebar button:disabled { opacity: .5; cursor: not-allowed; }

.hintbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.hintbar button { font-size: 13px; padding: 10px 6px; }
.hintbar button.used { border-color: var(--warn); color: var(--warn); }

.scene { text-align: center; padding: 14px; background: var(--panel-2); border-radius: 10px; }
.scene .emo { font-size: 40px; }
.scene .cap { color: var(--ink-dim); font-size: 14px; }

.ytbox { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; }
.ytbox iframe, .ythost { width: 100%; height: 100%; border: 0; }
.ytcover {
  position: absolute; inset: 0; background: #0b0d11;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-dim); font-size: 14px; letter-spacing: .5px;
}

/* diff result */
.diff { font-size: 17px; line-height: 2.1; }
.diff span { padding: 2px 3px; border-radius: 5px; }
.diff .ok { color: var(--ink); }
.diff .miss { background: #3a1f1f; color: #ffc9c9; cursor: pointer; border-bottom: 2px solid var(--bad); }
.diff .miss.known { background: #3a3320; color: #ffe1a8; border-bottom-color: var(--warn); }
.diff .extra { color: var(--ink-dim); text-decoration: line-through; }
.diff span.loading { opacity: .45; outline: 1px dashed var(--ink-dim); }
.legend { font-size: 12.5px; color: var(--ink-dim); margin-top: 6px; }

/* Azure deep scoring */
.chip.pa-ok { border-color: #2f5c44; }
.chip.pa-warn { border-color: var(--warn); color: var(--warn); }
.chip.pa-bad { border-color: var(--bad); color: var(--bad); }
.phlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 14px; }
.phlist span { padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; }
.phlist span.pa-warn { color: var(--warn); border-color: var(--warn); }
.phlist span.pa-bad { color: var(--bad); border-color: var(--bad); }

/* auto-shadow recording state */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 138, 138, .55); }
  50% { box-shadow: 0 0 0 12px rgba(240, 138, 138, 0); }
}
.btn.pulse { animation: pulse 1.2s ease-out infinite; }

.vi { color: var(--ink-dim); font-size: 14.5px; }
.wordable span.w { cursor: pointer; border-bottom: 1px dotted #4a5163; }
.wordable span.w:active { color: var(--accent); }

.gloss { margin-top: 10px; font-size: 13.5px; color: var(--ink-dim); }
.gloss b { color: var(--ink); font-weight: 600; }

.timer { font-size: 44px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--warn); }

audio { width: 100%; margin-top: 8px; }

table.stat { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stat th, table.stat td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.stat th:first-child, table.stat td:first-child { text-align: left; }
table.stat th { color: var(--ink-dim); font-weight: 600; font-size: 12.5px; }

input.txt {
  width: 100%; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px; font: inherit;
}
label.f { display: block; margin-bottom: 10px; font-size: 13px; color: var(--ink-dim); }
label.f input, label.f textarea { margin-top: 4px; }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: #2a2f3a; color: var(--ink); padding: 10px 16px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw;
}
#toast.show { opacity: 1; }
