*, *::before, *::after { box-sizing: border-box; }
body { color-scheme: var(--scheme); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.55 system-ui, sans-serif; }
a { color: inherit; }
img { display: block; max-width: 100%; object-fit: cover; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.08; }
h1 { font: var(--headline); letter-spacing: -.055em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.6rem); letter-spacing: -.045em; }
h3 { font-size: 1.12rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.wrap { width: min(100% - 2.5rem, 77rem); margin-inline: auto; }
.skip { position: absolute; top: .5rem; left: 1rem; z-index: 4; transform: translateY(-150%); }
.skip:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); background: var(--head); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo { flex: 0 0 auto; }
.logo img { width: 154px; height: auto; object-fit: contain; }
.desktop-nav { display: flex; align-items: center; gap: clamp(.15rem, 1vw, .8rem); }
.desktop-nav a, .category-dialog nav a, .mobile-fallback nav a { text-decoration: none; font-size: .94rem; font-weight: 680; padding: .58rem .63rem; border-radius: var(--radius); }
.desktop-nav a:hover, [aria-current="page"] { background: var(--surface); }
.category-toggle, .mobile-fallback { display: none; }
.category-dialog { width: min(calc(100% - 2rem), 26rem); max-height: calc(100% - 2rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); padding: 1.2rem; }
.category-dialog::backdrop { background: #121220b8; }
.category-dialog nav, .mobile-fallback nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: 1rem; }
.category-dialog nav a, .mobile-fallback nav a { background: var(--surface); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-top button { border: 1px solid var(--line); background: var(--surface); color: inherit; width: 2.65rem; height: 2.65rem; border-radius: var(--radius); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; padding: .65rem 1rem; min-height: 44px; width: fit-content; border: 1px solid transparent; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 780; line-height: 1.25; }
.button:hover { filter: brightness(.91); }
.text-link { font-weight: 750; text-underline-offset: .2em; }
.control { min-height: 44px; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; font-weight: 720; }
.eyebrow { color: var(--hint); font-size: .75rem; letter-spacing: .11em; text-transform: uppercase; font-weight: 800; }
.home { padding-block: clamp(1.1rem, 3.4vw, 3rem) 4rem; }
.opening { margin-bottom: clamp(2.8rem, 6vw, 5rem); }
.intro { display: grid; gap: 1.15rem; align-content: center; }
.intro p:not(.eyebrow), .page-lead p { color: var(--sub); max-width: 54ch; font-size: clamp(1rem, 1.4vw, 1.15rem); }
.section { margin-top: clamp(2.9rem, 6vw, 5rem); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: .8rem 1.5rem; margin-bottom: 1.25rem; }
.section-head p { margin-top: .46rem; color: var(--sub); max-width: 59ch; }
.section-head > a { flex-shrink: 0; }
.game-grid, .feature-row, .choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.55rem, 1.5vw, 1.15rem); padding: 0; margin: 0; list-style: none; }
.game-grid > li, .feature-row > li, .choice-grid > li { min-width: 0; }
.game-card { height: 100%; display: flex; flex-direction: column; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--surface); text-decoration: none; }
.game-card:hover, .feature-link:hover, .choice-link:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.game-card img { width: 100%; height: auto; aspect-ratio: 1.6; }
.card-info { display: grid; align-content: center; gap: .2rem; padding: .72rem .85rem; min-height: 3.6rem; overflow-wrap: anywhere; }
.card-info small, .feature-copy small, .choice-link small { color: var(--sub); }
.choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-link { height: 100%; display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: .8rem; align-items: center; padding: .6rem; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.choice-link img { width: 4rem; height: 4rem; border-radius: max(0px, var(--radius) - 3px); }
.choice-link span, .feature-copy { display: grid; gap: .15rem; overflow-wrap: anywhere; }
.feature-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature-link { min-height: 100%; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; display: block; text-decoration: none; }
.feature-link img { width: 100%; height: auto; aspect-ratio: 1.75; }
.feature-copy { padding: .9rem; }
.collections { scroll-margin-top: 1rem; }
.catalogue-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.collection-note { padding-top: .8rem; border-top: 1px solid var(--line); margin-top: 1.5rem; color: var(--sub); }
.site-footer { border-top: 1px solid var(--line); background: var(--head); }
.footer-inner { padding-block: 1.8rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .9rem 1.8rem; }
.footer-brand { display: grid; gap: .2rem; }
.footer-brand small { color: var(--sub); }
.footer-nav { display: flex; flex-wrap: wrap; gap: .55rem 1rem; font-size: .92rem; }
.footer-nav a { text-underline-offset: .22em; }
.page { padding-block: 1.4rem 4rem; min-height: 60vh; }
.crumbs { display: flex; flex-wrap: wrap; gap: .3rem .65rem; color: var(--sub); font-size: .9rem; margin-bottom: 1.45rem; }
.page-lead { display: grid; gap: .95rem; padding: clamp(1rem, 4vw, 2.75rem); border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); margin-bottom: 1.65rem; }
.page-lead h1, .legal h1, .game-detail h1, .player-page h1 { font-size: clamp(2rem, 5vw, 4.2rem); }
.game-detail { display: grid; grid-template-columns: clamp(8rem, 18vw, 13rem) minmax(0, 1fr); align-items: center; gap: clamp(1rem, 4vw, 3rem); padding: clamp(1rem, 4vw, 2.4rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.detail-image { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius); }
.detail-copy { display: grid; align-content: center; gap: .9rem; }
.detail-copy > p { color: var(--sub); max-width: 55ch; }
.game-guide { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; margin-top: 1rem; }
.game-guide section { background: var(--surface); border: 1px solid var(--line); padding: 1rem; border-radius: var(--radius); }
.game-guide section:only-child { grid-column: 1 / -1; }
.game-guide p { margin-top: .45rem; color: var(--sub); }
.player-top { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; }
.player-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.player-toolbar { display: flex; justify-content: flex-end; padding: .45rem .65rem; }
.player-frame iframe { display: block; border: 0; width: 100%; height: max(480px, min(78dvh, 850px)); background: #101018; }
.player-frame:is(:fullscreen, .is-expanded) { display: grid; grid-template-rows: auto minmax(0, 1fr); width: 100%; height: 100%; border: 0; border-radius: 0; }
.player-frame:is(:fullscreen, .is-expanded) iframe { height: 100% !important; min-height: 0; }
.player-frame.is-expanded { position: fixed; inset: 0; z-index: 10; height: 100dvh; }
.player-frame:is(:fullscreen, .is-expanded) .player-toolbar {
  padding-top: max(.45rem, env(safe-area-inset-top));
  padding-right: max(.65rem, env(safe-area-inset-right));
}
body:has(.player-frame.is-expanded) { overflow: hidden; }
.player-fallback { margin: 0 0 .8rem; }
.legal { max-width: 55rem; }
.legal h1 { margin-bottom: .85rem; }
.legal h2 { font-size: 1.42rem; margin-top: 1.75rem; margin-bottom: .55rem; }
.legal p, .legal ul { margin: .65rem 0; }
.legal a { text-underline-offset: .2em; overflow-wrap: anywhere; }
.legal li + li { margin-top: .45rem; }
.legal dl { margin: .75rem 0; }
.legal dt { font-weight: 750; margin-top: .6rem; }
.legal dd { margin: .15rem 0 .6rem; }
@media (max-width: 850px) {
  .desktop-nav { display: none; }
  .category-toggle:not([hidden]), .mobile-fallback { display: block; }
  .header-inner { min-height: 64px; }
  .mobile-fallback { position: relative; }
  .mobile-fallback nav { position: absolute; z-index: 2; right: 0; width: min(19rem, 82vw); margin-top: .4rem; padding: .65rem; background: var(--bg); border: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 1.5rem); }
  .game-grid, .feature-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head { flex-wrap: wrap; align-items: start; margin-bottom: .85rem; }
  .card-info { padding: .55rem; }
  .feature-copy { padding: .6rem; }
}
@media (max-width: 460px) {
  .choice-grid, .game-guide { grid-template-columns: 1fr; }
  .game-detail { grid-template-columns: 1fr; align-items: start; }
  .detail-image { width: 7.25rem; }
}

/* Arcade */
body.arcade { --scheme: light; --bg:#fff6e2; --head:#fff6e2; --surface:#fffdf7; --ink:#301858; --sub:#584375; --hint:#662d96; --line:#d7bfdf; --accent:#6c319d; --on-accent:#fff; --radius:15px; --headline:900 clamp(2.8rem, 6.7vw, 6.7rem)/.92 system-ui,sans-serif; }
.arcade .opening { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(1rem,4vw,3rem); align-items:center; padding:clamp(1.1rem,3.4vw,3rem); background:#f1dffa; border:1px solid #d5adeb; border-radius:48px 48px 48px 10px; }
.arcade .collage { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; }
.arcade .collage a { display:grid; gap:.3rem; background:#fffdf7; border:1px solid #d1aedb; border-radius:18px 18px 8px 8px; padding:.45rem; text-decoration:none; font-weight:780; }
.arcade .collage a:first-child { grid-row:span 2; align-self:center; background:#ffdf77; }
.arcade .collage a:first-child img { aspect-ratio:.92; }
.arcade .collage img { aspect-ratio:2.05; width:100%; height:auto; border-radius:13px; }
.arcade .collage span { padding-inline:.25rem; }
.arcade .feature-row { padding:clamp(.55rem,2vw,1.25rem); background:#e8d5f6; border-radius:26px; }
.arcade .collection-section:nth-child(2n) { background:#f8e7ca; border-radius:24px; padding:1rem; }
.arcade .game-detail { background:#f1dffa; border-radius:34px 34px 34px 8px; }

@media (max-width: 720px) {
  .sports .opening, .arcade .opening, .cards .opening, .puzzle .opening, .racing .opening { grid-template-columns:1fr; }
  .sports .hero-game { justify-self:start; width:100%; }
  .sports .hero-game img { aspect-ratio:1.8; }
  .arcade .opening { border-radius:24px 24px 24px 6px; }
  .puzzle .intro { padding-inline:0; }
}
@media (max-width: 520px) {
  .cards .game-card, .puzzle .feature-link { display:flex; flex-direction:column; align-items:stretch; }
  .cards .game-card img, .puzzle .feature-link img { height:auto; aspect-ratio:1.65; }
  .racing .feature-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
}



/* Google Ad Manager placements */
.schoolsti-ad {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  padding-block: 50px;
}
.schoolsti-ad > div {
  display: grid;
  justify-items: center;
  width: min(100%, 336px);
}
.schoolsti-ad + :is(.home, .page) { padding-block-start: 0; }
.home .opening:has(+ .schoolsti-ad) { margin-block-end: 0; }
.home .schoolsti-ad + .section { margin-block-start: 0; }
