:root {
  --sky-top: #7ec8ff;
  --sky-bottom: #d6f0ff;
  --ink: #2b2118;
  --ink-soft: #5b4a3a;
  --panel: #fff8ec;
  --panel-edge: #3b2a1c;
  --panel-hi: #ffffff;
  --panel-lo: #e6d6bd;
  --accent: #5fbf3f;
  --accent-dark: #3d8a26;
  --pink: #ff8fb8;
  --gold: #ffd84d;
  --cloud: #ffffff;
  --sun: #ffe066;
  --sun-edge: #ffb82e;
  --muted: #8a7a68;
  --on: #48d63c;
  --off: #ff4d5e;
  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-body: "Nunito", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky-top: #0d1640;
    --sky-bottom: #2b3a7a;
    --ink: #f4ecff;
    --ink-soft: #cfc4e8;
    --panel: #24264a;
    --panel-edge: #0a0b1e;
    --panel-hi: #3a3d70;
    --panel-lo: #17183a;
    --cloud: #6b74b8;
    --sun: #eef0ff;
    --sun-edge: #b8bde6;
    --muted: #a49cc4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sky-top: #0d1640; --sky-bottom: #2b3a7a; --ink: #f4ecff; --ink-soft: #cfc4e8;
  --panel: #24264a; --panel-edge: #0a0b1e; --panel-hi: #3a3d70; --panel-lo: #17183a;
  --cloud: #6b74b8; --sun: #eef0ff; --sun-edge: #b8bde6; --muted: #a49cc4; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 70%);
  background-attachment: fixed;
  overflow-x: hidden;
}
img.px, .px { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: var(--accent-dark); }
code {
  font-family: var(--font-pixel);
  font-size: .7em;
  background: rgba(0, 0, 0, .08);
  padding: .25em .45em;
  border-radius: 4px;
}

/* ---------- sky ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sun {
  position: absolute; top: 70px; right: 9vw; width: 84px; height: 84px;
  background: var(--sun); box-shadow: 0 0 0 8px var(--sun-edge), 0 0 80px 30px rgba(255, 224, 102, .35);
}
.cloud {
  position: absolute; height: 28px; background: var(--cloud); opacity: .9;
  box-shadow: 28px -20px 0 0 var(--cloud), 56px -20px 0 0 var(--cloud), 84px 0 0 0 var(--cloud);
  animation: drift linear infinite;
}
.c1 { top: 12%; width: 140px; animation-duration: 90s; animation-delay: -10s; }
.c2 { top: 30%; width: 200px; animation-duration: 130s; animation-delay: -60s; opacity: .7; }
.c3 { top: 55%; width: 110px; animation-duration: 100s; animation-delay: -35s; opacity: .6; }
.c4 { top: 20%; width: 170px; animation-duration: 150s; animation-delay: -110s; opacity: .8; }
@keyframes drift { from { transform: translateX(-260px); } to { transform: translateX(110vw); } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 4px solid var(--panel-edge);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-cube { width: 34px; height: 34px; display: grid; place-items: center; }
.brand-text { font-family: var(--font-pixel); font-size: 15px; letter-spacing: 1px; text-shadow: 2px 2px 0 var(--pink); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--ink); padding: 8px 12px; font-weight: 800;
  border: 3px solid transparent; transition: transform .15s;
}
.nav a:hover { transform: translateY(-2px); color: var(--accent-dark); }
.nav a.active { background: var(--accent); color: #fff; border-color: var(--panel-edge); box-shadow: inset -3px -3px 0 var(--accent-dark), inset 3px 3px 0 #8fe06f; }
.burger { display: none; margin-left: auto; font-size: 22px; background: none; border: 3px solid var(--panel-edge); color: var(--ink); padding: 4px 10px; cursor: pointer; }
.ip-pill {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font-pixel); font-size: 10px; color: var(--ink);
  background: var(--panel-lo); border: 3px solid var(--panel-edge); padding: 8px 10px;
}
.ip-pill:hover { background: var(--gold); color: #2b2118; }

.dot { width: 10px; height: 10px; background: #b9b9b9; display: inline-block; flex: none; }
.dot.on { background: var(--on); box-shadow: 0 0 0 3px rgba(72, 214, 60, .3); animation: pulse 1.6s infinite; }
.dot.off { background: var(--off); }
.dot.big { width: 16px; height: 16px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(72, 214, 60, 0); } }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; outline: none; }
main.enter > * { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
main.enter > *:nth-child(2) { animation-delay: .06s; }
main.enter > *:nth-child(3) { animation-delay: .12s; }
main.enter > *:nth-child(4) { animation-delay: .18s; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.panel {
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  box-shadow: inset 4px 4px 0 var(--panel-hi), inset -4px -4px 0 var(--panel-lo), 6px 6px 0 rgba(0, 0, 0, .18);
}

.section { margin-top: 56px; }
.section-title, .page-head h1, .prose h2 { font-family: var(--font-pixel); line-height: 1.5; }
.section-title { display: flex; align-items: center; gap: 14px; font-size: clamp(16px, 2.4vw, 22px); text-shadow: 3px 3px 0 rgba(255, 255, 255, .5); }
.section-title .px { width: 36px; }

/* ---------- buttons ---------- */
.mc-btn {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-family: var(--font-pixel); font-size: 12px; text-decoration: none; color: #fff;
  padding: 14px 20px; background: #8b8b8b; border: 4px solid #1e1e1e;
  box-shadow: inset 4px 4px 0 #b8b8b8, inset -4px -4px 0 #5a5a5a;
  text-shadow: 2px 2px 0 #3a3a3a; transition: transform .1s;
}
.mc-btn:hover { transform: translateY(-3px); background: #9aa4ff; box-shadow: inset 4px 4px 0 #c4caff, inset -4px -4px 0 #6670cc; }
.mc-btn:active { transform: translateY(1px); }
.mc-btn.green { background: var(--accent); box-shadow: inset 4px 4px 0 #8fe06f, inset -4px -4px 0 var(--accent-dark); }
.mc-btn.green:hover { background: #6fd14d; }
.mc-btn .px { width: 22px; }

/* ---------- hero ---------- */
.hero > * { min-width: 0; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; min-height: min(62vh, 620px); }
.hero-text { container-type: inline-size; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--pink); color: #fff; border: 3px solid var(--panel-edge); font-weight: 900; font-size: 14px;
}
.badge .px { width: 18px; }
.logo {
  font-family: var(--font-pixel); font-size: min(52px, calc((100cqi - 12px) / 11.5)); margin: 22px 0 10px; white-space: nowrap; line-height: 1.15;
  color: #fff; letter-spacing: 2px;
  text-shadow: 4px 4px 0 #3d8a26, 8px 8px 0 #2b2118;
}
.logo span { color: var(--gold); text-shadow: 4px 4px 0 #c47d12, 8px 8px 0 #2b2118; }
.lead { font-size: 19px; line-height: 1.6; color: var(--ink-soft); max-width: 560px; }
.ip-box {
  display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 18px 0; padding: 12px 14px;
  background: #1e1e1e; border: 4px solid #000; box-shadow: 6px 6px 0 rgba(0, 0, 0, .25);
}
.ip-box.center { display: flex; justify-content: center; margin: 32px auto; width: fit-content; max-width: 100%; }
.ip-label { color: #a0a0a0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.ip-big { font-family: var(--font-pixel); font-size: clamp(12px, 1.5vw, 16px); color: var(--gold); background: none; padding: 0; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-art { position: relative; display: grid; place-items: center; min-height: 380px; }
.scene { position: relative; width: 300px; height: 300px; display: grid; place-items: center; perspective: 900px; }
.floaters .float { position: absolute; width: 52px; animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, .2)); }
.f1 { top: 0; left: 10px; }
.f2 { top: 20px; right: 0; animation-delay: -.8s !important; width: 44px !important; }
.f3 { bottom: 30px; left: -20px; animation-delay: -1.6s !important; }
.f4 { bottom: 0; right: 20px; animation-delay: -2.2s !important; width: 40px !important; }
.f5 { top: 46%; right: -50px; animation-delay: -1.1s !important; width: 48px !important; }
@keyframes bob { 50% { transform: translateY(-16px) rotate(6deg); } }

.mascots { display: flex; gap: 40px; margin-top: 10px; }
.mascot { position: relative; animation: hop 2.4s ease-in-out infinite; }
.mascot .px { width: 64px; border: 4px solid var(--panel-edge); box-shadow: 4px 4px 0 rgba(0, 0, 0, .2); }
.pig-mascot { animation-delay: -1.2s; }
.bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 12px;
  white-space: nowrap; background: #fff; color: #2b2118; border: 3px solid #2b2118; padding: 4px 8px; font-size: 13px; font-weight: 900;
  opacity: 0; transition: opacity .2s;
}
.mascot:hover .bubble { opacity: 1; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 70% { transform: translateY(-18px); } 80% { transform: translateY(0); } }

/* ---------- CSS 3D cubes ---------- */
.cube { --s: 100px; position: relative; width: var(--s); height: var(--s); transform-style: preserve-3d; transform: rotateX(-28deg) rotateY(45deg); }
.cube .face {
  position: absolute; inset: 0; background-size: cover; image-rendering: pixelated;
  outline: 1px solid rgba(0, 0, 0, .15);
}
.cube .top    { transform: rotateX(90deg)  translateZ(calc(var(--s) / 2)); }
.cube .bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.5); }
.cube .front  { transform: translateZ(calc(var(--s) / 2)); filter: brightness(.85); }
.cube .back   { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); filter: brightness(.75); }
.cube .left   { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.7); }
.cube .right  { transform: rotateY(90deg)  translateZ(calc(var(--s) / 2)); filter: brightness(.95); }
.cube.big { --s: 170px; }
.cube.tiny { --s: 22px; }
.cube.mini { --s: 46px; }
.cube.spin { animation: spin 14s linear infinite; }
.cube.tiny.spin { animation-duration: 8s; }
@keyframes spin { from { transform: rotateX(-28deg) rotateY(0); } to { transform: rotateX(-28deg) rotateY(360deg); } }

.block-strip { display: flex; justify-content: center; flex-wrap: wrap; gap: 26px; margin-top: 70px; perspective: 800px; }
.mini-wrap { width: 60px; height: 70px; display: grid; place-items: center; animation: bob 3s ease-in-out infinite; animation-delay: var(--d); }
.mini-wrap:hover .cube { animation: spin 1.2s linear infinite; }

/* ---------- status ---------- */
.status-card { margin-top: 30px; padding: 22px 26px; }
.status-head { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 900; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.status-grid > div { background: var(--panel-lo); padding: 12px 14px; border: 3px solid var(--panel-edge); }
.status-grid .k { display: block; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: 1px; }
.status-grid .v { font-family: var(--font-pixel); font-size: 14px; display: block; margin-top: 8px; word-break: break-word; }
.player-heads { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.player-heads .head { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-lo); border: 3px solid var(--panel-edge); padding: 4px 10px 4px 4px; }
.player-heads .head .px { width: 22px; }
.muted { color: var(--muted); }

/* ---------- features ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature { padding: 22px; transition: transform .2s; }
.feature:hover { transform: translateY(-6px) rotate(-.6deg); }
.feature-icon {
  width: 72px; height: 72px; display: grid; place-items: center; background-size: cover;
  image-rendering: pixelated; border: 4px solid var(--panel-edge); box-shadow: inset -4px -4px 0 rgba(0, 0, 0, .25);
}
.feature-icon .px { width: 44px; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .45)); }
.feature h3 { font-family: var(--font-pixel); font-size: 13px; margin: 18px 0 10px; line-height: 1.5; }
.feature p { margin: 0; color: var(--ink-soft); line-height: 1.55; }

/* ---------- page heads ---------- */
.page-head { text-align: center; padding: 20px 0 10px; }
.page-head h1 { font-size: clamp(22px, 4vw, 38px); margin: 16px 0 10px; color: #fff; text-shadow: 3px 3px 0 var(--accent-dark), 6px 6px 0 #2b2118; }
.page-head p { font-size: 18px; color: var(--ink-soft); margin: 0 auto 20px; max-width: 620px; }
.head-icon { width: 72px; animation: bob 3s ease-in-out infinite; filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, .2)); }

/* ---------- about ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-top: 28px; }
.stat { padding: 18px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stat-tex { width: 48px; height: 48px; background-size: cover; image-rendering: pixelated; border: 3px solid var(--panel-edge); }
.stat strong { font-family: var(--font-pixel); font-size: 13px; }
.stat span { font-size: 13px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.prose { padding: 26px; line-height: 1.65; }
.prose h2 { display: flex; align-items: center; gap: 12px; font-size: 15px; margin-top: 0; }
.prose h2 .px { width: 30px; }
.prose p { color: var(--ink-soft); }
.plugin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.plugin-list li { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--panel-lo); border: 3px solid var(--panel-edge); }
.plugin-list .px { width: 30px; flex: none; }
.plugin-list b { display: block; }
.plugin-list span { color: var(--ink-soft); font-size: 14px; }

/* ---------- join ---------- */
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 28px; }
.step { display: flex; gap: 18px; align-items: center; padding: 20px; }
.step-num {
  width: 70px; height: 70px; flex: none; display: grid; place-items: center; background-size: cover;
  image-rendering: pixelated; border: 4px solid var(--panel-edge);
}
.step-num span { font-family: var(--font-pixel); font-size: 22px; color: #fff; text-shadow: 3px 3px 0 #000; }
.step h3 { font-family: var(--font-pixel); font-size: 12px; margin: 0 0 8px; line-height: 1.5; }
.step p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.cmd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cmd { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.cmd code { color: var(--accent-dark); font-size: 11px; background: none; padding: 0; }
.cmd span { color: var(--ink-soft); font-size: 14px; }

/* ---------- map ---------- */
.map-frame { position: relative; height: 70vh; min-height: 420px; padding: 0; overflow: hidden; }
.map-frame iframe { position: relative; z-index: 1; width: 100%; height: 100%; border: 0; display: block; }
.map-fallback { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding: 20px; color: var(--ink-soft); }
.map-fallback .px { width: 72px; animation: hop 2s infinite; }

/* ---------- rules ---------- */
.rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 28px; }
.rule { position: relative; display: flex; gap: 18px; align-items: center; padding: 20px 22px; transition: transform .2s; }
.rule:hover { transform: scale(1.02); }
.rule > .px, .rule-tex { width: 52px; height: 52px; flex: none; }
.rule-tex { background-size: cover; image-rendering: pixelated; border: 3px solid var(--panel-edge); }
.rule h3 { font-family: var(--font-pixel); font-size: 12px; margin: 0 0 8px; }
.rule p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.rule-n {
  position: absolute; top: -14px; left: -14px; width: 34px; height: 34px; display: grid; place-items: center;
  font-family: var(--font-pixel); font-size: 12px; background: var(--gold); color: #2b2118; border: 3px solid var(--panel-edge);
}

/* ---------- faq ---------- */
.faq { display: grid; gap: 14px; max-width: 820px; margin: 28px auto 0; }
.faq-item { padding: 0; }
.faq-item summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px; padding: 18px 20px; font-size: 17px; font-weight: 900; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; margin-left: auto; font-family: var(--font-pixel); color: var(--accent-dark); }
.faq-item[open] summary::after { content: "−"; }
.faq-item summary .px { width: 26px; transition: transform .3s; }
.faq-item[open] summary .px { transform: rotate(360deg); }
.faq-item p { margin: 0; padding: 0 20px 20px 58px; color: var(--ink-soft); line-height: 1.6; }

/* ---------- 404 ---------- */
.lost-art { display: grid; place-items: center; height: 200px; perspective: 800px; }

/* ---------- footer ---------- */
.footer { position: relative; z-index: 1; }
.grass-strip { height: 22px; background-size: 44px; image-rendering: pixelated; background-repeat: repeat-x; border-top: 4px solid #2b2118; }
.dirt { background-size: 44px; image-rendering: pixelated; }
.footer-inner { background: rgba(30, 18, 8, .55); color: #f5e9d6; text-align: center; padding: 28px 20px 34px; }
.footer-items { display: flex; justify-content: center; gap: 18px; margin-bottom: 14px; }
.footer-items .px { width: 36px; filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .5)); transition: transform .2s; }
.footer-items .px:hover { transform: translateY(-6px) rotate(-8deg); }
.footer .tiny { font-size: 12px; opacity: .7; font-weight: 500; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  background: #1e1e1e; color: #fff; border: 4px solid #000; padding: 12px 18px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .3); transition: transform .3s cubic-bezier(.2, 1.4, .4, 1);
}
.toast.show { transform: translate(-50%, 0); }
.toast .px { width: 22px; }
.toast b { color: var(--gold); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .lead { margin: 0 auto; }
  .cta-row { justify-content: center; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .cmd-grid { grid-template-columns: repeat(2, 1fr); }
  .ip-pill { display: none; }
}
@media (max-width: 760px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .burger { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; margin: 6px 0 0; }
  .menu-open .nav { display: flex; }
  main { padding: 20px 16px 60px; }
  .grid-3, .two-col, .steps, .rules { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .status-grid { grid-template-columns: 1fr; }
  .scene { width: 230px; height: 230px; }
  .cube.big { --s: 120px; }
  .f5 { right: -10px; }
  .hero-art { min-height: 320px; }
  .sun { width: 56px; height: 56px; top: 90px; }
  .ip-box { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
