:root {
  --ink: #0a0806;
  --ink-2: #15100b;
  --panel: #1a130c;
  --cream: #f6e7b4;
  --gold: #e8a33d;
  --amber: #c9751c;
  --brown: #5a3a1e;
  --lanyard: #3a52e0;
  --text: #f6efdc;
  --text-muted: #b9ab8a;
  --border: rgba(246, 231, 180, 0.14);
  --max: 1140px;
  --head-font: "Russo One", "Arial Black", sans-serif;
  --body-font: "PT Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
a, button { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: clip;
}
header, main, footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  max-width: none;
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  background: rgba(10, 8, 6, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 44px; width: 44px; display: block; border-radius: 8px; transition: transform 0.25s ease; }
.brand:hover img { transform: rotate(-4deg) scale(1.06); }
.brand span { font-family: var(--head-font); color: var(--cream); font-size: 18px; letter-spacing: 0.04em; }
nav { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  transition: color 0.15s ease;
}
nav a:hover { color: var(--gold); }
.cta, nav a.cta {
  display: inline-block;
  background: linear-gradient(180deg, var(--gold), var(--amber));
  color: var(--ink);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--brown);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.cta:hover, nav a.cta:hover { color: var(--ink); transform: translateY(-1px); box-shadow: 0 5px 0 var(--brown); }
.cta:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brown); }

/* XP bar */
.xp {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: rgba(246, 231, 180, 0.08);
}
.xp-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--lanyard), var(--gold));
  box-shadow: 0 0 10px var(--gold);
}
.xp-label {
  font-family: var(--head-font);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.08em;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid rgba(232, 163, 61, 0.35);
  border-radius: 999px;
  background: rgba(232, 163, 61, 0.08);
}
.head-left { display: flex; align-items: center; gap: 14px; }

/* Type */
main { padding-bottom: 64px; }
h1, h2, h3 { font-family: var(--head-font); font-weight: 400; color: var(--cream); margin: 0; line-height: 1.15; }
h1 {
  font-size: clamp(2.2rem, 6.5vw, 4.2rem);
  text-transform: uppercase;
  text-shadow: 0 3px 0 var(--amber), 0 0 30px rgba(232, 163, 61, 0.35);
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  text-transform: uppercase;
  margin: 0 0 8px;
}
h3 { font-size: 1.2rem; margin: 0 0 8px; }
.eyebrow {
  display: block;
  font-family: var(--head-font);
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.section-head { margin-bottom: 28px; }
p { margin: 0 0 16px; }
.muted { color: var(--text-muted); }
a { color: var(--gold); }
section { padding: 72px 0 0; }
h1, h2 { text-wrap: balance; }
p { text-wrap: pretty; }
section[id] { scroll-margin-top: 90px; }
main > h1 { margin: 40px 0 12px; font-size: clamp(1.9rem, 5vw, 2.8rem); }
main > h2 { margin-top: 44px; font-size: 1.3rem; color: var(--gold); }

/* Policy pages */
main.policy { max-width: 840px; }
.policy h2[id], .policy section[id] { scroll-margin-top: 90px; }
.policy h3 { margin-top: 24px; color: var(--cream); }
.policy li { margin-bottom: 6px; }
.policy .lead { font-size: 1.05rem; color: var(--text-muted); }
.toc {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 24px 0 8px;
}
.toc strong { font-family: var(--head-font); font-weight: 400; color: var(--gold); letter-spacing: 0.08em; font-size: 13px; text-transform: uppercase; }
.toc ol { margin: 10px 0 0; padding-left: 20px; columns: 2 240px; column-gap: 32px; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--gold); }
.table-wrap { overflow-x: auto; margin: 12px 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--gold); font-family: var(--head-font); font-weight: 400; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.note {
  border-left: 3px solid var(--gold);
  background: rgba(232, 163, 61, 0.07);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0;
}

/* Hero */
.hero {
  position: relative;
  min-height: min(calc(100svh - 70px), 720px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 48px;
  padding: 40px 0;
  isolation: isolate;
}
.hero-text { text-align: left; }
.hero-text h1 { margin-top: 0; font-size: clamp(2.2rem, 5vw, 4rem); }
.hero-text h1 em { font-style: normal; color: var(--gold); }
.hero-text p { margin-left: 0; max-width: 500px; font-size: 1.15rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 26px; }
.hero-actions .press-start { margin-top: 0; }
.btn-ghost {
  display: inline-block;
  padding: 14px 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--cream);
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.hero-art { position: relative; display: flex; justify-content: center; }
.hero-art .sun { top: 50%; transform: translate(-50%, -50%); width: 130%; max-width: 620px; animation: glow 5s ease-in-out infinite; }
.hero.compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: auto;
  padding: 56px 0 8px;
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; min-height: auto; padding-top: 28px; }
  .hero-art .hero-logo { max-width: 230px; }
  .card.game.locked .cover { height: 110px; }
  .hero-text h1 { font-size: clamp(1.7rem, 8vw, 2.6rem); }
  .hero-art { order: -1; }
  .hero-text { text-align: center; }
  .hero-text p { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
}
.hero-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}
.sun {
  position: absolute;
  left: 50%;
  top: 6%;
  width: min(520px, 95vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 231, 180, 0.55) 0%, rgba(232, 163, 61, 0.25) 40%, transparent 70%);
  z-index: -1;
  animation: rise 2s ease-out both, glow 5s ease-in-out 2s infinite;
}
.hero-logo {
  width: 100%;
  max-width: 440px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 0 0 1px var(--border), 0 24px 70px rgba(232, 163, 61, 0.3);
  animation: float 6s ease-in-out infinite;
}
.hero.compact { min-height: auto; padding: 56px 0 8px; }
.hero.compact h1 { margin-top: 0; }
.hero.compact p { margin-left: auto; margin-right: auto; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }
.hero p { max-width: 600px; color: var(--text-muted); font-size: 1.1rem; margin-top: 12px; }
.press-start {
  margin-top: 26px;
  font-family: var(--head-font);
  font-size: 1.1rem;
  letter-spacing: 0.16em;
  padding: 16px 34px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, var(--cream), var(--gold));
  color: var(--ink);
  box-shadow: 0 6px 0 var(--brown), 0 16px 40px rgba(232, 163, 61, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.press-start:hover { transform: translateY(-2px); }
.press-start:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--brown); }
.press-start span { animation: pulse-text 1.4s ease-in-out infinite; }
.hint { margin-top: 14px; font-size: 13px; color: var(--text-muted); letter-spacing: 0.08em; }
.hint kbd {
  font-family: var(--head-font);
  font-size: 11px;
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--cream);
}

/* Cards */
.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}
.card {
  position: relative;
  display: block;
  background: linear-gradient(160deg, var(--panel), var(--ink-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--lanyard), var(--gold), var(--amber));
}
a.card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 16px 36px rgba(232, 163, 61, 0.2);
}
.card .more { display: inline-block; margin-top: 8px; color: var(--gold); font-weight: 700; }
.badge {
  display: inline-block;
  font-family: var(--head-font);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 14px;
  background: var(--gold);
  color: var(--ink);
}
.badge.locked { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
/* Level-select covers */
.card.game { padding-top: 0; }
.card.game::before { z-index: 2; }
.cover {
  position: relative;
  margin: 0 -26px 18px;
  height: 160px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.cover .glyph {
  font-size: 72px;
  line-height: 1;
  transition: transform 0.3s ease;
}
.cover-memory {
  background:
    radial-gradient(circle at 50% 40%, rgba(246, 231, 180, 0.5), transparent 50%),
    radial-gradient(circle at 15% 110%, rgba(58, 82, 224, 0.75), transparent 55%),
    radial-gradient(circle at 90% 110%, var(--amber), transparent 55%),
    linear-gradient(160deg, #141a3a, #0a0806);
}
.cover-memory .glyph { filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6)); }

/* Game detail page */
.game-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 40px;
  align-items: center;
  padding-top: 48px;
}
.game-art {
  margin: 0;
  height: auto;
  aspect-ratio: 1;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(58, 82, 224, 0.2), 0 24px 60px rgba(232, 163, 61, 0.15);
}
.game-art .glyph { font-size: clamp(90px, 14vw, 150px); animation: float 6s ease-in-out infinite; }
.game-art .level-num { font-size: 56px; right: 20px; bottom: 14px; }
.game-hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.tagline-text { font-size: 1.2rem; color: var(--text-muted); margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chips span {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--cream);
  background: rgba(246, 231, 180, 0.05);
}
.cta.disabled { opacity: 0.7; cursor: default; box-shadow: 0 4px 0 var(--brown); }
.cta.disabled:hover { transform: none; }
.info { list-style: none; padding: 0; margin: 8px 0 0; }
.info li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.info li:last-child { border-bottom: 0; }
.info span { color: var(--text-muted); }
.info b { color: var(--cream); text-align: right; }
@media (max-width: 760px) {
  .game-hero { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 28px; text-align: center; }
  .game-art { width: 100%; max-width: 260px; margin: 0 auto; }
  .chips, .game-hero .hero-actions { justify-content: center; }
}
a.card.game:hover .glyph { transform: scale(1.12) rotate(-6deg); }
.cover-locked {
  background:
    repeating-linear-gradient(135deg, rgba(246, 231, 180, 0.04) 0 12px, transparent 12px 24px),
    linear-gradient(160deg, #1c1610, #0d0a07);
}
.cover-locked .glyph {
  font-family: var(--head-font);
  font-size: 84px;
  color: rgba(246, 231, 180, 0.16);
}
.level-num {
  position: absolute;
  right: 14px;
  bottom: 8px;
  font-family: var(--head-font);
  font-size: 40px;
  line-height: 1;
  color: rgba(246, 231, 180, 0.22);
}
.card.locked h3 { color: var(--text-muted); }
.card.locked { cursor: not-allowed; }

/* Full-bleed band behind a section */
section.band { position: relative; padding-bottom: 72px; }
section.band::after {
  content: "";
  position: absolute;
  top: 32px;
  bottom: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  background: linear-gradient(180deg, rgba(232, 163, 61, 0.06), rgba(232, 163, 61, 0.02));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  z-index: -1;
}

/* Contact banner */
.cta-banner {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 56px 24px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% -20%, rgba(246, 231, 180, 0.5), transparent 55%),
    linear-gradient(135deg, var(--amber), var(--brown));
  box-shadow: 0 24px 60px rgba(201, 117, 28, 0.25);
}
.cta-banner .eyebrow { color: var(--ink); opacity: 0.75; }
.cta-banner h2 { color: var(--ink); text-shadow: none; font-size: clamp(1.8rem, 5vw, 2.8rem); }
.cta-banner p { color: rgba(10, 8, 6, 0.85); max-width: 520px; margin: 12px auto 22px; font-size: 1.05rem; }
.cta.dark { background: var(--ink); color: var(--cream); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4); }
.cta.dark:hover { color: var(--gold); }

.about { display: grid; gap: 28px; grid-template-columns: 1.2fr 1fr; align-items: center; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } }
.stats { display: grid; gap: 12px; }
.stat { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 12px; font-size: 14px; }
.stat b { font-family: var(--head-font); font-weight: 400; color: var(--cream); font-size: 13px; letter-spacing: 0.06em; }
.bar { height: 10px; border-radius: 999px; background: rgba(246, 231, 180, 0.08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--gold)); transition: width 1.2s ease-out; }
.bar.on i { width: var(--v); }

/* Achievements */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.35s ease-out both;
}
.toast.out { animation: toast-out 0.3s ease-in both; }
.toast .ico { font-size: 26px; }
.toast small { display: block; font-family: var(--head-font); color: var(--gold); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.toast strong { color: var(--cream); }

.confetti {
  position: fixed;
  top: -12px;
  width: 9px;
  height: 14px;
  z-index: 60;
  pointer-events: none;
  animation: fall linear forwards;
}

/* Footer */
footer {
  margin-top: 80px;
  max-width: none;
  background: #050403;
  border-top: 1px solid var(--border);
  padding: 36px 20px 28px;
  color: var(--text-muted);
  font-size: 14px;
}
footer > div, footer > nav { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
footer nav { margin-top: 12px; }
footer nav a { font-size: 14px; color: var(--text-muted); font-weight: 400; }
footer nav a:hover { color: var(--gold); }
.secret { font-size: 12px; opacity: 0.5; }
footer.rich { padding-top: 48px; }
.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 28px;
}
.foot-brand p { margin: 12px 0 0; max-width: 260px; }
.foot-col { display: flex; flex-direction: column; gap: 8px; }
.foot-col strong { font-family: var(--head-font); font-weight: 400; color: var(--cream); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.foot-col a { color: var(--text-muted); text-decoration: none; overflow-wrap: anywhere; }
.foot-col a:hover { color: var(--gold); }
.foot-bottom {
  max-width: var(--max);
  margin: 36px auto 0;
  padding: 18px 20px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
@media (max-width: 900px) {
  .foot { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

@keyframes rise {
  from { transform: translateX(-50%) translateY(80px) scale(0.8); opacity: 0; }
  to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pulse-text { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateX(30px); opacity: 0; } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 640px) {
  header { flex-wrap: nowrap; padding: 10px 16px; }
  nav { gap: 14px; flex-wrap: nowrap; }
  nav a.nav-extra { display: none; }
  nav a.cta { padding: 8px 14px; font-size: 14px; }
  .brand img { width: 38px; height: 38px; }
  .brand span { font-size: 15px; }
  .xp-label { display: none; }
  header, main, footer { padding-left: 16px; padding-right: 16px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; }
  nav a, .brand span { white-space: nowrap; }
}
@media (hover: none) {
  .hint { display: none; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  .hero { min-height: auto; padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .bar i { width: var(--v); }
}

/* Multi-device */
@supports (padding: max(0px)) {
  header {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  main, .foot, .foot-bottom, footer > div, footer > nav {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
  footer { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  @supports (padding: max(0px)) {
    header, main, .foot, .foot-bottom, footer > div, footer > nav {
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }
  }
  .foot-col a { padding: 6px 0; }
  .foot-col { gap: 2px; }
  footer nav a { padding: 6px 0; }
  .card { padding: 22px; }
  .cover { margin: 0 -22px 16px; }
  .cta-banner { padding: 40px 18px; }
}

/* Touch screens: no sticky hover effects, give tap feedback instead */
@media (hover: none) {
  a.card:hover { transform: none; border-color: var(--border); box-shadow: none; }
  a.card.game:hover .glyph { transform: none; }
  .brand:hover img, .press-start:hover, .cta:hover { transform: none; }
  a.card:active { transform: scale(0.98); border-color: var(--gold); }
  .press-start:active, .cta:active { transform: translateY(3px); }
}

/* Phones in landscape: short screens */
@media (orientation: landscape) and (max-height: 520px) {
  header { position: relative; padding-top: 8px; padding-bottom: 8px; }
  .brand img { width: 36px; height: 36px; }
  .hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
    min-height: auto;
    gap: 24px;
    padding: 20px 0;
  }
  .hero-art { order: 0; }
  .hero-art .hero-logo { max-width: 190px; }
  .hero-text { text-align: left; }
  .hero-text h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); }
  .hero-text p { margin-left: 0; font-size: 1rem; }
  .hero-actions { justify-content: flex-start; margin-top: 16px; }
  .game-hero { grid-template-columns: minmax(0, 0.5fr) minmax(0, 1fr); text-align: left; padding-top: 20px; }
  .game-art { max-width: 200px; }
  .chips, .game-hero .hero-actions { justify-content: flex-start; }
  section { padding-top: 48px; }
}

/* Large screens */
@media (min-width: 1600px) {
  :root { --max: 1240px; }
  body { font-size: 18px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .game-art .level-num { font-size: 32px; right: 12px; bottom: 8px; }
}

/* Game artwork covers */
.cover-art { background: #0b1022; }
.card.game .cover-art { height: 210px; }
.cover-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 62%;
  transition: transform 0.4s ease;
}
.game-art.cover-art img { object-position: center; }
a.card.game:hover .cover-art img { transform: scale(1.06); }
.cover-art .level-num {
  z-index: 1;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}
@media (hover: none) {
  a.card.game:hover .cover-art img { transform: none; }
}
.card.game .cover { height: 210px; }
.cover.game-art { height: auto; margin: 0; }
@media (max-width: 760px) {
  .cover.game-art { margin: 0 auto; }
}

/* Phone: bottom tab bar, swipe rail, compact footer */
.tabbar, .rail-hint { display: none; }
@media (max-width: 640px) {
  header nav { display: none; }
  .brand span { display: inline; }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    gap: 0;
    margin: 0;
    padding: 6px max(4px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: rgba(10, 8, 6, 0.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    padding: 4px 0;
    border: 0;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
  }
  .tabbar a:active { background: rgba(232, 163, 61, 0.12); }
  .tabbar a[aria-current="page"] { color: var(--gold); }
  .tabbar svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }

  .rail-hint { display: block; margin: 8px 0 0; font-size: 14px; color: var(--text-muted); }
  .grid.rail {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    margin: 0 -16px;
    padding: 4px 16px 14px;
    scroll-padding-left: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .grid.rail::-webkit-scrollbar { display: none; }
  .grid.rail > .card { flex: 0 0 82%; scroll-snap-align: start; }
  .grid.rail .card.game .cover { height: 190px; }

  .foot-col:last-child { grid-column: 1 / -1; }
  .foot-col a { overflow-wrap: normal; }
}

/* Never let anything widen the page sideways */
html { overflow-x: hidden; }
@supports (overflow-x: clip) {
  html { overflow-x: clip; }
}
.hero, .hero-art { overflow-x: clip; }
img, svg, video, canvas { max-width: 100%; }

/* Phone: third-party table as stacked cards */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; }
  .table-wrap table { min-width: 0; }
  .table-wrap thead { display: none; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap tr {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 10px;
  }
  .table-wrap td { border: 0; padding: 4px 0; }
  .table-wrap td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--head-font);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
  }
}
