/* Weebalon play screen. Layout only. Colors come from theme.css, fonts and
   the type scale from ui.css. Pixel fonts stay sharp only at whole multiples
   of 16px, and pixel art only at whole multiples of its own size. */

html, body { margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  background-image: radial-gradient(ellipse at 50% 38%, var(--ink-2) 0%, var(--ink) 62%);
  padding: 0;
  overflow-x: hidden;
}


:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }
.is-hidden { opacity: 0; pointer-events: none; }
[hidden] { display: none !important; }

/* ---------- top ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px 0 12px;
}
.logo { margin: 0; line-height: 0; }
.logo img { display: none; width: 192px; height: 84px; image-rendering: pixelated; }
[data-theme="dark"] .logo-dark { display: block; }
[data-theme="light"] .logo-light { display: block; }

.btn {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  min-height: 48px;
  padding: 8px 20px;
  border: 2px solid var(--stone);
  background: var(--stone);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  cursor: pointer;
}
.btn:hover { background: var(--cream); border-color: var(--cream); }
.btn[aria-expanded="true"] { box-shadow: none; transform: translate(4px, 4px); }

/* ---------- party picker ---------- */
.party-wrap { position: relative; }
.party {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: min(360px, 92vw);
  border: 3px solid var(--gray-sh);
  background: var(--ink-2);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 12px;
}
.grp + .grp { margin-top: 12px; }
.grp h3 {
  margin: 0 0 4px;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
}
.who {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 2px 8px;
  border: 2px solid transparent;
  background: none;
  color: var(--cream);
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}
.who:hover, .who.is-on { border-color: var(--stone); }
.who .spr { flex: none; }

/* ---------- sprites ---------- */
.spr {
  display: block;
  width: calc(48px * var(--s, 1));
  height: calc(48px * var(--s, 1));
  background: var(--sheet) 0 0 / calc(288px * var(--s, 1)) auto no-repeat;
  image-rendering: pixelated;
}
@keyframes idle { to { background-position-x: calc(-192px * var(--s, 1)); } }
.mob .spr { animation: idle 0.67s steps(4) infinite; }
@media (prefers-reduced-motion: reduce) { .mob .spr { animation: none; } }

/* ---------- locations ---------- */
.loc { margin-top: 4px; }
/* Zone tabs wrap onto as many rows as they need. Each tab has its own
   border and overlaps its neighbours by 2px, so wrapped rows stay boxed. */
.segmented { display: flex; flex-wrap: wrap; padding: 2px 0 0 2px; margin-bottom: 12px; }
.seg {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  min-height: 44px;
  padding: 7px 14px;
  border: 2px solid var(--gray-sh);
  margin: -2px 0 0 -2px;
  background: var(--ink-2);
  color: var(--gray);
  cursor: pointer;
}
.seg:hover { color: var(--cream); }
.seg.is-active { background: var(--stone); color: var(--ink); }
.dim { color: var(--gray); }
.flag { color: var(--red); margin-right: 6px; }
.seg .flag { margin: 0 0 0 8px; }
.seg.is-active .flag { color: var(--ink); }

/* ---------- stage: map, tools, panels ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 12px;
}
.frame {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--gray-sh);
  background: var(--ink-2);
  padding: 8px;
  line-height: 0;
}
.stack { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); }
.stack > * { grid-area: 1 / 1; min-width: 0; }
.ratio { aspect-ratio: 5 / 4; }
.stack img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  transition: opacity 0.2s;
}

/* z-index here makes the sprite layer one stacking context, so a sprite's own
   depth ordering can never climb above the menu, drawer or pop-up. */
.mobs { position: relative; z-index: 1; pointer-events: none; }

/* Place pins. The tip of the tailed marker sits on the spot (x, y come from
   locations.js), under the sprites so a character can stand on one. The marker
   art is 48 x 64 with the tip on row 61, so the pin is lifted 3px. The icon
   (16 x 16) sits in the round plate. Both are shown at 1x, never stretched. */
.pins { position: relative; z-index: 1; pointer-events: none; }
/* While a pin is hovered or focused, the whole layer rises above the sprites so
   its name is never covered by a character. */
.pins:has(.pin:hover, .pin:focus-visible) { z-index: 2; }
.pin {
  position: absolute;
  transform: translate(-50%, calc(-100% + 3px));
  display: block;
  width: 48px;
  height: 64px;
  padding: 0;
  border: 0;
  background:
    var(--ic, none) 16px 14px / 16px 16px no-repeat,
    url(icons/marker-tailed.png) 0 0 / 48px 64px no-repeat;
  image-rendering: pixelated;
  pointer-events: auto;
  cursor: default;
  filter: drop-shadow(2px 2px 0 var(--ink));
}
.pin:hover, .pin:focus-visible { z-index: 2; outline: none; }
.pin.is-hot::before {
  content: "!";
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  line-height: 16px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  background: var(--red);
  color: var(--cream);
}
.pin::after {
  content: attr(data-name);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  padding: 4px 8px;
  white-space: nowrap;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1.2;
  background: var(--ink);
  color: var(--cream);
  border: 2px solid var(--stone);
  display: none;
}
/* Names only while labels are on (the eye). */
.show-names .pin:hover::after, .show-names .pin:focus-visible::after { display: block; }
.show-names .pin { cursor: help; }

/* The pin tool shows its mode: plain when only this district's pins show,
   a small ALL tag when every pin shows, faded when pins are hidden. */
#btn-pins { position: relative; }
#btn-pins[data-mode="none"] { opacity: 0.5; }
#btn-pins[data-mode="all"]::after {
  content: "ALL";
  position: absolute;
  right: -2px;
  bottom: -10px;
  padding: 0 2px;
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 12px;
  letter-spacing: 1px;
  background: var(--red);
  color: var(--cream);
}
.mob {
  position: absolute;
  transform: translate(-50%, -92%);   /* feet sit on the point */
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  line-height: 1;
}
.mob:active { cursor: grabbing; }
.tags {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.tag, .me {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  line-height: 20px;
  letter-spacing: 1px;
  padding: 0 4px;
  white-space: nowrap;
  border: 2px solid var(--gray-sh);
  background: var(--ink);
  color: var(--cream);
}
.me { background: var(--stone); border-color: var(--stone); color: var(--ink); }

.tool {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--gray-sh);
  background: var(--ink-2);
  color: var(--gray);
  text-decoration: none;
  line-height: 0;
  cursor: pointer;
}
.tool:hover { color: var(--cream); border-color: var(--stone); }
.tool[aria-pressed="true"], .tool[aria-expanded="true"] { background: var(--stone); color: var(--ink); border-color: var(--stone); }
.px { width: 24px; height: 24px; display: block; }
.rail { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.hamb { position: absolute; top: 12px; left: 12px; z-index: 30; }

.slide {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 20;
  width: min(340px, 100%);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  background: var(--ink-2);
  line-height: var(--lh-body);
  visibility: hidden;
  transition: transform 0.2s, visibility 0s linear 0.2s;
}
.slide-l { left: 0; transform: translateX(-100%); border-right: 3px solid var(--gray-sh); padding-top: 72px; }
.slide-r { right: 0; transform: translateX(100%); border-left: 3px solid var(--gray-sh); }
.slide.is-open { transform: none; visibility: visible; transition: transform 0.2s; }
@media (prefers-reduced-motion: reduce) { .slide, .slide.is-open { transition: none; } }

.slide h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 24px;
  line-height: 1.3;
  color: var(--heading);
}
.slide h3 {
  margin: 12px 0 0;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
}
.slide p { margin: 0; }
.slide .dateline { color: var(--gray); }
.slide ul { list-style: none; margin: 0; padding: 0; }
.menu li + li { margin-top: 4px; }
.menu a, .menu button, .menu .soon, .slide .back {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--gray-sh);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  text-align: left;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.menu a:hover, .menu button:hover, .slide .back:hover { border-color: var(--stone); }
.menu .soon { color: var(--gray); border-style: dashed; cursor: default; }
.slide .back { width: auto; margin-bottom: 8px; background: var(--ink-2); }
.dir li { padding-left: 24px; text-indent: -24px; }
.dir .note { display: block; color: var(--gray); text-indent: 0; }

.filter {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 2px solid var(--gray-sh);
  background: var(--ink);
  color: var(--cream);
  font: inherit;
  letter-spacing: inherit;
}
.rolls li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  border-bottom: 1px dotted var(--gray-sh);
}
.rolls .gh { display: block; border: 0; font-family: var(--font-ui); letter-spacing: 2px; text-transform: uppercase; color: var(--red); padding-top: 8px; }
.rt { color: var(--gray); }
.rb { min-width: 3ch; text-align: right; font-family: var(--font-ui); color: var(--stone); white-space: nowrap; }
/* Dice art at 1x: shape and colour say which die to pick up. */
.die { display: inline-block; width: 24px; height: 24px; vertical-align: middle; image-rendering: pixelated; }
.rb .die { margin-right: 4px; }
/* In the action pop-up the dice are the point: 2x, still whole pixels. */
.pop-top .die { width: 48px; height: 48px; }

/* ---------- action bar ---------- */
.bar-wrap { position: relative; margin-top: 16px; }
.bar {
  display: grid;
  grid-template-columns: repeat(10, minmax(44px, 52px));
  gap: 6px;
  justify-content: center;
}
.slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 44px;
  padding: 0;
  border: 2px solid var(--gray-sh);
  background: var(--ink-2);
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
}
.slot:not(.is-empty) {
  /* a raised game button: light top-left edge, dark bottom-right edge */
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.12), inset -2px -2px 0 rgba(0, 0, 0, 0.45);
}
.slot:hover { border-color: var(--stone); }
.slot:not(.is-empty):active { transform: translateY(2px); }
.slot[aria-pressed="true"] {
  background: var(--stone); border-color: var(--stone); color: var(--ink);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.35), inset -2px -2px 0 rgba(255, 255, 255, 0.25);
}
/* Action art: 16 x 16 icons drawn at exactly 2x, never smoothed. */
.ico { display: block; width: 32px; height: 32px; image-rendering: pixelated; }
.slot[aria-pressed="true"] .ico { transform: translateY(1px); }
.pop-top .ico { display: inline-block; vertical-align: middle; margin-right: 8px; }
.slot.is-empty { border-style: dashed; opacity: 0.4; cursor: default; }
.slot.is-empty:hover { border-color: var(--gray-sh); }
.hk { position: absolute; top: 2px; left: 4px; font-size: 16px; line-height: 16px; color: var(--gray); }
.slot[aria-pressed="true"] .hk { color: var(--ink); }

.pop {
  position: absolute;
  bottom: calc(100% + 12px);
  z-index: 40;
  width: min(340px, 100%);
  padding: 12px;
  border: 3px solid var(--gray-sh);
  background: var(--ink-2);
  box-shadow: 4px 4px 0 var(--shadow);
}
.pop::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--arrow, 24px);
  width: 12px;
  height: 12px;
  background: var(--ink-2);
  border-right: 3px solid var(--gray-sh);
  border-bottom: 3px solid var(--gray-sh);
  transform: translate(-50%, -6px) rotate(45deg);
}
.pop-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.pop-top strong { font-family: var(--font-ui); letter-spacing: 2px; text-transform: uppercase; }
.pop-top .px { width: 24px; height: 24px; }
.roll { display: inline-flex; align-items: center; gap: 6px; color: var(--stone); font-family: var(--font-ui); }
.pop-tag { color: var(--gray); }
.pop h4 {
  margin: 8px 0 0;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
}
.pop p { margin: 0; }

/* ---------- character card ---------- */
.card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border: 3px solid var(--gray-sh);
  background: var(--ink-2);
}
.portrait {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  overflow: hidden;
  border: 2px solid var(--gray-sh);
  background: var(--ink);
}
.portrait img { display: block; width: 128px; height: 128px; image-rendering: pixelated; }
.cname {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 24px;
  line-height: 1.3;
  color: var(--heading);
}
.meta { margin: 0; color: var(--stone); }
.stat { margin: 8px 0 0 0; }
.stat + .stat { margin-top: 0; }
.k { font-family: var(--font-ui); letter-spacing: 2px; text-transform: uppercase; color: var(--gray); margin-right: 8px; }
.num {
  display: inline-block;
  min-width: 2ch;
  padding: 0 6px;
  border-bottom: 2px dashed var(--gray-sh);
  text-align: center;
  color: var(--cream);
  cursor: text;
}
.num:focus { outline: none; border-bottom-color: var(--peri); }

.foot { margin: 16px 0 0; text-align: center; color: var(--gray); }



/* ==========================================================================
   THE CONSOLE
   The play screen is one fixed-size handheld, 1520 x 848: Mikey's painted
   shell (console/shell-v3-off.png and -on.png, 760 x 424) shown at exactly 2x. Every box
   below is a socket from art/console/sockets.json times 2. Repaint the
   shell and a socket moves? Re-measure, update sockets.json, then the
   matching number here.

   play.js scales the whole console to fit the window (--fit). Big windows
   get whole steps (1, 1.5, 2...) so pixels stay square; smaller windows,
   like a laptop, shrink it smoothly instead of switching layouts.
   ========================================================================== */
:root { --fit: 1; --brass-ink: #1e1e22; --readout: #2fae7a; --readout-hi: #c8ffe2; }

body { background: #121214; background-image: none; }

.console-fit {
  width: calc(1520px * var(--fit));
  height: calc(848px * var(--fit));
  margin: 12px auto 0;
}
.console {
  position: relative;
  width: 1520px;
  height: 848px;
  transform: scale(var(--fit));
  transform-origin: 0 0;
  background: url(console/shell-v3-off.png) 0 0 / 1520px 848px no-repeat;
  image-rendering: pixelated;
}
/* Lights: the Eon 359 plate and power lamp glow while someone is playing
   (play.js, see "lights"). Both shells are the same art otherwise. */
.console.is-lit { background-image: url(console/shell-v3-on.png); }
.console > * { position: absolute; }

/* Shared: a button that is only a hit area over a painted socket. */
.power, .portrait-btn, .menu-btn, .places .seg, .tool, .slot, .home {
  margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
}

/* ---------- left wing ---------- */
/* power (socket 146,22 / 20 x 20) */
.power { left: 292px; top: 44px; width: 40px; height: 40px; border-radius: 50%; }
.power:hover { box-shadow: 0 0 0 2px var(--readout-hi); }

/* mode readout (socket 19,69 / 145 x 16) */
.readout {
  left: 38px; top: 138px; width: 290px; height: 32px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px;
  font-family: var(--font-ui); font-size: 16px; line-height: 16px;
  letter-spacing: 2px; text-transform: uppercase; color: var(--readout);
}
.readout { padding: 0 2px; }
.readout button {
  min-width: 24px; height: 28px; padding: 0 4px; border: 0; background: none;
  font: inherit; color: var(--readout); cursor: pointer;
}
/* The page arrows are painted on the shell (x 21 and 153, 10 x 10); the
   buttons are bare hit areas over them. */
.readout button:not(.mode) { width: 40px; height: 32px; font-size: 0; color: transparent; border-radius: 4px; }
.readout button:not(.mode):hover, .readout button:not(.mode):focus-visible { background: rgba(200, 255, 226, .12); }
.readout button.mode:hover, .readout button.mode:focus-visible { color: var(--readout-hi); }
.readout button[disabled] { visibility: hidden; }
.readout .mode { flex: 1; text-align: center; }

/* 9 brass buttons, one column (sockets x 13, y 94 + 20n, 156 x 17). Each
   button has a painted tab 7px in from both ends; names sit between them
   and the right tab holds the "!" flag. Spellbinding at 24px is its drawn
   12px at 2x; -2px tracking matches how Aseprite sets it. */
.places {
  left: 26px; top: 188px; width: 312px;
  display: grid; grid-template-columns: 312px;
  grid-auto-rows: 34px; row-gap: 6px;
}
.places .seg {
  position: relative; width: 312px; height: 34px;
  display: flex; align-items: center; justify-content: center; padding: 0 16px 8px;
  font-family: var(--font-display); font-size: 24px; line-height: 24px;
  letter-spacing: -2px; text-transform: none; white-space: nowrap;
  color: #4f3a26; background-size: 312px 34px; background-repeat: no-repeat;
}
.places .seg:hover { background-color: transparent; color: #f4f1ea; }
.places .seg.is-active { background-image: url(console/sel-wide.png); }
.places .seg .flag {
  position: absolute; right: 0; top: 0; width: 14px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 16px; letter-spacing: 0; color: #a3203a;
}
.places .empty { grid-column: 1 / -1; padding: 8px; color: var(--brass-ink); font-family: var(--font-ui); }

/* character card (panel 5,276 / 166 x 136; portrait 64 x 64 at 20,299) */
.portrait-btn { left: 40px; top: 598px; width: 128px; height: 128px; z-index: 2; }
.portrait-btn:hover, .portrait-btn[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--readout-hi); }
.card {
  left: 40px; top: 568px; width: 290px; height: 248px;
  display: block; margin: 0; padding: 0; border: 0; background: none; overflow: visible;
  color: var(--brass-ink);
}
.card .portrait {
  position: absolute; left: 0; top: 30px; width: 128px; height: 128px;
  border: 0; background: none; overflow: hidden;
}
.card .portrait .spr { margin: 16px; }
.card .info { position: absolute; left: 140px; top: 24px; width: 148px; }
.cname { color: var(--brass-ink); font-size: 24px; line-height: 28px; }
.meta { color: var(--brass-ink); line-height: 24px; }
.k { color: #34343a; }
.num { color: var(--brass-ink); border-bottom-color: #34343a; }
/* ---------- screen (socket 192,20 / 480 x 384) ---------- */
.stage {
  left: 384px; top: 40px; width: 960px; height: 768px;
  display: block; margin: 0; overflow: hidden; background: #121214;
}
.stack { width: 960px; height: 768px; display: grid; }
.stack img { width: 960px; height: 768px; }
.party {
  top: 16px; left: 16px; transform: none; z-index: 50;
  width: 360px; max-height: 736px; overflow-y: auto;
}

/* ---------- right wing ---------- */
/* tools 2 x 2 (sockets x 693 and 725, y 13 and 41, 22 x 22) */
.rail {
  left: 1386px; top: 26px; width: 108px; margin: 0;
  display: grid; grid-template-columns: 44px 44px; column-gap: 20px; row-gap: 12px;
}
.tool { width: 44px; height: 44px; color: var(--brass-ink); border-radius: 4px; }
.tool:hover { color: #000; background: rgba(255, 255, 255, 0.12); }
.tool[aria-pressed="true"], .tool[aria-expanded="true"] {
  background: rgba(214, 183, 122, 0.55); color: #000; border: 0;
}
.tool .px { width: 24px; height: 24px; }

/* 20 action slots, 2 x 10 (sockets x 693 and 723, y 73 + 29r, 24 x 24) */
.bar-wrap { left: 1386px; top: 146px; width: 108px; margin: 0; }
.bar {
  display: grid; grid-template-columns: 48px 48px; column-gap: 12px;
  grid-auto-rows: 48px; row-gap: 10px;
}
.slot {
  width: 48px; height: 48px; min-width: 0; aspect-ratio: auto;
  display: grid; place-items: center; color: var(--brass-ink); border-radius: 4px;
}
.slot:not(.is-empty) { box-shadow: none; }
.slot:hover { background: rgba(255, 255, 255, 0.12); }
.slot[aria-pressed="true"] { background: rgba(214, 183, 122, 0.55); box-shadow: none; color: #000; }
.slot.is-empty { border: 0; opacity: 1; cursor: default; }
.slot.is-empty:hover { background: none; }
.hk { top: 1px; left: 3px; color: #34343a; }
.slot[aria-pressed="true"] .hk { color: #000; }

/* home (socket 695,371 / 50 x 38): a little screen of its own */
.home { left: 1390px; top: 742px; width: 100px; height: 76px; display: grid; place-items: center; color: var(--readout); }
.home .px { width: 48px; height: 48px; }
.home:hover, .home[aria-pressed="true"] { color: var(--readout-hi); }
.pin[data-do] { cursor: pointer; }

/* menu: top-left of the screen, over the map (old guide spot 196,24) */
.menu-btn {
  left: 392px; top: 48px; width: 48px; height: 48px; z-index: 30;
  display: grid; place-items: center;
  background: rgba(18, 18, 20, 0.85); color: var(--readout);
  box-shadow: 0 0 0 2px #34343a;
}
.menu-btn .px { width: 24px; height: 24px; }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { color: var(--readout-hi); box-shadow: 0 0 0 2px var(--readout); }

/* The action pop-up opens to the left of the buttons, over the screen,
   with its arrow pointing at the button pressed. play.js sets its top. */
.pop { bottom: auto; right: calc(100% + 16px); width: 340px; }
.pop::after {
  top: var(--arrow, 24px);
  left: 100%;
  border-bottom: 0;
  border-top: 3px solid var(--gray-sh);
  transform: translate(-6px, -50%) rotate(45deg);
}

/* ---------- encounter mode ----------
   The wings disappear and the console is one wide screen with Mikey's
   green HUD. Panels are art/console/encounter-sockets.json times 2.
   Colour rule: green for frames and anything neutral, red only for HP,
   damage and enemies, gold only for whose turn it is. */
:root { --hud: #2fae7a; --hud-dim: #1d5c4f; --hud-red: #a3203a; --hud-gold: #d6b77a; }
.console.is-enc { background-image: url(console/encounter-hud-v1.png); }
.console.is-enc > :not(.enc):not(.npc-banner) { display: none; }
.enc { left: 0; top: 0; width: 1520px; height: 848px; color: var(--hud); font-family: var(--font-ui); }
.enc[hidden] { display: none; }
.enc > * { position: absolute; }
.panel { overflow: hidden; padding: 8px 10px; font-size: 16px; line-height: 20px; letter-spacing: 1px; text-transform: uppercase; }
/* faint scanlines on the HUD panels, never on the stage */
.panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.22) 2px 4px);
}
.p-party { left: 30px;   top: 44px;  width: 204px;  height: 592px; }
.p-top   { left: 242px;  top: 44px;  width: 1024px; height: 72px;
           display: grid; grid-template-columns: 1fr 1fr 180px; align-items: center; gap: 12px; padding: 0 16px; }
.enc-exit { left: 1366px; top: 44px; width: 112px; height: 40px; border: 0; background: none;
            color: var(--hud); font: inherit; letter-spacing: 2px; text-transform: uppercase; cursor: pointer; }
.enc-exit:hover { color: #c8ffe2; }
.p-map   { left: 1274px; top: 124px; width: 208px;  height: 206px; }
.p-track { left: 1274px; top: 344px; width: 208px;  height: 292px; }
.p-stats { left: 30px;   top: 648px; width: 204px;  height: 156px; }
.p-turns { left: 242px;  top: 648px; width: 1024px; height: 72px;
           display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.p-gear  { left: 1274px; top: 648px; width: 208px;  height: 156px; }
.enc-stage { left: 242px; top: 124px; width: 1024px; height: 512px; overflow: hidden; }
.enc-stage iframe { width: 1024px; height: 512px; border: 0; display: block; background: transparent; }
.standby img { width: 1024px; height: 512px; display: block; image-rendering: pixelated; }

/* Combat code screen: sits over the map, palette from Mikey's mockup.
   The logo and type are whole-number scales so the pixels stay crisp. */
.codescreen {
  position: absolute; inset: 0; z-index: 60; margin: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #121214; color: #ff6b7d;
}
.codescreen[hidden] { display: none; }
.codescreen img { width: 576px; height: 252px; image-rendering: pixelated; margin-bottom: 24px; }
.codescreen label { font-family: var(--font-display); font-size: 48px; line-height: 56px; letter-spacing: -2px; }
.codescreen input {
  width: 680px; height: 96px; margin-top: 24px; padding: 0 24px; box-sizing: border-box;
  border: 3px solid #ff6b7d; border-radius: 6px; background: #121214; color: #ff6b7d;
  font-family: var(--font-ui); font-size: 40px; letter-spacing: 4px; text-transform: uppercase;
  caret-color: #ff6b7d; outline: none;
}
.codescreen input:focus { box-shadow: 0 0 0 3px #4a1c25; }
.enc-msg { min-height: 32px; margin: 16px 0 0; font-family: var(--font-ui); font-size: 24px; color: #ff6b7d; }

/* party: one block per player, hearts then class resources */
.pc { margin-bottom: 16px; }
.pc-name { color: var(--hud); }
.pc.is-turn .pc-name { color: var(--hud-gold); }
.pc-hearts { display: flex; gap: 2px; margin: 4px 0; }   /* 10 x 16 + 9 x 2 = 178, fits the 184 inside the panel */
.heart { width: 16px; height: 14px; display: block; }
.res { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--hud); }
.res .pips { display: flex; gap: 3px; }
.pip { width: 8px; height: 8px; border: 2px solid var(--hud); }
.pip.on { background: var(--hud); }

/* top bar: objective, rule, clock */
.p-top .obj { color: #c8ffe2; }
.p-top .law { color: var(--hud-gold); }
.p-top .clock { text-align: right; font-size: 24px; line-height: 28px; color: #c8ffe2; }
.p-top .clock.low, .p-top .clock.out { color: var(--hud-red); }
.p-top .clock small { display: block; font-size: 12px; line-height: 14px; color: var(--hud); }

/* tracker + stats */
.big { font-size: 32px; line-height: 40px; color: #c8ffe2; }
.lost { color: var(--hud-red); }

/* turn order cards */
.tcard { width: 56px; height: 56px; display: grid; place-items: center; border: 2px solid var(--hud-dim); color: var(--hud); }
.tcard.enemy { border-color: var(--hud-red); color: var(--hud-red); }
.tcard.down { opacity: 0.35; }
.tcard.done { opacity: 0.6; }
.tcard.now { border-color: var(--hud-gold); color: var(--hud-gold); box-shadow: 0 0 0 2px var(--hud-gold); }

.foot { margin: 8px 0; }

/* Character card text at Bagura 32 (2x its drawn size, so it stays crisp). */
.card .info { left: 148px; width: 140px; }
.card .meta, .card .stat { font-size: 32px; line-height: 36px; letter-spacing: 0; }

/* ---------- NPC banner (art/console/console-shell-NPC1.png) ----------
   Bottom of the map screen, full width; over the board's lower part in a
   fight. Panel: Slate Deep #26262b at 85%. Portraits are 64x64 and shown
   at a whole-number scale (4x on the map, 3x in a fight). Name in
   Spellbinding at 3x its drawn 12px; lines in Bagura Umbreia. */
.npc-banner {
  left: 384px; top: 508px; width: 960px; height: 300px; z-index: 70;
  display: flex; align-items: flex-end; gap: 24px; padding: 0 32px 0 24px; box-sizing: border-box;
  background: rgba(38, 38, 43, 0.85); color: #f0e9de; pointer-events: none;
}
.npc-banner[hidden] { display: none; }
.npc-face { flex: none; width: 256px; height: 256px; display: block; image-rendering: pixelated; }
.npc-text { flex: 1; align-self: stretch; padding: 24px 0; overflow: hidden; }
.npc-name { font-family: var(--font-display); font-size: 36px; line-height: 44px; letter-spacing: -1px; margin-bottom: 12px; }
.npc-text p { margin: 0 0 10px; font-family: var(--font-body); font-size: 32px; line-height: 40px; }   /* 2x its drawn 16px */
.npc-text .npc-quest { margin-top: 16px; color: var(--hud-gold); }
.npc-banner.in-fight { left: 242px; top: 416px; width: 1024px; height: 220px; }
.npc-banner.in-fight .npc-face { width: 192px; height: 192px; }
.npc-banner.in-fight .npc-text { padding: 16px 0; }
