:root {
  --bg: #111214; --panel: #1b1d21; --text: #ececec; --muted: #8b8f98;
  --accent: #ff5a36; --accent-dim: #5a2418; --me: #23262c; --line: #2a2d33;
  --good: #6fcf97; --bad: #ff7b7b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; max-width: 680px; margin: 0 auto;
  padding: 0 16px env(safe-area-inset-bottom);
}
header { display: flex; align-items: center; gap: 10px; padding: 16px 0 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header h1 { font-size: 20px; margin: 0; letter-spacing: .02em; }
header h1 span { color: var(--accent); }
header .sp { flex: 1; }
a { color: var(--text); }
.badge { font-size: 12px; color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 999px; padding: 2px 8px; }
select, .small, button.wide {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 14px; text-decoration: none;
}
button.wide { padding: 8px 18px; }
button.wide:disabled { opacity: .5; }
#log { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 10px 14px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; word-wrap: break-word; }
.me { align-self: flex-end; background: var(--me); }
.me .tag { color: var(--muted); font-size: 12px; display: block; }
.max { align-self: flex-start; background: var(--panel); border-left: 3px solid var(--accent); }
.en { color: #ffb199; font-weight: 600; }
.repeat, .hw { margin-top: 6px; font-size: 14px; color: var(--muted); }
.repeat b, .hw b { color: var(--text); }
.summary { align-self: stretch; max-width: none; background: var(--panel); border: 1px solid var(--line); }
.summary .h { font-weight: 600; margin-bottom: 4px; }
.pass { margin-top: 8px; color: var(--good); }
.fail { margin-top: 8px; color: var(--bad); }
.sys { align-self: center; color: var(--muted); font-size: 14px; text-align: center; }
footer { padding: 12px 0 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#talk {
  width: 128px; height: 128px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font: 600 16px system-ui, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 0 0 0 var(--accent-dim); transition: transform .1s, box-shadow .2s, opacity .2s;
}
#talk.rec { transform: scale(1.08); box-shadow: 0 0 0 14px var(--accent-dim); }
#talk:disabled { opacity: .35; }
#status { color: var(--muted); font-size: 14px; min-height: 1.4em; text-align: center; }

/* progress page */
.page { padding: 16px 0 32px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.ladder { display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.step .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.step.done { color: var(--text); } .step.done .dot { background: var(--muted); border-color: var(--muted); }
.step.cur { color: var(--accent); font-weight: 600; } .step.cur .dot { background: var(--accent); border-color: var(--accent); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; border-top: none; }
td.n { text-align: right; font-variant-numeric: tabular-nums; }
.wrong { color: var(--bad); text-decoration: line-through; }
.sess { border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.sess:first-of-type { border-top: none; }
.sess .meta { color: var(--muted); font-size: 12px; }
.pill { font-size: 12px; color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 999px;
        padding: 2px 10px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .pill { animation: none; } }
