:root {
  --bg-sky: #e8f6ff;
  --card: #ffffff;
  --ink: #073b4c;
  --accent: #118ab2;
  --pink: #ef476f;
  --good: #06d6a0;
  --warn: #ffd166;
  --muted: #5b7a86;
  --radius: 22px;
  --shadow: 0 10px 0 rgba(7, 59, 76, 0.12);
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: linear-gradient(165deg, #caf0f8 0%, #e8f6ff 40%, #fff3b0 100%);
  color: var(--ink);
  min-height: 100vh;
}
#app { max-width: 720px; margin: 0 auto; padding: 12px 16px 56px; }
.top {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 14px;
}
.brand { flex: 1; text-align: center; }
.brand-mark {
  display: block; font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent);
}
.top h1 { margin: 2px 0 0; font-size: 1.4rem; }
.voice-picks {
  display: grid; gap: 8px; margin: 0 0 10px;
  position: sticky; top: 0; z-index: 5;
  background: rgba(232, 246, 255, 0.96);
  padding: 8px 0;
}
.reply-voices {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  max-width: 520px; margin: 10px auto 0;
}
.reply-voices button {
  font: inherit; font-weight: 800; font-size: 0.82rem;
  border: 3px solid var(--ink); border-radius: 14px;
  background: #fff; padding: 10px 6px; cursor: pointer;
}
.reply-voices button.on { background: var(--good); }
.voice-picks label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.85rem; font-weight: 800;
}
.voice-picks select {
  font: inherit; font-weight: 800; border: 3px solid var(--ink);
  border-radius: 12px; padding: 8px 10px; background: #fff; max-width: 220px;
}
#checkerStatus { text-align: center; margin: 0 0 6px; min-height: 1.3em; font-weight: 700; }
.load-track {
  height: 14px; background: #fff; border: 2px solid var(--ink);
  border-radius: 999px; overflow: hidden; margin: 0 8px 12px;
}
.load-fill {
  height: 100%; width: 8%; background: var(--accent); border-radius: 999px;
}
.load-fill.creep {
  width: 38%;
  animation: load-creep 1.1s ease-in-out infinite;
}
@keyframes load-creep {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(320%); }
}
.grade-box { margin: 8px 0 4px; }
.grade-box p { text-align: center; font-weight: 800; margin: 0 0 6px; }
.word-box { margin: 10px 0 4px; text-align: center; }
.word-hint { margin: 0 0 8px; color: var(--muted); font-size: 0.88rem; font-weight: 700; }
.word-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.word-chip-wrap { display: flex; flex-direction: column; align-items: center; max-width: 160px; }
.word-chip-wrap .word-hint { margin: 4px 0 0; font-size: 0.75rem; line-height: 1.25; }
.word-chip {
  border: 3px solid var(--ink); border-radius: 16px; background: #fff;
  min-width: 72px; padding: 8px 10px; font: inherit; font-weight: 900; cursor: pointer;
}
.word-chip .p { display: block; font-size: 0.75rem; font-weight: 800; }
.word-chip.good { background: #06d6a0; }
.word-chip.ok { background: #ffd166; }
.word-chip.bad { background: #ef476f; color: #fff; }
.badge {
  background: var(--pink); color: #fff; border-radius: 999px;
  padding: 4px 10px; font-size: 0.85rem; font-weight: 800;
}
.lead { text-align: center; font-size: 1.08rem; line-height: 1.45; font-weight: 600; }
.lead small { color: var(--muted); font-weight: 500; }
.card-grid, .unit-grid { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 520px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  .unit-grid { grid-template-columns: 1fr 1fr; }
}
.book-card, .unit-card {
  background: var(--card); border: 3px solid var(--ink);
  border-radius: var(--radius); padding: 18px 16px; text-align: left;
  box-shadow: var(--shadow); cursor: pointer; font: inherit; color: inherit; width: 100%;
}
.book-card:active, .unit-card:active { transform: translateY(2px); box-shadow: 0 6px 0 rgba(7,59,76,0.12); }
.book-card h2, .unit-card h3 { margin: 0 0 4px; font-size: 1.15rem; }
.book-card p, .unit-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
button.primary, button.secondary, button.ghost, button.big, button.stop {
  border: 3px solid var(--ink); border-radius: 999px; padding: 12px 20px;
  font: inherit; font-weight: 800; cursor: pointer;
}
button.primary { background: var(--pink); color: #fff; }
button.secondary { background: #fff; color: var(--ink); }
button.ghost { background: transparent; color: var(--accent); border-color: transparent; }
button.big { font-size: 1.2rem; padding: 16px 28px; margin: 8px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.actions { display: flex; gap: 10px; justify-content: center; margin: 16px 0 8px; flex-wrap: wrap; }
.mic { font-size: 1.15rem; min-width: 150px; }
.mic.listening { background: var(--ink); animation: pulse 1s infinite; }
button.stop {
  position: fixed; z-index: 30; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--pink); color: #fff; font-size: 1.2rem; min-width: 180px;
  box-shadow: var(--shadow);
}
.word-chip.listening { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.cue-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: 28px;
  padding: 24px 16px; box-shadow: var(--shadow); text-align: center; margin-top: 8px;
}
.hint { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.cue-btn {
  background: linear-gradient(135deg, #48cae4, #0077b6);
  color: #fff; border: 3px solid var(--ink); border-radius: 22px;
  padding: 26px 18px; width: 100%; max-width: 480px; cursor: pointer;
}
.say-line {
  font-size: clamp(1.35rem, 5.2vw, 2.1rem); font-weight: 900;
  display: block; line-height: 1.3;
}
.heard { margin-top: 12px; font-size: 1rem; font-weight: 700; color: var(--muted); }
.progress-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress {
  flex: 1; height: 12px; background: #fff; border: 2px solid var(--ink);
  border-radius: 999px; overflow: hidden; position: relative;
}
.progress::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--pct, 0%); background: var(--accent); border-radius: 999px;
  transition: width 0.25s ease;
}
.try-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.try-dots span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--ink); background: #fff;
}
.try-dots span.used { background: var(--pink); }
.reply-banner {
  display: block; width: 100%;
  margin: 14px auto 0; max-width: 520px; padding: 14px 16px;
  background: #073b4c; color: #fff; border-radius: 18px; text-align: left;
  font: inherit; font-weight: 700; line-height: 1.4;
  border: 3px solid var(--ink); cursor: pointer;
}
.reply-label {
  display: inline-block; background: var(--good); color: var(--ink);
  border-radius: 999px; padding: 2px 10px; font-size: 0.75rem;
  font-weight: 900; margin-right: 8px; vertical-align: middle;
}
.nav-row { display: flex; justify-content: space-between; margin-top: 18px; }
.status { text-align: center; min-height: 1.4em; }
.muted { color: var(--muted); font-size: 0.92rem; }
.done-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: 28px;
  padding: 32px 20px; text-align: center; box-shadow: var(--shadow); margin-top: 20px;
}
.done-card button { margin: 8px; }
.big-score { font-size: 2rem; font-weight: 900; margin: 8px 0; }
.results-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 14px; flex-wrap: wrap;
}
.eyebrow {
  margin: 0; font-size: 0.8rem; font-weight: 900; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
}
.results-head h2 { margin: 2px 0 4px; font-size: 2rem; }
.results-list { display: grid; gap: 12px; }
.result-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: 18px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.result-card.success { border-color: var(--good); }
.result-card.missed { border-color: var(--pink); }
.result-card .q { font-size: 1.15rem; font-weight: 900; margin: 0 0 6px; }
.result-card .a { margin: 0; font-weight: 700; color: var(--ink); }
.result-card .tag {
  display: inline-block; font-size: 0.75rem; font-weight: 900;
  padding: 2px 8px; border-radius: 999px; margin-bottom: 6px;
}
.result-card.success .tag { background: #d8fff3; color: #067a5a; }
.result-card.missed .tag { background: #ffe0e8; color: #9d2343; }
.result-card .miss-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.tip { margin-top: 18px; }

@media print {
  body { background: #fff; }
  .print-hide, #btnHome, #btnStop, .top .badge, #checkerStatus, #loadTrack, #gradeBox, #wordBox { display: none !important; }
  .result-card { box-shadow: none; break-inside: avoid; }
}
