/* Pixel escape room styles. Chunky borders, no smoothing, readable text (18px+). */
:root {
  --ink: #0e1118;
  --ink-2: #1b1f2a;
  --ink-3: #2a3040;
  --paper: #f4f1ea;
  --paper-2: #fffdf8;
  --line: #14181f;
  --alert: #f2994a;
  --alert-deep: #b8501a;
  --ok: #3fd68a;
  --danger: #e03c3c;
  --muted: #aeb4be;
  --px-w: 960px;
  --font: "VT323", "Courier New", monospace;
  --font-title: "Press Start 2P", "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 30%, #1a2030, var(--ink) 70%);
  color: var(--paper);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.35;
  overflow-x: hidden;
}
button { font: inherit; }
:focus-visible { outline: 3px solid var(--alert); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  font-family: var(--font);
  background: var(--ink-3);
  border: 2px solid var(--line);
  box-shadow: 0 2px 0 var(--line);
  padding: 0 6px;
  border-radius: 3px;
}

.px-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
}

/* ---- HUD -------------------------------------------------------------------------- */
.px-hud, .px-bar {
  width: var(--px-w);
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--ink-2);
  border: 4px solid var(--line);
  box-shadow: inset 0 0 0 2px var(--ink-3);
  padding: 6px 14px;
}
.px-hud__room { font-weight: 700; color: var(--alert); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.px-hud__objective { flex: 1; min-width: 0; font-size: 18px; color: var(--paper); }
.px-hud__objective::before { content: "★ "; color: var(--alert); }
.px-hud__timer {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--alert);
  background: var(--ink);
  border: 3px solid var(--line);
  padding: 6px 10px;
  white-space: nowrap;
}
.px-hud__timer.is-warn { color: #ffb36b; border-color: var(--alert-deep); }
.px-hud__timer.is-critical { color: #fff; background: var(--danger); }
@media (prefers-reduced-motion: no-preference) {
  .px-hud__timer.is-critical { animation: px-pulse 1s steps(2) infinite; }
}
@keyframes px-pulse { 50% { background: #7a1f1f; } }

.px-bar__inv { white-space: nowrap; color: var(--muted); }
.px-bar__prompt {
  flex: 1;
  text-align: center;
  color: var(--ink);
  font-weight: 700;
  visibility: hidden;
}
.px-bar__prompt.is-on {
  visibility: visible;
  background: var(--paper);
  border: 3px solid var(--line);
  padding: 2px 10px;
}
.px-bar__btns { display: flex; gap: 8px; }

/* ---- Stage ------------------------------------------------------------------------ */
.px-stage { position: relative; line-height: 0; }
#px-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid var(--line);
  box-shadow: 0 0 0 4px var(--ink-3), 0 18px 40px rgba(0,0,0,.6);
  background: #000;
}
.px-stage > *:not(canvas) { line-height: 1.35; }

/* ---- Buttons ----------------------------------------------------------------------- */
.px-btn {
  color: var(--paper);
  background: var(--ink-3);
  border: 3px solid var(--line);
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.08);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 18px;
}
.px-btn:hover { background: #38405a; }
.px-btn:active { box-shadow: inset 3px 3px 0 rgba(0,0,0,.35); }
.px-btn--big {
  font-size: 22px;
  padding: 10px 22px;
  background: var(--alert);
  color: var(--ink);
  font-weight: 700;
}
.px-btn--big:hover { background: #ffb36b; }

/* ---- Dialog box ---------------------------------------------------------------------- */
.px-dialog {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--ink-2);
  border: 4px solid var(--paper);
  box-shadow: 0 0 0 4px var(--line), 0 10px 0 rgba(0,0,0,.35);
  padding: 14px 16px;
  cursor: pointer;
  z-index: 5;
}
.px-dialog[hidden] { display: none; }
.px-dialog__face {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  image-rendering: pixelated;
  border: 3px solid var(--line);
  box-shadow: 0 0 0 2px var(--paper);
}
.px-dialog__col { flex: 1; min-width: 0; }
.px-dialog__name { color: var(--alert); font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: .05em; }
.px-dialog__name:empty { display: none; }
.px-dialog__text { margin: 2px 0 0; font-size: 21px; min-height: 2.7em; }
.px-dialog__more { align-self: flex-end; color: var(--alert); font-size: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .px-dialog__more { animation: px-bob .7s steps(2) infinite; }
}
@keyframes px-bob { 50% { transform: translateY(4px); } }

.px-choices { display: grid; gap: 4px; margin-top: 8px; }
.px-choice {
  text-align: left;
  color: var(--paper);
  background: transparent;
  border: 2px solid transparent;
  padding: 3px 8px 3px 26px;
  font-size: 19px;
  cursor: pointer;
  position: relative;
}
.px-choice.is-selected { background: var(--ink-3); border-color: var(--alert); }
.px-choice.is-selected::before { content: "▶"; position: absolute; left: 6px; color: var(--alert); font-size: 14px; top: 7px; }

/* ---- Panels (case files, map, keypad) -------------------------------------------------- */
.px-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(7, 9, 13, .78);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}
.px-panel[hidden] { display: none; }
.px-panel__sheet {
  width: min(560px, 100%);
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--line);
  box-shadow: 0 0 0 4px var(--paper-2), 0 0 0 8px var(--line), 0 20px 0 rgba(0,0,0,.4);
  padding: 16px 18px 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.px-panel--wide .px-panel__sheet { width: min(1040px, 100%); }
/* "More below" cue for sheets taller than the window, so buttons under the fold are not missed. */
.px-panel__sheet.has-more::after {
  content: "▼ more below · scroll or PgDn";
  position: sticky; bottom: -20px; display: block; margin: 8px -18px -20px; padding: 10px 0 6px;
  text-align: center; font-size: 20px; color: #ffd27a; background: linear-gradient(transparent, #05070b 55%); pointer-events: none;
}
/* Docked puzzle: the head and controls stay put, the text and figures scroll between them. */
.px-panel__sheet.is-docked { display: flex; flex-direction: column; overflow: hidden; }
.px-panel__sheet.is-docked > .px-panel__head { flex: none; }
.px-panel__scroll { flex: 0 1000 auto; min-height: 60px; overflow-y: auto; padding-bottom: 8px; }
.px-panel__dock { flex: 0 1 auto; min-height: 0; overflow-y: auto; display: grid; gap: 12px; justify-items: center; text-align: center; font-size: 26px; padding-top: 12px; border-top: 3px dashed color-mix(in srgb, var(--mood, #c9bfa9) 40%, transparent); }
.px-panel__dock p { margin: 0; }
.px-panel__dock .px-puzzle__status:empty { display: none; }
/* Short screens: squeeze the docked controls so the figure above keeps most of the room. */
@media (max-height: 820px) {
  .px-panel__sheet.is-docked { width: min(1040px, 100%); padding-block: 10px 12px; }
  .px-panel__scroll { gap: 8px; font-size: 22px; }
  .px-panel__dock { gap: 6px; padding-top: 8px; font-size: 22px; }
  .px-panel__dock .px-lock { padding: 6px; }
  .px-panel__dock .px-dial { grid-template-columns: auto auto auto; align-items: center; }
  .px-panel__dock .px-dial__label { grid-column: 1 / -1; }
  .px-panel__dock .px-dial button { width: 40px; }
  .px-panel__dock .px-dial__num { width: 52px; padding: 4px 0; font-size: 22px; }
  .px-panel__dock .px-tip { margin: 0; font-size: 17px; }
  .px-panel__dock .px-key { padding: 2px 0; font-size: 20px; }
  .px-panel__dock .px-keypad__keys { width: 100%; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; }
  .px-panel__dock .px-keypad__screen { padding: 4px 12px; font-size: 24px; }
  .px-panel__dock .px-tank__controls { gap: 2px; }
  .px-panel__dock :is(.px-opt, .px-knob__input) { padding: 1px 10px; font-size: 21px; }
  .px-panel__dock .px-btn--big { padding-block: 6px; }
}
/* Short but wide screens, puzzles with a graph: controls go in a column on the right, so the graph gets the full height. */
@media (max-height: 820px) and (min-width: 1000px) {
  .px-panel__sheet.is-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 36%); grid-template-rows: auto minmax(0, 1fr); column-gap: 18px; }
  .px-panel__sheet.is-side > .px-panel__head { grid-column: 1 / -1; }
  .px-panel__sheet.is-side .px-panel__scroll { min-height: 0; }
  .px-panel__sheet.is-side .px-panel__dock { align-content: center; padding: 0 0 0 18px; border-top: 0; border-left: 3px dashed color-mix(in srgb, var(--mood, #c9bfa9) 40%, transparent); }
  .is-side .px-panel__scroll .px-figure { max-height: calc(100vh - 220px); }
  /* The microscope has four lines of text above its slide: keep the whole slide on screen under them. */
  .is-side .px-panel__scroll .px-scope { max-height: calc(100vh - 360px); }
  /* The text stays readable and the graph gives way, so both fit. Click a graph to enlarge it. */
  .px-panel__sheet.is-side .px-panel__scroll :is(p, .px-paper) { font-size: 20px; line-height: 1.25; }
  .px-panel__sheet.is-side .px-panel__scroll .px-paper { padding-block: 8px; }
  .is-side .px-panel__scroll { display: flex; flex-direction: column; }
  .is-side .px-panel__scroll > * { flex: none; }
  .is-side .px-panel__scroll > .px-figure:not(.px-scope) { flex: 0 1 auto; min-height: 180px; object-fit: contain; }
  .is-side .px-panel__scroll:has(> .px-figure ~ .px-figure) { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
  .is-side .px-panel__scroll:has(> .px-figure ~ .px-figure) > :not(.px-figure) { grid-column: 1 / -1; }
  .is-side .px-panel__scroll:has(> .px-figure ~ .px-figure) > .px-figure { width: 100%; max-height: 220px; min-height: 0; margin: 0; }
}
/* Read-only pages with two figures: side by side, so neither hides under the other. */
@media (min-width: 1000px) {
  .px-panel__sheet:not(.is-docked) .px-puzzle:has(> .px-figure ~ .px-figure) { grid-template-columns: 1fr 1fr; align-items: start; }
  .px-panel__sheet:not(.is-docked) .px-puzzle:has(> .px-figure ~ .px-figure) > :not(.px-figure) { grid-column: 1 / -1; }
}
/* Hess calorimeter: each card and its multipliers on one line, so the target above stays in view. */
@media (max-height: 820px) and (min-width: 1000px) {
  /* Six or so steppers in one column would leave no room for the text above them. */
  .px-panel__dock .px-tank__controls:has(> :nth-child(5)) { grid-template-columns: repeat(2, auto); column-gap: 28px; }
  .px-panel__dock .px-hess__eq { flex-basis: auto; font-size: 19px; }
}
.px-panel__sheet.is-docked.has-more::after { content: none; }
/* Docked: the cue sits at the bottom of the box that scrolls, right where the hidden part is.
   The negative margin keeps it from adding height, or it would keep itself switched on. */
.px-panel__sheet.is-docked.has-more .px-panel__scroll::after { content: "▼ more in this box · scroll or PgDn"; justify-self: stretch; width: 100%; position: sticky; bottom: -8px; display: block; box-sizing: border-box; height: 42px; margin-top: -42px; padding: 14px 0 4px; text-align: center; font-size: 20px; color: #ffd27a; background: linear-gradient(transparent, #05070b 55%); pointer-events: none; }
.px-panel__head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; border-bottom: 4px dashed #c9bfa9; padding-bottom: 8px; }
.px-panel__title { margin: 0; font-family: var(--font-title); font-size: 15px; line-height: 1.5; color: var(--alert-deep); }
.px-panel__close { color: var(--paper); }
.px-tip { margin: 0 0 12px; font-size: 18px; color: #4a4f58; }

/* Case files */
.px-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.px-file {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  color: var(--ink);
  background: #f7e7b4;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(0,0,0,.25);
  padding: 22px 12px 12px;
  cursor: pointer;
  font-size: 17px;
  overflow: hidden;
}
.px-file:hover { background: #fbefc6; }
.px-file__tab {
  position: absolute;
  top: 0;
  left: 10px;
  background: var(--alert);
  border: 3px solid var(--line);
  border-top: 0;
  padding: 0 8px;
  font-weight: 700;
  font-size: 16px;
}
.px-file__name { font-weight: 700; font-size: 18px; }
.px-file__small { font-size: 16px; color: #4a4f58; }
.px-file__flag { font-weight: 700; color: #6b6f78; font-size: 16px; }
.px-file__flag:empty { display: none; }
.px-file.is-aside { background: #d9d6cd; color: #5a5f68; }
.px-file.is-aside .px-file__name { text-decoration: line-through; }
.px-file.is-aside::after {
  content: "SET ASIDE";
  position: absolute;
  right: 6px;
  top: 30px;
  transform: rotate(-12deg);
  border: 3px solid #6b6f78;
  color: #6b6f78;
  font-family: var(--font-title);
  font-size: 11px;
  padding: 4px 6px;
  background: rgba(255,255,255,.4);
}

/* Festival map */
.px-map { background: #e9dfc4; border: 3px solid var(--line); padding: 12px; }
.px-map__row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.px-map__street {
  margin: 10px -12px;
  padding: 8px;
  text-align: center;
  background: #5a5f68;
  color: var(--paper);
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: .2em;
  background-image: linear-gradient(90deg, transparent 0 40%, #f4f1ea 40% 60%, transparent 60%);
  background-size: 48px 3px;
  background-repeat: repeat-x;
  background-position: 0 50%;
}
.px-stall {
  position: relative;
  background: var(--paper-2);
  border: 3px solid var(--line);
  padding: 0 8px 8px;
  font-size: 16px;
  overflow: hidden;
}
.px-stall__awning {
  height: 14px;
  margin: 0 -8px 6px;
  border-bottom: 3px solid var(--line);
  background: repeating-linear-gradient(90deg, var(--c, #e06c75) 0 12px, #fffdf8 12px 24px);
}
.px-stall--1 { --c: #e06c75; } .px-stall--2 { --c: #e5c07b; } .px-stall--3 { --c: #f7e36b; } .px-stall--4 { --c: #c0392b; }
.px-stall--5 { --c: #c9a0dc; } .px-stall--6 { --c: #e5a050; } .px-stall--7 { --c: #6fa8dc; } .px-stall--8 { --c: #3f9b6e; }
.px-stall__num { font-family: var(--font-title); font-size: 14px; color: var(--alert-deep); }
.px-stall__name { font-weight: 700; font-size: 18px; line-height: 1.15; margin: 2px 0; }
.px-stall__sells { color: #4a4f58; }
.px-stall__permit { margin-top: 6px; background: var(--ink); color: var(--paper); display: inline-block; padding: 1px 6px; }
.px-stamp {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  border: 4px solid var(--danger);
  color: var(--danger);
  font-family: var(--font-title);
  font-size: 14px;
  padding: 6px 8px;
  background: rgba(255,253,248,.85);
}

/* Keypad */
.px-keypad { display: grid; gap: 12px; justify-items: center; }
.px-keypad__screen {
  width: 100%;
  max-width: 300px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 30px;
  letter-spacing: .1em;
  color: var(--ok);
  background: #0b1a12;
  border: 4px solid var(--line);
  box-shadow: inset 0 0 0 3px #173626;
  padding: 16px 8px;
}
.px-keypad__screen.is-shake { animation: px-shake .35s steps(4); color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .px-keypad__screen.is-shake { animation: none; } }
@keyframes px-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }
.px-keypad__keys { display: grid; grid-template-columns: repeat(3, 76px); gap: 8px; }
.px-key {
  height: 60px;
  font-size: 24px;
  font-weight: 700;
  color: var(--paper);
  background: #3a4150;
  border: 3px solid var(--line);
  box-shadow: inset -4px -4px 0 rgba(0,0,0,.35), inset 4px 4px 0 rgba(255,255,255,.1);
  cursor: pointer;
}
.px-key:hover { background: #4a5266; }
.px-key:active { box-shadow: inset 4px 4px 0 rgba(0,0,0,.35); }
.px-key--ok { background: var(--alert-deep); }
.px-keypad__msg { margin: 0; max-width: 420px; text-align: center; font-size: 18px; min-height: 2.7em; }

/* ---- Title / end screens --------------------------------------------------------------- */
.px-screen {
  position: absolute;
  inset: 4px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
  background: rgba(10, 12, 18, .86);
}
.px-screen[hidden] { display: none; }
.px-logo {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(30px, 6vw, 64px);
  color: var(--alert);
  text-shadow: 4px 4px 0 var(--alert-deep), 8px 8px 0 var(--line);
  letter-spacing: .06em;
}
.px-logo--small { font-size: clamp(20px, 3.6vw, 36px); }
.px-screen__eyebrow { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .2em; font-size: 16px; }
.px-screen__sub { margin: 0; font-size: 22px; color: var(--paper); }
.px-screen__text { margin: 0; max-width: 640px; font-size: 20px; }
.px-keys { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; font-size: 18px; color: var(--muted); }
.px-stats { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.px-stats div { background: var(--ink-2); border: 3px solid var(--line); padding: 8px 14px; display: grid; }
.px-stats span { font-size: 16px; color: var(--muted); }
.px-stats strong { font-size: 24px; color: var(--alert); }

/* ---- Toasts ------------------------------------------------------------------------------ */
.px-toasts { position: absolute; top: 14px; left: 0; right: 0; display: grid; justify-items: center; gap: 6px; z-index: 15; pointer-events: none; }
.px-toast {
  background: var(--danger);
  color: #fff;
  border: 3px solid var(--line);
  padding: 4px 14px;
  font-weight: 700;
  transition: opacity .4s;
}
.px-toast.is-out { opacity: 0; }

/* ---- Small screens ------------------------------------------------------------------------ */
@media (max-width: 760px) {
  body { font-size: 18px; }
  .px-hud, .px-bar { flex-wrap: wrap; gap: 8px; }
  .px-hud__objective { flex-basis: 100%; order: 3; }
  .px-dialog { left: 6px; right: 6px; bottom: 6px; padding: 8px; }
  .px-dialog__face { width: 48px; height: 48px; }
  .px-dialog__text { font-size: 18px; }
  .px-map__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Permit numbers are puzzle answers: show them in the chunky, unambiguous title font. */
.px-stall__permit { font-size: 14px; padding: 3px 6px; }
.px-stall__permit strong { font-family: var(--font-title); font-size: 15px; letter-spacing: .08em; color: #ffd27a; }


/* ---- Full-screen layout: the game canvas fills the window and the HUD floats above it. ---- */
html, body { overflow: hidden; }
.px-wrap { display: block; min-height: 0; padding: 0; }
.px-stage { position: fixed; inset: 0; }
#px-canvas { width: 100vw; height: 100vh; border: 0; box-shadow: none; }
.px-hud, .px-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  width: auto;
  max-width: none;
  z-index: 4;
}
.px-hud { top: 10px; }
.px-bar { bottom: 10px; }
.px-screen { position: fixed; inset: 0; }
.px-dialog {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 74px;
  width: min(1100px, calc(100vw - 32px));
  transform: translateX(-50%);
  max-height: calc(100vh - 150px);
  overflow-y: auto;
}
.px-toasts { position: fixed; top: 72px; }

/* Investigation documents */
.px-definition { background: #fff3c4; border: 3px solid var(--line); padding: 10px 14px; margin-bottom: 12px; }
.px-definition h3 { margin: 0 0 4px; font-size: 20px; color: var(--alert-deep); }
.px-definition p { margin: 0; }
.px-definition ol { margin: 6px 0 0; padding-left: 24px; }
.px-table { width: 100%; border-collapse: collapse; background: var(--paper-2); font-size: 19px; }
.px-table th, .px-table td { border: 2px solid var(--line); padding: 7px 10px; text-align: left; }
.px-table th { background: var(--ink-3); color: var(--paper); }
.px-table tbody tr:nth-child(even) { background: #efe8d7; }
.px-note { margin: 12px 0 0; font-weight: 600; }
.px-file__tab { font-size: 15px; }


/* ---- Clearer reading text: VT323 has unmistakable digits but runs small, so size it up. ---- */
body { font-size: 25px; line-height: 1.2; }
.px-hud__room, .px-hud__objective, .px-btn, .px-bar__inv, .px-bar__er { font-size: 25px; }
.px-bar__prompt { font-size: 26px; }
.px-dialog__name { font-size: 24px; }
.px-dialog__text { font-size: 29px; line-height: 1.15; }
.px-choice { font-size: 27px; }
.px-choice.is-selected::before { top: 6px; }
.px-tip { font-size: 25px; color: #30343b; }
.px-file { font-size: 25px; }
.px-file__name { font-size: 27px; }
.px-file__tab, .px-file__flag { font-size: 23px; }
.px-definition, .px-definition h3 { font-size: 26px; }
.px-table { font-size: 30px; }
.px-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.px-stall { font-size: 23px; }
.px-stall__name { font-size: 26px; }
.px-keypad__msg { font-size: 26px; }
.px-key { font-size: 34px; }
.px-screen__sub { font-size: 30px; }
.px-screen__text { font-size: 28px; }
.px-keys, .px-stats span, kbd { font-size: 25px; }
.px-toast { font-size: 26px; }
.px-panel__sheet { color: #101319; }
.px-bar__er { color: #ff7a70; white-space: nowrap; }


/* ---- Main menu ---- */
.px-menu { background: linear-gradient(rgba(25, 4, 6, .78), rgba(8, 10, 16, .92)); gap: 10px; }
.px-menu__tag { margin: 0 0 8px; font-size: 30px; color: #ffb3a8; }
.px-menu__list { display: grid; gap: 7px; width: min(390px, 90vw); }
.px-menu__item {
  font-size: 30px;
  padding: 7px 18px;
  color: var(--paper);
  text-align: center;
  background: var(--ink-3);
  border: 3px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35);
}
.px-menu__item.is-selected { color: var(--ink); background: var(--alert); }
.px-menu__keys { margin: 8px 0 0; font-size: 23px; color: var(--muted); }
.px-settings { display: grid; gap: 10px; }
.px-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 12px; color: var(--paper); background: var(--ink-3); border: 3px solid var(--line); cursor: pointer; font-size: 26px; text-align: left; }
.px-setting strong { color: #ffc27f; white-space: nowrap; }
.px-setting small { display: block; color: #cfd4da; font-size: 21px; }
/* Always show which level is picked, even when the panel was opened by mouse. */
.px-setting:focus { border-color: #ffd27a; outline: 3px solid #ffd27a; outline-offset: 2px; }
.px-guide { display: grid; gap: 10px; }
.px-guide article { background: var(--paper-2); border: 3px solid var(--line); padding: 8px 12px; font-size: 26px; }
.px-guide h3 { margin: 0; color: var(--alert-deep); font-size: 29px; }
.px-guide p { margin: 2px 0 0; }
.px-guide em { color: #2f5877; font-style: normal; }

/* Keep panels and menus above the status bars, and hide the bars outside active play. */
.px-stage { position: static; }
#px-canvas { position: fixed; inset: 0; z-index: 0; }
body:has(#px-title:not([hidden])) :is(.px-hud, .px-bar),
body:has(#px-end:not([hidden])) :is(.px-hud, .px-bar) { display: none; }


/* ---- Guided opening ---- */
.px-cold { background: #000; }
.px-cold__text { margin: 0; font-size: clamp(32px, 4vw, 52px); color: #ffb3a8; white-space: pre-line; }
.px-cold__next { margin: 18px 0 0; font-size: 26px; color: var(--muted); }
body:has(#px-cold:not([hidden])) :is(.px-hud, .px-bar) { display: none; }
body.is-opening :is(.px-hud__room, .px-hud__timer, #hud-inv, #hud-er, .px-bar__btns) { visibility: hidden; }
.px-menu__item { font-size: 25px; padding: 4px 16px; }
.px-menu__item--primary { font-size: 36px; padding: 10px 18px; }


/* ---- Learning recap and teacher overview ---- */
.px-screen { overflow-y: auto; }
.px-learned { max-width: 760px; text-align: left; font-size: 25px; }
.px-learned:empty { display: none; }
.px-learned h2 { margin: 0 0 4px; color: var(--alert); font-size: 30px; text-align: center; }
.px-learned ul { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 2px; }
.px-learned li::before { content: "✓ "; color: var(--ok); }
.px-learned p { margin: 6px 0 0; color: #ffd9a8; }
.px-teachers { font-size: 26px; display: grid; gap: 12px; }
.px-teachers p, .px-teachers h3, .px-teachers ul, .px-teachers dl { margin: 0; }
.px-teachers h3 { color: var(--alert-deep); font-size: 30px; }
.px-teachers ul { padding-left: 24px; }
.px-teachers dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; }
.px-teachers dt { font-weight: 700; }
.px-teachers dd { margin: 0; }

body:has(#px-end:not([hidden])) .px-toasts { display: none; }


/* ---- Escape room puzzles ---- */
.px-puzzle { display: grid; gap: 12px; font-size: 26px; justify-items: center; text-align: center; }
.px-puzzle p { margin: 0; }
.px-puzzle__status { min-height: 1.2em; color: #203a55; font-size: 27px; }
.px-puzzle__row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: flex-end; }
.px-hess__eq { flex-basis: 100%; text-align: center; }
:is(.px-puzzle, .px-panel__dock) canvas { max-width: 100%; height: auto; border: 3px solid var(--line); }
.px-paper { background: var(--paper-2); border: 3px solid var(--line); padding: 12px 16px; text-align: left; font-size: 27px; white-space: pre-line; width: 100%; }
/* A list of short, parallel entries (the incubator's eggs): two columns, so all of them show on a short screen. */
.px-paper--cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; padding-block: 8px; font-size: 22px; }
.px-paper--cols p { margin: 0; }
.px-uvnote { background: #17102e; color: #c5ff7a; border: 3px solid #6f4cff; padding: 10px 16px; text-align: left; font-size: 27px; width: 100%; }
.px-lock { display: flex; gap: 8px; background: #3a2c1a; border: 4px solid var(--line); padding: 12px; }
.px-dial { display: grid; gap: 4px; justify-items: center; padding: 3px; border: 3px solid transparent; }
.px-dial.is-active { border-color: var(--alert); }
.px-dial button { width: 58px; font-size: 24px; color: var(--paper); background: var(--ink-3); border: 3px solid var(--line); cursor: pointer; }
.px-dial__num { font-family: var(--font-title); font-size: 26px; width: 74px; padding: 12px 0; text-align: center; background: var(--paper-2); color: var(--ink); border: 3px solid var(--line); }
.px-lock.is-shake { animation: px-shake .35s steps(4); }
.px-opt { min-width: 150px; padding: 6px 12px; font-size: 25px; color: var(--paper); background: var(--ink-3); border: 3px solid var(--line); cursor: pointer; }
.px-opt.is-on { background: var(--alert); color: var(--ink); }
.px-opt:disabled { opacity: .45; cursor: default; }
.px-circuit { display: flex; align-items: center; gap: 0; padding: 18px; background: #1b2029; border: 3px solid var(--line); flex-wrap: wrap; justify-content: center; }
.px-wire { width: 28px; height: 6px; background: #d4a24c; }
.px-slot { width: 140px; min-height: 60px; font-size: 23px; color: var(--paper); background: #0e1118; border: 3px dashed #79808c; cursor: pointer; padding: 3px; }
.px-slot.is-full { border-style: solid; border-color: var(--alert); }
.px-bulb { width: 54px; height: 54px; border-radius: 50%; background: #3c3c33; border: 4px solid #79808c; }
.px-bulb.is-on { background: #fff17a; box-shadow: 0 0 34px 12px #ffd84a; }
.px-chart { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 2px; width: 100%; }
.px-el { background: #fffdf8; border: 1px solid var(--line); font-size: 18px; line-height: 1; padding: 2px 0; }
.px-el b { display: block; font-size: 22px; }
.px-el small { display: block; font-size: 13px; opacity: .75; }
.px-el.is-glow { background: #17102e; color: #c5ff7a; }
.px-beam { display: grid; grid-template-columns: repeat(9, 1fr); width: min(760px, 100%); border-top: 8px solid #5a616c; margin: 42px 0 0; transition: transform .35s; transform-origin: 50% 0; }
.px-hook { min-height: 118px; padding: 0 2px; background: none; border: 0; cursor: pointer; font-size: 22px; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.px-hook:disabled { cursor: default; }
.px-weight { background: #48505f; color: #fff; padding: 2px 4px; font-size: 22px; border: 2px solid var(--line); }
.px-column { width: 150px; height: 186px; display: flex; flex-direction: column; justify-content: flex-end; background: #dceaf0; border: 4px solid var(--line); border-top: 0; }
.px-column i { display: block; height: 42px; }
.px-jar { display: grid; gap: 3px; justify-items: center; font-size: 24px; padding: 5px 8px; color: var(--ink); background: var(--paper-2); border: 3px solid var(--line); cursor: pointer; }
.px-jar span { width: 40px; display: block; border: 2px solid var(--line); }
.px-bars { display: flex; gap: 6px; align-items: flex-end; height: 92px; }
.px-bars i { display: block; width: 28px; background: var(--alert-deep); }
.px-bottle { width: 72px; height: 136px; display: flex; align-items: flex-end; background: #dff2fb; border: 4px solid var(--line); cursor: pointer; padding: 0; }
.px-bottle i { display: block; width: 100%; background: #3f8fe0; }
.px-chain { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; align-items: center; }
.px-node { width: 130px; min-height: 80px; font-size: 22px; color: var(--paper); background: #1b2029; border: 3px solid var(--line); cursor: pointer; padding: 4px; }
.px-node.is-lit { background: #2f8f62; }
.px-node.is-bad { background: var(--danger); }
.px-node small { display: block; color: #ffd27a; font-size: 19px; }
/* Bag: storage-chest slot grids with a title tab on each frame, like a crafting game. */
.px-pack { width: 100%; display: grid; gap: 30px; padding-top: 18px; text-align: left; }
.px-pack__box { position: relative; padding: 28px 14px 14px; background: #7a3a22; border: 4px solid #2a120a; border-radius: 6px; box-shadow: inset 0 0 0 3px #c8643a, inset 0 0 0 6px #5a2614, 0 4px 0 #1a0a05; }
.px-pack__tab { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); margin: 0; padding: 4px 28px; background: #5a2614; color: #fbe9d0; border: 4px solid #2a120a; border-radius: 5px; box-shadow: inset 0 0 0 3px #c8643a; font-size: 20px; white-space: nowrap; }
.px-pack__grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.px-pack__slot { aspect-ratio: 1; display: grid; place-items: center; padding: 0; background: #c8673a; border: 3px solid #5a2614; border-radius: 8px; box-shadow: inset 0 3px 0 rgba(255,255,255,.14), inset 0 -3px 0 rgba(0,0,0,.2); cursor: pointer; }
.px-pack__box:last-of-type .px-pack__slot { background: #6e2c1c; box-shadow: inset 0 3px 0 rgba(255,255,255,.06), inset 0 -3px 0 rgba(0,0,0,.3); }
button.px-pack__slot:hover, .px-panel__sheet button.px-pack__slot:focus { border-color: #ffd27a; background: #dd7d4a; outline: none; }
.px-pack__box:last-of-type button.px-pack__slot:hover, .px-panel__sheet .px-pack__box:last-of-type button.px-pack__slot:focus { background: #8e3d26; }
.px-pack__slot--empty { cursor: default; }
@media (max-width: 600px) { .px-pack__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } } /* slot counts are multiples of 8, so rows stay full */
.px-pack__icon { width: 70%; height: 70%; image-rendering: pixelated; pointer-events: none; }
.px-pack__info { margin: -12px 0 0; padding: 8px 14px; min-height: 1.4em; background: #2a120a; color: #fbe9d0; border: 3px solid #5a2614; border-radius: 5px; font-size: 20px; text-align: center; }
.px-pack__page { display: grid; gap: 8px; justify-items: start; color: var(--ink); background: var(--paper-2); border: 3px solid var(--line); padding: 10px 14px; }
.px-pack__page h3 { margin: 0; font-size: 28px; }
.px-pack__page p { margin: 0; font-size: 22px; }
.px-pack__big { width: 96px; height: 96px; image-rendering: pixelated; }
.px-pack__kind { font-size: 18px; color: #6b5a44; text-transform: uppercase; }
.px-item { padding: 6px 10px; font-size: 25px; color: var(--ink); background: var(--paper-2); border: 3px solid var(--line); cursor: pointer; text-align: left; }
.px-item.is-on { background: #ffd27a; }
.px-item small { display: block; font-size: 21px; color: #30343b; }
.px-formula { font-weight: 700; color: var(--alert-deep); }

/* Keep the bottom bar to one line so it never covers the floor; the prompt floats above it. */
.px-bar { padding: 3px 10px; justify-content: space-between; }
.px-bar .px-btn { white-space: nowrap; padding: 1px 8px; font-size: 22px; }
.px-bar__prompt { position: fixed; left: 50%; bottom: 62px; transform: translateX(-50%); flex: none; white-space: nowrap; z-index: 4; }
@media (max-width: 760px) { .px-bar__inv { display: none; } }

/* Hands-on Biology equipment */
.px-blood { display: grid; grid-template-columns: 150px repeat(3, 1fr); gap: 6px; width: 100%; align-items: center; }
.px-well { height: 58px; font-size: 22px; background: #efe4e0; border: 3px solid var(--line); border-radius: 50%; cursor: pointer; color: var(--ink); }
.px-well.is-smooth { background: #c8434b; color: #fff; }
.px-well.is-clump { background: radial-gradient(#6d0f17 22%, transparent 24%) 0 0 / 14px 14px, #eab0ae; }
.px-tank { position: relative; width: 300px; height: 230px; background: #dcefd8; border: 4px solid var(--line); }
.px-latch { position: absolute; left: 10px; top: 42px; padding: 2px 6px; font-size: 20px; color: #fff; background: #5a616c; }
.px-stem { position: absolute; left: 146px; bottom: 0; width: 8px; height: 150px; background: #3f9b6e; transform-origin: 50% 100%; transition: transform 1.3s ease-out; }
.px-stem i { position: absolute; top: -8px; left: -10px; width: 28px; height: 16px; background: #58b04f; border-radius: 50%; }
.px-tank__controls { display: grid; gap: 6px; }

/* Labels over lock dials, antibody vial buttons, canvases inside puzzles. */
.px-dial__label { font-size: 18px; color: var(--paper); letter-spacing: .05em; }
.px-vial { display: inline-flex; align-items: center; gap: 8px; min-width: 120px; }
.px-vial canvas { width: 40px; height: 40px; image-rendering: pixelated; }
:is(.px-puzzle, .px-panel__dock) canvas { max-width: 100%; height: auto; }
.px-opt--small { min-width: 56px; }

/* ---- Payoff effects: flashes, found-item cards, room cards ---- */
.px-fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; display: grid; place-items: center; }
.px-flash { position: fixed; inset: 0; animation: px-flash .55s ease-out forwards; }
.px-flash--good { background: rgba(255, 244, 176, .35); }
.px-flash--gold { background: rgba(255, 210, 122, .6); }
.px-flash--bad { background: rgba(214, 53, 47, .35); }
@keyframes px-flash { to { opacity: 0; } }
.px-reveal, .px-bigcard {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, 0) scale(1);
  display: grid; gap: 4px; justify-items: center; text-align: center;
  min-width: min(520px, 86vw); max-width: 86vw; padding: 16px 28px;
  background: #14181f; color: #f4f1ea; border: 4px solid #ffd27a;
  box-shadow: 0 0 0 4px #14181f, 0 0 40px rgba(255, 210, 122, .55);
  animation: px-pop .35s cubic-bezier(.2, 1.6, .4, 1) both;
  transition: opacity .3s, transform .3s;
}
.px-reveal small, .px-bigcard small { color: #ffd27a; font-size: 22px; letter-spacing: .2em; }
.px-reveal strong { font-family: var(--font-title); font-size: clamp(22px, 3vw, 32px); }
.px-reveal span { font-size: 22px; color: #c9cdd3; max-width: 60ch; }
.px-reveal--evidence { border-color: #ff7a70; box-shadow: 0 0 0 4px #14181f, 0 0 40px rgba(255, 90, 80, .6); }
.px-reveal--evidence small { color: #ff7a70; }
.px-reveal.is-out, .px-bigcard.is-out { opacity: 0; transform: translate(-50%, -12px) scale(.96); }
.px-bigcard { top: 30%; padding: 22px 40px; }
.px-bigcard strong { font-family: var(--font-title); font-size: clamp(30px, 5vw, 56px); color: #ffd27a; }
.px-bigcard span { font-size: 26px; color: #ffb3a8; letter-spacing: .08em; }
.px-bigcard--gold { border-color: #3fd68a; box-shadow: 0 0 0 4px #14181f, 0 0 60px rgba(63, 214, 138, .6); }
.px-bigcard--gold strong { color: #3fd68a; }
@keyframes px-pop { from { opacity: 0; transform: translate(-50%, 0) scale(.6); } }
@media (prefers-reduced-motion: reduce) { .px-reveal, .px-bigcard, .px-flash { animation: none; } }

/* ---- Debrief and results sheet ---- */
#px-end { overflow-y: auto; }
.px-debrief, .px-results { width: min(860px, 92vw); margin: 0 auto 18px; padding: 18px 22px; text-align: left; background: #1b2029; border: 3px solid #3a4150; }
.px-debrief h2, .px-results h2 { margin: 6px 0 12px; font-size: 30px; color: #ffd27a; }
.px-debrief p { font-size: 24px; }
.px-debrief__count { font-size: 20px; color: #9aa6ad; letter-spacing: .08em; }
.px-debrief__opts { display: grid; gap: 8px; margin: 10px 0; }
.px-debrief__opt { text-align: left; min-width: 0; }
.px-debrief__opts--fbd { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.px-debrief__opts--fbd .px-debrief__opt { display: grid; place-items: center; padding: 6px; }
.px-fbd { width: 100%; max-width: 200px; height: auto; }
.px-ramp { display: block; width: 100%; max-width: 360px; margin: 6px auto 10px; }
.px-debrief__opt.is-right { background: #1e6b49; color: #fff; }
.px-debrief__opt.is-wrong { background: #7a1f1f; color: #fff; }
.px-debrief__why { padding: 10px 14px; border-left: 4px solid #ffd27a; background: #14181f; }
.px-debrief__why.is-right { border-color: #3fd68a; }
.px-debrief__why.is-wrong { border-color: #ff7a70; }
.px-results__name { display: block; margin: 8px 0 12px; font-size: 24px; }
.px-knob__input { font: inherit; width: 7em; padding: 4px 8px; background: #f4f1ea; color: #14181f; border: 3px solid #3a4150; }
.px-results__name input { font: inherit; padding: 4px 8px; width: min(320px, 70vw); background: #f4f1ea; color: #14181f; border: 3px solid #3a4150; }
.px-results__sheet { margin: 12px 0 0; padding: 12px; max-height: 40vh; overflow: auto; white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: 15px; line-height: 1.4; background: #f4f1ea; color: #14181f; }
@media print {
  body * { visibility: hidden !important; }
  .px-results__sheet, .px-results__sheet * { visibility: visible !important; }
  .px-results__sheet { position: absolute; inset: 0 auto auto 0; max-height: none; overflow: visible; background: #fff; }
}

/* ---- Keypads and equipment dials ---- */
.px-keypad__screen { min-width: min(520px, 90%); min-height: 1.6em; overflow-wrap: anywhere; padding: 10px 16px; font-family: var(--font-title); font-size: 30px; letter-spacing: .15em; text-align: center; background: #0d2a1d; color: #7aff9a; border: 4px solid var(--line); }
.px-keypad__screen.is-shake { animation: px-shake .35s steps(4); }
.px-keypad__keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; width: min(620px, 100%); }
.px-key { padding: 8px 0; font-size: 24px; color: var(--paper); background: var(--ink-3); border: 3px solid var(--line); cursor: pointer; }
.px-key--wide { grid-column: span 2; }
.px-key--go { background: #1e6b49; }
.px-knob__val { min-width: 96px; text-align: center; font-size: 26px; }

/* Graphs and pictures drawn from the room data */
.px-figure { display: block; width: 100%; max-width: 640px; height: auto; margin: 10px auto; border: 3px solid var(--line); background: #fffdf8; }
/* In a panel, keep the whole graph on screen at once: cap its height and let the width follow its aspect ratio. */
.px-panel__sheet .px-figure { width: auto; max-width: min(640px, 100%); max-height: max(220px, calc(100vh - 330px)); }
.px-item .px-figure { margin-top: 8px; }
/* A table is all small print: on a page you only read, show it full size and let the page scroll. */
.px-panel__sheet:not(.is-docked) .px-figtable { width: 100%; max-height: none; }
.px-panel__sheet .px-zoomable { cursor: zoom-in; }
.px-item--evidence summary { cursor: pointer; font-size: 22px; }
.px-item--evidence p { font-size: 18px; margin: 6px 0 0; }

/* Developer mode (playtesting only) */
.px-dev { color: #8a2be2; font-size: 18px; text-align: left; }
.px-devpanel .px-btn.is-on { background: var(--alert); color: var(--ink); }
.px-devlist { display: grid; gap: 6px; width: 100%; max-height: 60vh; overflow: auto; text-align: left; }
.px-devrow { background: var(--paper-2); border: 2px solid var(--line); padding: 4px 8px; color: var(--ink); }
.px-devrow__head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.px-devrow__head span { color: #444; }
.px-devrow__acts { margin-left: auto; display: flex; gap: 4px; }
.px-devrow small { display: block; font-size: 17px; }

/* Phones: the bar buttons wrap instead of running off the right edge. */
@media (max-width: 760px) {
  .px-bar__btns { flex-wrap: wrap; justify-content: center; gap: 4px; width: 100%; }
  .px-bar .px-btn { font-size: 17px; padding: 1px 6px; }
  /* Dial locks with 4-6 dials wrap onto two rows instead of hiding dials off the right edge. */
  .px-lock { flex-wrap: wrap; justify-content: center; padding: 8px; }
  .px-dial button { width: 46px; }
  .px-dial__num { width: 56px; padding: 8px 0; }
}

/* A find card already showing steps aside when a puzzle panel opens over it. */
body:has(.px-panel:not([hidden])) .px-reveal { display: none; }

/* ---- Puzzle panels as in-world devices, coloured like the level ---------------------------------
   Each subject has a mood (the same colours as the room's neon and haze in atmos.js). Inside a panel,
   light "paper" surfaces become dark screens, text turns light, and borders and accents glow. */
:root { --mood: #ffd27a; --mood-2: #5fd8ff; --mood-deep: #14181f; --mood-ink: #10131a; }
body[data-subject="biology"] { --mood: #5fffc8; --mood-2: #bfff8a; --mood-deep: #06201c; --mood-ink: #04140f; }
body[data-subject="chemistry"] { --mood: #ff5fb0; --mood-2: #5fe0ff; --mood-deep: #1a0620; --mood-ink: #12040f; }
body[data-subject="physics"] { --mood: #b48fff; --mood-2: #5fd8ff; --mood-deep: #0b0820; --mood-ink: #07051a; }
/* Read by figures.js when it draws a chart. */
body { --fig-bg: #0d1017; --fig-ink: #e8ecf2; --fig-grid: rgba(255,255,255,.12); --fig-bar: var(--mood-2); --fig-band: rgba(255,255,255,.05); }

.px-panel { background: rgba(4, 5, 9, .72); backdrop-filter: blur(2px); }
.px-panel__sheet {
  --paper-2: color-mix(in srgb, var(--mood-ink) 82%, #ffffff 6%);
  --ink: #e8ecf2;
  --line: color-mix(in srgb, var(--mood) 35%, #05070b);
  color: #e8ecf2;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--mood) 14%, transparent), transparent 60%),
    linear-gradient(var(--mood-deep), var(--mood-ink));
  border: 4px solid var(--mood);
  box-shadow: 0 0 0 4px #05070b, 0 0 0 7px color-mix(in srgb, var(--mood) 45%, #05070b), 0 0 46px color-mix(in srgb, var(--mood) 35%, transparent), 0 18px 0 rgba(0,0,0,.45);
  image-rendering: pixelated;
}
.px-panel__head { border-bottom: 3px dashed color-mix(in srgb, var(--mood) 40%, transparent); }
.px-panel__title { color: var(--mood); text-shadow: 0 0 10px color-mix(in srgb, var(--mood) 70%, transparent), 2px 2px 0 #000; }
.px-panel__sheet .px-btn { border-color: #05070b; }
.px-panel__sheet .px-panel__close:hover, .px-panel__sheet .px-btn:hover { background: color-mix(in srgb, var(--mood) 22%, var(--ink-3)); }
.px-panel__sheet .px-btn--big { background: var(--mood); color: var(--mood-ink); box-shadow: inset -3px -3px 0 rgba(0,0,0,.3), 0 0 18px color-mix(in srgb, var(--mood) 55%, transparent); }
.px-panel__sheet .px-btn--big:hover { background: color-mix(in srgb, var(--mood) 75%, #ffffff); }
.px-panel__sheet :is(.px-tip, .px-pack__kind, .px-devrow__head span) { color: #9aa3b2; }
.px-panel__sheet .px-puzzle__status { color: var(--mood-2); }
.px-panel__sheet .px-dev { color: #c9a2ff; }
.px-panel__sheet .px-formula, .px-panel__sheet :is(.px-guide h3, .px-teachers h3) { color: var(--mood); }
.px-panel__sheet .px-guide em { color: var(--mood-2); }
.px-panel__sheet .px-item small { color: #b6bdc8; }

/* Notes, printouts and readouts: dark inset screens. */
.px-panel__sheet :is(.px-paper, .px-guide article, .px-pack__page, .px-item, .px-devrow) {
  background: color-mix(in srgb, var(--mood-ink) 70%, #000);
  border: 3px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), inset 0 0 18px rgba(0,0,0,.6);
}
.px-panel__sheet .px-item.is-on { background: color-mix(in srgb, var(--mood) 28%, var(--mood-ink)); border-color: var(--mood); }

/* Dial locks: a metal plate with LED digits. */
.px-lock { flex-wrap: wrap; justify-content: center; max-width: 100%; }
.px-panel__sheet .px-lock { background: linear-gradient(#232836, #151922); border: 4px solid #05070b; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--mood) 25%, transparent), 0 0 0 3px var(--line); }
.px-panel__sheet .px-dial.is-active { border-color: var(--mood); box-shadow: 0 0 14px color-mix(in srgb, var(--mood) 45%, transparent); }
.px-panel__sheet .px-dial__label { color: var(--mood-2); }
.px-panel__sheet .px-dial__num { background: #05070b; color: var(--mood); border-color: #2a3040; text-shadow: 0 0 8px color-mix(in srgb, var(--mood) 80%, transparent); }
.px-panel__sheet :is(.px-dial button, .px-key, .px-opt) { background: linear-gradient(#323a4d, #232a38); border-color: #05070b; box-shadow: inset 0 -3px 0 rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.07); }
.px-panel__sheet :is(.px-dial button, .px-key, .px-opt):hover:not(:disabled) { border-color: var(--mood); color: #fff; }
.px-panel__sheet .px-opt.is-on { background: var(--mood); color: var(--mood-ink); box-shadow: 0 0 12px color-mix(in srgb, var(--mood) 50%, transparent); }
.px-panel__sheet .px-key--go { background: linear-gradient(color-mix(in srgb, var(--mood) 70%, #000), color-mix(in srgb, var(--mood) 45%, #000)); color: #fff; }
.px-panel__sheet .px-keypad__screen { background: #05070b; color: var(--mood); border-color: #2a3040; text-shadow: 0 0 10px color-mix(in srgb, var(--mood) 80%, transparent); box-shadow: inset 0 0 22px color-mix(in srgb, var(--mood) 18%, transparent); }

/* Charts, periodic table, equipment. */
.px-panel__sheet .px-figure { border: 3px solid var(--line); background: var(--fig-bg); box-shadow: 0 0 0 2px #05070b, 0 0 22px color-mix(in srgb, var(--mood) 18%, transparent); }
.px-panel__sheet :is(.px-puzzle, .px-panel__dock) canvas { border-color: var(--line); }
.px-panel__sheet .px-el { background: #10141c; border-color: #2a3040; color: #e8ecf2; }
.px-panel__sheet .px-el b { color: var(--mood); }
.px-panel__sheet .px-el.is-glow { background: color-mix(in srgb, var(--mood) 30%, #10141c); color: #fff; box-shadow: 0 0 10px var(--mood); }
.px-panel__sheet .px-slot { background: #05070b; }
.px-panel__sheet .px-node { background: #161b26; }
.px-panel__sheet :focus-visible { outline-color: var(--mood); }
.px-panel__sheet .px-knob__val { padding: 6px 10px; background: #05070b; border: 3px solid #2a3040; color: var(--mood); text-shadow: 0 0 8px color-mix(in srgb, var(--mood) 80%, transparent); font-family: var(--font-title); font-size: 18px; }

/* Results code a student copies and hands in. */
.px-results__code { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 14px; line-height: 1.35; padding: 8px 10px; color: #7aff9a; background: #05070b; border: 3px solid #3a4150; resize: none; word-break: break-all; }

/* Tap-to-enlarge for charts on narrow screens. */
@media (max-width: 700px) { .px-zoomable { cursor: zoom-in; } }
.px-figview { position: fixed; inset: 0; z-index: 1000; overflow: hidden; background: rgba(8, 10, 14, .94); cursor: zoom-out; }
.px-figview canvas { position: absolute; left: 50%; top: calc(50% - 16px); max-width: none; border: 3px solid var(--line); }
.px-figview p { position: fixed; bottom: 8px; left: 0; right: 0; margin: 0; text-align: center; font-size: 20px; color: #c9d1d6; }
.px-zoomhint { display: block; margin: -4px 0 8px; text-align: center; font-size: 18px; color: #9aa6ad; }
