:root {
  color-scheme: light;
  --paper: #f8f8f3;
  --ink: #172a23;
  --muted: #51625b;
  --line: #dfe5dc;
  --forest: #142c23;
  --coral: #ff6c65;
  --red-ink: #a82c27;
  --lime: #d9f985;
  --hero-surface: var(--forest);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: local('Plus Jakarta Sans');
  font-weight: 400 800;
  font-display: swap;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #3677df; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 1rem; }
.wrap { width: min(1170px, calc(100% - 72px)); margin-inline: auto; }
.skip { position: absolute; z-index: 5; top: .5rem; left: .5rem; transform: translateY(-200%); padding: .75rem; background: white; }
.skip:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); }
.nav-row { min-height: 73px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.brand { display: inline-flex; width: fit-content; align-items: center; gap: .58rem; font-size: 1.68rem; font-weight: 800; letter-spacing: -.065em; line-height: 1; }
.brand-accent { color: var(--red-ink); }
.logo { display: grid; place-items: center; width: 2.22rem; aspect-ratio: 1; border-radius: .68rem; background: var(--coral); color: #361612; font: 800 1.85rem/1 system-ui, sans-serif; }
.nav-row nav { display: flex; gap: 2rem; font-size: .95rem; font-weight: 700; }
.nav-row nav a { padding-block: .72rem; }
.nav-row nav a:hover { color: var(--red-ink); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: .85rem; }
.project-label { justify-self: end; display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; color: var(--muted); }
.project-label span { width: .52rem; aspect-ratio: 1; background: #679456; border-radius: 50%; }
.theme-toggle { min-height: 38px; padding: .4rem .68rem; border: 1px solid var(--line); border-radius: .68rem; background: white; color: var(--ink); font-size: .81rem; font-weight: 750; white-space: nowrap; }
.theme-toggle:hover { border-color: var(--muted); }

.hero { isolation: isolate; position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr .97fr; min-height: 375px; margin-top: 27px; background: var(--hero-surface); color: #f8f9ef; border-radius: 26px; }
.hero-copy { position: relative; z-index: 1; padding: 44px 0 46px 54px; }
.eyebrow { display: flex; align-items: center; gap: .62rem; color: #dce9d9; font-size: .77rem; font-weight: 800; text-transform: uppercase; letter-spacing: .115em; }
.eyebrow span { width: .59rem; aspect-ratio: 1; border-radius: 50%; background: var(--coral); }
.hero h1 { margin-top: 18px; font-size: clamp(3.1rem, 6.05vw, 5.3rem); line-height: .94; font-weight: 800; letter-spacing: -.071em; }
.hero h1 em { color: var(--lime); font-style: normal; }
.hero-words { display: inline-grid; vertical-align: baseline; overflow: hidden; padding: .12em .05em .13em 0; margin: -.12em -.05em -.13em 0; border: 0; border-radius: .12em; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; white-space: nowrap; }
.hero-words:focus-visible { outline-color: var(--lime); }
.hero-word { grid-area: 1 / 1; visibility: hidden; }
.hero-word.is-current, .hero-word.is-leaving { visibility: visible; }
.hero-period { color: var(--coral); }
.lede { max-width: 35ch; margin-top: 21px; color: #dce9d9; font-size: 1.05rem; line-height: 1.5; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; margin-top: 23px; min-height: 47px; padding: .7rem 1.08rem; background: var(--coral); color: #351411; border-radius: .72rem; font-size: .95rem; font-weight: 800; transition: background .16s, transform .16s; }
.primary:hover { background: #ff9389; transform: translateY(-2px); }
.play-icon { width: .68rem; height: .76rem; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }

.hero-art { position: relative; min-width: 0; overflow: hidden; container-type: inline-size; background-image: linear-gradient(90deg, var(--hero-surface) 0%, transparent 32%), radial-gradient(ellipse at 53% 50%, #4f775043, transparent 70%), radial-gradient(#b9e8b137 1px, transparent 1px); background-size: auto, auto, 17px 17px; }
.hero-art::before { position: absolute; inset: 0; content: ''; background: radial-gradient(ellipse at 51% 48%, #b7ed7142, #75b7821d 37%, transparent 69%); opacity: 0; transform: scale(.8); transition: opacity .65s ease, transform .9s cubic-bezier(.2, .7, .25, 1); pointer-events: none; }
.hero.is-orbiting .hero-art::before { opacity: 1; transform: scale(1.06); }
.orbit-plane { position: absolute; inset: 0; z-index: 1; transform-origin: 51% 48%; transform: rotate(-22deg); pointer-events: none; }
.orbit { position: absolute; top: 48%; left: 51%; border: 1px solid #97bd8470; border-radius: 50%; transform: translate(-50%, -50%); transition: border-color .65s ease; }
.hero.is-orbiting .orbit { border-color: #c3ea968f; }
.orbit-outer { width: 74%; height: 64%; }
.orbit-inner { width: 67%; height: 53%; opacity: .51; }
.orbit-symbol { position: absolute; inset: 0; transform: translate3d(var(--orbit-x), var(--orbit-y), 0); }
.orbit-division { --orbit-x: -26.62%; --orbit-y: -22.23%; --tile-angle: 34deg; }
.orbit-plus { --orbit-x: 32.67%; --orbit-y: -15.02%; --tile-angle: 35deg; }
.orbit-equals { --orbit-x: 20.69%; --orbit-y: 26.53%; --tile-angle: 10deg; }
.orbit-equation { --orbit-x: -29.55%; --orbit-y: 19.26%; --tile-angle: 13deg; }
.orbit-symbol > * { position: absolute; top: 48%; left: 51%; transform: translate(-50%, -50%) rotate(var(--tile-angle)); }
.tile { position: absolute; display: grid; place-items: center; aspect-ratio: 1; font-family: system-ui, sans-serif; font-weight: 800; line-height: 1; }
.tile-main { width: 30%; left: 51%; top: 48%; border-radius: 6cqw; font-size: 25cqw; color: #63241f; background: linear-gradient(145deg, #ffa39a, #ff6c65 70%); transform: translate(-50%, -50%) rotate(-14deg); box-shadow: inset 0 2px 3px #ffccc0, 0 10px 0 #a7372f, 0 25px 32px #081e18b0; transition: transform .85s cubic-bezier(.2, .7, .25, 1); }
.hero.is-orbiting .tile-main { transform: translate(-50%, -50%) rotate(-8deg) scale(1.035); }
.tile-plus { width: 17%; border-radius: 3.5cqw; font-size: 13cqw; color: #38521a; background: linear-gradient(145deg, #efffaf, #c5eb72); box-shadow: inset 0 2px 2px #f8ffdf, 0 7px 0 #779f37, 0 15px 18px #0b2417a0; }
.tile-division { width: 14%; border-radius: 3cqw; font-size: 11.2cqw; color: #3f3375; background: linear-gradient(145deg, #e9ddff, #b9a7f5); box-shadow: inset 0 2px 2px #f6efff, 0 6px 0 #7261b7, 0 16px 18px #0b2417a0; }
.tile-equals { width: 12%; border-radius: 2.7cqw; font-size: 9.3cqw; color: #25595b; background: linear-gradient(140deg, #bdf2ef, #8ed6d9); box-shadow: inset 0 2px 2px #e2fffd, 0 5px 0 #4d8d99, 0 14px 18px #0b2417a0; }
.equation { padding: .48em .77em; background: #fcf8eb; box-shadow: 0 5px 0 #afa990, 0 14px 17px #081e18a0; color: #263b2e; border-radius: .52em; font-size: 3.75cqw; font-weight: 800; white-space: nowrap; }
.equation strong { color: var(--red-ink); }
.spark, .art-dot { position: absolute; color: var(--lime); }
.spark-one { left: 37%; top: 12%; font-size: 4.6cqw; }
.spark-two { left: 87%; top: 41%; font-size: 6cqw; }
.spark-three { left: 59%; top: 78%; font-size: 5cqw; color: #f5ebae; }
.art-dot { width: 7px; aspect-ratio: 1; background: currentColor; border-radius: 50%; }
.art-dot-one { left: 15%; top: 66%; }
.art-dot-two { left: 86%; top: 73%; color: var(--coral); }

.grades { margin-top: 36px; }
.section-intro { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.section-intro h2 { font-size: clamp(1.75rem, 3vw, 2.38rem); line-height: 1.04; font-weight: 800; letter-spacing: -.062em; }
.grade-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
.grade { display: flex; gap: .53rem; align-items: baseline; justify-content: center; padding: 10px 8px 12px; border: 1px solid transparent; border-radius: 13px; background: var(--grade-fill); color: var(--grade-ink); font-size: .86rem; font-weight: 750; transition: transform .16s, border-color .16s; }
.grade strong { font-size: 2.33rem; letter-spacing: -.1em; line-height: 1.13; }
.grade:hover { transform: translateY(-2px); }
.grade[aria-pressed='true'] { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.grade-2 { --grade-fill: #ffe0dc; --grade-ink: #863a36; }
.grade-3 { --grade-fill: #f9e6d6; --grade-ink: #824422; }
.grade-4 { --grade-fill: #e9efca; --grade-ink: #445826; }
.grade-5 { --grade-fill: #d7efdf; --grade-ink: #285a42; }
.grade-6 { --grade-fill: #ddeafa; --grade-ink: #2d4e7f; }
.grade-7 { --grade-fill: #eae0fb; --grade-ink: #65418a; }
.grade-8 { --grade-fill: #f4dfef; --grade-ink: #794264; }
.grade-9 { --grade-fill: #dceceb; --grade-ink: #245956; }
.reset-link { border: 0; background: none; color: var(--red-ink); padding: .2rem 0; font-size: .87rem; font-weight: 750; text-decoration: underline; text-underline-offset: .24em; }

.catalog { margin: 40px 0 56px; }
.catalog-intro p { color: var(--muted); }
.catalog-intro h2 + p { margin-top: .57rem; line-height: 1.5; }
.game-count { flex: none; padding-bottom: .15rem; font-size: .84rem; font-weight: 700; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.filter { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: .45rem .82rem; border: 1px solid #dbe2d8; border-radius: 100px; background: #fff; font-size: .87rem; font-weight: 700; }
.filter:hover { border-color: var(--ink); }
.filter[aria-pressed='true'] { background: var(--forest); color: white; border-color: var(--forest); }
.topic-dot { width: .59rem; aspect-ratio: 1; border-radius: 50%; background: var(--dot); }
.red { --dot: #ec514c; }
.green { --dot: #43a46a; }
.violet { --dot: #a16be2; }
.blue { --dot: #4c89e7; }
.amber { --dot: #c66d28; }
.teal { --dot: #25a185; }
.pink { --dot: #dc5186; }
.cyan { --dot: #319eba; }
.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.game-card { overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 4px 10px #2431220a; }
.game-art { border-radius: 15px; }
.game-card .game-scene { transition: scale .45s cubic-bezier(.18, .72, .25, 1); }
.game-art { position: relative; overflow: hidden; height: clamp(9.2rem, 13vw, 11rem); background-color: var(--art-fill, #ffe0dc); }
.game-scene { position: absolute; top: 50%; left: 50%; width: 100%; min-height: 100%; aspect-ratio: 3 / 2; transform: translate(-50%, -50%); container-type: inline-size; background: var(--art-image, url('herni-ilustrace.png')) var(--art-position, 0 0) / var(--art-size, 200% 200%) no-repeat; }
.game-scene::before { position: absolute; inset: 0; content: ''; pointer-events: none; background-image: linear-gradient(#fbfff836 1px, transparent 1px), linear-gradient(90deg, #fbfff836 1px, transparent 1px); background-size: 5.2cqw 5.2cqw; mask-image: linear-gradient(90deg, #0009, transparent 36%, transparent 61%, #0009); }
.callout { position: absolute; z-index: 1; padding: .3em .52em; border: 1px solid #f3fff0b8; border-radius: .44em; background: var(--glass); color: #f7fff4; backdrop-filter: blur(5px); box-shadow: 0 2px 12px #101a2230, inset 0 0 7px #f8fff51c; font: 750 clamp(.85rem, 5.2cqw, 1.38rem)/1.1 'Cascadia Mono', Consolas, monospace; letter-spacing: -.02em; white-space: nowrap; }
.callout::after { position: absolute; z-index: -1; top: 50%; width: var(--wire, 10cqw); height: 6px; content: ''; background: radial-gradient(circle at var(--tip) 50%, #f2ffec 0 2px, transparent 2.4px), linear-gradient(#f2ffeccc, #f2ffeccc) center / 100% 1px no-repeat; transform: rotate(var(--angle, 0deg)); }
.callout-1 { top: var(--first-y, 20%); left: var(--first-x, 6%); }
.callout-1::after { left: 100%; --tip: right; transform-origin: left; }
.callout-2 { top: var(--second-y, 62%); right: var(--second-x, 6%); }
.callout-2::after { right: 100%; --tip: left; transform-origin: right; }
.race { --art-position: 0 0; --art-fill: #fa6861; --game-tint: #ffe9e6; --topic-ink: #972f2b; }
.pizza { --art-position: 100% 0; --art-fill: #81dc8f; --game-tint: #dff4e4; --topic-ink: #21593a; }
.escape { --art-position: 0 100%; --art-fill: #c58be1; --game-tint: #f0e7fc; --topic-ink: #69418e; }
.target { --art-position: 100% 100%; --art-fill: #88b2f1; --game-tint: #e4efff; --topic-ink: #315582; }
.race .game-scene { --glass: #5a1f27be; --first-y: 29%; --second-y: 62%; }
.race .callout-1 { --wire: 12cqw; --angle: 13deg; }
.race .callout-2 { --wire: 17cqw; --angle: 17deg; }
.pizza .game-scene { --glass: #173c28b8; --first-y: 25%; --first-x: 7%; --second-y: 63%; --second-x: 6%; }
.pizza .callout-1 { --wire: 19cqw; --angle: 19deg; }
.pizza .callout-2 { --wire: 10cqw; --angle: 36deg; }
.escape .game-scene { --glass: #3e215cbf; --first-y: 13%; --first-x: 8%; --second-y: 70%; }
.escape .callout-1::after { display: none; }
.escape .callout-2 { --wire: 13cqw; --angle: 20deg; }
.target .game-scene { --glass: #1a3764c9; --first-y: 27%; --first-x: 6%; --second-y: 69%; --second-x: 5%; }
.target .callout-1 { --wire: 13cqw; --angle: 14deg; }
.target .callout-2 { --wire: 31cqw; --angle: 38deg; }
:is(.balance, .stories, .maps, .percent, .powers, .solids) {
  --art-image: url('herni-ilustrace-2.png');
  --art-size: 200% 300%;
  --first-y: 18%;
  --second-y: 66%;
  --wire: 10cqw;
}
.balance { --art-position: 0 0; --art-fill: #b485ec; --game-tint: #efe3fb; --topic-ink: #664084; --glass: #472264da; }
.stories { --art-position: 100% 0; --art-fill: #edac62; --game-tint: #faead6; --topic-ink: #79441f; --glass: #5c3019dc; }
.maps { --art-position: 0 50%; --art-fill: #58c4ab; --game-tint: #d9f1e9; --topic-ink: #1c5c4e; --glass: #123e37dd; }
.percent { --art-position: 100% 50%; --art-fill: #ec83a3; --game-tint: #fbe1ec; --topic-ink: #843355; --glass: #562238df; }
.powers { --art-position: 0 100%; --art-fill: #6e97ee; --game-tint: #e3eaff; --topic-ink: #344c8d; --glass: #1e2b65dc; }
.solids { --art-position: 100% 100%; --art-fill: #54bbd2; --game-tint: #def1f6; --topic-ink: #1b576b; --glass: #123d50db; }
.maps .callout { font-size: clamp(.66rem, 4.25cqw, 1.15rem); }
.game-copy { flex: 1; display: flex; flex-direction: column; padding: 15px; }
.game-topic { color: var(--topic-ink, var(--red-ink)); font-size: .78rem; font-weight: 800; }
.game-card h3 { margin-top: .25rem; font-size: 1.2rem; line-height: 1.26; letter-spacing: -.04em; }
.game-card h3 + p { flex: 1; margin: .45rem 0 .82rem; color: var(--muted); font-size: .91rem; line-height: 1.43; }
.card-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding-top: .64rem; border-top: 1px solid var(--line); }
.card-bottom > .grade-caption { color: var(--muted); font-size: .8rem; font-weight: 700; }
.play-button { display: inline-flex; align-items: center; gap: .38rem; min-height: 40px; border: 0; border-radius: .48rem; padding: .35rem .75rem; background: var(--game-tint); color: var(--topic-ink); font-size: .88rem; font-weight: 800; }
.play-button .play-icon { width: .49rem; height: .58rem; }
.play-button:hover { background: var(--topic-ink); color: white; }
.game-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.new-game-button { min-height: 40px; border: 1px solid color-mix(in srgb, var(--topic-ink) 30%, white); border-radius: .48rem; padding: .35rem .62rem; background: white; color: var(--topic-ink); font-size: .83rem; font-weight: 750; }
.new-game-button:hover { background: var(--game-tint); }
.new-game-button[hidden] { display: none; }
.empty { border: 1px dashed #a9baad; border-radius: 14px; padding: 2rem; text-align: center; background: white; }
.secondary { min-height: 41px; margin-top: .85rem; border: 0; border-radius: .5rem; padding: .5rem .8rem; background: var(--forest); color: white; font-weight: 750; }
.site-footer { border-top: 1px solid var(--line); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; min-height: 75px; padding-block: 12px; }
.footer-row p { color: var(--muted); font-size: .87rem; }
.footer-row .brand { font-size: 1.27rem; }
.footer-row .logo { width: 1.62rem; font-size: 1.3rem; border-radius: .45rem; }

html:has(#game-dialog[open]) { overflow: hidden; }
#game-dialog { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: var(--ink); background: transparent; overflow: hidden; }
.game-app { height: 100%; overflow: auto; overscroll-behavior: contain; background: radial-gradient(ellipse at 14% 0%, var(--game-tint), transparent 58%), #f8f7fb; }
.game-app:fullscreen { width: 100%; height: 100%; }
.game-bar { position: sticky; top: 0; z-index: 3; border-bottom: 1px solid #e4dfec; background: #fdfbff; }
.game-bar-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .7rem; width: min(1180px, calc(100% - 48px)); min-height: 66px; margin-inline: auto; }
.game-bar-button { min-height: 42px; border: 1px solid #e8e2ee; border-radius: .72rem; padding: .44rem .75rem; background: white; color: #42266e; font-size: .9rem; font-weight: 750; }
.game-bar-button:hover { border-color: #b7a3d7; }
.game-bar-inner form span { margin-right: .2em; font-size: 1.25em; line-height: .7; }
.game-bar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .4rem; }
.sound-button { white-space: nowrap; }
.sound-icon { font-size: 1.12em; }
.sound-state { color: #655676; font-size: .76em; }
.sound-button[aria-pressed='false'] { background: #f2eef6; }
.fullscreen-icon { display: none; }
.game-wordmark { color: #372252; font-size: 1.38rem; font-weight: 850; letter-spacing: -.055em; }
.game-layout { display: grid; grid-template-columns: minmax(248px, 335px) minmax(0, 1fr); align-items: start; gap: clamp(1.2rem, 3.5vw, 3.25rem); width: min(1130px, calc(100% - 60px)); margin: clamp(1.4rem, 5vh, 3rem) auto 20px; }
.game-sidebar { overflow: hidden; border: 1px solid #e1dce8; border-radius: 1.15rem; background: white; box-shadow: 0 10px 30px #3124520a; }
.game-sidebar .game-art { height: clamp(150px, 23vh, 220px); }
.game-sidebar-copy { padding: clamp(1.05rem, 2.3vw, 1.65rem); }
.game-sidebar h2 { margin: .32rem 0 1.1rem; font-size: clamp(1.65rem, 2.7vw, 2.35rem); line-height: 1.03; letter-spacing: -.052em; }
.level-list { display: grid; gap: .38rem; margin: 0; padding: 0; list-style: none; font-size: .91rem; font-weight: 700; }
.level-list li { display: flex; align-items: center; gap: .62rem; padding: .38rem .46rem; border: 1px solid transparent; border-radius: .68rem; }
.level-marker { flex: none; display: grid; place-items: center; width: 1.68rem; aspect-ratio: 1; border-radius: .48rem; background: #f2eff6; color: #675c72; font-size: .84rem; }
.level-list [data-status='active'] { border-color: color-mix(in srgb, var(--topic-ink) 30%, white); background: var(--game-tint); color: var(--topic-ink); }
.level-list [data-status='active'] .level-marker { background: var(--topic-ink); color: white; }
.level-list [data-status='complete'] { color: var(--topic-ink); }
.level-list [data-status='complete'] .level-marker { background: var(--game-tint); color: var(--topic-ink); }
.level-list [data-status='locked'] { color: #675c72; }
.dialog-copy { min-width: 0; padding: clamp(1.05rem, 3vw, 2.15rem); border: 1px solid #e1dce8; border-radius: 1.25rem; background: white; box-shadow: 0 15px 35px #3124520a; }
.timer-strip { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .35rem .5rem; margin: 0 0 .8rem; }
.timer-strip span { display: inline-flex; align-items: center; gap: .36rem; padding: .35rem .58rem; border: 1px solid #e8e4ed; border-radius: 999px; background: #faf9fc; color: #706879; font-size: .76rem; font-weight: 700; }
.timer-strip strong { color: var(--topic-ink); font-size: .82rem; font-variant-numeric: tabular-nums; }
.round-status { display: flex; justify-content: space-between; gap: .6rem; color: var(--muted); font-size: clamp(.85rem, 1.4vw, 1rem); font-weight: 750; }
#game-progress { color: var(--topic-ink); font-variant-numeric: tabular-nums; }
.track { height: 9px; margin: .63rem 0 1.3rem; border-radius: 100px; background: var(--game-tint); overflow: hidden; }
.track span { display: block; height: 100%; border-radius: inherit; background: var(--topic-ink); transition: width .24s ease-out; }
.round, .result { min-width: 0; border-radius: .9rem; padding: clamp(1rem, 3.2vw, 1.8rem); background: var(--game-tint); }
.round-type { margin-bottom: .55rem; color: var(--topic-ink); font-size: .85rem; font-weight: 800; }
.round h3, .result h3 { margin-bottom: 1.1rem; font-size: clamp(1.25rem, 2.7vw, 2.04rem); line-height: 1.22; letter-spacing: -.032em; font-weight: 750; }
.round-instruction { margin: -.45rem 0 1rem; color: var(--topic-ink); font-size: .92rem; line-height: 1.45; }
.game-app h3, .game-app input, .game-app .secondary { scroll-margin-top: 80px; }
.round h3:focus, .result h3:focus { outline: none; }
.answers { display: flex; flex-wrap: wrap; gap: .68rem; }
.answers button { min-height: 48px; min-width: 64px; padding-inline: .72rem; border: 1px solid #a9b8b2; border-radius: .58rem; background: white; font-size: 1.04rem; font-weight: 750; }
.answers button:not(:disabled):hover { border-color: var(--ink); }
.answers button:disabled { cursor: default; }
.answers button[data-answer='incorrect'] { background: #f5ece5; color: #714c43; border-color: #c3a69c; }
.answers button[data-answer='correct'], .answers button[aria-pressed='true'] { color: white; background: var(--forest); border-color: var(--forest); }
.fraction-answers { flex-direction: column; align-items: center; }
.fraction-object-name { display: flex; align-items: center; justify-content: center; gap: .55rem; color: var(--topic-ink); font-size: .95rem; font-weight: 800; }
.fraction-object-name > span:first-child { font-size: 1.5rem; line-height: 1; filter: drop-shadow(0 2px 2px #17201420); }
.fraction-object-name[data-theme='chocolate'] { color: #70402b; }
.fraction-object-name[data-theme='balloon'] { color: #a13970; }
.fraction-object-name[data-theme='planet'] { color: #315c9d; }
.fraction-object-name[data-theme='phone'] { color: #4f548e; }
.fraction-wheel-frame { position: relative; display: grid; place-items: center; width: min(100%, 340px); }
.fraction-wheel-frame.object-chocolate { width: min(100%, 380px); }
.fraction-wheel-frame.object-phone { width: min(100%, 300px); }
.fraction-wheel { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 7px 4px #24312830); }
.fraction-wheel [data-index] { cursor: crosshair; transition: fill .12s ease; }
.fraction-wheel [data-index]:focus { outline: none !important; }
.fraction-wheel [data-index]:focus-visible { stroke: #ffffff !important; stroke-width: 2 !important; }
.fraction-count { color: var(--topic-ink); font-size: .9rem; font-weight: 750; font-variant-numeric: tabular-nums; }

.number-field { display: grid; gap: .35rem; flex: 0 1 8.75rem; min-width: min(7rem, 100%); color: var(--topic-ink); font-size: .88rem; font-weight: 750; }
.number-field input { min-width: 0; width: 100%; height: 52px; border: 1px solid #a9b8b2; border-radius: .58rem; padding: .4rem .68rem; background: white; color: var(--ink); font: 750 1.28rem/1.3 system-ui, sans-serif; }
.number-field input:focus-visible { outline: 3px solid #3677df; outline-offset: 2px; }
.round-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .48rem .82rem; margin-top: 1rem; }
.round-actions .secondary { margin-top: 0; }
.game-app .secondary { min-height: 44px; border-radius: .62rem; padding-inline: .95rem; background: var(--topic-ink); }
.secondary:disabled { opacity: .62; cursor: default; }
.hint-button { min-height: 44px; border: none; border-radius: .5rem; padding: .5rem .1rem; color: var(--topic-ink); background: transparent; text-decoration: underline; text-underline-offset: .2em; font-weight: 750; }
.feedback { margin-top: .85rem; padding: .72rem .8rem; border-radius: .55rem; background: white; color: var(--ink); line-height: 1.45; font-size: .95rem; }
.feedback[data-tone='correct'] { border-left: 4px solid #458b52; }
.feedback[data-tone='try'] { border-left: 4px solid #bd682c; }
.feedback[data-tone='hint'] { border-left: 4px solid var(--topic-ink); }
.result p { line-height: 1.5; }
.result .result-times { margin-top: .55rem; color: var(--topic-ink); font-size: .86rem; font-variant-numeric: tabular-nums; }

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #0b1220;
  --ink: #f1f5fa;
  --muted: #afbed1;
  --line: #2b3749;
  --surface: #151f2e;
  --surface-raised: #1c293b;
  --control-border: #526278;
  --accent-text: #ff9a91;
  --hero-surface: #131c28;
}

[data-theme='dark'] :is(.brand-accent, .nav-row nav a:hover, .reset-link) { color: var(--accent-text); }
[data-theme='dark'] :is(button, a, input):focus-visible { outline-color: #a1c8ff; }
[data-theme='dark'] .hero-words:focus-visible { outline-color: var(--lime); }
[data-theme='dark'] .hero { box-shadow: inset 0 0 0 1px var(--line); }

[data-theme='dark'] .grade { border-color: color-mix(in srgb, var(--grade-ink) 36%, var(--grade-fill)); }
[data-theme='dark'] .grade:is(:hover, [aria-pressed='true']) { border-color: var(--grade-ink); }
[data-theme='dark'] .grade-2 { --grade-fill: #2e2029; --grade-ink: #ff9a91; }
[data-theme='dark'] .grade-3 { --grade-fill: #302620; --grade-ink: #f9b38a; }
[data-theme='dark'] .grade-4 { --grade-fill: #292a1e; --grade-ink: #ded285; }
[data-theme='dark'] .grade-5 { --grade-fill: #1b2b2b; --grade-ink: #9cdeb6; }
[data-theme='dark'] .grade-6 { --grade-fill: #192b3f; --grade-ink: #a2caff; }
[data-theme='dark'] .grade-7 { --grade-fill: #2b2137; --grade-ink: #d6b1fb; }
[data-theme='dark'] .grade-8 { --grade-fill: #332435; --grade-ink: #edb1d5; }
[data-theme='dark'] .grade-9 { --grade-fill: #192e30; --grade-ink: #9cddd8; }
[data-theme='dark'] .race { --game-tint: #35252e; --topic-ink: #ffaaa3; }
[data-theme='dark'] .pizza { --game-tint: #1e302d; --topic-ink: #a2e4bb; }
[data-theme='dark'] .escape { --game-tint: #2d263c; --topic-ink: #dfc3ff; }
[data-theme='dark'] .target { --game-tint: #1e3046; --topic-ink: #b3d5ff; }
[data-theme='dark'] .balance { --game-tint: #30243e; --topic-ink: #dfbdfb; }
[data-theme='dark'] .stories { --game-tint: #352a23; --topic-ink: #ffce9f; }
[data-theme='dark'] .maps { --game-tint: #17332f; --topic-ink: #a3e7d3; }
[data-theme='dark'] .percent { --game-tint: #372438; --topic-ink: #ffb9d2; }
[data-theme='dark'] .powers { --game-tint: #222b46; --topic-ink: #bfd0ff; }
[data-theme='dark'] .solids { --game-tint: #1a303b; --topic-ink: #a5e0f1; }

[data-theme='dark'] :is(.skip, .filter, .empty, .game-card, .game-bar, .game-bar-button, .theme-toggle, .game-sidebar, .dialog-copy, .new-game-button, .feedback) {
  background: var(--surface);
  border-color: var(--line);
}
[data-theme='dark'] :is(.game-card, .game-sidebar, .dialog-copy) { box-shadow: 0 12px 28px #03081039; }
[data-theme='dark'] .game-card { border-color: color-mix(in srgb, var(--topic-ink) 25%, var(--line)); }
[data-theme='dark'] :is(.filter, .theme-toggle, .game-bar-button, .new-game-button):hover { border-color: var(--control-border); }
[data-theme='dark'] :is(.filter, .theme-toggle)[aria-pressed='true'] { background: #263750; border-color: #627da5; color: var(--ink); }
[data-theme='dark'] .play-button:hover,
[data-theme='dark'] .game-app .secondary { background: var(--topic-ink); color: var(--paper); }
[data-theme='dark'] .new-game-button:hover { background: var(--game-tint); }
[data-theme='dark'] .empty .secondary { background: var(--surface-raised); color: var(--ink); }

[data-theme='dark'] .game-app { background: radial-gradient(ellipse at 14% 0%, var(--game-tint), transparent 58%), var(--paper); }
[data-theme='dark'] :is(.game-bar-button, .game-wordmark) { color: var(--ink); }
[data-theme='dark'] :is(.sound-state, .level-list [data-status='locked']) { color: var(--muted); }
[data-theme='dark'] .sound-button[aria-pressed='false'] { background: var(--paper); }
[data-theme='dark'] .level-marker { background: var(--surface-raised); color: var(--muted); }
[data-theme='dark'] .level-list [data-status='active'] { border-color: color-mix(in srgb, var(--topic-ink) 32%, var(--game-tint)); }
[data-theme='dark'] .level-list [data-status='active'] .level-marker { color: var(--paper); }
[data-theme='dark'] .timer-strip span { background: var(--surface-raised); border-color: var(--line); color: var(--muted); }
[data-theme='dark'] :is(.answers button, .number-field input) { background: var(--surface); border-color: var(--control-border); color: var(--ink); }
[data-theme='dark'] .answers button[data-answer='incorrect'] { background: #3b2630; border-color: #97606d; color: #ffbec3; }
[data-theme='dark'] .answers button:is([data-answer='correct'], [aria-pressed='true']) { background: #203e37; border-color: #6fa38a; color: #b1eacb; }
[data-theme='dark'] .fraction-object-name[data-theme='chocolate'] { color: #efb98d; }
[data-theme='dark'] .fraction-object-name[data-theme='balloon'] { color: #f7b7de; }
[data-theme='dark'] .fraction-object-name[data-theme='planet'] { color: #f0d294; }
[data-theme='dark'] .fraction-object-name[data-theme='phone'] { color: #c5cdff; }

@media (max-width: 760px) {
  .game-bar-inner, .game-layout { width: calc(100% - 30px); }
  .game-bar-inner { grid-template-columns: 1fr auto; min-height: 58px; }
  .game-wordmark { display: none; }
  .game-layout { grid-template-columns: 1fr; gap: 1rem; margin-block: 1rem; }
  .game-sidebar .game-art { display: none; }
  .game-sidebar-copy { padding: .9rem 1rem; }
  .game-sidebar h2 { margin-bottom: .72rem; }
  .level-list { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .35rem; }
  .level-list li { justify-content: center; padding: .35rem 0; }
  .level-list li > span:last-child { display: none; }
}

@media (max-width: 960px) {
  .wrap { width: calc(100% - 48px); }
  .hero-copy { padding-left: 36px; }
  .grade-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-art { height: clamp(9.5rem, 21vw, 13rem); }
}
@media (max-width: 700px) {
  .wrap { width: calc(100% - 32px); }
  .nav-row { min-height: 64px; gap: .6rem; grid-template-columns: 1fr auto auto; }
  .nav-row nav { gap: .85rem; font-size: .85rem; }
  .project-label { display: none; }
  .hero { display: flex; flex-direction: column; margin-top: 16px; border-radius: 20px; }
  .hero-copy { padding: 30px 23px 7px; }
  .hero h1 { font-size: clamp(3.05rem, 11vw, 4.25rem); }
  .hero-art { width: min(395px, 100%); align-self: center; height: clamp(200px, 62vw, 275px); background-image: radial-gradient(ellipse at 53% 50%, #4f775043, transparent 70%), radial-gradient(#b9e8b137 1px, transparent 1px); background-size: auto, 17px 17px; mask-image: linear-gradient(transparent, black 13%, black 92%, transparent); }
  .grade-grid { gap: 8px; }
  .grade { padding: .5rem .2rem .65rem; }
  .grade strong { font-size: 1.95rem; }
  .catalog, .grades { margin-top: 30px; }
  .catalog-intro { flex-wrap: wrap; gap: .5rem; }
}
@media (max-width: 480px) {
  .grade { flex-direction: column; align-items: center; gap: .16rem; }
  .nav-row { grid-template-columns: 1fr auto; row-gap: 0; padding-top: .55rem; }
  .nav-row nav { grid-column: 1 / -1; grid-row: 2; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .game-bar-actions .theme-toggle { padding-inline: .55rem; }
  .theme-toggle-detail { display: none; }
  .fullscreen-label { display: none; }
  .fullscreen-icon { display: inline; font-size: 1.12em; }
  .brand { font-size: 1.44rem; }
  .logo { width: 1.8rem; border-radius: .5rem; font-size: 1.5rem; }
  .nav-row nav { gap: .59rem; }
  .game-grid { grid-template-columns: 1fr; }
  .game-art { height: clamp(10.5rem, 54vw, 13rem); }
  .topics { gap: 6px; }
  .filter { padding-inline: .67rem; }
  .dialog-copy { padding: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
