/* =========================================================
   PROJECT_IDENTITY
   Aesthetic: Bright pixel JRPG — title screen, party select,
              overworld map, save point
   Palette:   Sweetie 16 (16 colours, nothing outside it)
   Fonts:     Display Jersey 10 · Body Pixelify Sans · Labels Silkscreen
   Radius:    0. Corners are notched by 4px "pixels", never rounded.
   ========================================================= */

:root {
  --night: #1a1c2c;
  --plum: #5d275d;
  --red: #b13e53;
  --orange: #ef7d57;
  --yellow: #ffcd75;
  --lime: #a7f070;
  --green: #38b764;
  --teal: #257179;
  --navy: #29366f;
  --blue: #3b5dc9;
  --sky: #41a6f6;
  --cyan: #73eff7;
  --white: #f4f4f4;
  --grey: #94b0c2;
  --slate: #566c86;
  --slate-d: #333c57;

  --px: 4px;
  --f-display: "Jersey 10", "Pixelify Sans", monospace;
  --f-body: "Pixelify Sans", system-ui, sans-serif;
  --f-label: "Silkscreen", monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-ui: cubic-bezier(0.25, 1, 0.5, 1);
  --gutter: clamp(16px, 4vw, 48px);

  --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%231a1c2c' d='M0 0h2v1h1v1h1v1h1v1h1v1h1v1h1v1H6v1h1v2H6v1H4v-2H3V9H2v1H0z'/%3E%3Cpath fill='%23f4f4f4' d='M1 1h1v1h1v1h1v1h1v1h1v1h1v1H5v1h1v2H5V9H4V8H3V7H2v1H1z'/%3E%3C/svg%3E") 0 0, auto;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--white);
  font: 400 19px/1.55 var(--f-body);
  cursor: var(--cursor);
  overflow-x: hidden;
}
a, button { cursor: var(--cursor); }
img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
a { color: inherit; text-decoration: none; }
ol, ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }
::selection { background: var(--yellow); color: var(--night); }
:focus-visible { outline: var(--px) solid var(--yellow); outline-offset: var(--px); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -80px; z-index: 100; padding: 10px 14px; background: var(--yellow); color: var(--night); font: 700 14px var(--f-label); }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Pixel window (JRPG box, notched corners) ---------- */
.win {
  position: relative;
  margin: var(--px);
  background: var(--navy);
  box-shadow:
    inset 0 0 0 var(--px) var(--blue),
    inset 0 0 0 calc(var(--px) * 2) var(--night),
    0 calc(var(--px) * -1) 0 0 var(--white),
    0 var(--px) 0 0 var(--white),
    calc(var(--px) * -1) 0 0 0 var(--white),
    var(--px) 0 0 0 var(--white),
    0 calc(var(--px) * 3) 0 0 var(--night);
}

/* ---------- Typography ---------- */
.kicker { font: 400 15px/1.3 var(--f-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); }
.kicker-y { color: var(--yellow); }
.kicker-d { color: var(--night); }
.h2 {
  margin-top: 8px;
  font: 400 clamp(56px, 8vw, 112px)/0.86 var(--f-display);
  letter-spacing: -0.01em;
  text-shadow: var(--px) var(--px) 0 var(--red), calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--night);
}
.h2-dark { color: var(--night); text-shadow: var(--px) var(--px) 0 var(--lime); }
.zone-sub { margin-top: 20px; max-width: 52ch; color: var(--grey); font-size: 21px; }
.zone-sub-light { color: var(--white); }
.zone-sub-dark { color: var(--night); }

/* ---------- Pixel buttons ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 20px; }
.pbtn {
  display: inline-flex; align-items: center; gap: 10px;
  margin: var(--px);
  min-height: 48px; padding: 0 20px;
  font: 700 14px/1 var(--f-label); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--night); background: var(--yellow);
  box-shadow:
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 0 var(--orange),
    inset var(--px) var(--px) 0 0 var(--white),
    0 calc(var(--px) * -1) 0 0 var(--night),
    0 var(--px) 0 0 var(--night),
    calc(var(--px) * -1) 0 0 0 var(--night),
    var(--px) 0 0 0 var(--night),
    0 calc(var(--px) * 2) 0 0 var(--night);
  transition: transform .12s var(--ease-ui), filter .2s var(--ease-ui);
}
.pbtn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.pbtn:active { transform: translateY(var(--px)) scale(0.98); }
.pbtn-b { background: var(--sky); box-shadow:
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 0 var(--blue),
    inset var(--px) var(--px) 0 0 var(--cyan),
    0 calc(var(--px) * -1) 0 0 var(--night), 0 var(--px) 0 0 var(--night),
    calc(var(--px) * -1) 0 0 0 var(--night), var(--px) 0 0 0 var(--night),
    0 calc(var(--px) * 2) 0 0 var(--night); }
.pbtn-r { background: var(--red); color: var(--white); box-shadow:
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 0 var(--plum),
    inset var(--px) var(--px) 0 0 var(--orange),
    0 calc(var(--px) * -1) 0 0 var(--night), 0 var(--px) 0 0 var(--night),
    calc(var(--px) * -1) 0 0 0 var(--night), var(--px) 0 0 0 var(--night),
    0 calc(var(--px) * 2) 0 0 var(--night); }

/* ---------- HUD ---------- */
.hud { position: sticky; top: 0; z-index: 50; background: var(--night); border-bottom: var(--px) solid var(--slate-d); }
.hud-row { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 400 30px/1 var(--f-display); letter-spacing: 0.02em; }
.logo b { color: var(--yellow); font-weight: 400; margin-inline: 2px; }
.logo-mark { width: 48px; height: 48px; animation: bob 1s steps(2) infinite; }
.menu { display: flex; gap: 8px; margin-left: auto; font: 400 15px var(--f-label); text-transform: uppercase; }
.menu a { position: relative; display: block; padding: 8px 10px 8px 26px; color: var(--grey); transition: color .15s var(--ease-ui); }
.menu a::before { content: "▶"; position: absolute; left: 8px; color: var(--yellow); opacity: 0; transform: translateX(-4px); transition: opacity .15s var(--ease-ui), transform .2s var(--ease-out); }
.menu a:hover, .menu a:focus-visible { color: var(--white); }
.menu a:hover::before, .menu a:focus-visible::before { opacity: 1; transform: none; animation: nudge .5s steps(2) infinite; }
.hud-lv { display: flex; align-items: baseline; gap: 6px; padding: 4px 10px; background: var(--red); font-variant-numeric: tabular-nums; box-shadow: inset 0 calc(var(--px) * -1) 0 var(--plum); }
.lv { font: 700 13px var(--f-label); color: var(--yellow); }
.lv-num { font: 400 28px/1 var(--f-display); }
@media (max-width: 760px) {
  .menu { display: none; }
  .hud-player { margin-left: auto; }
}

/* ---------- Title screen ---------- */
.title-screen { position: relative; min-height: 640px; min-height: clamp(640px, calc(100svh - 68px), 960px); display: flex; overflow: hidden; background: var(--navy); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.title-inner { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding-block: clamp(40px, 7vh, 88px) clamp(32px, 5vh, 56px); }
.kicker { text-shadow: 2px 2px 0 var(--night); }
.logo-big {
  margin-top: 16px;
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.12em;
  font: 400 clamp(88px, 15vw, 232px)/0.78 var(--f-display);
  letter-spacing: 0.01em;
  color: var(--yellow);
  text-shadow:
    var(--px) var(--px) 0 var(--orange),
    calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--red),
    calc(var(--px) * 3) calc(var(--px) * 3) 0 var(--plum),
    calc(var(--px) * 4) calc(var(--px) * 4) 0 var(--night);
}
.logo-big .amp { color: var(--cyan); text-shadow: var(--px) var(--px) 0 var(--sky), calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--blue), calc(var(--px) * 3) calc(var(--px) * 3) 0 var(--night); }
.logo-big span { display: inline-block; animation: rise .7s var(--ease-out) both; }
.logo-big span:nth-child(2) { animation-delay: 80ms; }
.logo-big span:nth-child(3) { animation-delay: 160ms; }

.dialog { display: flex; gap: 20px; max-width: 720px; padding: 24px 28px 28px; background: var(--night); }
.dialog-portrait { flex: none; display: grid; place-items: center; width: 104px; height: 104px; padding: 4px; background: var(--navy); box-shadow: inset 0 0 0 var(--px) var(--blue); }
.dialog-portrait svg { width: 100%; height: 100%; animation: bob 1s steps(2) infinite; }
.dialog-body { min-width: 0; flex: 1; }
.nametag { display: inline-block; padding: 3px 10px; font: 700 14px var(--f-label); letter-spacing: 0.08em; color: var(--night); background: var(--cyan); }
.dialog-text { margin-top: 12px; min-height: 4.5em; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; }
.caret { display: inline-block; margin-left: 6px; color: var(--yellow); font-size: 0.8em; animation: blink 0.8s steps(1) infinite; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 16px; font: 400 16px var(--f-label); text-transform: uppercase; }
.choice { position: relative; display: block; padding: 6px 4px 6px 22px; color: var(--grey); transition: color .15s var(--ease-ui); }
.choice::before { content: "▶"; position: absolute; left: 2px; color: var(--yellow); opacity: 0; }
.choices li:first-child .choice { color: var(--white); }
.choices li:first-child .choice::before, .choice:hover::before, .choice:focus-visible::before { opacity: 1; animation: nudge .5s steps(2) infinite; }
.choices:hover li:first-child .choice:not(:hover)::before { opacity: 0; }
.choice:hover, .choice:focus-visible { color: var(--yellow); }
.choice:active { transform: scale(0.98); }

@media (max-width: 640px) {
  .dialog { flex-direction: column; gap: 12px; padding: 20px; }
  .dialog-portrait { position: absolute; top: -44px; right: 16px; width: 72px; height: 72px; padding: 4px; }
}

/* ---------- Zones ---------- */
.zone { position: relative; padding-block: clamp(96px, 11vw, 152px); }
.zone-head { margin-bottom: 56px; }
.edge { position: absolute; left: 0; right: 0; top: -16px; height: 16px; background-repeat: repeat-x; background-size: 32px 16px; image-rendering: pixelated; }
.edge-navy { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 4' shape-rendering='crispEdges'%3E%3Cpath fill='%2329366f' d='M0 2h1V1h2v1h1v1h2V2h2v2H0z'/%3E%3C/svg%3E"); }
.edge-grass { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 4' shape-rendering='crispEdges'%3E%3Cpath fill='%23257179' d='M0 3h8v1H0z'/%3E%3Cpath fill='%2338b764' d='M0 2h1V0h1v2h2V1h1v1h1V0h1v2h1v2H0z'/%3E%3Cpath fill='%23a7f070' d='M1 0h1v1H1zM6 0h1v1H6zM4 1h1v1H4z'/%3E%3C/svg%3E"); }
.edge-night { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 4' shape-rendering='crispEdges'%3E%3Cpath fill='%231a1c2c' d='M0 1h2v1h3V0h2v2h1v2H0z'/%3E%3C/svg%3E"); }

/* ---------- Game select ---------- */
.zone-games {
  background-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cpath fill='%23333c57' d='M0 0h1v1H0zM8 8h1v1H8z'/%3E%3C/svg%3E");
  background-size: 64px 64px;
}
.select { display: grid; grid-template-columns: 5fr 7fr; gap: 32px; align-items: start; }

.slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 24px; background: var(--night); }
.slot {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 8px; background: var(--navy);
  box-shadow: inset 0 0 0 var(--px) var(--slate-d);
  transition: transform .15s var(--ease-ui), box-shadow .15s var(--ease-ui);
}
.slot img { width: 100%; aspect-ratio: 460 / 215; object-fit: cover; }
.slot-name { display: block; margin-top: 8px; font: 400 24px/1 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-no { position: absolute; top: 0; left: 0; padding: 2px 6px; font: 700 13px var(--f-label); background: var(--night); color: var(--grey); font-variant-numeric: tabular-nums; }
.slot-demo { position: absolute; top: 0; right: 0; padding: 2px 6px; font: 700 13px var(--f-label); text-transform: uppercase; background: var(--sky); color: var(--night); }
.slot:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 var(--px) var(--sky); }
.slot:active { transform: scale(0.98); }
.slot[aria-selected="true"] { background: var(--blue); box-shadow: inset 0 0 0 var(--px) var(--yellow); }
.slot[aria-selected="true"] .slot-no { background: var(--yellow); color: var(--night); }
.slot[aria-selected="true"]::after { content: "▶"; position: absolute; left: -18px; top: 50%; margin-top: -10px; color: var(--yellow); font-size: 16px; animation: nudge .5s steps(2) infinite; }
.slot:focus-visible { outline-offset: 2px; }

.sheet { padding: 12px; overflow: hidden; }
.sheet-art { position: relative; display: block; overflow: hidden; }
.sheet-art img { width: 100%; aspect-ratio: 460 / 215; object-fit: cover; }
.sheet-date { position: absolute; right: 0; bottom: 0; padding: 6px 10px; font: 700 14px var(--f-label); background: var(--night); color: var(--yellow); font-variant-numeric: tabular-nums; }
.sheet-body { padding: 24px 20px 20px; }
.sheet-class { font: 400 15px var(--f-label); color: var(--cyan); text-transform: uppercase; }
.sheet-title { margin-top: 6px; font: 400 clamp(44px, 4.6vw, 64px)/0.9 var(--f-display); text-shadow: var(--px) var(--px) 0 var(--night); }
.sheet-desc { margin-top: 14px; max-width: 60ch; color: var(--grey); }
.rule { position: relative; margin-top: 24px; padding: 18px 18px 16px; background: var(--night); box-shadow: inset var(--px) 0 0 var(--yellow); }
.rule-tag { position: absolute; top: -10px; left: 16px; padding: 3px 8px; font: 700 13px var(--f-label); text-transform: uppercase; background: var(--yellow); color: var(--night); }
.rule p { font: 400 clamp(24px, 2.2vw, 30px)/1.05 var(--f-display); color: var(--yellow); }
.stats { width: 100%; margin-top: 20px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 10px 0; border-bottom: 2px dashed var(--slate); text-align: left; }
.stats th { font: 400 14px var(--f-label); text-transform: uppercase; color: var(--grey); }
.stats td { text-align: right; font: 400 26px/1 var(--f-display); color: var(--white); }
.sheet .btns { margin-top: 24px; }

.sheet.swap .sheet-art img, .sheet.swap .sheet-body > * { animation: pop .45s var(--ease-out) both; }
.sheet.swap .sheet-body > *:nth-child(2) { animation-delay: 40ms; }
.sheet.swap .sheet-body > *:nth-child(3) { animation-delay: 80ms; }
.sheet.swap .sheet-body > *:nth-child(4) { animation-delay: 120ms; }
.sheet.swap .sheet-body > *:nth-child(5) { animation-delay: 160ms; }

@media (max-width: 960px) {
  .select { grid-template-columns: 1fr; }
  .slots { grid-template-columns: repeat(3, 1fr); padding: 16px; gap: 10px; }
  .slot-name { font-size: 18px; }
  .slot[aria-selected="true"]::after { display: none; }
}
@media (max-width: 560px) {
  .slots { grid-template-columns: repeat(2, 1fr); }
  .sheet-body { padding: 20px 8px 8px; }
}

/* ---------- Overworld map ---------- */
.zone-map {
  background-color: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cpath fill='%23a7f070' d='M2 3h1v1H2zM11 9h1v1h-1z'/%3E%3Cpath fill='%23257179' d='M6 12h1v1H6zM13 2h1v1h-1zM12 3h1v1h-1z'/%3E%3C/svg%3E");
  background-size: 64px 64px;
  color: var(--night);
}
.map { position: relative; aspect-ratio: 1200 / 560; }
.map-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trail { fill: none; stroke-width: 8; stroke-linejoin: miter; vector-effect: non-scaling-stroke; }
.trail.done { stroke: var(--yellow); stroke-dasharray: 8 8; }
.trail.todo { stroke: var(--night); stroke-dasharray: 4 12; opacity: .6; }
.tree { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 40px; height: 50px; transform: translate(-50%, -100%); }

.node { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 0; height: 0; }
.flag {
  position: absolute; left: -16px; top: -40px; width: 32px; height: 40px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10' shape-rendering='crispEdges'%3E%3Cpath fill='%231a1c2c' d='M1 0h6v5H2v4h2v1H0V9h1z'/%3E%3Cpath fill='%23b13e53' d='M2 1h4v3H2z'/%3E%3Cpath fill='%23ef7d57' d='M2 1h2v1H2z'/%3E%3C/svg%3E");
  image-rendering: pixelated;
  animation: wave 1s steps(2) infinite;
}
.flag-demo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10' shape-rendering='crispEdges'%3E%3Cpath fill='%231a1c2c' d='M1 0h6v5H2v4h2v1H0V9h1z'/%3E%3Cpath fill='%2341a6f6' d='M2 1h4v3H2z'/%3E%3Cpath fill='%2373eff7' d='M2 1h2v1H2z'/%3E%3C/svg%3E"); }
.flag-hero { width: 40px; height: 50px; left: -20px; top: -50px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10' shape-rendering='crispEdges'%3E%3Cpath fill='%231a1c2c' d='M1 0h6v5H2v4h2v1H0V9h1z'/%3E%3Cpath fill='%23ffcd75' d='M2 1h4v3H2z'/%3E%3Cpath fill='%23f4f4f4' d='M2 1h2v1H2z'/%3E%3C/svg%3E"); }
.flag-lock { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10' shape-rendering='crispEdges'%3E%3Cpath fill='%231a1c2c' d='M2 1h4v1h1v3h1v5H0V5h1V2h1zM3 3v2h2V3z'/%3E%3Cpath fill='%23ffcd75' d='M1 6h6v3H1z'/%3E%3Cpath fill='%23ef7d57' d='M1 8h6v1H1z'/%3E%3Cpath fill='%231a1c2c' d='M3 6h2v2H3z'/%3E%3C/svg%3E"); animation: none; }
.node::after { content: ""; position: absolute; left: -12px; top: -4px; width: 24px; height: 8px; background: var(--teal); opacity: .6; }

.node .win-sm {
  position: absolute; left: 0; top: 18px; transform: translateX(-50%);
  display: block; width: max-content; max-width: 200px; padding: 12px 14px 12px;
  margin: 0;
  background: var(--night); color: var(--white);
  font-size: 15px; line-height: 1.2;
  --px: 3px;
  transition: transform .2s var(--ease-out);
}
.node.up .win-sm { top: auto; bottom: 56px; }
.node.is-latest .win-sm { top: 18px; }
.node:last-child .win-sm, .node:nth-last-child(2) .win-sm { left: auto; right: -20px; transform: none; }
.win-sm b { display: block; font: 700 14px var(--f-label); color: var(--yellow); font-variant-numeric: tabular-nums; }
.win-sm span { display: block; margin-top: 4px; font: 400 25px/0.95 var(--f-display); }
.win-sm i { display: block; margin-top: 6px; font: 400 13px var(--f-label); font-style: normal; color: var(--grey); text-transform: uppercase; }
a.win-sm:hover { transform: translateX(-50%) translateY(-4px); }
.node:nth-last-child(2) a.win-sm:hover { transform: translateY(-4px); }
a.win-sm:active { transform: translateX(-50%) scale(0.98); }
.is-latest .win-sm { background: var(--red); }
.is-latest .win-sm i { color: var(--yellow); }
.is-locked .win-sm { background: var(--slate-d); color: var(--grey); }

@media (max-width: 900px) {
  .map { aspect-ratio: auto; }
  .map-path, .tree { display: none; }
  .nodes { position: relative; display: grid; gap: 20px; padding-left: 64px; }
  .nodes::before { content: ""; position: absolute; left: 22px; top: 20px; bottom: 20px; width: 8px; background: repeating-linear-gradient(var(--yellow) 0 8px, transparent 8px 16px); }
  .node { position: relative; left: auto; top: auto; width: auto; height: auto; }
  .flag, .flag-hero { left: -60px; top: 6px; width: 32px; height: 40px; }
  .node::after { display: none; }
  .node .win-sm, .node.up .win-sm, .node.is-latest .win-sm, .node:last-child .win-sm, .node:nth-last-child(2) .win-sm { position: relative; inset: auto; transform: none; max-width: none; width: auto; }
  a.win-sm:hover, .node:nth-last-child(2) a.win-sm:hover { transform: translateY(-2px); }
}

/* ---------- Contact ---------- */
.edge-plum { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 4' shape-rendering='crispEdges'%3E%3Cpath fill='%235d275d' d='M0 2h2V0h2v2h1V1h2v1h1v2H0z'/%3E%3C/svg%3E"); }
.zone-contact {
  background-color: var(--plum);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cpath fill='%23b13e53' d='M3 4h1v1H3z'/%3E%3Cpath fill='%231a1c2c' d='M11 11h1v1h-1z'/%3E%3C/svg%3E");
  background-size: 64px 64px;
}
.contact { display: grid; grid-template-columns: 5fr 7fr; gap: 48px; align-items: start; }
.contact-head { position: sticky; top: 112px; }
.big-mascot { width: min(320px, 70%); margin-top: 48px; }
.big-mascot svg { display: block; width: 100%; height: auto; animation: bob 1.2s steps(2) infinite; filter: drop-shadow(8px 8px 0 var(--night)); }

.quest-form { display: grid; gap: 24px; padding: 36px 32px 32px; background: var(--night); }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { display: block; margin-bottom: 10px; padding: 0; font: 700 15px var(--f-label); text-transform: uppercase; letter-spacing: 0.04em; color: var(--yellow); }
.field input[type="text"], .field input[type="email"], .field textarea {
  display: block; width: 100%;
  padding: 14px 16px;
  font: 400 20px/1.4 var(--f-body); color: var(--white);
  background: var(--navy); border: 0; border-radius: 0;
  box-shadow: inset 0 0 0 var(--px) var(--slate);
  transition: box-shadow .15s var(--ease-ui), background-color .15s var(--ease-ui);
}
.field textarea { resize: vertical; min-height: 160px; }
.field input:hover, .field textarea:hover { box-shadow: inset 0 0 0 var(--px) var(--grey); }
.field input:focus, .field textarea:focus { outline: none; background: var(--blue); box-shadow: inset 0 0 0 var(--px) var(--cyan); }
.field [aria-invalid="true"] { box-shadow: inset 0 0 0 var(--px) var(--orange); }
.err { margin-top: 8px; font: 700 14px var(--f-label); color: var(--orange); }
.err:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: block; padding: 10px 14px; font: 700 15px var(--f-label); text-transform: uppercase; color: var(--grey); background: var(--navy); box-shadow: inset 0 0 0 var(--px) var(--slate-d); cursor: var(--cursor); transition: color .15s var(--ease-ui), box-shadow .15s var(--ease-ui), transform .12s var(--ease-ui); }
.chip:hover span { color: var(--white); box-shadow: inset 0 0 0 var(--px) var(--grey); }
.chip:active span { transform: scale(0.98); }
.chip input:checked + span { color: var(--night); background: var(--cyan); box-shadow: inset 0 calc(var(--px) * -1) 0 var(--sky); }
.chip input:focus-visible + span { outline: var(--px) solid var(--yellow); outline-offset: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.form-foot .pbtn { min-height: 56px; font-size: 16px; }
.pbtn[disabled] { opacity: .6; pointer-events: none; }
.form-status { font: 700 15px/1.4 var(--f-label); color: var(--lime); }
.form-status.is-error { color: var(--orange); }
.form-done h3 { font: 400 64px/0.9 var(--f-display); color: var(--lime); text-shadow: var(--px) var(--px) 0 var(--teal); }
.form-done p { margin-top: 14px; color: var(--grey); }
@media (max-width: 900px) {
  .contact { grid-template-columns: 1fr; gap: 32px; }
  .contact-head { position: static; }
  .big-mascot { width: 160px; margin-top: 28px; }
  .quest-form { padding: 28px 20px 24px; }
}

/* ---------- Save point ---------- */
.zone-save {
  background-color: var(--night);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Cpath fill='%23333c57' d='M3 5h1v1H3zM20 14h1v1h-1zM11 26h1v1h-1z'/%3E%3Cpath fill='%2394b0c2' d='M27 3h1v1h-1z'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}
.save { display: grid; grid-template-columns: 4fr 8fr; gap: 48px; align-items: center; }
.crystal { position: relative; justify-self: center; width: clamp(120px, 14vw, 180px); }
.crystal svg { width: 100%; height: auto; animation: float 1.6s steps(4) infinite; filter: drop-shadow(0 0 0 var(--cyan)); }
.crystal-shadow { display: block; width: 60%; height: 12px; margin: 20px auto 0; background: var(--slate-d); animation: shadow 1.6s steps(4) infinite; }
.save-box { padding: 40px; }
.save-text { margin-top: 20px; max-width: 52ch; color: var(--grey); font-size: 19px; }
.save-box .btns { margin-top: 32px; }
@media (max-width: 760px) {
  .save { grid-template-columns: 1fr; gap: 24px; }
  .save-box { padding: 28px 20px; }
}

/* ---------- Footer ---------- */
.footer { background: var(--night); border-top: var(--px) solid var(--slate-d); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-block: 24px; font: 500 16px var(--f-body); color: var(--grey); }
.footer-row a:hover { color: var(--yellow); }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); transition-delay: var(--d, 0ms); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Keyframes (stepped = pixel feel) ---------- */
@keyframes bob { 50% { transform: translateY(-2px); } }
@keyframes nudge { 50% { transform: translateX(3px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes wave { 50% { transform: translateY(-2px); } }
@keyframes float { 50% { transform: translateY(-12px); } }
@keyframes shadow { 50% { transform: scaleX(0.7); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Pixel scrollbar ---------- */
/* Chromium / Safari: bevelled "potion" thumb, pixel arrow buttons */
::-webkit-scrollbar { width: 20px; height: 20px; background: var(--night); }
::-webkit-scrollbar-track {
  background-color: var(--night);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4' shape-rendering='crispEdges'%3E%3Cpath fill='%23333c57' d='M1 1h1v1H1z'/%3E%3C/svg%3E");
  background-size: 8px 8px;
  box-shadow: inset 4px 0 0 var(--slate-d);
}
::-webkit-scrollbar-thumb {
  min-height: 48px;
  background-color: var(--yellow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5' shape-rendering='crispEdges'%3E%3Cpath fill='%23ef7d57' d='M0 0h4v1H0zM0 2h4v1H0zM0 4h4v1H0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 8px 10px;
  border: 4px solid var(--night);
  box-shadow: inset -4px -4px 0 var(--orange), inset 4px 4px 0 var(--white);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--cyan); box-shadow: inset -4px -4px 0 var(--sky), inset 4px 4px 0 var(--white); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5' shape-rendering='crispEdges'%3E%3Cpath fill='%2341a6f6' d='M0 0h4v1H0zM0 2h4v1H0zM0 4h4v1H0z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-thumb:active { background-color: var(--orange); box-shadow: inset 4px 4px 0 var(--red), inset -4px -4px 0 var(--yellow); }
::-webkit-scrollbar-button:single-button { display: block; width: 20px; height: 20px; background-color: var(--night); background-repeat: no-repeat; background-position: center; background-size: 12px 12px; }
::-webkit-scrollbar-button:single-button:vertical:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 6' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffcd75' d='M2 1h2v1h1v1h1v2H0V3h1V2h1z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:vertical:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 6' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffcd75' d='M0 1h6v2H5v1H4v1H2V4H1V3H0z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 6' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffcd75' d='M3 0h2v6H3V5H2V4H1V2h1V1h1z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 6' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffcd75' d='M1 0h2v1h1v1h1v2H4v1H3v1H1z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:hover { background-color: var(--slate-d); }
::-webkit-scrollbar-button:single-button:active { background-color: var(--red); }
::-webkit-scrollbar-corner { background: var(--night); }
::selection { background: var(--yellow); color: var(--night); }

/* Firefox: no pseudo-elements, so palette colours only.
   (Chromium ignores ::-webkit-scrollbar when scrollbar-color is set, hence the @supports guard.) */
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: var(--yellow) var(--night); }
  textarea { scrollbar-color: var(--cyan) var(--navy); }
}

/* =========================================================
   RPG layer: HUD stats, coins, toasts, floats, wild slime,
   save crystal, pause menu
   ========================================================= */
.hud-player { display: flex; align-items: center; gap: 10px; margin-left: 16px; }
.hud-stats { display: flex; align-items: center; gap: 8px; padding: 4px 10px; background: var(--red); font-variant-numeric: tabular-nums; box-shadow: inset 0 calc(var(--px) * -1) 0 var(--plum); }
.hud-stats.pulse { animation: pulse .6s steps(3) 2; }
.xpbar { position: relative; width: 64px; height: 12px; background: var(--night); box-shadow: inset 0 0 0 2px var(--plum); }
.xpbar i { position: absolute; inset: 2px; background: var(--lime); transform-origin: left; transform: scaleX(0); transition: transform .5s var(--ease-out); }
.gold { display: inline-flex; align-items: center; gap: 4px; font: 400 24px/1 var(--f-display); color: var(--yellow); }
.gold svg { width: 16px; height: 16px; }
.hud-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  font: 700 13px var(--f-label); text-transform: uppercase; color: var(--white);
  background: var(--slate-d); box-shadow: inset 0 calc(var(--px) * -1) 0 var(--night);
  transition: background-color .15s var(--ease-ui), transform .12s var(--ease-ui);
}
.hud-btn:hover { background: var(--slate); }
.hud-btn:active { transform: translateY(2px) scale(0.98); }
.hud-btn[aria-pressed="true"] { background: var(--teal); }
.hud-btn kbd { font: inherit; font-size: 11px; padding: 1px 4px; background: var(--night); color: var(--grey); }
@media (max-width: 1100px) { .hud-btn kbd { display: none; } }
@media (max-width: 560px) {
  .xpbar, .gold, #hud-sound { display: none; }
  .hud-player { gap: 6px; }
  .logo span { font-size: 26px; }
}

/* Coins */
.coin { position: absolute; z-index: 6; width: 28px; height: 28px; padding: 0; animation: coin 1s steps(1) infinite; filter: drop-shadow(2px 2px 0 var(--night)); }
.coin svg { width: 100%; height: 100%; }
.coin:hover { animation-duration: .4s; }
.coin:focus-visible { outline-offset: 2px; }
.coin.got { animation: none; transform: translateY(-24px); opacity: 0; transition: transform .4s var(--ease-out), opacity .4s var(--ease-out); }
.footer { position: relative; }
@keyframes coin { 0%, 100% { transform: scaleX(1); } 25%, 75% { transform: scaleX(.5); } 50% { transform: scaleX(.15); } }

/* Floating numbers */
.float { position: fixed; z-index: 90; pointer-events: none; transform: translate(-50%, -50%); font: 400 30px/1 var(--f-display); color: var(--lime); text-shadow: 2px 2px 0 var(--night), -2px -2px 0 var(--night), 2px -2px 0 var(--night), -2px 2px 0 var(--night); animation: floatup .9s var(--ease-out) forwards; }
.float.gold { color: var(--yellow); }
.float.dmg { color: var(--white); font-size: 40px; text-shadow: 3px 3px 0 var(--red), -2px -2px 0 var(--night), 2px -2px 0 var(--night), -2px 2px 0 var(--night); }
.float.cyan { color: var(--cyan); }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -180%); } }

/* Toasts */
.toasts { position: fixed; z-index: 95; top: 84px; right: 16px; display: grid; gap: 12px; justify-items: end; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 320px; padding: 12px 16px 12px 52px; position: relative;
  background: var(--night); color: var(--white);
  box-shadow: inset 0 0 0 3px var(--blue), 0 -3px 0 var(--white), 0 3px 0 var(--white), -3px 0 0 var(--white), 3px 0 0 var(--white), 0 9px 0 var(--night);
  animation: toastin .35s var(--ease-out) both;
}
.toast::before { content: "!"; position: absolute; left: 12px; top: 50%; width: 28px; height: 28px; margin-top: -14px; display: grid; place-items: center; font: 700 16px var(--f-label); color: var(--night); background: var(--cyan); }
.toast b { display: block; font: 700 13px var(--f-label); text-transform: uppercase; color: var(--cyan); }
.toast span { display: block; margin-top: 2px; font-size: 17px; line-height: 1.3; }
.toast.is-ach::before { content: "★"; background: var(--yellow); }
.toast.is-ach b { color: var(--yellow); }
.toast.is-level::before { content: "▲"; background: var(--lime); }
.toast.is-level b { color: var(--lime); }
.toast.is-coin::before { content: "G"; background: var(--yellow); }
.toast.is-save::before { content: "◆"; background: var(--cyan); }
.toast.out { animation: toastout .35s var(--ease-out) forwards; }
@keyframes toastin { from { opacity: 0; transform: translateX(24px); } }
@keyframes toastout { to { opacity: 0; transform: translateX(24px); } }
@media (max-width: 560px) { .toasts { top: 76px; left: 16px; right: 16px; justify-items: stretch; } .toast { max-width: none; } }

/* Wild slime encounter */
.wild-slime { position: fixed; z-index: 80; left: 16px; bottom: 16px; width: 72px; height: 54px; padding: 0; animation: slime-in .9s var(--ease-out) both, hop .6s steps(2) .9s infinite; }
.wild-slime svg { width: 100%; height: 100%; display: block; filter: drop-shadow(3px 3px 0 var(--night)); }
.wild-tag { position: absolute; left: 64px; top: -20px; white-space: nowrap; padding: 4px 8px; font: 700 12px var(--f-label); text-transform: uppercase; color: var(--night); background: var(--yellow); box-shadow: 0 0 0 3px var(--night); }
.wild-slime.hit svg { animation: hitflash .25s steps(2); }
.wild-slime.down { animation: poof .6s steps(4) forwards; }
.wild-slime.down .wild-tag, .wild-slime.flee .wild-tag { display: none; }
.wild-slime.flee { animation: slime-out .6s var(--ease-ui) forwards; }
@keyframes slime-in { from { transform: translateX(-120px); } }
@keyframes slime-out { to { transform: translateX(-140px); } }
@keyframes hop { 50% { transform: translateY(-6px); } }
@keyframes hitflash { 50% { filter: brightness(3) drop-shadow(3px 3px 0 var(--night)); transform: translateX(4px); } }
@keyframes poof { to { transform: scale(1.6, .2); opacity: 0; } }

/* Gold rain (Konami) */
.rain-coin { position: fixed; top: -40px; z-index: 85; width: 24px; height: 24px; pointer-events: none; animation: rain linear forwards; }
.rain-coin svg { width: 100%; height: 100%; }
@keyframes rain { to { transform: translateY(calc(100vh + 80px)); } }

/* Save crystal as a button */
.crystal { padding: 0; border: 0; background: none; }
.crystal-tip { display: block; margin-top: 14px; font: 700 13px var(--f-label); text-transform: uppercase; color: var(--cyan); text-align: center; }
.crystal:hover svg { filter: brightness(1.15); }
.crystal:active { transform: scale(0.98); }
.crystal.flash svg { animation: hitflash .3s steps(2) 2, float 1.6s steps(4) infinite; }

/* Quest log banner (readable on grass) */
.zone-banner { display: inline-block; max-width: 640px; padding: 28px 32px 30px; background: var(--night); }
.zone-banner .zone-sub { margin-top: 16px; }

/* Pause menu */
.menu-dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; padding: 36px; color: var(--white); background: var(--night); border: 0; }
.menu-dialog::backdrop { background: rgba(26, 28, 44, 0.82); }
.menu-dialog[open] { animation: pop .3s var(--ease-out); }
.menu-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 40px; }
.menu-title { margin-top: 6px; font: 400 64px/0.9 var(--f-display); color: var(--yellow); text-shadow: var(--px) var(--px) 0 var(--red); }
.pstats { margin: 20px 0 0; font-variant-numeric: tabular-nums; }
.pstats div { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 2px dashed var(--slate-d); }
.pstats dt { font: 700 13px var(--f-label); text-transform: uppercase; color: var(--grey); }
.pstats dd { margin: 0; font: 400 28px/1 var(--f-display); }
.menu-nav { margin-top: 20px; font: 400 16px var(--f-label); text-transform: uppercase; }
.menu-nav .choice { width: 100%; text-align: left; }
.menu-nav .choice:hover::before, .menu-nav .choice:focus-visible::before { opacity: 1; }
.menu-opts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.menu-opts .pbtn { min-height: 44px; font-size: 13px; }
.menu-sub { margin: 0; display: flex; justify-content: space-between; font: 400 40px/1 var(--f-display); }
.menu-sub span { font: 700 14px var(--f-label); color: var(--yellow); align-self: center; }
.ach-list { display: grid; gap: 8px; margin-top: 16px; }
.ach { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--navy); box-shadow: inset 0 0 0 3px var(--slate-d); }
.ach-ico { display: grid; place-items: center; width: 36px; height: 36px; font: 700 18px var(--f-label); background: var(--slate-d); color: var(--grey); }
.ach b { display: block; font: 400 24px/1 var(--f-display); }
.ach i { display: block; font-style: normal; font-size: 15px; color: var(--grey); }
.ach em { font: 700 12px var(--f-label); font-style: normal; color: var(--grey); white-space: nowrap; }
.ach.got { background: var(--blue); box-shadow: inset 0 0 0 3px var(--yellow); }
.ach.got .ach-ico { background: var(--yellow); color: var(--night); }
.ach.got i { color: var(--white); }
.ach.got em { color: var(--yellow); }
.menu-hint { margin-top: 16px; font-size: 15px; color: var(--grey); }
.menu-x { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; font: 700 18px var(--f-label); color: var(--white); background: var(--slate-d); }
.menu-x:hover { background: var(--red); }
@media (max-width: 760px) {
  .menu-dialog { padding: 28px 20px; }
  .menu-grid { grid-template-columns: 1fr; gap: 28px; }
}
@keyframes pulse { 50% { transform: scale(1.1); } }

@media (prefers-reduced-motion: reduce) {
  .coin, .wild-slime { animation: none !important; }
}
.menu-dialog { position: fixed; inset: 0; margin: auto; height: fit-content; }
.zone-banner { color: var(--white); }
.menu-sub { padding-right: 56px; }
@media (max-width: 440px) { .logo span { display: none; } .hud-btn { padding: 0 10px; } }
.crystal { display: block; }
.crystal svg { display: block; width: 100%; height: auto; aspect-ratio: 12 / 16; }
