:root {
  color-scheme: light;
  font: 16px/1.55 "Inter", "Segoe UI", sans-serif;
  color: #17223c;
  background: #f3f5fa;
  --line: #dbe1ed;
  --muted: #525f77;
  --accent: #4044bc;
  --navy: #242b63;
  --page-width: 1600px;
  --page-gutter: clamp(14px, 2vw, 30px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a, button, input, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #686cf0; outline-offset: 4px; }
#prompt:focus { outline: none; }
.top { border-bottom: 1px solid var(--line); background: #fff; }
.top-inner { max-width: var(--page-width); min-height: 70px; margin: auto; padding: 8px var(--page-gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; font-size: 1.02rem; font-weight: 750; }
.logo { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: white; }
.layout { max-width: var(--page-width); padding: 24px var(--page-gutter) 40px; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); gap: 18px; align-items: start; }
.intro, .mode-bar { grid-column: 1 / -1; }
.intro p, .quiz-header p { margin: 0; }
h1 { margin: 2px 0 1px; font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.045em; line-height: 1.14; }
.muted { color: var(--muted); }
.sidebar { display: grid; gap: 12px; }
@media (width > 760px) {
  .layout { grid-template-rows: min-content min-content 1fr; }
  .layout:has(> .sidebar:not([hidden])) > .mode-bar { grid-column: 1; }
  .sidebar { grid-column: 2; grid-row: 2 / span 2; }
}
.progress { position: relative; overflow: hidden; padding: 21px; border-radius: 17px; background: var(--navy); color: white; }
.progress::after { content: ""; position: absolute; width: 100px; height: 100px; border: 1px solid #ffffff26; border-radius: 50%; top: -59px; right: -20px; box-shadow: 0 0 0 17px #ffffff11, 0 0 0 34px #ffffff0a; pointer-events: none; }
.progress h2 { margin: 0 0 9px; font-size: .93rem; font-weight: 650; }
.score { display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.score strong { font-size: 2.25rem; line-height: 1.15; }
.score span, .progress p { color: #dbe0ff; font-size: .85rem; }
.progress p { margin: 5px 0 0; }
progress { display: block; appearance: none; width: 100%; height: 7px; margin-top: 14px; border: 0; border-radius: 10px; background: #ffffff38; overflow: hidden; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: #b8c0ff; border-radius: 10px; }
progress::-moz-progress-bar { background: #b8c0ff; border-radius: 10px; }
.setting, .keyboard { background: #fff; border: 1px solid var(--line); border-radius: 11px; font-size: .9rem; }
.setting { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 8px 14px; cursor: pointer; }
.setting input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.keyboard { padding: 14px 16px; }
.keyboard h2 { margin: 0 0 4px; font-size: 1rem; }
.keyboard p { margin: 8px 0 12px; color: var(--muted); }
.keyboard dl { padding: 0; margin: 0; }
.keyboard dt { flex-shrink: 0; }
.keyboard dd { text-align: right; }
#practice-guide { width: 100%; min-height: 48px; font-size: 1rem; }
dl { padding: 0 14px; margin: 0 0 10px; }
dl div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; }
dd { margin: 0; color: var(--muted); }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; background: #f3f5fa; }
.quiz { grid-column: 1; grid-row: 3; min-width: 0; background: #fff; padding: clamp(16px, 2vw, 28px); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 8px 25px #242b6308; }
.quiz[data-result="correct"] { background: #e2f5e9; border-color: #63a47b; }
.quiz[data-result="correct"] .quiz-header { color: #165436; }
.quiz[data-result="correct"] .choice:not([data-result="correct"]) { background: #f8fdf9; }
.quiz[data-result="correct"] .quiz-actions { border-color: #b7d8c3; }
.quiz-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--accent); font-size: .88rem; font-weight: 700; }
#review { color: #705011; background: #fff1cb; border-radius: 6px; padding: 1px 7px; }
.question-text { margin: 10px 0 6px; font-size: clamp(1.16rem, 2vw, 1.5rem); line-height: 1.36; font-weight: 700; white-space: pre-line; overflow-wrap: anywhere; }
.question-instruction { margin: 0 0 12px; font-size: .9rem; }
.question-choices { display: grid; gap: 9px; }
.choice { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 5px 11px; border: 1px solid var(--line); border-radius: 10px; min-height: 54px; padding: 9px 12px; cursor: pointer; }
.choice:has(input:focus-visible) { outline: 3px solid #686cf0; outline-offset: 3px; }
.choice:hover:not(:has(input:disabled)), .choice:has(input:checked:not(:disabled)) { background: #f0f0fe; border-color: #9296e0; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.letter { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 7px; background: #eef0f7; color: #364161; font-size: .84rem; font-weight: 750; }
.choice:has(input:checked:not(:disabled)) .letter { background: var(--accent); color: white; }
.option { white-space: pre-line; overflow-wrap: anywhere; }
.choice b { grid-column: 2; font-size: .82rem; }
.choice b:empty { display: none; }
.choice:has(input:disabled) { cursor: default; }
.choice[data-result="correct"] { background: #eaf8ef; border-color: #63a47b; color: #165436; }
.choice[data-result="correct"] .letter { color: white; background: #226841; }
.choice[data-result="wrong"] { background: #fff0f1; border-color: #c66c76; color: #8c2739; }
.choice[data-result="wrong"] .letter { color: white; background: #9a3043; }
#feedback { padding: 12px 14px; border-radius: 8px; background: #edf0fa; margin: 16px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
#feedback[data-result="correct"] { background: #eaf8ef; color: #165436; }
#feedback[data-result="wrong"] { background: #fff0f1; color: #8c2739; }
mark { color: #432c00; background: #ffe36e; border-radius: 3px; padding-inline: 2px; font-weight: 650; box-decoration-break: clone; }
#streak { border-radius: 999px; background: #ffec9f; color: #4d3500; padding: 3px 10px; }
#quiz { position: relative; }
.streak-fire {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 0 2px #ff9536, 0 0 12px #ff8c28c9, 0 0 25px #ff4a1e63;
}
.streak-fire svg {
  position: absolute;
  bottom: -6px;
  width: clamp(43px, 6vw, 86px);
  transform-origin: bottom center;
  filter: drop-shadow(0 0 6px #ff872a9c);
}
.streak-fire-left { left: -14px; }
.streak-fire-right { right: -14px; scale: -1 1; }
@media (prefers-reduced-motion: no-preference) {
  .streak-fire { animation: fire-glow 1400ms ease-out both; }
  .streak-fire svg { animation: fire-rise 660ms ease-out both; }
  .streak-fire .streak-fire-right { animation-delay: 45ms; }
  .streak-embers { animation: fire-embers 820ms ease-out both; }
}
@media (prefers-reduced-motion: reduce) {
  .streak-fire svg { display: none; }
}
@keyframes fire-glow {
  0%, 100% { opacity: 0; }
  15%, 63% { opacity: 1; }
}
@keyframes fire-rise {
  0% { transform: scale(.65, .2); }
  35% { transform: scale(.9, 1.12) skewX(-6deg); }
  65% { transform: scale(1.04, .91) skewX(5deg); }
  100% { transform: scale(1); }
}
@keyframes fire-embers {
  0% { opacity: 0; transform: translateY(8px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-12px); }
}
.quiz-actions, .answer-actions, .navigation { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.quiz-actions { justify-content: space-between; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
button { font: inherit; font-size: .9rem; font-weight: 650; min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 9px; color: inherit; background: white; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: white; }
button.quiet:hover:not(:disabled) { background: #edf0fa; }
button.primary:hover:not(:disabled) { background: #303496; }
button:disabled { opacity: .53; cursor: default; }
@media (max-width: 760px) {
  .layout { display: flex; flex-direction: column; gap: 16px; padding: 24px 14px 36px; }
  .top-inner { padding-inline: 14px; }
  .intro, .mode-bar, .sidebar, .quiz { width: 100%; }
  .sidebar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
  .progress { padding: 12px; }
  .progress h2 { margin-bottom: 4px; }
  .score strong { font-size: 1.6rem; }
  progress { margin-top: 8px; }
  .keyboard { grid-column: 1 / -1; }
  .setting { font-size: .82rem; padding-inline: 9px; }
  .quiz-actions > div { width: 100%; justify-content: space-between; }
}
.mode-nav, .mode-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-actions { margin-top: 16px; }
.mode-nav button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.mode-panel { grid-column: 1 / -1; width: 100%; min-width: 0; padding: clamp(16px, 3.5vw, 34px); background: #fff; border: 1px solid var(--line); border-radius: 19px; }
.mode-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; }
.mode-heading h2 { margin: 0; }
.mode-heading span { color: var(--muted); font-weight: 650; }
.flash-card { display: grid; width: 100%; padding: 0; border: 0; background: transparent; font: inherit; text-align: left; }
#exam-prompt { margin-bottom: 4px; white-space: pre-line; }
#exam-choices { display: grid; gap: 8px; }
@media (min-width: 1080px) {
  .quiz .choice, #exam-choices .choice { min-height: 48px; padding-block: 7px; }
}
.exam-score { font-size: 1.45rem; font-weight: 750; }
#exam-review p { white-space: pre-line; padding-block: 10px; border-bottom: 1px solid var(--line); }
#exam-review summary { cursor: pointer; font-weight: 650; }
#admin-form .mode-actions { margin-top: 6px; }
#member-email { font: inherit; color: inherit; width: min(100%, 340px); padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
#member-list { padding: 0; margin: 0; list-style: none; }
#member-list li { padding: 10px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
#member-list span { flex: 1 1 220px; overflow-wrap: anywhere; }
.gate { width: min(calc(100% - 32px), 560px); margin: 12vh auto; padding: 24px; border: 1px solid var(--line); border-radius: 19px; background: #fff; }
.gate h1 { font-size: clamp(1.55rem, 5vw, 2.25rem); }
.gate a { color: var(--accent); font-weight: 700; }
#tutorial { width: min(1480px, calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: clamp(16px, 3vw, 36px); color: inherit; border: 1px solid var(--line); border-radius: 19px; }
#tutorial::backdrop { background: #17223c90; }
.tutorial-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tutorial-top h2 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.2; }
.tutorial-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tutorial-panel { min-width: 0; padding: clamp(14px, 2vw, 24px); border: 1px solid var(--line); border-radius: 13px; background: #f8f9fd; }
.tutorial-panel h3, .tutorial-panel p { margin: 0 0 12px; }
.tutorial-panel h3 { color: var(--accent); font-size: 1.25rem; }
.tutorial-panel .tutorial-question { font-weight: 700; }
#tutorial-options .choice { text-align: left; min-height: 46px; font-size: 1rem; }
#tutorial-options .choice:hover:not(:disabled) { background: #f0f0fe; border-color: #9296e0; }
#tutorial-options .choice:disabled { opacity: 1; cursor: default; }
#tutorial-continue { margin-top: 10px; }
#tutorial[data-step="reveal"] [aria-labelledby="tutorial-reveal-title"] { border-color: var(--accent); }
.tutorial-panel .tutorial-feedback { margin: 12px 0 0; color: #165436; font-weight: 650; }
.tutorial-feedback:empty { display: none; }
.tutorial-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; margin-top: 16px; }
.tutorial-footer p { flex: 1 1 440px; margin: 0; color: var(--muted); }
@media (max-width: 680px) {
  .tutorial-grid { grid-template-columns: 1fr; }
  .tutorial-footer button { width: 100%; }
}
