:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #1d1f1e; --sub: #5f6663; --line: #e3e1da;
  --accent: #1f5f4a; --accent-ink: #ffffff; --accent-soft: #e3efe9;
  --good: #1f7a4d; --bad: #b3412f; --warn: #a86a00; --rec: #c8372d;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121514; --card: #1b1f1d; --ink: #eceeed; --sub: #9aa39f; --line: #2c322f;
    --accent: #5fb892; --accent-ink: #0d1411; --accent-soft: #1d2d26;
    --good: #5fc48f; --bad: #ef7d6b; --warn: #e0a846; --rec: #ef5a4c;
  }
}
:root[data-theme="dark"] {
  --bg: #121514; --card: #1b1f1d; --ink: #eceeed; --sub: #9aa39f; --line: #2c322f;
  --accent: #5fb892; --accent-ink: #0d1411; --accent-soft: #1d2d26;
  --good: #5fc48f; --bad: #ef7d6b; --warn: #e0a846; --rec: #ef5a4c;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; padding-top: calc(14px + env(safe-area-inset-top)); }
.brand { font-weight: 700; letter-spacing: -0.01em; }
.streak { font-size: 14px; color: var(--sub); }
main { max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; }
h2 { font-size: 20px; margin: 14px 0 8px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 18px 0 6px; }
p { margin: 6px 0; }
.sub { color: var(--sub); font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip.gray { background: transparent; border: 1px solid var(--line); color: var(--sub); font-weight: 500; }
button, .btn {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; min-height: 44px;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: .45; }
button.block { width: 100%; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; border-radius: 0; background: none; font-size: 13px; white-space: nowrap; color: var(--sub); min-height: 56px; padding: 6px 0; }
.tabs button.on { color: var(--accent); font-weight: 700; }
.qtext { font-size: 17px; line-height: 1.5; }
.qtext.hidden { filter: blur(6px); user-select: none; }
.frame { font-size: 14px; color: var(--sub); border-left: 3px solid var(--accent); padding-left: 10px; margin-top: 8px; }
.recbtn {
  width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--rec); color: #fff;
  font-weight: 700; font-size: 16px; display: block; margin: 16px auto 6px;
}
.recbtn.on { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(200,55,45,.45); } 50% { box-shadow: 0 0 0 14px rgba(200,55,45,0); } }
.timer { text-align: center; font-variant-numeric: tabular-nums; font-size: 28px; font-weight: 700; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.metric { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.metric b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.metric span { font-size: 12px; color: var(--sub); }
.ok b { color: var(--good); } .no b { color: var(--bad); }
.transcript { white-space: pre-wrap; font-size: 15px; background: var(--bg); border-radius: 10px; padding: 10px; }
.flash { text-align: center; padding: 22px 10px; }
.flash .ko { font-size: 19px; font-weight: 600; }
.flash .en { font-size: 18px; color: var(--accent); margin-top: 14px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.grades button { padding: 8px 0; font-size: 14px; }
.list-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .en { color: var(--accent); }
textarea, input[type=text], input[type=password] {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px;
}
textarea { min-height: 150px; }
ol.kw { margin: 6px 0; padding-left: 22px; }
details summary { cursor: pointer; color: var(--sub); font-size: 14px; padding: 6px 0; }
.status { font-size: 14px; color: var(--sub); text-align: center; padding: 10px; }
.toggle { display: flex; gap: 6px; }
.toggle button { flex: 1; font-size: 14px; }
.toggle button.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
audio { width: 100%; margin-top: 8px; }
.fix { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.fix:last-child { border-bottom: 0; }
.fix .wrong { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
.fix .right { color: var(--good); font-weight: 600; }
.mini { min-height: 32px; padding: 2px 10px; font-size: 13px; }
.tally { display: flex; flex-wrap: wrap; gap: 6px; }
