/* Math Heroes site. Colours and the carved frame come from the game itself. */
:root {
  --night: #0e1526;
  --panel: #17223c;
  --panel-2: #1d2a49;
  --gold: #e8c547;
  --gold-soft: #f3dc86;
  --elf: #7ee2b0;
  --ink: #f2ead3;
  --mist: #a3b1c8;
  --line: rgba(232, 197, 71, 0.38);
  --radius: 10px;
  --wrap: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 400 18px/1.6 "Atkinson Hyperlegible", system-ui, sans-serif;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--gold-soft); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--elf); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--night); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

h1, h2, h3 { font-family: "Cinzel", Georgia, serif; font-weight: 800; color: var(--gold); line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
p { margin: 0 0 1em; max-width: 68ch; }
.lead { font-size: 1.2rem; color: var(--ink); }
.section-lead { color: var(--mist); font-size: 1.1rem; }
.fine { color: var(--mist); font-size: 0.95rem; }
.center { text-align: center; margin-inline: auto; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 8px;
  font: 700 1.05rem/1.2 "Atkinson Hyperlegible", sans-serif;
  text-decoration: none;
  text-align: center;
  border: 2px solid transparent;
}
.btn-gold { background: var(--gold); color: #1b1503; }
.btn-gold:hover { background: var(--gold-soft); }
.btn-line { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-line:hover { border-color: var(--gold); }
.btn-small { padding: 9px 16px; font-size: 0.95rem; }

/* The game's carved frame: a thin gold line inside a dark ring. */
.frame {
  margin: 0;
  padding: 6px;
  background: #0b1120;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 6px #0b1120, 0 0 0 7px rgba(232, 197, 71, 0.18), 0 24px 60px rgba(0, 0, 0, 0.45);
}
.frame img { width: 100%; }
figcaption { color: var(--mist); font-size: 0.9rem; padding: 10px 4px 2px; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: rgba(14, 21, 38, 0.94); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(232, 197, 71, 0.15); }
.top-row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { font-family: "Cinzel", serif; font-weight: 800; font-size: 1.35rem; color: var(--gold); text-decoration: none; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--ink); text-decoration: none; font-size: 0.98rem; }
.nav a:hover { color: var(--gold-soft); }

/* Hero */
.hero { padding: 64px 0 72px; background: radial-gradient(1200px 500px at 75% 20%, rgba(126, 226, 176, 0.08), transparent 60%); }
.hero-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 56px; align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 14px; }

/* Sections */
section { padding: 80px 0; }
.band { background: var(--panel); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 28px 0 44px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li { counter-increment: step; padding-left: 52px; position: relative; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -4px;
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--gold); color: var(--gold);
  font: 800 1.1rem/34px "Cinzel", serif; text-align: center;
}
.steps p { color: var(--mist); font-size: 1rem; }
.shots { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; align-items: start; }

.lands { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lands li { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.lands img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.land-name { display: block; padding: 12px 14px 14px; font-family: "Cinzel", serif; font-weight: 600; font-size: 1.05rem; }
.tag { position: absolute; top: 10px; right: 10px; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; background: rgba(11, 17, 32, 0.88); color: var(--gold-soft); border: 1px solid var(--line); }
.tag-free { color: #0b1a12; background: var(--elf); border-color: var(--elf); }

.parents-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 56px; }
.features { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 26px 32px; }
.features dt { font-weight: 700; color: var(--elf); margin-bottom: 4px; }
.features dd { margin: 0; color: var(--mist); font-size: 1rem; }

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 30px 0 18px; align-items: stretch; }
.plan { display: flex; flex-direction: column; padding: 26px 24px; background: var(--panel); border: 1px solid rgba(163, 177, 200, 0.2); border-radius: var(--radius); }
.plan-main { border-color: var(--gold); background: var(--panel-2); }
.plan h3 { font-size: 1.35rem; color: var(--gold); margin-bottom: 6px; }
.price { font: 800 2.2rem/1.1 "Cinzel", serif; color: var(--ink); margin-bottom: 6px; }
.price span { font: 400 1rem "Atkinson Hyperlegible", sans-serif; color: var(--mist); }
.who { color: var(--elf); font-weight: 700; font-size: 1rem; }
.plan ul { padding-left: 20px; margin: 6px 0 22px; color: var(--ink); font-size: 1rem; flex: 1; }
.plan li { margin-bottom: 6px; }
.plan .btn { width: 100%; }

.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid rgba(163, 177, 200, 0.2); padding: 4px 0; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; font-size: 1.08rem; list-style-position: outside; }
.faq details p { color: var(--mist); }

.foot { padding: 30px 0; border-top: 1px solid rgba(232, 197, 71, 0.15); }
.foot-row { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; align-items: center; color: var(--mist); font-size: 0.95rem; }
.foot-row p { margin: 0; }
.foot nav { display: flex; gap: 22px; flex-wrap: wrap; }
.foot a { color: var(--mist); }

/* Narrow screens */
@media (max-width: 900px) {
  .nav a:not(.nav-login) { display: none; }
  .hero { padding: 40px 0 52px; }
  .hero-grid, .parents-grid, .shots { grid-template-columns: 1fr; gap: 32px; }
  .steps { grid-template-columns: 1fr; gap: 22px; }
  .lands { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .plans { grid-template-columns: 1fr; }
  section { padding: 56px 0; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .top-row { gap: 14px; }
  .brand { font-size: 1.15rem; }
  .features { grid-template-columns: 1fr; }
  .lands { grid-template-columns: 1fr 1fr; }
  .land-name { font-size: 0.92rem; padding: 8px 10px 10px; }
  .tag { font-size: 0.72rem; top: 6px; right: 6px; }
  .hero-actions .btn { width: 100%; }
}

/* ——— Hero: trailer + embers ——— */
.hero { position: relative; overflow: hidden; }
.hero .hero-grid { position: relative; z-index: 1; }
.embers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.video { position: relative; aspect-ratio: 16 / 9; background: #05080f; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.frame-glow { animation: rimGlow 4.5s ease-in-out infinite; }
@keyframes rimGlow {
  0%, 100% { box-shadow: 0 0 0 6px #0b1120, 0 0 0 7px rgba(232, 197, 71, 0.18), 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(232, 197, 71, 0.08); }
  50% { box-shadow: 0 0 0 6px #0b1120, 0 0 0 7px rgba(232, 197, 71, 0.5), 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 70px rgba(232, 197, 71, 0.28); }
}

/* ——— Break a seal ——— */
.try { background: radial-gradient(900px 420px at 72% 50%, rgba(232, 197, 71, 0.10), transparent 65%), var(--night); }
.try-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.grades { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.chip { cursor: pointer; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 700 0.95rem "Atkinson Hyperlegible", sans-serif; }
.chip.on { background: var(--gold); border-color: var(--gold); color: #1b1503; }
.sum { font: 800 clamp(2rem, 5vw, 3.2rem)/1.1 "Cinzel", serif; color: var(--ink); margin: 0 0 18px; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 460px; }
.answer {
  cursor: pointer; padding: 16px 12px; border-radius: 10px; border: 2px solid rgba(163, 177, 200, 0.28);
  background: var(--panel); color: var(--ink); font: 800 1.5rem "Atkinson Hyperlegible", sans-serif;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.answer:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-2px); }
.answer.right { background: var(--elf); border-color: var(--elf); color: #0b1a12; }
.answer.wrong { border-color: #f87171; color: #fca5a5; opacity: 0.6; }
.etheral { min-height: 1.6em; margin: 14px 0 4px; color: var(--elf); font-weight: 700; }
.tally { color: var(--mist); margin: 0 0 14px; }
.tally strong { color: var(--gold); font-size: 1.15rem; }

.chest-stage { position: relative; height: 380px; display: grid; place-items: end center; }
.chest-stage .chest { position: absolute; bottom: 40px; left: 50%; width: min(380px, 90%); transform: translateX(-50%); transition: opacity 0.25s ease, transform 0.25s ease; }
.chest-stage .chest img { width: 100%; height: auto; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.55)); }
.chest-stage .chest-open { opacity: 0; }
.chest-stage.is-open .chest-locked { opacity: 0; }
.chest-stage.is-open .chest-open { opacity: 1; transform: translateX(-50%) scale(1.04); }
.chest-stage::before { content: ""; position: absolute; bottom: 28px; left: 50%; width: 70%; height: 40px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(232, 197, 71, 0.28), transparent); }
.chest-stage.is-open::before { background: radial-gradient(closest-side, rgba(232, 197, 71, 0.65), transparent); }
.seal {
  position: absolute; z-index: 2; bottom: 150px; left: 50%; transform: translateX(-50%);
  min-width: 74px; height: 74px; padding: 0 12px; border-radius: 999px; display: grid; place-items: center;
  font: 800 1.6rem "Cinzel", serif; color: #1b1503; background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 55%, #b8891d);
  box-shadow: 0 0 0 4px rgba(11, 17, 32, 0.85), 0 0 30px rgba(232, 197, 71, 0.6);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.chest-stage.is-open .seal { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(1.4); }
.chest-stage.is-shake .chest-locked, .chest-stage.is-shake .seal { animation: shake 0.42s ease; }
@keyframes shake {
  0%, 100% { margin-left: 0; }
  20% { margin-left: -10px; } 40% { margin-left: 9px; } 60% { margin-left: -6px; } 80% { margin-left: 4px; }
}
.coins { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.try-cta { margin-top: 4px; }

.lands li img { transition: transform 0.35s ease; }
.lands li:hover img { transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .frame-glow, .chest-stage.is-shake .chest-locked, .chest-stage.is-shake .seal { animation: none; }
  .lands li img, .answer, .chest-stage .chest, .seal { transition: none; }
}
@media (max-width: 900px) {
  .try-grid { grid-template-columns: 1fr; gap: 10px; }
  .chest-stage { height: 300px; order: -1; }
  .chest-stage .chest { width: min(300px, 80%); bottom: 24px; }
  .seal { bottom: 118px; min-width: 62px; height: 62px; font-size: 1.3rem; }
}
.try-cta[hidden] { display: none; }
