:root {
  --bg: #132019;
  --bg-deep: #0c1511;
  --ink: #f2efe6;
  --muted: color-mix(in srgb, var(--ink) 58%, transparent);
  --accent: #e0a11a;
  --accent-deep: #b87a0c;
  --sage: #3f8f6b;
  --panel: #1a2a22;
  --line: color-mix(in srgb, var(--ink) 14%, transparent);
  --display: "Syne", Georgia, serif;
  --body: "Figtree", Georgia, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--ink);
  line-height: 1.55;
  background:
    radial-gradient(900px 520px at 85% -5%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 58%),
    radial-gradient(700px 480px at -10% 55%, color-mix(in srgb, var(--sage) 22%, transparent), transparent 55%),
    linear-gradient(165deg, var(--bg-deep), var(--bg) 45%, #182820);
  background-attachment: fixed;
}

a { color: var(--accent); }
a:hover { color: color-mix(in srgb, var(--accent) 80%, white); }

.wrap {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-deep) 82%, transparent);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}

.logo {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.15rem;
}

.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.nav a[aria-current="page"],
.nav a:hover { color: var(--ink); }

/* Hero — one composition, brand-first, full-bleed visual */
.hero {
  position: relative;
  min-height: min(92vh, 760px);
  display: grid;
  align-items: end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.lattice {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(color-mix(in srgb, var(--sage) 35%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--sage) 35%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(700px) rotateX(52deg) scale(1.35);
  transform-origin: center 20%;
  opacity: 0.45;
  animation: lattice-drift 18s linear infinite;
}

.hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 70% 35%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 42%),
    linear-gradient(to top, var(--bg-deep) 8%, transparent 55%);
  animation: glow-breathe 7s ease-in-out infinite alternate;
}

.hero-copy {
  position: relative;
  z-index: 1;
  padding: 4.5rem 0 3.25rem;
  max-width: 40rem;
  animation: rise-in 0.9s var(--ease) both;
}

.brand-mark {
  margin: 0 0 0.65rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  letter-spacing: -0.03em;
  color: var(--accent);
}

.brand-mark-inline {
  margin-bottom: 0.35rem;
  font-size: 1.1rem;
}

.hero h1,
.play-page h1,
.legal h1 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0 0 0.85rem;
}

.hero h1 {
  font-size: clamp(3.2rem, 10vw, 5.6rem);
}

.lede {
  margin: 0 0 1.35rem;
  max-width: 34ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  font-family: var(--body);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.2s ease, border-color 0.2s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #1a1408;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, white);
  color: #1a1408;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.section { padding: 2.75rem 0; }

.meta-strip {
  padding-top: 1.75rem;
  padding-bottom: 0.5rem;
  animation: rise-in 0.8s var(--ease) 0.15s both;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.85rem;
}

.meta-row li {
  border: 1px solid var(--line);
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.editor-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.editor-line strong {
  font-family: var(--display);
  color: var(--ink);
  font-size: 1.25rem;
}

.section h2 {
  font-family: var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.prose p,
.prose li {
  max-width: 62ch;
  color: var(--muted);
}

.prose ul { padding-left: 1.2rem; }
.prose h2 {
  margin-top: 1.75rem;
  font-size: 1.25rem;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.7rem;
  max-width: 640px;
}

.steps li {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border-left: 4px solid var(--accent);
  padding: 0.9rem 1.05rem;
}

.chapters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.chapter h3 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.1rem;
}

.chapter p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.cta {
  margin-top: 1.75rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.cta p {
  margin: 0;
  color: var(--muted);
  max-width: 42ch;
}

.play-page { padding: 2rem 0 3rem; }
.play-page h1 { font-size: clamp(2rem, 5vw, 3rem); }

.game-shell {
  border: 1px solid var(--line);
  background: var(--bg-deep);
  overflow: hidden;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--sage) 18%, var(--bg-deep));
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.game-hud strong {
  color: var(--accent);
  font-family: var(--display);
}

.btn-hud {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}

.btn-hud:hover { border-color: var(--accent); color: var(--accent); }

.canvas-wrap { position: relative; }

#game {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  margin: 0 auto;
  touch-action: manipulation;
  cursor: pointer;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  background: color-mix(in srgb, var(--bg-deep) 88%, transparent);
  text-align: center;
  padding: 1.5rem;
  animation: rise-in 0.5s var(--ease) both;
}

.game-overlay[hidden] { display: none !important; }

.overlay-title {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0;
}

.overlay-text {
  margin: 0;
  color: var(--muted);
  max-width: 34ch;
}

.play-note {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 2rem;
  margin-top: 1rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-inner a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.footer-inner a:hover { color: var(--ink); }

.legal h1 { font-size: clamp(2rem, 5vw, 2.8rem); }

@keyframes lattice-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 48px, 48px 0; }
}

@keyframes glow-breathe {
  from { opacity: 0.85; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .chapters { grid-template-columns: 1fr; }
  .hero { min-height: min(88vh, 680px); }
  .btn-hud { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .lattice,
  .hero-glow,
  .hero-copy,
  .meta-strip,
  .game-overlay { animation: none; }
  .btn:hover { transform: none; }
  html { scroll-behavior: auto; }
}
