:root {
  --night: #0f0b24;
  --night-2: #17123a;
  --panel: #1f1848;
  --panel-2: #2a2160;
  --line: #3d3285;
  --ink: #ece6ff;
  --muted: #b3a9d9;
  --gold: #f2c14e;
  --gold-2: #ffde8a;
  --gold-dark: #8a5a12;
  --discord: #5865f2;
  --discord-dark: #3540b8;
  --sky: #7fd3ff;
  --px: 4px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 400 17px/1.6 "Nunito", system-ui, sans-serif;
  overflow-x: hidden;
}
img { max-width: 100%; }
a { color: var(--gold-2); }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
h1, h2, h3 { font-family: "Pixelify Sans", "Nunito", sans-serif; line-height: 1.15; margin: 0 0 .4em; }
h2 { font-size: clamp(28px, 4vw, 40px); color: var(--gold); }
h3 { font-size: 22px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: #000; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- pixel frame: stepped corners, no blur ---------- */
.pixel-frame, .panel, .feature, .gallery figure, .class-card, .patch, .btn, kbd, .chip, details {
  --frame: var(--line);
  border: 0;
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--frame),
    0 var(--px) 0 0 var(--frame),
    calc(var(--px) * -1) 0 0 0 var(--frame),
    var(--px) 0 0 0 var(--frame);
  margin: var(--px);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  font: 700 18px "Pixelify Sans", sans-serif;
  color: #fff; text-decoration: none; cursor: pointer;
  background: var(--panel-2);
  transition: transform .08s steps(2);
  position: relative;
}
.btn img { width: 32px; height: 32px; margin: -6px 0; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(2px); }
.btn-gold { background: linear-gradient(var(--gold-2), var(--gold)); color: #2a1600; --frame: var(--gold-dark); }
.btn-discord { background: var(--discord); --frame: var(--discord-dark); }
.btn-ghost { background: transparent; color: var(--ink); font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 16px; }
.btn-lg { padding: 16px 28px; font-size: 22px; }
.btn:focus-visible, .chip:focus-visible, summary:focus-visible, .gallery button:focus-visible { outline: 3px solid var(--sky); outline-offset: 6px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(15, 11, 36, .88);
  backdrop-filter: blur(6px);
  border-bottom: var(--px) solid var(--night-2);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold); text-decoration: none; font: 900 21px "Cinzel", Georgia, serif; letter-spacing: .03em; }
.nav nav { display: flex; align-items: center; gap: 22px; }
.nav nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; }
.nav nav a:not(.btn):hover { color: var(--gold-2); }
.nav-toggle { display: none; background: none; border: 0; color: var(--ink); font-size: 26px; cursor: pointer; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(92vh, 860px);
  display: grid; place-items: center;
  text-align: center;
  padding: 60px 16px 170px;
}
.hero-sky {
  position: absolute; inset: -40px 0 0 0;
  background: url(assets/art/hero.png) center bottom / cover no-repeat;
  will-change: transform;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, rgba(15,11,36,.25), rgba(15,11,36,.75) 75%),
              linear-gradient(transparent 70%, var(--night));
}
.fireflies { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.hero-inner { position: relative; z-index: 2; max-width: 760px; }
.crest { width: 128px; height: 128px; filter: drop-shadow(0 0 18px rgba(127, 211, 255, .45)); animation: bob 3s steps(6) infinite alternate; }
@keyframes bob { to { transform: translateY(-8px); } }
.title { margin: 8px 0 12px; color: var(--gold); font-family: "Cinzel", Georgia, serif; font-weight: 900; text-shadow: 0 0 24px rgba(242, 160, 40, .45), 0 4px 0 #3b1d00; }
.title-small { display: block; font-size: clamp(22px, 3.4vw, 34px); letter-spacing: .25em; }
.title-big {
  display: block; font-size: clamp(64px, 13vw, 132px); letter-spacing: .06em;
  border-top: 3px solid rgba(242, 193, 78, .6); border-bottom: 3px solid rgba(242, 193, 78, .6);
  padding: 0 .2em; margin-top: 6px; line-height: 1.1;
}
.tagline { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink); max-width: 600px; margin: 0 auto 26px; text-shadow: 0 2px 6px #000; }
.cta { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.fine { margin-top: 18px; color: var(--muted); font: 14px "Silkscreen", monospace; text-shadow: 0 2px 4px #000; }
.fine-note { margin: 6px auto 0; max-width: 46ch; font-size: 12px; }
.fine-note b { color: var(--ink); font-weight: normal; }

.parade { position: absolute; left: 0; right: 0; bottom: 84px; height: 64px; z-index: 2; pointer-events: none; }
.walker {
  position: absolute; bottom: 0; width: 64px; height: 64px;
  background-size: 256px 64px; background-repeat: no-repeat;
  image-rendering: pixelated;
  animation: walk-frames .5s steps(1) infinite, walk-across linear infinite;
}
@keyframes walk-frames { 0% { background-position: -128px 0; } 50% { background-position: -192px 0; } }
@keyframes walk-across { from { left: -80px; } to { left: 100%; } }

/* ---------- features ---------- */
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px;
  max-width: 1160px; margin: -70px auto 0; padding: 0 16px; position: relative; z-index: 3;
}
.feature { background: var(--panel); padding: 20px 22px; }
.feature h3 { color: var(--gold-2); font-size: 20px; }
.feature p { margin: 0; color: var(--muted); font-size: 15.5px; }

/* ---------- sections ---------- */
.section { max-width: 1160px; margin: 0 auto; padding: 90px 16px 10px; }
.section-head { display: flex; gap: 18px; align-items: center; margin-bottom: 26px; }
.section-head .icon { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 4px 0 rgba(0,0,0,.4)); }
.section-head p { margin: 0; color: var(--muted); }

/* ---------- gallery ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.chip { background: var(--night-2); color: var(--muted); padding: 6px 14px; font: 14px "Silkscreen", monospace; cursor: pointer; }
.chip.on { background: var(--gold); color: #2a1600; --frame: var(--gold-dark); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.gallery figure { margin: var(--px); background: var(--panel); overflow: hidden; }
.gallery figure[hidden] { display: none; }
.gallery button { display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: zoom-in; overflow: hidden; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .4s; }
.gallery button:hover img { transform: scale(1.06); }
.gallery figcaption { padding: 12px 16px 16px; color: var(--muted); font-size: 15px; }
.gallery figcaption b { display: block; color: var(--ink); font: 700 19px "Pixelify Sans", sans-serif; margin-bottom: 2px; }

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  background: rgba(8, 6, 20, .94); padding: 16px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; text-align: center; }
.lightbox img { max-height: 80vh; width: auto; max-width: 100%; box-shadow: 0 0 0 var(--px) var(--line); }
.lightbox figcaption { margin-top: 12px; color: var(--muted); }
.lightbox figcaption b { color: var(--gold); font: 700 22px "Pixelify Sans", sans-serif; margin-right: 8px; }
.lightbox button { background: none; border: 0; color: var(--ink); font-size: 44px; cursor: pointer; }
.lb-close { position: absolute; top: 10px; right: 18px; font-size: 30px !important; }

/* ---------- classes ---------- */
.classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.class-card { background: var(--panel); padding: 18px; display: flex; gap: 16px; align-items: center; }
.class-card .sprite {
  width: 96px; height: 96px; flex: none;
  background-size: 384px 96px; background-repeat: no-repeat;
  background-color: var(--night-2);
  image-rendering: pixelated;
  animation: idle-frames 1s steps(1) infinite;
}
.class-card:hover .sprite { animation: walk-east .4s steps(1) infinite; }
@keyframes idle-frames { 0% { background-position: 0 0; } 50% { background-position: -96px 0; } }
@keyframes walk-east { 0% { background-position: -192px 0; } 50% { background-position: -288px 0; } }
.class-card h3 { margin: 0 0 4px; color: var(--gold-2); }
.class-card p { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.45; }
.class-card .skills { margin-top: 6px; font: 12px "Silkscreen", monospace; color: var(--sky); }

/* ---------- faq ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(300px, 1fr) 1.3fr; gap: 28px; align-items: start; }
.panel { background: var(--panel); padding: 22px 24px; }
.controls h3 { color: var(--gold-2); font-size: 20px; }
.controls h3:not(:first-child) { margin-top: 20px; }
.controls dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; align-items: center; }
.controls dl.cols { grid-template-columns: auto 1fr auto 1fr; }
.controls dt { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.controls dd { margin: 0; color: var(--ink); }
kbd {
  --px: 2px;
  display: inline-block; min-width: 28px; padding: 1px 7px; margin: 2px;
  text-align: center; font: 13px "Silkscreen", monospace; color: var(--night);
  background: linear-gradient(#fff 0 70%, #c9c0ee 70%);
  --frame: #000;
}
.note { color: var(--muted); font-size: 14.5px; margin: 18px 0 0; }
.qa { display: grid; gap: 14px; }
details { background: var(--panel); padding: 0; }
summary {
  cursor: pointer; list-style: none; padding: 14px 18px 14px 46px; position: relative;
  font: 700 18px "Pixelify Sans", sans-serif;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; position: absolute; left: 18px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  background: var(--gold);
  clip-path: polygon(0 0, 50% 0, 50% 25%, 75% 25%, 75% 75%, 50% 75%, 50% 100%, 0 100%);
  transition: transform .15s steps(2);
}
details[open] summary::before { transform: rotate(90deg); }
details p { margin: 0; padding: 0 18px 16px 46px; color: var(--muted); }

/* ---------- patch notes ---------- */
.patches { display: grid; gap: 20px; }
.patch { background: var(--panel); padding: 20px 24px; position: relative; }
.patch header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 14px; margin-bottom: 8px; }
.patch h3 { margin: 0; color: var(--ink); }
.badge { font: 13px "Silkscreen", monospace; background: var(--night-2); color: var(--sky); padding: 2px 8px; }
.patch time { font: 13px "Silkscreen", monospace; color: var(--muted); }
.patch.latest { --frame: var(--gold); }
.patch.latest::before {
  content: "LATEST"; position: absolute; top: -14px; right: 18px;
  background: var(--gold); color: #2a1600; padding: 2px 10px; font: 13px "Silkscreen", monospace;
}
.patch-body { color: var(--muted); }
.patch-body h4 { font: 700 18px "Pixelify Sans", sans-serif; color: var(--gold-2); margin: 14px 0 4px; }
.patch-body ul, .patch-body ol { margin: 6px 0; padding-left: 22px; }
.patch-body li { margin: 3px 0; }
.patch-body li::marker { color: var(--gold); }
.patch-body p { margin: 6px 0; }
.patch-body strong { color: var(--ink); }
.patch.collapsed .patch-body { max-height: 150px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.patch .expand { margin-top: 8px; background: none; border: 0; color: var(--gold-2); font: 13px "Silkscreen", monospace; cursor: pointer; padding: 0; }
.patches-more { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 26px; }

/* ---------- discord band ---------- */
.discord-band {
  max-width: 1160px; margin: 100px auto 0; padding: 30px clamp(20px, 4vw, 44px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 24px;
  background: linear-gradient(120deg, #2b2f8f, var(--discord));
  box-shadow: 0 -4px 0 #1d2070, 0 4px 0 #1d2070, -4px 0 0 #1d2070, 4px 0 0 #1d2070;
}
.discord-band > div { flex: 1 1 280px; }
.discord-band h2 { color: #fff; margin-bottom: 4px; }
.discord-band p { margin: 0; color: #e3e6ff; }
.discord-band .btn-discord { background: #fff; color: var(--discord-dark); --frame: #1d2070; }

.footer { text-align: center; padding: 60px 16px 40px; color: var(--muted); font-size: 14px; }
.footer img { opacity: .85; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--night); border-bottom: var(--px) solid var(--night-2);
    display: none;
  }
  .nav nav.open { display: flex; }
  .nav nav a { padding: 14px 20px; }
  .nav nav .btn { margin: 10px 20px 16px; justify-content: center; }
  .brand span { font-size: 19px; }
  .faq-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .controls dl.cols { grid-template-columns: auto 1fr; }
  .lightbox { grid-template-columns: 36px 1fr 36px; padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .walker { display: none; }
}
