/* FULL NET — strict 1-bit: two colors only, everywhere. */

@font-face {
  font-family: "Press Start 2P";
  src: url("font/press-start-2p.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #17140e;
  --paper: #f2eee1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Press Start 2P", "Courier New", monospace;
  color: var(--ink);
  background-color: var(--ink);
  /* 2px checkerboard dither around the cabinet */
  background-image: conic-gradient(var(--paper) 25%, transparent 0 50%, var(--paper) 0 75%, transparent 0);
  background-size: 4px 4px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 18px 8px 40px;
  -webkit-font-smoothing: none;
}

#cabinet {
  position: relative;
  /* The pond is 3:4, so the cabinet's width decides the whole thing's height.
     Cap it against the viewport height as well as its own 512px design width,
     so the game fits without scrolling — both on a laptop and inside the
     shop's popup, which is where most people will meet it. 30px covers the
     cabinet's own padding and borders. */
  width: min(512px, calc(56vh * 0.75 + 30px));
  max-width: 100%;
  container-type: inline-size;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 10px 12px 12px;
}

/* ---------- top bar ---------- */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
}

#logo { font-size: 14px; letter-spacing: 2px; }

#castmeter { font-size: 8px; flex: 1; text-align: center; }

button {
  font-family: inherit;
  font-size: 9px;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
}
button:hover { background: var(--ink); color: var(--paper); }
button:active { transform: translate(3px, 3px); box-shadow: none; }
button:disabled, button.locked {
  opacity: 0.45;
  pointer-events: none;
}
#mutebtn { padding: 5px 7px; font-size: 8px; }
#mutebtn.muted { text-decoration: line-through; }

/* ---------- stage ---------- */
#stage {
  position: relative;
  border: 2px solid var(--ink);
  line-height: 0;
}

#scene {
  width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

#depthlabels span {
  position: absolute;
  right: 5px;
  font-size: 7px;
  letter-spacing: 1px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 3px 4px;
  pointer-events: none;
}

#fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
#fx canvas { position: absolute; image-rendering: pixelated; }

/* ---------- journal ---------- */
#journal {
  font-size: 8px;
  line-height: 1.6;
  min-height: 28px;
  padding: 7px 2px 3px;
  white-space: pre-wrap;
}

/* ---------- net bar ---------- */
#netbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 4px 0 10px;
}
.slot {
  border: 2px dashed var(--ink);
  opacity: 0.45;
  text-align: center;
  padding: 3px 0 4px;
}
.slot canvas { width: 100%; max-width: 66px; image-rendering: pixelated; display: block; margin: 0 auto; }
.slot .lbl { font-size: 7px; letter-spacing: 0; display: block; padding-top: 3px; }
.slot.filled { border-style: solid; opacity: 1; }
.slot.flash { animation: slotflash 0.5s steps(2, end) 2; }
@keyframes slotflash {
  0% { background: var(--paper); color: var(--ink); }
  50% { background: var(--ink); color: var(--paper); }
}

/* ---------- controls ---------- */
#controls { display: flex; gap: 8px; align-items: stretch; }
#depthbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex: 1; }
.depthbtn { padding: 9px 2px 7px; font-size: 8px; line-height: 1; }
.bandname { display: block; }
.bandfish {
  display: flex;
  gap: 1px;
  justify-content: center;
  align-items: center;
  min-height: 15px;
  padding-top: 5px;
}
.bandfish canvas { width: 22px; image-rendering: pixelated; }
.bandempty { font-style: normal; opacity: 0.4; font-size: 8px; }
/* the icons are ink-on-paper, so invert them when the button inverts */
.depthbtn:hover .bandfish canvas,
.depthbtn.chosen .bandfish canvas { filter: invert(1); }
.depthbtn.chosen { background: var(--ink); color: var(--paper); opacity: 1; }
#guidebtn { font-size: 7px; padding: 6px; }

/* An author `display` rule beats the browser's own [hidden] rule, so the dev
   toolbar stayed visible in production even with the attribute set. Anything
   toggled via `hidden` needs this guard. */
#devbar[hidden] { display: none; }
#devbar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--ink);
  font-size: 7px;
}
#devbar button { font-size: 7px; padding: 4px 6px; box-shadow: 2px 2px 0 var(--ink); }

footer {
  font-size: 7px;
  letter-spacing: 1px;
  text-align: center;
  padding-top: 10px;
  opacity: 0.5;
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: var(--paper);
  display: none;
  overflow-y: auto;
  z-index: 10;
  padding: 18px 16px;
}
.overlay.show { display: flex; }

.panel { text-align: center; margin: auto; width: 100%; }

.panel h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 4px;
  padding: 10px 0 12px;
  text-shadow: 4px 4px 0 var(--paper), 5px 5px 0 var(--ink);
}
.panel h2 { font-size: 16px; padding: 6px 0 14px; }
.panel .sub { font-size: 8px; letter-spacing: 2px; padding-bottom: 16px; }

.rules {
  border: 2px solid var(--ink);
  padding: 12px 10px;
  margin: 0 auto 16px;
  max-width: 400px;
  text-align: left;
}
.rules p { font-size: 8px; line-height: 1.9; }

.ladder {
  max-width: 400px;
  margin: 0 auto 16px;
  border: 2px solid var(--ink);
}
.ladder .lrow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 8px;
  padding: 7px 8px;
  border-bottom: 1px dashed var(--ink);
}
.ladder .lrow:last-child { border-bottom: 0; }
.ladder .lrow.top { background: var(--ink); color: var(--paper); border-bottom-style: solid; }
.ladder .lrow.none { opacity: 0.5; }

.btnrow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 6px 0 10px; }
button.big { font-size: 12px; padding: 14px 18px; }

.fine { font-size: 7px; opacity: 0.55; line-height: 1.8; }
#guidejunk { padding-top: 12px; }

/* field guide */
.grow {
  display: grid;
  grid-template-columns: 74px 1fr repeat(var(--bands, 3), 28px);
  gap: 4px;
  align-items: center;
  border-bottom: 1px dashed var(--ink);
  padding: 6px 0;
  text-align: left;
}
.grow.head { font-size: 7px; border-bottom: 2px solid var(--ink); opacity: 0.7; }
.grow canvas { width: 100%; max-width: 70px; image-rendering: pixelated; }
.grow .gname { font-size: 8px; }
.grow .gblurb { font-size: 7px; opacity: 0.6; line-height: 1.6; padding-top: 4px; }
.dots { display: flex; gap: 2px; justify-content: center; }
.dots i { width: 5px; height: 5px; background: var(--ink); }
.dots i.off { outline: 1px solid var(--ink); outline-offset: -1px; background: transparent; opacity: 0.25; }

/* end screens */
.trophy {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border: 3px double var(--ink);
  padding: 10px;
  margin: 12px auto;
  max-width: 380px;
}
.trophy .t { text-align: center; }
.trophy canvas { width: 100%; max-width: 80px; image-rendering: pixelated; }
.trophy .lbl { font-size: 7px; display: block; padding-top: 2px; }
.trophy .t.ghost { opacity: 0.35; }

.prizebanner {
  background: var(--ink);
  color: var(--paper);
  max-width: 380px;
  margin: 16px auto 0;
  padding: 14px 10px 16px;
  box-shadow: 6px 6px 0 var(--ink);
}
.prizebanner .pl {
  display: block;
  font-size: 8px;
  letter-spacing: 4px;
  padding-bottom: 10px;
}
.prizebanner .pv {
  display: block;
  font-size: 30px;
  letter-spacing: 2px;
  line-height: 1.2;
}
.prizebanner.jackpot .pv { font-size: 38px; }

.ticket {
  border: 3px dashed var(--ink);
  padding: 14px 10px;
  margin: 14px auto;
  max-width: 340px;
}
.ticket .tl { font-size: 8px; letter-spacing: 2px; opacity: 0.6; }
.ticket .code { font-size: 15px; letter-spacing: 1px; padding: 12px 0; user-select: all; }

.stamp {
  display: inline-block;
  font-size: 10px;
  border: 2px solid var(--ink);
  padding: 6px 8px;
  transform: rotate(-4deg);
  margin: 8px 0;
}

@keyframes cabshake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(2px, 2px); }
}
#cabinet.shake { animation: cabshake 0.3s steps(5) 2; }

.confetti { position: absolute; width: 5px; height: 5px; background: var(--ink); top: -10px; }

/* When the cabinet itself is short on width — a short laptop, or the shop's
   popup — shrink the chrome. A container query, not a media query: the cabinet
   can be narrow inside a perfectly wide viewport. */
@container (max-width: 470px) {
  #castmeter { font-size: 7px; white-space: nowrap; }
  .depthbtn { font-size: 7px; padding: 10px 1px; }
  #guidebtn { font-size: 6px; padding: 6px 3px; }
  .slot .lbl { font-size: 6px; }
  #logo { font-size: 12px; letter-spacing: 1px; }
}

@media (max-width: 540px) {
  body { padding: 6px 4px 20px; }
  #cabinet { box-shadow: 4px 4px 0 var(--ink); }
  .panel h1 { font-size: 26px; }
  .slot .lbl { font-size: 5px; }
}
