:root {
  color-scheme: dark;
  --background: #151125;
  --surface: #211a36;
  --surface-raised: #2b2145;
  --border: #45365f;
  --heading: #fff6e7;
  --text: #cec4de;
  --mint: #b5f8d1;
  --lavender: #d8c0ff;
  --coral: #ffc1a8;
  --ink: #1c1830;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; background: var(--background); color: var(--text); font: 1rem/1.65 var(--body); }
a { color: var(--mint); text-underline-offset: 0.2em; }
a:hover { color: var(--heading); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
img { display: block; max-width: 100%; }
p, figure, dl { margin: 0; }
h1, h2, h3, h4 { margin: 0; color: var(--heading); font-family: var(--display); line-height: 1.13; }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -0.035em; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.12rem; }
.site-wrap { width: min(100% - 64px, 1160px); margin-inline: auto; }
.skip-link { position: absolute; top: 12px; left: 12px; z-index: 4; padding: 10px 14px; color: var(--ink); background: var(--mint); transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--border); background: var(--background); }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.header-inner { min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--heading); font: 800 1.24rem/1 var(--display); text-decoration: none; white-space: nowrap; }
.brand img { border: 1px solid var(--border); border-radius: 9px; }
.desktop-nav, .site-footer nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 30px; }
.desktop-nav a, .site-footer nav a, .mobile-nav nav a { display: flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 600; }
.desktop-nav a:hover, .site-footer nav a:hover, .mobile-nav nav a:hover { color: var(--mint); }
.mobile-nav { display: none; position: relative; }
.mobile-nav summary { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--heading); }
.mobile-nav summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); }
.mobile-nav[open] summary::after { transform: rotate(225deg); }
.mobile-nav nav { position: absolute; z-index: 3; top: calc(100% + 8px); right: 0; min-width: 150px; padding: 6px 14px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 28px #100c1e; }

.hero {
  padding: clamp(26px, 4vw, 58px) 0;
  background: radial-gradient(ellipse at 76% 35%, #3a2859 0, transparent 50%), linear-gradient(145deg, #211736, var(--background) 68%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 960px; }
.hero h1 { font-size: clamp(3rem, 6vw, 5.3rem); font-weight: 800; letter-spacing: -.075em; line-height: .94;  }
.hero-lead { max-width: 66ch; margin-top: 14px; font-size: clamp(1rem, 2vw, 1.19rem); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 48px; padding: 10px 17px; border: 1px solid transparent; border-radius: 8px; font-weight: 800; text-decoration: none; }
.button-primary { color: var(--ink); background: var(--mint); border-color: var(--mint); }
.button-primary:hover { color: var(--ink); background: #dbffe9; }
.game-facts { display: flex; flex-wrap: wrap; gap: 12px 26px; list-style: none; margin: 31px 0 0; padding: 19px 0 0; border-top: 1px solid var(--border); }
.game-facts li { display: grid; line-height: 1.3; gap: 3px; }
.game-facts strong { color: var(--heading); font: 800 1.22rem/1.15 var(--display); }
.game-facts span { font-size: .81rem; }

.game-player {
  --game-ink: #110d20;
  --game-ice: #9effdf;
  --game-violet: #bb8cff;
  margin-top: 21px;
  padding: 7px 7px 0;
  border: 1px solid transparent;
  border-radius: 19px;
  background:
    linear-gradient(140deg, #261d3e, var(--game-ink) 56%, #211735) padding-box,
    linear-gradient(135deg, var(--game-ice), #4b416e 31%, #534174 64%, var(--game-violet)) border-box;
  box-shadow: -8px -4px 30px #79ffd126, 9px 7px 34px #a578f34d, 0 24px 52px #0b061f9c;
}
.game-player:focus-within { box-shadow: -8px -4px 30px #79ffd13b, 9px 7px 34px #a578f36b, 0 24px 52px #0b061f9c; }
.game-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 12px;
  background: var(--game-ink);
}
.game-frame {
  display: block;
  width: 100%;
  height: auto;
  min-height: 265px;
  aspect-ratio: 900 / 520;
  border: 0;
  background: var(--game-ink);
}
.game-frame:focus-visible { outline-offset: -3px; }
.game-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: 20px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  color: var(--heading);
  background:
    radial-gradient(ellipse at 50% 42%, #483373 0%, #211736 46%, transparent 74%),
    repeating-linear-gradient(0deg, transparent 0 5px, #c3b1ff0b 6px 7px),
    var(--game-ink);
  font: 700 .9rem/1.3 var(--display);
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.game-screen.is-loading .game-loader {
  visibility: visible;
  opacity: 1;
  transition-delay: .08s, 0s;
}
.game-loader-ice {
  width: 46px;
  height: 46px;
  margin: 5px 0 4px;
  border: 2px solid #dffff4;
  border-radius: 10px;
  background: linear-gradient(145deg, #e4fff7 8%, #8de8ed 34%, #f4f1ff 39%, #9bc6ff 54%, #9167df 100%);
  box-shadow: inset 0 0 0 4px #baf6f6ab, 0 0 24px #89e8ff99;
  transform: rotate(45deg);
}
.game-loader-track {
  width: 105px;
  height: 4px;
  overflow: hidden;
  border-radius: 12px;
  background: #af95e54a;
}
.game-loader-track::before {
  content: "";
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--game-violet), var(--game-ice));
  transform: translateX(64%);
}
.game-screen.is-loading .game-loader-track::before { animation: game-loading-sweep 1.25s ease-in-out infinite; }
@keyframes game-loading-sweep {
  from { transform: translateX(-110%); }
  to { transform: translateX(240%); }
}
@media (prefers-reduced-motion: reduce) {
  .game-loader { transition: none; }
  .game-screen.is-loading .game-loader-track::before { animation: none; }
}
.game-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; padding: 2px 12px; }
.game-toolbar a { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; font-size: .88rem; font-weight: 700; }
.level-screenshot { width: min(100%, 570px); margin: 20px 0 26px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.level-screenshot img { width: 100%; height: auto; }
.level-screenshot figcaption { display: grid; gap: 3px; padding: 12px 16px; font-size: .9rem; }
.site-section { padding-block: clamp(42px, 6vw, 72px); }
.site-section + .site-section { border-top: 1px solid var(--border); }
.section-intro { margin-top: 12px; max-width: 68ch; }
.control-grid, .reading-grid, .series-grid, .mechanic-grid { display: grid; gap: 16px; margin-top: 26px; }
.control-grid, .reading-grid, .series-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.control-card, .series-card, .mechanic-grid article { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 20px; }
.control-card h3 { color: var(--mint); margin-bottom: 12px; }
.control-card:nth-child(2) h3 { color: var(--lavender); }
.control-card dl div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 9px 0; }
.control-card dl div + div { border-top: 1px solid var(--border); }
.control-card dd { margin: 0; display: flex; flex-wrap: wrap; gap: 5px; }
kbd { display: inline-grid; place-items: center; min-width: 33px; min-height: 31px; padding-inline: 7px; border: 1px solid #77628f; border-radius: 5px; background: var(--surface-raised); box-shadow: 0 2px 0 var(--background); color: var(--heading); font: 700 .93rem/1 "IBM Plex Mono", ui-monospace, monospace; }
.reading-grid { gap: 22px 34px; }
.reading-grid article p, .mechanic-grid article p, .series-card p, .retry-note p { margin-top: 8px; }
.mechanic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mechanic-grid h3 { color: var(--lavender); }
.level-heading { margin-top: 30px; }
.level-guide { columns: 2; column-gap: 35px; margin-top: 18px; }
.level-guide article { break-inside: avoid; padding: 0 0 18px; }
.level-guide p { margin-top: 6px; }
.retry-note { margin-top: 12px; padding: 16px 20px; border-left: 3px solid var(--coral); background: var(--surface); border-radius: 0 8px 8px 0; }
.series-card a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 8px; }
.faq-list { display: grid; gap: 8px; margin-top: 22px; max-width: 820px; }
.faq-list details { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; }
.faq-list summary { position: relative; cursor: pointer; list-style: none; min-height: 48px; padding: 12px 43px 12px 15px; color: var(--heading); font-weight: 700; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 16px; top: 11px; color: var(--mint); font-size: 1.4rem; line-height: 1.2; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list details p { padding: 0 15px 14px; max-width: 74ch; }
.legal-page { max-width: 780px; min-height: 55vh; padding-block: 60px 72px; }
.legal-page h1 { font-size: clamp(2.6rem, 7vw, 4.7rem); letter-spacing: -.055em; }
.legal-page h2 { margin-top: 30px; font-size: 1.5rem; letter-spacing: -.02em; }
.legal-page p { margin-top: 12px; overflow-wrap: anywhere; }
.legal-page .button { margin-top: 20px; }
.site-footer { padding: 34px 0; border-top: 1px solid var(--border); background: var(--surface); }
.site-footer p { max-width: 45ch; margin-top: 8px; font-size: .88rem; }

@media (max-width: 800px) {
  .site-wrap { width: min(100% - 40px, 650px); }
  .desktop-nav { display: none; }
  .mobile-nav { display: block; }
  .mechanic-grid { grid-template-columns: 1fr; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 12px; }
}
@media (max-width: 540px) {
  .header-inner { min-height: 62px; }
  .hero h1 { font-size: clamp(2.9rem, 12vw, 3.75rem); }
  .game-facts { margin-top: 22px; padding-top: 14px; }
  .control-grid, .reading-grid, .series-grid { grid-template-columns: 1fr; }
  .level-guide { columns: 1; }
  .site-footer nav { gap: 6px 18px; }
}
