:root { color-scheme: dark; font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif; background:#101722; color:#f7f9fc; }
* { box-sizing:border-box; }
body { margin:0; min-width:280px; min-height:100dvh; background:radial-gradient(circle at 50% 5%, #283a51, #101722 60%); }
button { font:inherit; -webkit-tap-highlight-color:transparent; touch-action:manipulation; cursor:pointer; }
.app-shell { width:min(100%, 540px); min-height:100dvh; margin:auto; padding:max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); }
.screen { min-height:calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)); }
.start-screen, .result-screen { display:grid; place-items:center; }
.start-content { width:100%; text-align:center; }
.eyebrow { color:#91d4c3; font-size:.78rem; font-weight:800; letter-spacing:.14em; margin:0 0 14px; }
h1 { margin:0; font-size:clamp(2rem, 8vw, 2.8rem); line-height:1.23; letter-spacing:-.055em; }
.count-picker { margin:clamp(44px, 10vh, 82px) 0 28px; }
.count-picker p { margin:0 0 18px; color:#c8d2df; font-size:1rem; }
.picker-row { display:flex; align-items:center; justify-content:center; gap:30px; }
.picker-row output { min-width:82px; font-size:3rem; font-weight:800; font-variant-numeric:tabular-nums; }
.triangle-button { border:0; color:#91d4c3; background:transparent; border-radius:50%; width:56px; height:56px; font-size:1.25rem; }
.triangle-button:active { background:#314154; transform:scale(.94); }
.script-picker { border:0; padding:0; margin:0 0 32px; }
.script-picker legend { padding:0; margin:0 auto 13px; color:#c8d2df; font-size:1rem; }
.script-options { display:grid; gap:9px; }
.script-options label { position:relative; display:block; }
.script-options input { position:absolute; opacity:0; }
.script-options span { display:block; border:1px solid #596b82; border-radius:12px; padding:13px 12px; background:#1b2737; color:#dbe4ef; font-weight:700; }
.script-options input:checked + span { border-color:#91d4c3; background:#24493f; color:#f7f9fc; box-shadow:inset 0 0 0 1px #91d4c3; }
.script-options input:focus-visible + span { outline:3px solid #fff; outline-offset:2px; }
.primary-button, .secondary-button { min-height:56px; border-radius:14px; font-weight:800; font-size:1rem; width:100%; }
.primary-button { border:0; color:#0d1b25; background:#91d4c3; box-shadow:0 8px 20px #0004; }
.primary-button:active { transform:translateY(2px); box-shadow:none; }
.quiz-screen { display:flex; flex-direction:column; padding-top:8px; }
.quiz-header { text-align:center; color:#d8e0eb; font-size:.94rem; font-weight:700; }
.progress-track, .timer-track { overflow:hidden; border-radius:99px; background:#354254; }
.progress-track { height:5px; margin:12px auto 0; width:64%; }
#progress-fill { height:100%; width:0; background:#91d4c3; transition:width .25s ease; }
.question-card { display:grid; place-items:center; aspect-ratio:1 / 1; min-height:190px; margin:clamp(34px, 8vh, 78px) auto 18px; width:min(100%, 380px); border:1px solid #53647b; border-radius:24px; background:#1b2737; box-shadow:0 18px 35px #0003; }
#question { margin:0; font-family:"Noto Sans JP", sans-serif; font-size:clamp(3rem, 15vw, 5.5rem); font-weight:700; line-height:1.2; }
.timer-track { height:8px; width:47%; margin:0 auto clamp(30px, 7vh, 56px); }
#timer-fill { height:100%; width:100%; transform-origin:left; background:#91d4c3; }
.choices { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:13px; margin-top:auto; }
.choice { min-height:64px; border:1px solid #596b82; color:#f7f9fc; background:#1b2737; border-radius:14px; padding:8px; font-weight:750; font-size:clamp(.95rem, 4vw, 1.1rem); }
.choice:active:not(:disabled) { transform:scale(.98); background:#2b3c51; }
.choice:disabled { cursor:default; }
.choice.correct { background:#277962; border-color:#91d4c3; }
.choice.wrong { background:#913f4c; border-color:#ffb6bf; }
.feedback { height:25px; margin:14px 0 0; text-align:center; color:#dce5ef; font-weight:800; }
.result-card { width:100%; text-align:center; border:1px solid #53647b; border-radius:24px; padding:36px 25px 25px; background:#1b2737; box-shadow:0 18px 35px #0003; }
h2 { margin:0; font-size:1.7rem; letter-spacing:-.04em; }
.stats { margin:32px 0; display:grid; grid-template-columns:1fr 1fr; gap:1px; background:#43546b; border:1px solid #43546b; border-radius:14px; overflow:hidden; }
.stats div { padding:17px 8px; background:#202e40; }
dt { color:#b9c6d6; font-size:.8rem; } dd { margin:5px 0 0; font-size:1.25rem; font-weight:800; font-variant-numeric:tabular-nums; }
.result-actions { display:grid; gap:10px; }
.secondary-button { border:1px solid #71839a; color:#f7f9fc; background:transparent; }
[hidden] { display:none !important; }
@media (max-height:650px) { .question-card { min-height:140px; margin:24px auto 14px; } .timer-track { margin-bottom:22px; } }


/* Keep long kana, larger text, and landscape phones within their containers. */
.question-card { flex-shrink:0; padding:12px; }
#question { max-width:100%; overflow-wrap:anywhere; text-align:center; }
.choice { overflow-wrap:anywhere; }
.script-options label { cursor:pointer; }
button:focus-visible { outline:3px solid #fff; outline-offset:3px; }
@media (max-height:740px) {
  .question-card { width:min(100%, 260px); margin-top:24px; }
  .timer-track { margin-bottom:24px; }
  .count-picker { margin-top:32px; }
}
@media (orientation:landscape) and (max-height:540px) {
  .question-card { width:180px; min-height:0; margin-top:18px; }
}


