:root {
  --bg: #fff8ec;
  --ink: #26323f;
  --card: #ffffff;
  --radius: 1.25rem;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 1.05rem;
}
h1, h2, h3, .h1, .h2, .h3, .h4, .display-5, .display-6, .navbar-brand { font-weight: 900; letter-spacing: -0.01em; }

/* Nav */
.app-nav { background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.06); }
.app-nav .navbar-brand { font-size: 1.5rem; color: var(--ink); }
.app-nav .nav-link, .app-nav .btn { white-space: nowrap; }
.app-nav .nav-link { font-weight: 800; border-radius: 999px; padding: .4rem .9rem !important; color: var(--ink); }
.app-nav .nav-subject { --c: #888; }
.app-nav .nav-subject:hover { background: color-mix(in srgb, var(--c) 12%, white); color: var(--c); }
.app-nav .nav-subject.active { background: var(--c); color: #fff; }
.app-nav .nav-link.active:not(.nav-subject) { background: #eef1f4; }
.user-menu { border: 0; border-radius: 1rem; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: .5rem; }
.user-menu .dropdown-item { font-weight: 700; border-radius: .6rem; padding: .5rem .9rem; }
.points-pill {
  display: inline-block; background: #ffd166; color: #5a3d00; font-weight: 900;
  border-radius: 999px; padding: .35rem .9rem; white-space: nowrap;
}

/* Cards */
.fun-card {
  background: var(--card); border: 0; border-radius: var(--radius);
  box-shadow: 0 6px 0 rgba(0,0,0,.06), 0 12px 24px rgba(0,0,0,.05);
}
.subject-card {
  --c: #888;
  display: block; text-decoration: none; color: #fff; background: var(--c);
  border-radius: var(--radius); padding: 1.75rem; min-height: 190px;
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 70%, black);
  transition: transform .12s ease, box-shadow .12s ease;
}
.subject-card:hover { color: #fff; transform: translateY(-3px); box-shadow: 0 11px 0 color-mix(in srgb, var(--c) 70%, black); }
.subject-card:active { transform: translateY(4px); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 70%, black); }
.subject-card .icon { font-size: 3rem; line-height: 1; }
.subject-card h2 { margin: .5rem 0 .25rem; font-size: 1.9rem; }
.subject-card .pts { background: rgba(255,255,255,.25); border-radius: 999px; padding: .2rem .75rem; font-weight: 800; }

.section-hero {
  --c: #888;
  background: var(--c); color: #fff; border-radius: var(--radius); padding: 2rem;
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 70%, black);
}
.section-hero .icon { font-size: 3.5rem; }
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .big { font-size: 4rem; }

/* Buttons */
.btn { font-weight: 800; border-radius: 999px; }
.btn-lg { padding: .75rem 1.75rem; }

/* Forms */
.form-control, .form-select { border-radius: .9rem; border-width: 2px; padding: .6rem .9rem; }
.form-label { font-weight: 800; }

/* Highscore */
.hs-tabs .nav-link { font-weight: 800; border-radius: 999px; color: var(--ink); }
.hs-tabs .nav-link.active { background: var(--c, #f4a261); color: #fff; }
.hs-row-me { background: #fff3c4 !important; }
.hs-table td, .hs-table th { padding: .8rem 1rem; vertical-align: middle; }
.hs-table .medal { font-size: 1.5rem; }

/* Login */
body.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #ffd16655 0, transparent 40%),
              radial-gradient(circle at 80% 30%, #06d6a055 0, transparent 40%),
              radial-gradient(circle at 50% 90%, #118ab255 0, transparent 45%), var(--bg); }
.login-card { width: 100%; max-width: 420px; padding: 2.25rem; }
.login-logo { font-size: 3.5rem; }
.lang-switch a { text-decoration: none; font-weight: 800; color: var(--ink); opacity: .5; }
.lang-switch a.active { opacity: 1; }

.table { --bs-table-bg: transparent; }

/* Activity cards (section pages) */
.activity-card { text-decoration: none; color: var(--ink); border-top: 8px solid var(--c); transition: transform .12s ease; }
.activity-card:hover { color: var(--ink); transform: translateY(-3px); }
.activity-icon { font-size: 2.75rem; line-height: 1; width: 4.5rem; height: 4.5rem; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 15%, white); border-radius: 1.25rem; }

/* Math sprint */
.level-picker { display: grid; gap: .6rem; }
.level-option { position: relative; display: flex; align-items: center; gap: .9rem; padding: .7rem 1rem; border: 3px solid #e7e2d6;
  border-radius: 1rem; cursor: pointer; font-weight: 700; transition: border-color .1s, background .1s; }
.level-option input { position: absolute; opacity: 0; pointer-events: none; }
.level-option .level-num { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center;
  background: #f1ede4; font-weight: 900; flex-shrink: 0; }
.level-option:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, white); }
.level-option:has(input:checked) .level-num { background: var(--c); color: #fff; }
.level-option:has(input:focus-visible) { outline: 3px solid #1d70b8; outline-offset: 2px; }

.sprint-board { max-width: 460px; }
.sprint-stats { font-weight: 800; font-size: 1.15rem; }
.level-badge { background: var(--c); font-size: .9rem; }
.timer-track { height: 14px; background: #eee6d6; border-radius: 999px; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #06d6a0, #2a9d8f); border-radius: 999px; transition: width .1s linear; }
.timer-fill.hurry { background: linear-gradient(90deg, #ff6b6b, #f4a261); }
.sprint-question { font-size: clamp(2.6rem, 11vw, 4.2rem); font-weight: 900; text-align: center; margin: .75rem 0 .25rem;
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.sprint-answer { font-size: clamp(2.2rem, 9vw, 3.2rem); font-weight: 900; text-align: center; min-height: 4.2rem;
  background: #f7f3ea; border-radius: 1rem; padding: .3rem 1rem; color: var(--c); font-variant-numeric: tabular-nums; }
.sprint-answer.empty::after { content: '?'; color: #cfc6b3; }
.sprint-feedback { text-align: center; font-weight: 800; min-height: 1.8rem; margin: .5rem 0; }
.sprint-feedback.good { color: #1f8a5b; }
.sprint-feedback.bad { color: #d64545; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.numpad button { height: 64px; border: 0; border-radius: 1rem; background: #fff; font-size: 1.7rem; font-weight: 900;
  color: var(--ink); box-shadow: 0 4px 0 #ddd5c4, inset 0 0 0 2px #eee6d6; touch-action: manipulation; }
.numpad button:active { transform: translateY(3px); box-shadow: 0 1px 0 #ddd5c4, inset 0 0 0 2px #eee6d6; }
.numpad .key-alt { background: #f7f3ea; }
.numpad .key-ok { grid-column: 1 / -1; background: var(--c); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 65%, black); }
.flash-good { animation: flashGood .35s ease; }
.flash-bad { animation: shake .35s ease; }
@keyframes flashGood { 0% { box-shadow: 0 0 0 0 #06d6a0; } 50% { box-shadow: 0 0 0 10px #06d6a055; } 100% { box-shadow: 0 6px 0 rgba(0,0,0,.06); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.result-emoji { font-size: 4.5rem; line-height: 1; }
.record-banner { display: inline-block; background: #ffd166; color: #5a3d00; font-weight: 900; border-radius: 999px; padding: .4rem 1.2rem; }
@media (prefers-reduced-motion: reduce) { .flash-good, .flash-bad { animation: none; } }

/* Multiple-choice games */
.btn-fun { color: #fff; border: 0; background: var(--btn, #ff6b6b); box-shadow: 0 5px 0 color-mix(in srgb, var(--btn, #ff6b6b) 70%, black); }
.btn-fun:hover { color: #fff; background: color-mix(in srgb, var(--btn, #ff6b6b) 90%, black); }
.btn-fun:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--btn, #ff6b6b) 70%, black); }
.choice-board { max-width: 560px; }
.choice-instr { text-align: center; font-weight: 800; color: #6b6356; margin-top: .5rem; }
.choice-emoji { font-size: 5rem; line-height: 1.1; text-align: center; margin: .5rem 0; }
.choice-prompt { font-size: clamp(1.5rem, 5.5vw, 2.2rem); font-weight: 900; text-align: center; margin: .75rem 0 1rem; line-height: 1.35; }
.choice-prompt .blank { display: inline-block; min-width: 4.5rem; border-bottom: 4px solid var(--c); margin: 0 .2rem; padding: 0 .25rem; color: var(--c); }
.choice-prompt .blank.filled.good { color: #1f8a5b; border-color: #1f8a5b; }
.choice-options { display: grid; grid-template-columns: 1fr; gap: .7rem; }
@media (min-width: 576px) { .choice-options { grid-template-columns: 1fr 1fr; } }
.choice-option { position: relative; display: flex; align-items: center; gap: .75rem; min-height: 64px; padding: .6rem 1rem;
  border: 0; border-radius: 1rem; background: #fff; font-size: 1.3rem; font-weight: 800; color: var(--ink); text-align: left;
  box-shadow: 0 4px 0 #ddd5c4, inset 0 0 0 2px #eee6d6; touch-action: manipulation; }
.choice-option:hover:not(:disabled) { box-shadow: 0 4px 0 #ddd5c4, inset 0 0 0 3px var(--c); }
.choice-option:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #ddd5c4, inset 0 0 0 2px #eee6d6; }
.choice-option:disabled { opacity: 1; cursor: default; }
.choice-num { flex-shrink: 0; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center;
  background: #f1ede4; font-size: .95rem; font-weight: 900; color: #7a705f; }
.choice-option.right { background: #dff7ec; box-shadow: 0 4px 0 #9fd9bd, inset 0 0 0 3px #1f8a5b; }
.choice-option.right .choice-num { background: #1f8a5b; color: #fff; }
.choice-option.wrong { background: #fde4e4; box-shadow: 0 4px 0 #efb1b1, inset 0 0 0 3px #d64545; }
.choice-option.wrong .choice-num { background: #d64545; color: #fff; }
