@font-face {
  font-family: PressStart;
  src: url("/assets/fonts/PressStart2P-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --red: #da291c;
  --green: #046a38;
  --gold: #ffd200;
  --ink: #0a120c;
  --pitch: #14532d;
  --cream: #f4f0d8;
  --panel: #0d1f12;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: PressStart, ui-monospace, monospace;
  color: var(--cream);
  background:
    repeating-linear-gradient(90deg, #114a28 0 18px, #165530 18px 36px);
  min-height: 100%;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.hide { position: absolute; left: -9999px; }

.scan {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.1) 2px 3px);
}

.tape {
  height: 28px;
  overflow: hidden;
  background: var(--red);
  color: #fff;
  border-bottom: 4px solid var(--ink);
  font-size: 8px;
  letter-spacing: .06em;
}
.tape-track {
  display: flex;
  gap: 1.8rem;
  width: max-content;
  padding: 9px 12px 0;
  animation: tape 24s linear infinite;
}
@keyframes tape { to { transform: translateX(-50%); } }

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 4px solid var(--gold);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--gold);
}
.brand img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 3px solid var(--gold);
}
.nav nav { display: flex; gap: 14px; font-size: 8px; }
.nav nav a:hover { color: var(--gold); }
.btn {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 12px;
  font-size: 8px;
  line-height: 1.4;
}
.btn.gold { background: var(--gold); color: var(--ink); margin-left: 0; }
.btn:hover { transform: translate(-1px,-1px); }

.stage, .lore, .howto, .open, .shop {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 16px 10px;
}
.eyebrow {
  text-align: center;
  color: var(--gold);
  font-size: 8px;
  letter-spacing: .12em;
  margin-bottom: 14px;
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.stage-head h1 {
  font-size: clamp(16px, 4vw, 28px);
  color: #fff;
  text-shadow: 4px 4px 0 var(--ink);
}
.sound {
  background: var(--panel);
  color: var(--gold);
  border: 3px solid var(--gold);
  padding: 8px 10px;
  font-size: 8px;
}

.modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.mode {
  background: var(--panel);
  color: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 8px 10px;
  font-size: 8px;
}
.mode.is-on { background: var(--gold); color: var(--ink); }
.mode-note {
  font-size: 7px;
  line-height: 1.7;
  opacity: .8;
  margin-bottom: 12px;
}

#game-container {
  position: relative;
  width: min(100%, 800px);
  margin: 0 auto;
  aspect-ratio: 2 / 1;
  border: 4px solid var(--gold);
  box-shadow: 8px 8px 0 var(--ink);
  overflow: hidden;
  background: #2e5d32;
}
canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#hud {
  position: absolute;
  top: 8px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-around;
  font-size: 9px;
  text-shadow: 2px 2px #000;
  pointer-events: none;
}
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 10, .86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
}
.overlay-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 3px solid var(--gold);
}
.overlay h3 { font-size: 14px; color: var(--gold); text-align: center; }
.overlay-sub, .overlay-keys {
  font-size: 7px;
  line-height: 1.7;
  text-align: center;
  max-width: 420px;
  opacity: .9;
}
.hidden { display: none !important; }
#controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 14px 0 8px;
}
.ctrl {
  min-width: 64px;
  height: 48px;
  background: #222;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 3px 3px 0 #000;
  font-size: 10px;
}
.ctrl.shoot { background: var(--red); min-width: 88px; }
.ctrl:active { transform: translateY(2px); }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.stats div {
  background: var(--panel);
  border: 3px solid var(--ink);
  padding: 10px 8px;
  text-align: center;
}
.stats span { display: block; color: var(--gold); font-size: 6px; margin-bottom: 8px; }
.stats b { font-size: 14px; }

.banner-band {
  max-width: 1040px;
  margin: 24px auto;
  padding: 0 16px;
}
.banner-band img {
  width: 100%;
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

.album { max-width: 1040px; margin: 0 auto; padding: 28px 16px 10px; }
.album-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.album-grid figure {
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.album-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.album-grid figcaption {
  padding: 8px 10px;
  font-size: 8px;
  color: var(--gold);
  text-align: center;
}

.facts-strip {
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.facts-strip div {
  background: rgba(0,0,0,.28);
  border: 3px solid var(--ink);
  padding: 12px;
}
.facts-strip small { display: block; color: var(--gold); font-size: 6px; margin-bottom: 8px; }
.facts-strip strong { font-size: 8px; line-height: 1.6; }

.kicker { color: var(--gold); font-size: 8px; letter-spacing: .14em; margin-bottom: 10px; }
h2 { font-size: 14px; margin-bottom: 12px; color: #fff; }

.lore {
  display: grid;
  grid-template-columns: minmax(0, 300px) 1fr;
  gap: 20px;
  align-items: center;
}
.lore img { border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.lore p { font-size: 9px; line-height: 1.8; margin-top: 10px; }
.rule { color: var(--gold); }

.howto ol { list-style: none; display: grid; gap: 12px; }
.howto li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  background: rgba(0,0,0,.28);
  border: 3px solid var(--ink);
  padding: 12px;
}
.howto li b { color: var(--gold); font-size: 12px; }
.howto h3 { font-size: 10px; margin-bottom: 6px; }
.howto p { font-size: 8px; line-height: 1.7; }

.note { font-size: 7px; line-height: 1.7; opacity: .8; margin-bottom: 14px; }
.boards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.boards > div {
  background: var(--panel);
  border: 3px solid var(--ink);
  padding: 12px;
  overflow: auto;
}
.boards h3 { font-size: 8px; color: var(--gold); margin-bottom: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 7px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #1f3a28; }
th { color: var(--gold); }

.shop { text-align: center; }
.shop-status { color: var(--gold); font-size: 9px; margin-bottom: 16px; }
.shop-label { font-size: 7px; letter-spacing: .16em; margin-bottom: 8px; }
.ca-card {
  display: block;
  width: min(100%, 640px);
  margin: 0 auto 14px;
  background: var(--panel);
  color: var(--gold);
  border: 3px solid var(--gold);
  padding: 16px 12px;
  font-size: 9px;
  word-break: break-all;
  cursor: pointer;
}
.shop-foot { font-size: 7px; line-height: 1.8; opacity: .85; }

footer {
  margin-top: 28px;
  padding: 16px;
  text-align: center;
  font-size: 8px;
  line-height: 1.7;
  background: var(--panel);
  border-top: 4px solid var(--gold);
}
#footer-ca { cursor: pointer; color: var(--gold); }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  background: var(--gold);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 12px;
  font-size: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .18s ease;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .stats, .facts-strip, .boards, .album-grid { grid-template-columns: 1fr 1fr; }
  .lore { grid-template-columns: 1fr; }
  .nav { flex-wrap: wrap; }
  .nav nav { width: 100%; order: 3; }
}
@media (max-width: 560px) {
  .stats, .facts-strip, .boards, .album-grid { grid-template-columns: 1fr; }
  .stage-head { flex-direction: column; align-items: flex-start; }
}
