/* Sugar Rush Guide — "candy counter" theme
   Light paper background, ink outlines, hard offset shadows.
   tokens → base → chrome (topbar, subnav, basement) → masthead → layout → content blocks → version themes → motion */

/* ---------- tokens ---------- */
:root {
  --paper: #fff7ee;
  --paper-2: #ffeedd;
  --card: #ffffff;
  --ink: #2b1140;
  --ink-soft: #5a4868;
  --link: #a80f58;
  --pink: #ff5c9d;
  --lemon: #ffd84d;
  --mint: #8ee6c0;
  --sky: #9bdcff;
  --peach: #ffb894;
  --lilac: #cdb8ff;
  --m1: #ffd1e6;
  --m2: #ffe9c7;
  --m3: #c9ecff;
  --edge: 2px solid var(--ink);
  --drop: 4px 4px 0 var(--ink);
  --r: 16px;
  --display: "Baloo 2", "Fredoka", ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --body: Inter, Manrope, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --max: 1160px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.02rem/1.68 var(--body); }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0 0 .55em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5.4vw, 3.3rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.45rem, 3.2vw, 1.95rem); margin-top: 2.4em; }
h3 { font-size: clamp(1.1rem, 2.2vw, 1.3rem); margin-top: 1.7em; }
p, ul, ol, dl { margin: 0 0 1.05em; }
a { color: var(--link); text-decoration-thickness: 2px; text-underline-offset: .2em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
svg { max-width: 100%; }
code { background: var(--paper-2); padding: .1em .35em; border-radius: 6px; font-size: .92em; }
.gem { width: 1.25em; height: 1.25em; vertical-align: -.25em; }
.gem--lg { width: 1.8rem; height: 1.8rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.jump { position: absolute; left: -999px; top: 0; background: var(--lemon); color: var(--ink); padding: .6rem 1rem; z-index: 100; border: var(--edge); }
.jump:focus { left: .5rem; top: .5rem; }

/* ---------- topbar: brand, main navigation, language switch ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--card); border-bottom: var(--edge); }
.topbar__in { max-width: var(--max); margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; margin-right: auto; color: var(--ink); text-decoration: none; font: 700 1.2rem var(--display); }
.brand__mark { width: 2.1rem; height: 2.1rem; }
.burger { order: 3; padding: .45rem .9rem; font: 700 .95rem var(--display); color: var(--ink); background: var(--lemon); border: var(--edge); border-radius: 10px; cursor: pointer; }
.langs { order: 2; display: inline-flex; border: var(--edge); border-radius: 10px; overflow: hidden; font: 700 .85rem var(--display); }
.langs > * { padding: .35rem .65rem; color: var(--ink); text-decoration: none; }
.langs [aria-current] { background: var(--ink); color: var(--paper); }
.mainnav { order: 4; flex-basis: 100%; display: none; }
.mainnav.is-open { display: block; }
.mainnav ul { list-style: none; margin: 0; padding: .3rem 0 .5rem; display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; }
.mainnav a { display: block; padding: .55rem .7rem; color: var(--ink); text-decoration: none; font-weight: 600; border-radius: 10px; }
.mainnav a:hover { background: var(--paper-2); }
.mainnav a[aria-current] { background: var(--lemon); box-shadow: inset 0 0 0 2px var(--ink); }
@media (min-width: 1040px) {
  .burger { display: none; }
  .mainnav { display: block; order: 1; flex-basis: auto; }
  .mainnav ul { display: flex; padding: 0; gap: .1rem; }
  .mainnav a { padding: .4rem .6rem; font-size: .95rem; }
}

/* ---------- subnav: Play / Demo / Review switch for one game ---------- */
.subnav { background: var(--ink); color: var(--paper); }
.subnav__in { max-width: var(--max); margin: 0 auto; padding: .45rem 1rem; display: flex; align-items: center; gap: .9rem; overflow-x: auto; }
.subnav__game { font: 700 .95rem var(--display); white-space: nowrap; opacity: .85; }
.subnav__tabs { display: flex; gap: .4rem; }
.subnav__tab { padding: .3rem .95rem; border: 2px solid var(--paper); border-radius: 999px; color: var(--paper); text-decoration: none; font: 700 .9rem var(--display); white-space: nowrap; }
.subnav__tab:hover { color: var(--lemon); border-color: var(--lemon); }
.subnav__tab[aria-current] { background: var(--lemon); border-color: var(--lemon); color: var(--ink); }

/* ---------- masthead: coloured band with H1, short answer and the multiplier staircase ---------- */
.masthead { background: linear-gradient(135deg, var(--m1) 0%, var(--m2) 55%, var(--m3) 100%); border-bottom: var(--edge); }
.masthead__in { max-width: var(--max); margin: 0 auto; padding: 1.4rem 1rem 2.6rem; display: grid; gap: 1.6rem; }
@media (min-width: 960px) { .masthead--art .masthead__in { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: end; } }
.indie { display: inline-block; margin: 0 0 .7rem; padding: .2rem .7rem; background: var(--card); border: var(--edge); border-radius: 999px; font-size: .78rem; font-weight: 600; }
.trail ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0 0 .6rem; font-size: .85rem; }
.trail li + li::before { content: "/"; margin-right: .3rem; opacity: .6; }
.trail a { color: var(--ink); }
.dateline { font-size: .88rem; color: var(--ink-soft); margin: -.2rem 0 1rem; }
.dateline a { color: var(--ink); font-weight: 600; }
.lead { position: relative; background: var(--card); border: var(--edge); border-radius: var(--r); box-shadow: var(--drop); padding: 1.5rem 1.2rem 1.2rem; font-size: 1.06rem; }
.lead__tag { position: absolute; top: -.85rem; left: 1rem; padding: .1rem .7rem; background: var(--ink); color: var(--paper); border-radius: 8px; font: 700 .8rem var(--display); letter-spacing: .03em; text-transform: uppercase; }
.lead p { margin: 0 0 .9rem; }
.lead > :last-child { margin-bottom: 0; }

/* staircase: one step per doubling of a multiplier spot */
.stairs { display: flex; align-items: flex-end; gap: 5px; height: 230px; padding: 0 .2rem; }
.stairs__step { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: .35rem; border: var(--edge); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--card); font: 700 clamp(.6rem, 1.5vw, .85rem) var(--display); }
.stairs__step svg { width: 70%; max-width: 2rem; aspect-ratio: 1; height: auto; margin-top: -1.5rem; }
.stairs__step:nth-child(1) { height: 22%; background: var(--sky); }
.stairs__step:nth-child(2) { height: 31%; background: var(--mint); }
.stairs__step:nth-child(3) { height: 40%; background: var(--lemon); }
.stairs__step:nth-child(4) { height: 49%; background: var(--peach); }
.stairs__step:nth-child(5) { height: 58%; background: var(--pink); }
.stairs__step:nth-child(6) { height: 67%; background: var(--lilac); }
.stairs__step:nth-child(7) { height: 76%; background: var(--sky); }
.stairs__step:nth-child(8) { height: 84%; background: var(--mint); }
.stairs__step:nth-child(9) { height: 92%; background: var(--lemon); }
.stairs__step:nth-child(10) { height: 100%; background: var(--pink); }
.stairs--7 .stairs__step:nth-child(7) { height: 100%; background: var(--pink); }
.stairs--7 .stairs__step:nth-child(6) { height: 86%; }
.stairs--7 .stairs__step:nth-child(5) { height: 72%; }
@media (max-width: 959px) { .stairs { height: 150px; } }

/* ---------- tiles: key facts as a row of stat cards pulled up over the masthead ---------- */
.tiles { max-width: var(--max); margin: -1.6rem auto 0; padding: 0 1rem; position: relative; }
.tiles__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin: 0; }
@media (min-width: 768px) { .tiles__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .tiles__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } .tiles__grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--card); border: var(--edge); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); padding: .7rem .8rem; border-top-width: 8px; }
.tile:nth-child(6n+1) { border-top-color: var(--pink); }
.tile:nth-child(6n+2) { border-top-color: #3bb98a; }
.tile:nth-child(6n+3) { border-top-color: #e0a800; }
.tile:nth-child(6n+4) { border-top-color: #3aa5dd; }
.tile:nth-child(6n+5) { border-top-color: #8b62e8; }
.tile:nth-child(6n) { border-top-color: #f0763a; }
.tile dt { font-size: .76rem; color: var(--ink-soft); line-height: 1.3; }
.tile dd { margin: .15rem 0 0; font: 700 1.12rem/1.2 var(--display); overflow-wrap: anywhere; }
.tiles__note { margin: .5rem 0 0; font-size: .8rem; color: var(--ink-soft); }

/* ---------- layout: sticky contents rail + story column ---------- */
.layout { max-width: var(--max); margin: 0 auto; padding: 1.6rem 1rem 3rem; display: grid; gap: 1.5rem; }
@media (min-width: 1040px) { .layout--rail { grid-template-columns: 250px minmax(0, 1fr); gap: 2.6rem; align-items: start; } .rail { position: sticky; top: 4.6rem; } }
.story { min-width: 0; max-width: 780px; }
.story > .prose > h2:first-child { margin-top: .4em; }
.contents { background: var(--card); border: var(--edge); border-radius: 14px; }
.contents summary { cursor: pointer; padding: .7rem .9rem; font: 700 1rem var(--display); }
.contents ol { margin: 0; padding: 0 .9rem .8rem 2.1rem; font-size: .92rem; }
.contents li { margin: .3rem 0; }
.contents a { color: var(--ink); text-decoration: none; }
.contents a:hover { text-decoration: underline; }
.rail__go { display: none; margin-top: 1rem; }
@media (min-width: 1040px) { .rail__go { display: block; text-align: center; } }

/* ---------- prose ---------- */
.prose h2 { padding-bottom: .15em; background: linear-gradient(var(--lemon), var(--lemon)) left bottom / 3.2rem 6px no-repeat; }
.prose li { margin-bottom: .4em; }
.prose ul { padding-left: 1.2rem; list-style: none; }
.prose ul > li { position: relative; padding-left: .5rem; }
.prose ul > li::before { content: ""; position: absolute; left: -1rem; top: .62em; width: .5rem; height: .5rem; background: var(--pink); border: 1.5px solid var(--ink); border-radius: 50%; }
.prose ol { padding-left: 0; list-style: none; counter-reset: n; }
.prose ol > li { counter-increment: n; position: relative; padding: .7rem .9rem .7rem 3.4rem; margin-bottom: .6rem; background: var(--card); border: var(--edge); border-radius: 12px; }
.prose ol > li::before { content: counter(n); position: absolute; left: .7rem; top: .65rem; width: 2rem; height: 2rem; display: grid; place-items: center; background: var(--lemon); border: var(--edge); border-radius: 50%; font: 700 1rem var(--display); }

/* ---------- cta: buttons with a pressed state ---------- */
.cta { display: inline-block; padding: .65rem 1.3rem; background: var(--card); color: var(--ink); border: var(--edge); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); font: 700 1rem var(--display); text-decoration: none; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.cta:hover { color: var(--ink); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.cta:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.cta--go { background: var(--pink); }
.cta--s { padding: .3rem .8rem; font-size: .9rem; }
.stamp { display: inline-block; padding: .05rem .55rem; background: var(--mint); border: 1.5px solid var(--ink); border-radius: 6px; font: 600 .74rem var(--body); vertical-align: middle; white-space: nowrap; transform: rotate(-1.5deg); }

/* ---------- sheet: scrollable tables ---------- */
.sheet { overflow-x: auto; margin: 1.1rem 0 1.6rem; background: var(--card); border: var(--edge); border-radius: 14px; box-shadow: var(--drop); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
caption { caption-side: top; text-align: left; padding: .7rem .9rem; font-size: .84rem; color: var(--ink-soft); border-bottom: var(--edge); }
th, td { padding: .58rem .8rem; text-align: left; white-space: nowrap; border-bottom: 1px solid #e6d9ea; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fff9f3; }
td { font-variant-numeric: tabular-nums; }
thead th { background: var(--lemon); font-family: var(--display); border-bottom: var(--edge); }
tbody th { font-weight: 600; }
.pays th, .pays td { text-align: center; padding: .5rem .55rem; }
.pays td:last-child { font-weight: 700; background: #ffe9f2; }

/* ---------- memo (notes), lab (our test), verdict (pros and cons) ---------- */
.memo, .lab { border: var(--edge); border-radius: 14px; padding: 1rem 1.15rem; margin: 1.3rem 0; }
.memo { background: #e9f9f1; }
.memo--alert { background: #ffeadd; }
.memo h3, .lab h2, .lab h3 { margin-top: 0; }
.memo > :last-child, .lab > :last-child { margin-bottom: 0; }
.lab { background: #e6f5ff; box-shadow: var(--drop); }
.lab h2, .lab h3 { background: none; padding: 0; font-size: 1.25rem; }
.verdict { display: grid; gap: 1rem; margin: 1.1rem 0; }
@media (min-width: 700px) { .verdict { grid-template-columns: 1fr 1fr; } }
.verdict > div { border: var(--edge); border-radius: 14px; padding: 1rem 1.1rem; }
.verdict h3 { margin-top: 0; }
.verdict ul { margin: 0; }
.verdict__up { background: #e9f9f1; }
.verdict__down { background: #ffeadd; }
.verdict__down ul > li::before { background: var(--ink); border-radius: 2px; }

/* ---------- stage: demo placeholder, the provider iframe is injected on click ---------- */
.stage { position: relative; aspect-ratio: 16 / 10; min-height: 300px; margin: 1.2rem 0; border: var(--edge); border-radius: 18px; box-shadow: var(--drop); overflow: hidden; background: repeating-linear-gradient(45deg, #ffe3ef 0 18px, #fff1f7 18px 36px); }
.stage__in { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding: 1rem; gap: .3rem; }
.stage__ico { width: 3.4rem; height: 3.4rem; }
.stage__name { margin: 0; font: 700 1.35rem var(--display); }
.stage__hint { max-width: 34rem; margin: 0 0 .5rem; font-size: .9rem; color: var(--ink-soft); }
.stage__alt { margin: .7rem 0 0; font-size: .85rem; }
.stage__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
@media (max-width: 600px) { .stage { aspect-ratio: 3 / 4; } }

/* ---------- asks (FAQ), onward (next steps), byline, safe ---------- */
.asks__item { background: var(--card); border: var(--edge); border-radius: 12px; margin-bottom: .6rem; }
.asks__item summary { cursor: pointer; padding: .8rem 2.6rem .8rem 1rem; font-weight: 700; position: relative; list-style: none; }
.asks__item summary::-webkit-details-marker { display: none; }
.asks__item summary::after { content: "+"; position: absolute; right: .9rem; top: .55rem; font: 700 1.4rem var(--display); }
.asks__item[open] summary::after { content: "–"; }
.asks__item[open] { background: #fff9f3; }
.asks__item p { padding: 0 1rem 1rem; margin: 0; }
.onward__list { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
@media (min-width: 700px) { .onward__list { grid-template-columns: 1fr 1fr; } }
.onward__card { display: block; height: 100%; padding: .85rem 2.4rem .85rem 1rem; position: relative; background: var(--card); border: var(--edge); border-radius: 12px; color: var(--ink); text-decoration: none; transition: transform .12s; }
.onward__card::after { content: "→"; position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); font-size: 1.3rem; }
.onward__card:hover { transform: translate(-2px, -2px); box-shadow: var(--drop); }
.onward__card b { display: block; font-family: var(--display); font-size: 1.05rem; }
.onward__card span { font-size: .9rem; color: var(--ink-soft); }
.byline { display: flex; gap: .9rem; align-items: center; margin: 2.6rem 0 1rem; padding: .9rem 1.1rem; background: var(--paper-2); border: var(--edge); border-radius: 14px; }
.byline__face { flex: none; width: 3rem; height: 3rem; display: grid; place-items: center; background: var(--lilac); border: var(--edge); border-radius: 12px; font: 700 1rem var(--display); }
.byline p { margin: 0; font-size: .9rem; }
.byline__who { font-weight: 700; font-size: 1rem !important; }
.byline__src { color: var(--ink-soft); margin-top: .25rem !important; }
.safe { padding: .9rem 1.1rem; border: 2px dashed var(--ink); border-radius: 14px; font-size: .9rem; }
.safe p { margin: 0; }

/* ---------- dock: sticky mobile call to action ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: .6rem; align-items: center; justify-content: center; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); background: var(--lemon); border-top: var(--edge); }
.dock[hidden] { display: none; }
.dock .cta { flex: 1; max-width: 22rem; text-align: center; }
.dock__x { width: 2.6rem; height: 2.6rem; background: var(--card); border: var(--edge); border-radius: 10px; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
@media (min-width: 768px) { .dock { display: none !important; } }
@media (max-width: 767px) { body { padding-bottom: 4.6rem; } }

/* ---------- basement: footer ---------- */
.basement { background: var(--ink); color: #eadff2; font-size: .88rem; }
.basement__in { max-width: var(--max); margin: 0 auto; padding: 2.2rem 1rem; display: grid; gap: 1.6rem; }
@media (min-width: 860px) { .basement__in { grid-template-columns: 1.3fr 1fr 1fr; } .basement__wide { grid-column: 1 / -1; } }
.basement h2 { font-size: 1rem; margin: 0 0 .6rem; color: var(--lemon); }
.basement a { color: #fff; }
.basement ul { list-style: none; margin: 0; padding: 0; }
.basement li { margin: .3rem 0; }
.basement__age { display: flex; gap: .8rem; align-items: center; }
.basement__age b { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; background: var(--pink); color: var(--ink); border-radius: 50%; font: 700 1rem var(--display); }
.basement p { margin: 0 0 .7rem; }

/* ---------- plain pages (404, /go/) ---------- */
.plain { max-width: 720px; margin: 0 auto; padding: 3rem 1rem; }

/* ---------- version themes ---------- */
[data-version="1000"] { --m1: #ffe38a; --m2: #ffc7a3; --m3: #ffa6cc; --lemon: #ffcf33; }
[data-version="super-scatter"] { --m1: #dccfff; --m2: #c4e6ff; --m3: #c9f5e3; --pink: #b99bff; }
[data-version="xmas"] { --m1: #d3f1ea; --m2: #edf7ff; --m3: #ffdada; --pink: #ff8f8f; --lemon: #bfeede; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .stairs.is-live .stairs__step svg { animation: bob 2.6s ease-in-out infinite; }
  .stairs.is-live .stairs__step:nth-child(even) svg { animation-delay: .4s; }
  @keyframes bob { 50% { transform: translateY(-5px); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- small screens: keep brand, language switch and menu on one row ---------- */
@media (max-width: 480px) {
  .topbar__in { gap: .45rem; flex-wrap: wrap; }
  .brand { font-size: 1rem; gap: .35rem; }
  .brand__mark { width: 1.7rem; height: 1.7rem; }
  .burger { padding: .35rem .6rem; font-size: .85rem; }
  .langs > * { padding: .3rem .45rem; }
}

/* ---------- snap: game screenshots ---------- */
.snap { margin: 1.2rem 0 1.6rem; background: var(--card); border: var(--edge); border-radius: 14px; box-shadow: var(--drop); overflow: hidden; }
.snap img { display: block; width: 100%; height: auto; }
.snap figcaption { padding: .6rem .9rem; font-size: .84rem; color: var(--ink-soft); border-top: var(--edge); }

/* ---------- header call to action ---------- */
.topbar__go { order: 2; padding: .4rem 1rem; font-size: .95rem; box-shadow: 2px 2px 0 var(--ink); white-space: nowrap; }
@media (min-width: 1040px) { .topbar__go { order: 3; } }
@media (max-width: 480px) { .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } .topbar__go { padding: .35rem .7rem; font-size: .88rem; } }
