:root {
    color-scheme: light;
    --bg: #fff8eb;
    --card: #ffffff;
    --surface: #fffdf8;
    --surface-hover: #fff1d6;
    --border: #ead8b8;
    --text: #263238;
    --muted: #60717a;
    --accent: #b54631;
    --accent-hover: #933323;
    --teal: #0f766e;
    --correct: #15803d;
    --wrong: #be3455;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100vh; padding: 1rem; display: flex; justify-content: center; align-items: center; color: var(--text); background: radial-gradient(circle at 16% 14%, #ffe3a9 0, transparent 28%), radial-gradient(circle at 88% 88%, #bce8e2 0, transparent 30%), var(--bg); }
.container { width: 100%; max-width: 550px; padding: 1.5rem; position: relative; background: var(--card); border: 1px solid #f3e5ce; border-radius: 1.25rem; box-shadow: 0 16px 38px -14px rgba(125, 85, 35, 0.28); }
.hidden { display: none !important; }
h1 { margin-bottom: 0.25rem; color: var(--teal); text-align: center; font-size: 1.7rem; }
.subtitle { margin-bottom: 1.35rem; color: var(--muted); text-align: center; font-size: 0.92rem; }
label { display: block; margin-bottom: 0.4rem; color: var(--muted); font-size: 0.87rem; font-weight: 650; }
input[type="text"], select { width: 100%; margin-bottom: 1rem; padding: 0.82rem; color: var(--text); background: #fff; border: 2px solid var(--border); border-radius: 0.65rem; font-size: 1rem; outline: none; }
input[type="text"]:focus, select:focus { border-color: var(--accent); }
.btn { width: 100%; margin-bottom: 0.5rem; padding: 0.86rem; border: 0; border-radius: 0.65rem; color: #fff; background: var(--accent); font-size: 1rem; font-weight: 750; cursor: pointer; transition: background 160ms ease, transform 160ms ease; }
.btn:hover { background: var(--accent-hover); }
.btn-secondary { color: #22444a; background: #d7eee9; }
.btn-secondary:hover { background: #bfe2da; }
.ranking-hint { margin: 0.2rem 0 0.8rem; color: var(--muted); text-align: center; font-size: 0.8rem; line-height: 1.4; }
.name-privacy-hint { margin: -0.7rem 0 1rem; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 0.88rem; font-weight: 750; }
.combo-badge { color: #a65313; }
.timer-bar { width: 100%; height: 7px; margin-bottom: 1.1rem; overflow: hidden; background: #f0dfc1; border-radius: 99px; }
.timer-progress { width: 100%; height: 100%; background: var(--accent); transition: width 100ms linear; }
.answer-feedback { min-height: 1.5rem; margin-bottom: 0.55rem; text-align: center; font-weight: 700; }
.answer-feedback.correct { color: var(--correct); }
.answer-feedback.wrong { color: var(--wrong); }
.equation-card { margin-bottom: 1.15rem; padding: 1.35rem; text-align: center; background: var(--surface); border: 1px solid #f1dfc4; border-radius: 1rem; }
.equation-card h2 { color: var(--teal); font-size: clamp(2rem, 8vw, 2.8rem); letter-spacing: 0.02em; }
.equation-card p { margin-top: 0.3rem; color: var(--muted); font-size: 0.88rem; }
.options-grid { display: grid; gap: 0.75rem; }
.option-btn { position: relative; min-height: 3.35rem; padding: 0.85rem 3rem 0.85rem 0.9rem; color: var(--text); background: #fff; border: 2px solid var(--border); border-radius: 0.7rem; text-align: left; font-size: 1.05rem; font-weight: 700; cursor: pointer; transition: background 160ms ease, border-color 160ms ease, transform 160ms ease; }
.option-btn:hover:not([disabled]) { background: var(--surface-hover); border-color: var(--accent); }
.option-btn.correct { padding-right: 3rem; color: #14532d; background: #dcfce7 !important; border-color: var(--correct) !important; animation: answer-pop 320ms ease-out; }
.option-btn.correct::after { content: '✓'; position: absolute; top: 50%; right: 1rem; transform: translateY(-50%); font-size: 1.4rem; font-weight: 900; }
.option-btn.wrong { color: #9f1239; background: #fff1f2 !important; border-color: var(--wrong) !important; animation: answer-shake 320ms ease-in-out; }
.final-score { margin: 1rem 0; color: var(--teal); text-align: center; font-size: 2.5rem; font-weight: 800; }
.leaderboard-table { width: 100%; margin: 1rem 0 1.5rem; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td { padding: 0.6rem; border-bottom: 1px solid #f1dfc4; text-align: left; font-size: 0.9rem; }
.leaderboard-table th { color: var(--teal); }
.rank { width: 30px; color: #a65313; font-weight: 800; }
.score-cell { color: var(--teal); font-weight: 800; }
.date-cell, .table-message { color: var(--muted); }
.table-message { text-align: center; }
.table-message.error { color: var(--wrong); }
.utility-links { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 1.2rem; color: var(--muted); font-size: 0.78rem; }
.utility-links a, .version-badge { color: var(--muted); background: transparent; border: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.utility-links a:hover, .version-badge:hover, .back-link:hover { color: var(--teal); }
.back-link { display: block; margin-top: 0.8rem; color: var(--muted); text-align: center; text-decoration: none; font-size: 0.85rem; }
.modal-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(38, 50, 56, 0.46); }
.modal-body { width: 100%; max-width: 480px; max-height: 80vh; padding: 1.5rem; overflow-y: auto; background: var(--card); border: 1px solid #f1dfc4; border-radius: 1rem; box-shadow: 0 10px 25px rgba(70, 45, 20, 0.25); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 0.8rem; margin-bottom: 1rem; border-bottom: 1px solid #f1dfc4; }
.modal-header h2 { color: var(--teal); font-size: 1.2rem; }
.close-btn { color: var(--muted); background: none; border: 0; font-size: 1.6rem; cursor: pointer; }
.changelog-entry { margin-bottom: 1.2rem; }
.changelog-entry .v-title { margin-bottom: 0.3rem; color: var(--teal); font-size: 0.95rem; font-weight: 800; }
.changelog-entry ul { padding-left: 1.2rem; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.changelog-date { color: var(--muted); font-size: 0.8rem; font-weight: normal; }
.privacy-content { max-width: 700px; }
.privacy-content section { margin: 1.3rem 0; }
.privacy-content h2 { margin-bottom: 0.45rem; color: var(--teal); font-size: 1.1rem; }
.privacy-content p, .privacy-content li { color: var(--muted); line-height: 1.55; }
.privacy-content ul { padding-left: 1.25rem; }
.privacy-content a:not(.back-link) { color: #b84f35; }
.privacy-note { font-size: 0.85rem; }
.math-mascot { position: relative; width: 112px; height: 73px; margin: -0.15rem auto 0.25rem; pointer-events: none; }
.start-mascot { display: block; padding: 0; margin: 0.1rem auto -0.1rem; background: transparent; border: 0; cursor: pointer; pointer-events: auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.start-mascot:hover { filter: brightness(1.04); }
.start-mascot:focus-visible { outline: 3px solid #a65313; outline-offset: 5px; border-radius: 0.8rem; }
.dog-body, .dog-head, .dog-leg, .dog-tail, .dog-bandana { position: absolute; display: block; }
.dog-body { z-index: 1; width: 64px; height: 37px; left: 20px; bottom: 9px; background: #f4efe5; border-radius: 46% 54% 40% 42%; box-shadow: inset -8px -5px 0 rgba(123, 102, 72, 0.13); }
.dog-leg { z-index: 0; width: 13px; height: 25px; bottom: 2px; background: #e5d9c6; border-radius: 0 0 8px 8px; }
.dog-leg-back { left: 28px; }.dog-leg-front { left: 70px; }
.dog-tail { z-index: 0; width: 34px; height: 11px; left: 0; bottom: 33px; background: #e5d9c6; border-radius: 12px 0 0 12px; transform: rotate(-20deg); transform-origin: right center; animation: dog-tail-wag 2.8s ease-in-out infinite; }
.dog-head { z-index: 2; width: 48px; height: 46px; top: 5px; right: 7px; background: #f8f3e9; border-radius: 48% 52% 50% 47%; box-shadow: inset -5px -4px 0 rgba(123, 102, 72, 0.08); transform-origin: 50% 90%; }
.dog-ear { position: absolute; z-index: -1; width: 18px; height: 30px; top: -7px; background: #bd825e; border-radius: 70% 32% 55% 40%; }.dog-ear-left { left: 2px; transform: rotate(25deg); }.dog-ear-right { right: 1px; transform: rotate(-19deg); }
.dog-spot { position: absolute; width: 15px; height: 11px; top: 5px; right: 6px; background: #bd825e; border-radius: 50%; transform: rotate(-22deg); }
.dog-eye { position: absolute; top: 17px; width: 5px; height: 7px; background: #263238; border-radius: 50%; }.dog-eye-left { left: 14px; }.dog-eye-right { right: 14px; }
.dog-muzzle { position: absolute; bottom: 6px; left: 12px; width: 24px; height: 17px; background: #fffaf0; border-radius: 48%; }.dog-nose { position: absolute; top: 3px; left: 8px; width: 8px; height: 6px; background: #263238; border-radius: 50% 50% 48% 48%; }.dog-muzzle::after { content: ''; position: absolute; top: 9px; left: 11px; width: 7px; height: 5px; border-bottom: 2px solid #263238; border-radius: 0 0 8px 8px; }
.dog-bandana { z-index: 3; right: 27px; bottom: 9px; width: 19px; height: 16px; padding-top: 1px; color: #fff; background: var(--accent); border-radius: 4px 4px 10px 10px; font-size: 0.75rem; font-weight: 900; line-height: 15px; text-align: center; }
.mascot-happy-hop { animation: dog-happy-hop 470ms ease-out; }.mascot-happy-hop .dog-tail, .mascot-happy-wiggle .dog-tail { animation: dog-tail-happy 180ms ease-in-out 4; }.mascot-happy-bow .dog-head { animation: dog-happy-bow 520ms ease-out; }.mascot-happy-bow .dog-tail { animation: dog-tail-bow 240ms ease-in-out 3; }.mascot-happy-wiggle { animation: dog-happy-wiggle 460ms ease-in-out; }
.mascot-oops-tilt .dog-head { animation: dog-oops-head 380ms ease-out; }.mascot-oops-tilt .dog-ear-left, .mascot-oops-shy .dog-ear-left { animation: dog-ear-droop-left 380ms ease-out both; }.mascot-oops-tilt .dog-ear-right, .mascot-oops-shy .dog-ear-right { animation: dog-ear-droop-right 380ms ease-out both; }.mascot-oops-shy { animation: dog-oops-shy 480ms ease-out; }.mascot-oops-sigh .dog-body { animation: dog-oops-sigh 540ms ease-out; }.mascot-oops-sigh .dog-tail { animation: dog-tail-sigh 540ms ease-out; }
.btn:active, .option-btn:active:not([disabled]) { transform: scale(0.98); }.btn:focus-visible, .option-btn:focus-visible, input:focus-visible, select:focus-visible, .close-btn:focus-visible, .version-badge:focus-visible { outline: 3px solid #a65313; outline-offset: 3px; }
@keyframes answer-pop { 0%,100% { transform:scale(1); } 45% { transform:scale(1.025); } } @keyframes answer-shake { 0%,100% { transform:translateX(0); } 25% { transform:translateX(-5px); } 75% { transform:translateX(5px); } } @keyframes dog-tail-wag { 0%,78%,100% { transform:rotate(-20deg); } 86% { transform:rotate(9deg); } 93% { transform:rotate(-35deg); } } @keyframes dog-tail-happy { 0%,100% { transform:rotate(-30deg); } 50% { transform:rotate(28deg); } } @keyframes dog-happy-hop { 0%,100% { transform:translateY(0) rotate(0); } 40% { transform:translateY(-8px) rotate(-3deg); } 70% { transform:translateY(-2px) rotate(2deg); } } @keyframes dog-happy-bow { 0%,100% { transform:rotate(0) translateY(0); } 45% { transform:rotate(8deg) translateY(5px); } } @keyframes dog-tail-bow { 0%,100% { transform:rotate(-20deg); } 50% { transform:rotate(-52deg); } } @keyframes dog-happy-wiggle { 0%,100% { transform:rotate(0); } 25% { transform:rotate(-4deg); } 55% { transform:rotate(4deg); } 75% { transform:rotate(-2deg); } } @keyframes dog-oops-head { 0%,100% { transform:rotate(0); } 40% { transform:rotate(-7deg) translateY(3px); } 70% { transform:rotate(3deg); } } @keyframes dog-ear-droop-left { to { transform:rotate(55deg) translateY(4px); } } @keyframes dog-ear-droop-right { to { transform:rotate(-55deg) translateY(4px); } } @keyframes dog-oops-shy { 0%,100% { transform:translateX(0); } 40% { transform:translateX(-5px); } } @keyframes dog-oops-sigh { 0%,100% { transform:scaleY(1); } 45% { transform:scaleY(.92) translateY(3px); } } @keyframes dog-tail-sigh { 0%,100% { transform:rotate(-20deg); } 50% { transform:rotate(-33deg); } }
@media (max-width: 480px) { .container { padding: 1.1rem; }.option-btn { min-height: 3.55rem; } }
@media (prefers-color-scheme: dark) { :root { color-scheme:dark; --bg:#17212a; --card:#1d2a33; --surface:#15212a; --surface-hover:#273642; --border:#50616a; --text:#f7faf8; --muted:#c5d2d2; --accent:#ff9b70; --accent-hover:#ffb08f; --teal:#78d6c7; --correct:#4ade80; --wrong:#fb7185; } body { background:radial-gradient(circle at 16% 14%, #4c3522 0, transparent 28%),radial-gradient(circle at 88% 88%, #174f4b 0, transparent 30%),var(--bg); }.container { border-color:#3f5360; box-shadow:0 16px 38px -14px rgba(0,0,0,.55); }.btn { color:#492315; }.btn-secondary { color:#eaf7f4; background:#315b59; }.btn-secondary:hover { background:#3a716d; }.timer-bar { background:#42545d; }.equation-card,.leaderboard-table th,.leaderboard-table td,.modal-header { border-color:#3f5360; }.option-btn { background:#15212a; }.option-btn.correct { color:#f0fdf4; background:#14532d !important; }.option-btn.wrong { color:#fff1f2; background:#7f1d1d !important; }.modal-overlay { background:rgba(0,0,0,.7); }.modal-body { border-color:#3f5360; box-shadow:0 10px 25px rgba(0,0,0,.5); }.mascot-greeting { color:#f4c6a3; }.privacy-content a:not(.back-link) { color:#ffb08f; } input[type="text"], select { color:var(--text) !important; background-color:#15212a !important; -webkit-text-fill-color:var(--text); caret-color:var(--text); } input[type="text"]::placeholder { color:#b8c7c8; opacity:1; } input[type="text"]:-webkit-autofill, input[type="text"]:-webkit-autofill:hover, input[type="text"]:-webkit-autofill:focus { -webkit-text-fill-color:var(--text); -webkit-box-shadow:0 0 0 1000px #15212a inset; box-shadow:0 0 0 1000px #15212a inset; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }.math-mascot,.math-mascot * { animation:none !important; transition:none !important; } }
