/* ==========================================================================
   DMG-01 PORTFOLIO
   Everything on the console is sized in cqw (1% of the console's width), so
   the object keeps its proportions at any size. The breakpoints below only
   decide how big the console is and how much of it fits on screen.
   ========================================================================== */

:root {
  /* LCD palette */
  --lcd-light: #b6c28e;
  --lcd-mid: #8f9f6b;
  --lcd-dark: #425034;
  --lcd-deep: #1f2a1b;

  /* Plastics */
  --ink: #3a3883;
  --bezel-hi: #6c6a7b;
  --bezel: #5b5a6a;
  --bezel-lo: #4e4d5b;
  --pink: #a3245f;
  --pink-hi: #cb3f7c;
  --pink-lo: #7a1646;
  --pink-edge: #561030;

  --font-brand: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-lcd: "Press Start 2P", "Courier New", monospace;

  /* Console width. Mobile: the whole console must fit the viewport. */
  --gb-w: min(94vw, calc((100vh - 24px) / 1.644));
}
@supports (height: 100dvh) {
  :root { --gb-w: min(94vw, calc((100dvh - 24px) / 1.644)); }
}
/* Tablet: larger object, controls start to reveal below the screen */
@media (min-width: 768px) {
  :root { --gb-w: min(86vw, 88vh); }
}
/* Desktop: the console is split. Upper half on the left, controls panel on the right. */
@media (min-width: 1025px) {
  :root {
    /* Both halves together are 1.6 x --gb-w wide plus the gap: fill ~95% of the width, ~92% of the height */
    --gb-w: min(58vw, 108vh);
    --ctl-w: calc(var(--gb-w) * 0.6);
    --split-gap: 2.5vw;
  }
}
/* Phones held sideways: keep it readable and let the page scroll */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1024px) {
  :root { --gb-w: min(62vw, 520px); }
}

* { box-sizing: border-box; }
html { background: #17161a; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(120% 70% at 50% 0%, #3a3841 0%, #1f1e24 55%, #141317 100%) fixed;
}

.stage {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
}
@supports (height: 100dvh) { .stage { min-height: 100dvh; } }
@media (min-width: 768px) {
  .stage { align-items: flex-start; padding: clamp(12px, 3vh, 36px) 0 8vh; }
}
@media (min-width: 1025px) {
  .stage { align-items: center; padding: 2vh 0; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1024px) {
  .stage { align-items: flex-start; }
}

/* Shown only when JavaScript is off */
.ns { position: relative; z-index: 3; max-width: 560px; margin: 24px auto; padding: 18px 20px; background: #1f2a1b; color: #dfe8bd; font: 15px/1.6 var(--font-brand); }
.ns h2 { margin: 0 0 8px; font-size: 20px; }
.ns a { color: #fff; }
.ns ul { padding-left: 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   CONSOLE
   ========================================================================== */
.gb {
  position: relative;
  flex: none;
  width: var(--gb-w);
  aspect-ratio: 100 / 164.4;
  container-type: inline-size;
  font-family: var(--font-brand);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Generic positioned part: --x/--y are the centre in cqw */
.part {
  position: absolute;
  left: calc(var(--x) * 1cqw);
  top: calc(var(--y) * 1cqw);
  width: calc(var(--w) * 1cqw);
  height: calc(var(--h) * 1cqw);
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
}

/* ---- Shell ------------------------------------------------------------- */
.gb__body {
  position: absolute;
  inset: 0;
  border-radius: 4.4cqw 4.4cqw 18cqw 5.6cqw;
  background: linear-gradient(172deg, #dad8ce 0%, #d0cec3 42%, #c6c4b8 100%);
  box-shadow:
    inset 0 .5cqw 0 rgba(255,255,255,.6),
    inset .35cqw 0 0 rgba(255,255,255,.3),
    inset -.45cqw 0 0 rgba(0,0,0,.12),
    inset 0 -.9cqw 0 rgba(0,0,0,.17),
    0 0 0 .2cqw rgba(0,0,0,.4),
    0 1.4cqw 3cqw rgba(0,0,0,.5);
  overflow: hidden;
}
.gb__body::before {            /* moulded plastic grain */
  content: "";
  position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .22;
  mix-blend-mode: multiply;
}
.gb__body::after {             /* uneven tone: light catching the upper left */
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(90% 40% at 20% 6%, rgba(255,255,255,.22), transparent 70%),
    linear-gradient(90deg, rgba(0,0,0,.05), transparent 12%, transparent 88%, rgba(0,0,0,.07));
}
.gb__panel {                   /* the seam where the front shell meets the frame */
  position: absolute;
  inset: 1.3cqw;
  border-radius: 3.4cqw 3.4cqw 16.8cqw 4.3cqw;
  box-shadow: inset 0 0 0 .16cqw rgba(0,0,0,.08), 0 .16cqw 0 rgba(255,255,255,.4);
}

/* ---- Top edge ---------------------------------------------------------- */
.gb__top { position: absolute; left: 0; right: 0; top: 0; height: 6cqw; }
.gb__groove {
  position: absolute; left: 26cqw; right: 6.6cqw; top: 3.7cqw; height: .55cqw;
  border-radius: .3cqw;
  background: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.12));
  box-shadow: 0 .32cqw 0 rgba(255,255,255,.55);
}

/* ---- Power switch ------------------------------------------------------ */
.power {
  appearance: none; border: 0; background: none; margin: 0; padding: 0;
  position: absolute; left: 6.6cqw; top: .7cqw; width: 15cqw; height: 5.2cqw;
  --pos: 0; --knob: 6cqw;
  font-family: var(--font-brand); touch-action: none; -webkit-touch-callout: none;
}
.gb[data-power="on"] .power { --pos: 1; }
.power::after { content: ""; position: absolute; inset: -1.5cqw -1.2cqw; }
.power:focus-visible { outline: .45cqw solid #ffcf3a; outline-offset: .5cqw; }
.power__labels {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; justify-content: space-between;
  font: 700 1.2cqw/1 var(--font-brand); letter-spacing: .14em; color: #6d6c78;
}
.power__slot {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2.7cqw; border-radius: 1.35cqw;
  background: linear-gradient(#8a887e, #a6a498);
  box-shadow: inset 0 .35cqw .5cqw rgba(0,0,0,.5), 0 .25cqw 0 rgba(255,255,255,.55);
}
.power__knob {
  position: absolute; top: -.7cqw; bottom: -.7cqw; width: var(--knob);
  left: calc(var(--pos) * (100% - var(--knob)));
  border-radius: .7cqw;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.18) 0 .22cqw, transparent .22cqw .75cqw),
    linear-gradient(#d4d2c7, #b5b3a7);
  box-shadow: inset 0 .25cqw 0 rgba(255,255,255,.65), inset 0 -.25cqw .3cqw rgba(0,0,0,.25), 0 .4cqw .5cqw rgba(0,0,0,.35), 0 0 0 .15cqw rgba(0,0,0,.25);
  transition: left 140ms cubic-bezier(.3,.7,.3,1);
}
.power.is-drag .power__knob { transition: none; }
.gb[data-power="off"] .power__knob { animation: nudge 2.6s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: translateX(0); } 82% { transform: translateX(.9cqw); } 92% { transform: translateX(0); } }

/* ---- Bezel ------------------------------------------------------------- */
.bezel {
  position: absolute;
  left: 11cqw; top: 8cqw; width: 78cqw; height: 64.6cqw;
  border-radius: 2.4cqw 2.4cqw 11.5cqw 2.4cqw;
  background: linear-gradient(150deg, var(--bezel-hi) 0%, var(--bezel) 55%, var(--bezel-lo) 100%);
  box-shadow:
    inset 0 .7cqw .6cqw rgba(0,0,0,.45),
    inset .35cqw 0 .3cqw rgba(0,0,0,.25),
    inset -.2cqw -.3cqw .3cqw rgba(255,255,255,.08),
    0 .5cqw 0 rgba(255,255,255,.55),
    0 -.2cqw 0 rgba(0,0,0,.22);
}
.bezel::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .05;
}

.bezel__tagline {
  position: absolute; left: 3.4cqw; right: 3.4cqw; top: 2.5cqw; margin: 0;
  display: flex; align-items: center; gap: 1.3cqw;
  color: #d6d5e2; font: 700 1.38cqw/1 var(--font-brand); letter-spacing: .07em; white-space: nowrap;
}
.stripes {
  flex: 1; height: .38cqw;
  border-top: .3cqw solid #b13a77;
  border-bottom: .3cqw solid #3f4ca5;
}

.battery { position: absolute; left: 2.8cqw; top: 19cqw; width: 11cqw; text-align: center; }
.battery__led {
  display: block; width: 1.6cqw; height: 1.6cqw; margin: 0 auto .8cqw; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a7d, #e0201a 55%, #8d0d0a);
  box-shadow: 0 0 .9cqw .25cqw rgba(255,40,30,.55), inset 0 -.15cqw .2cqw rgba(0,0,0,.4);
  animation: led 5s steps(1) infinite;
}
.battery__label { font: 600 1.15cqw/1 var(--font-brand); letter-spacing: .1em; color: #d0cfdc; }
@keyframes led { 0%, 96% { opacity: 1; } 97%, 100% { opacity: .78; } }
.gb[data-power="off"] .battery__led {
  animation: none;
  background: radial-gradient(circle at 35% 30%, #7a3a36, #4d1a18 60%, #2a0d0c);
  box-shadow: inset 0 -.15cqw .2cqw rgba(0,0,0,.5);
}

.screen {
  position: absolute; left: 16cqw; top: 9.6cqw; width: 54cqw;
  padding: .8cqw;
  border-radius: .7cqw;
  background: #24232b;
  box-shadow: inset 0 0 0 .18cqw #000, 0 .3cqw 0 rgba(255,255,255,.07);
}

/* ---- Branding ---------------------------------------------------------- */
.branding {
  position: absolute; left: 11.2cqw; top: 75.9cqw; margin: 0;
  display: flex; align-items: baseline; gap: 1.5cqw;
  color: var(--ink); white-space: nowrap;
}
.branding__maker { font: 800 3.3cqw/1 var(--font-brand); letter-spacing: -.03em; }
.branding__model { font: italic 800 4.7cqw/1 var(--font-brand); letter-spacing: .05em; }
.branding__model sup { font-size: .32em; font-style: normal; vertical-align: top; margin-left: .2em; letter-spacing: 0; }

/* ==========================================================================
   LCD
   ========================================================================== */
.lcd {
  position: relative;
  width: 100%;
  aspect-ratio: 160 / 144;
  container-type: inline-size;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 45% 40%, #bfca97, var(--lcd-light) 72%);
  font-family: var(--font-lcd);
}
.lcd__view, .lcd__overlay, .lcd__boot { --p: calc(100cqw / 160); position: absolute; inset: 0; }
.lcd__fx { position: absolute; inset: 0; pointer-events: none; }
.lcd__fx--grid {
  z-index: 5;
  background-image:
    linear-gradient(to right, rgba(24,34,20,.07) 0 12%, transparent 12%),
    linear-gradient(to bottom, rgba(24,34,20,.05) 0 12%, transparent 12%);
  background-size: calc(100cqw / 160) calc(100cqw / 160);
}
.lcd__fx--noise {
  z-index: 5;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 .1  0 0 0 0 0  0 0 0 .8 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .16; mix-blend-mode: multiply;
}
.lcd__fx--glass {
  z-index: 6;
  background:
    linear-gradient(to bottom, rgba(10,16,8,.30), transparent 9%),
    linear-gradient(to right, rgba(10,16,8,.14), transparent 5%, transparent 95%, rgba(10,16,8,.10)),
    radial-gradient(ellipse at 50% 48%, transparent 58%, rgba(14,22,10,.30) 100%);
}

/* ---- LCD interface ----------------------------------------------------- */
.ui {
  --p: calc(100cqw / 160);
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  font-size: calc(var(--p) * 8);
  line-height: 1;
  color: var(--lcd-deep);
  text-transform: uppercase;
  text-shadow: calc(var(--p) * .7) calc(var(--p) * .7) 0 rgba(31,42,27,.16);
  -webkit-font-smoothing: none;
  font-smooth: never;
}
.ui a { color: inherit; text-decoration: none; }
.ui a:focus-visible { outline: calc(var(--p) * 1.5) solid var(--lcd-deep); outline-offset: calc(var(--p) * 1); }

.ui__bar {
  flex: none; height: calc(var(--p) * 14);
  display: flex; align-items: center; justify-content: space-between; gap: calc(var(--p) * 4);
  padding: 0 calc(var(--p) * 6);
  background: var(--lcd-deep); color: var(--lcd-light); text-shadow: none;
  white-space: nowrap;
}
.ui__title { overflow: hidden; line-height: calc(var(--p) * 12); }
.ui__meta { flex: none; color: var(--lcd-mid); }

.ui__body { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.ui__scroll { padding: calc(var(--p) * 4) calc(var(--p) * 6); overflow-wrap: break-word; }

.item { display: flex; align-items: center; height: calc(var(--p) * 16); }
.item .cur { flex: none; width: calc(var(--p) * 10); visibility: hidden; }
.item .lbl { flex: 1; min-width: 0; display: block; overflow: hidden; white-space: nowrap; line-height: calc(var(--p) * 12); color: var(--lcd-dark); }
.item.is-sel .lbl { color: var(--lcd-deep); }
.item.is-sel .cur { visibility: visible; animation: cursor 1.1s steps(1) infinite; }
@keyframes cursor { 0%, 72% { opacity: 1; } 72.1%, 100% { opacity: .15; } }

.ui p { margin: 0 0 calc(var(--p) * 12); line-height: calc(var(--p) * 12); }
.row { height: calc(var(--p) * 12); line-height: calc(var(--p) * 12); }
.row--gap { margin-bottom: calc(var(--p) * 12); }
.chip {
  display: inline-block; padding: calc(var(--p) * 1) calc(var(--p) * 3) 0 calc(var(--p) * 4);
  line-height: calc(var(--p) * 10); background: var(--lcd-deep); color: var(--lcd-light); text-shadow: none;
}
.dim { color: var(--lcd-dark); }
.sub { margin-top: calc(var(--p) * 8); color: var(--lcd-dark); }

.item .val { flex: none; color: var(--lcd-dark); }
.item.is-sel .val { color: var(--lcd-deep); }
.vol { flex: none; display: inline-flex; align-items: center; gap: calc(var(--p) * 2); }
.vb { display: block; width: calc(var(--p) * 5); height: calc(var(--p) * 9); box-sizing: border-box; border: calc(var(--p) * 1) solid var(--lcd-dark); cursor: var(--cur-point, pointer); }
.item.is-sel .vb { border-color: var(--lcd-deep); }
.vb.on { background: var(--lcd-deep); border-color: var(--lcd-deep); }
.vol.is-off .vb.on { background: var(--lcd-mid); border-color: var(--lcd-mid); }
.marq { overflow: hidden; white-space: nowrap; line-height: calc(var(--p) * 12); }
.marq > span { display: inline-block; }
.marq.is-run > span { animation: marq 5s steps(24) infinite alternate; }
@keyframes marq { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(calc(var(--dist) * -1px)); } }

.ui__foot {
  flex: none; height: calc(var(--p) * 14);
  display: flex; align-items: center; gap: calc(var(--p) * 8);
  padding: 0 calc(var(--p) * 6);
  border-top: calc(var(--p) * 2) solid var(--lcd-deep);
  white-space: nowrap; overflow: hidden; line-height: calc(var(--p) * 12);
}
.ui__foot .key {
  display: inline-block; min-width: calc(var(--p) * 10);
  padding: calc(var(--p) * 1) calc(var(--p) * 1) 0 calc(var(--p) * 2);
  margin-right: calc(var(--p) * 4);
  background: var(--lcd-deep); color: var(--lcd-light); text-align: center;
  line-height: calc(var(--p) * 9); text-shadow: none;
}
.ui__foot .push { margin-left: auto; color: var(--lcd-dark); }
/* Footer caption: loops like a marquee when it is too long; the button prompt stays put */
.ui__foot .chip-btn { flex: none; }
.ui__foot .marq-loop { flex: 1; min-width: 0; margin-left: 0; overflow: hidden; text-align: right; }
.marq-track { display: inline-flex; white-space: nowrap; }
.marq-track > span + span { display: none; }
.marq-loop.is-run { text-align: left; }
.marq-loop.is-run .marq-track > span + span { display: inline-block; }
.marq-loop.is-run .marq-track > span { padding-right: calc(var(--p) * 16); }
.marq-loop.is-run .marq-track { animation: marq-loop var(--dur, 8s) steps(var(--steps, 40)) infinite; }
@keyframes marq-loop { to { transform: translateX(calc(var(--w) * -1px)); } }

.arrow {
  position: absolute; right: calc(var(--p) * 3); width: 0; height: 0; display: none;
  border-left: calc(var(--p) * 3) solid transparent; border-right: calc(var(--p) * 3) solid transparent;
}
.arrow--up { top: calc(var(--p) * 3); border-bottom: calc(var(--p) * 4) solid var(--lcd-deep); }
.arrow--down { bottom: calc(var(--p) * 3); border-top: calc(var(--p) * 4) solid var(--lcd-deep); }
.arrow.is-on { display: block; }

/* ---- SELECT overlay ---------------------------------------------------- */
.lcd__overlay { z-index: 2; display: none; font-size: calc(var(--p) * 8); text-transform: uppercase; color: var(--lcd-deep); }
.lcd__overlay.is-open { display: block; }
.sys {
  position: absolute; left: calc(var(--p) * 12); right: calc(var(--p) * 12); top: calc(var(--p) * 14); bottom: calc(var(--p) * 14);
  padding: calc(var(--p) * 6) calc(var(--p) * 8);
  background: var(--lcd-light);
  border: calc(var(--p) * 2) solid var(--lcd-deep);
  box-shadow: calc(var(--p) * 3) calc(var(--p) * 3) 0 var(--lcd-deep);
  line-height: calc(var(--p) * 12); overflow: hidden;
}
.sys h2 { margin: 0 0 calc(var(--p) * 6); font: inherit; background: var(--lcd-deep); color: var(--lcd-light); padding: calc(var(--p) * 1) calc(var(--p) * 4) 0; line-height: calc(var(--p) * 10); }
.sys div { white-space: nowrap; overflow: hidden; }

/* ---- Boot -------------------------------------------------------------- */
.lcd__boot {
  z-index: 4; display: grid; place-items: center; background: var(--lcd-light);
  color: var(--lcd-deep); font-size: calc(var(--p) * 8); text-transform: uppercase; text-align: center;
}
.lcd__boot { align-content: center; justify-items: center; gap: calc(var(--p) * 10); }
.lcd__boot.is-done { display: none; }
/* Intro: every letter drops in on its own, bounces, squashes on landing with a dust puff, then shines in turn */
.lcd__bootname { display: flex; gap: calc(var(--p) * 2); font-size: calc(var(--p) * 16); line-height: 1; }
.bl {
  position: relative; display: inline-block; padding: calc(var(--p) * 1) calc(var(--p) * 1) 0; text-shadow: calc(var(--p) * 1) calc(var(--p) * 1) 0 rgba(31,42,27,.2);
  transform: translateY(calc(var(--p) * -90));
}
.lcd__bootsub:empty { display: none; }
.lcd__boot.is-play .bl {
  animation:
    letter-drop 560ms steps(10) calc(140ms + var(--i) * 150ms) both,
    letter-shine 380ms steps(1) calc(1650ms + var(--i) * 80ms) both;
}
.bl::after {                              /* dust puff where it lands */
  content: ""; position: absolute; left: 50%; bottom: calc(var(--p) * -3); width: calc(var(--p) * 2); height: calc(var(--p) * 2); opacity: 0;
  background: var(--lcd-dark);
  box-shadow: calc(var(--p) * -10) 0 var(--lcd-dark), calc(var(--p) * 10) 0 var(--lcd-dark), calc(var(--p) * -16) calc(var(--p) * -3) var(--lcd-mid), calc(var(--p) * 16) calc(var(--p) * -3) var(--lcd-mid);
}
.lcd__boot.is-play .bl::after { animation: dust 320ms steps(3) calc(140ms + var(--i) * 150ms + 540ms) both; }
@keyframes letter-drop {
  0%   { transform: translateY(calc(var(--p) * -90)); }
  58%  { transform: translateY(0); }
  70%  { transform: translateY(calc(var(--p) * -10)); }
  82%  { transform: translateY(0); }
  91%  { transform: translateY(calc(var(--p) * 1.5)) scaleY(.8); }
  100% { transform: none; }
}
@keyframes letter-shine { 0%, 100% { background: transparent; color: inherit; } 30%, 70% { background: var(--lcd-deep); color: var(--lcd-light); text-shadow: none; } }
@keyframes dust { 0% { opacity: 1; transform: translateX(-50%) scale(.3); } 100% { opacity: 0; transform: translateX(-50%) scale(1.5); } }
.spark { position: absolute; left: 50%; top: 50%; width: calc(var(--p) * 2); height: calc(var(--p) * 2); background: var(--lcd-deep); opacity: 0;
  box-shadow: calc(var(--p) * -2) 0 var(--lcd-deep), calc(var(--p) * 2) 0 var(--lcd-deep), 0 calc(var(--p) * -2) var(--lcd-deep), 0 calc(var(--p) * 2) var(--lcd-deep);
  translate: calc(var(--x) * var(--p)) calc(var(--y) * var(--p)); }
.lcd__boot.is-play .spark { animation: twinkle 700ms steps(4) calc(1550ms + var(--d, 0ms)) 2 both; }
@keyframes twinkle { 0% { opacity: 0; scale: .2; } 35% { opacity: 1; scale: 1; } 65% { opacity: 1; scale: 1.5; } 100% { opacity: 0; scale: .4; } }

/* ---- Unpowered LCD: flat, dull, dead ----------------------------------- */
.lcd { transition: background-color 120ms; }
.lcd.is-off { background: #9ba288; }
.lcd.is-off .lcd__view, .lcd.is-off .lcd__overlay, .lcd.is-off .lcd__boot, .lcd.is-off .lcd__wipe { display: none; }
.lcd.is-off .lcd__fx--glass { background: linear-gradient(to bottom, rgba(10,16,8,.3), transparent 9%), radial-gradient(ellipse at 50% 48%, transparent 58%, rgba(14,22,10,.2) 100%); }

/* ---- Transitions: blinds wipe + flicker -------------------------------- */
.lcd__wipe { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; pointer-events: none; }
.lcd__wipe i { flex: 1; background: var(--lcd-deep); transform: scaleX(0); transform-origin: 0 50%; }
.lcd.is-wiping .lcd__wipe i { animation: wipe 270ms steps(5) both; }
.lcd.is-wiping .lcd__wipe i:nth-child(even) { animation-name: wipe-r; }
@keyframes wipe {
  0% { transform: scaleX(0); transform-origin: 0 50%; }
  50% { transform: scaleX(1); transform-origin: 0 50%; }
  50.1% { transform: scaleX(1); transform-origin: 100% 50%; }
  100% { transform: scaleX(0); transform-origin: 100% 50%; }
}
@keyframes wipe-r {
  0% { transform: scaleX(0); transform-origin: 100% 50%; }
  50% { transform: scaleX(1); transform-origin: 100% 50%; }
  50.1% { transform: scaleX(1); transform-origin: 0 50%; }
  100% { transform: scaleX(0); transform-origin: 0 50%; }
}
.lcd.is-flick .lcd__view { animation: flick 180ms steps(1) both; }
@keyframes flick { 0% { opacity: .5; } 35% { opacity: 1; } 55% { opacity: .78; } 100% { opacity: 1; } }

/* ==========================================================================
   CONTROLS
   ========================================================================== */
.controls { position: absolute; inset: 0; pointer-events: none; }
.controls > * { pointer-events: auto; }
.controls button {
  appearance: none; border: 0; padding: 0; margin: 0; background: none;
  touch-action: manipulation; -webkit-touch-callout: none;
}
.controls button:focus-visible { outline: .5cqw solid #ffcf3a; outline-offset: .5cqw; }

/* D-pad */
.dpad { position: absolute; left: 12.5cqw; top: 88.5cqw; width: 23cqw; height: 23cqw; }
.dpad__well {
  position: absolute; inset: -3.4cqw; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #c2c0b5, #cac8bd);
  box-shadow: inset .5cqw .6cqw .8cqw rgba(0,0,0,.3), inset -.2cqw -.2cqw .4cqw rgba(255,255,255,.2), 0 .32cqw 0 rgba(255,255,255,.5);
}
.dpad__cross {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 .6cqw 0 #101013) drop-shadow(0 1cqw .7cqw rgba(0,0,0,.35));
  transition: transform 70ms ease-out, filter 70ms ease-out;
  transform: perspective(60cqw);
}
.dpad[data-dir] .dpad__cross { filter: drop-shadow(0 .2cqw 0 #101013) drop-shadow(0 .4cqw .4cqw rgba(0,0,0,.3)); }
.dpad[data-dir="up"] .dpad__cross { transform: perspective(60cqw) rotateX(7deg) translateY(.35cqw); }
.dpad[data-dir="down"] .dpad__cross { transform: perspective(60cqw) rotateX(-7deg) translateY(.35cqw); }
.dpad[data-dir="left"] .dpad__cross { transform: perspective(60cqw) rotateY(-7deg) translateY(.35cqw); }
.dpad[data-dir="right"] .dpad__cross { transform: perspective(60cqw) rotateY(7deg) translateY(.35cqw); }

.dpad__hit { position: absolute; inset: -2.2cqw; }
.dpad__b { position: absolute; inset: 0; width: 100%; height: 100%; }
.dpad__b--up    { clip-path: polygon(0 0, 100% 0, 50% 50%); }
.dpad__b--right { clip-path: polygon(100% 0, 100% 100%, 50% 50%); }
.dpad__b--down  { clip-path: polygon(0 100%, 100% 100%, 50% 50%); }
.dpad__b--left  { clip-path: polygon(0 0, 0 100%, 50% 50%); }
.controls .dpad__b:focus-visible { outline: 0; background: rgba(255,207,58,.35); }

/* A / B */
.ab-slot {
  position: absolute; left: 59.2cqw; top: 96.4cqw; width: 30.6cqw; height: 13.8cqw;
  border-radius: 7cqw; transform: rotate(-25deg); transform-origin: 50% 50%;
  background: linear-gradient(#c3c1b6, #cbc9be);
  box-shadow: inset .5cqw .6cqw .8cqw rgba(0,0,0,.28), 0 .32cqw 0 rgba(255,255,255,.5);
}
.ab__btn {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, var(--pink-hi), var(--pink) 52%, var(--pink-lo));
  box-shadow:
    inset .45cqw .55cqw .5cqw rgba(255,255,255,.24),
    inset -.4cqw -.5cqw .7cqw rgba(0,0,0,.35),
    0 .6cqw 0 var(--pink-edge),
    0 .95cqw .9cqw rgba(0,0,0,.35);
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
}
.ab__btn::after { content: ""; position: absolute; inset: -1.4cqw; border-radius: 50%; }
.ab__btn.is-pressed {
  transform: translateY(.45cqw);
  box-shadow:
    inset .45cqw .55cqw .5cqw rgba(255,255,255,.14),
    inset -.4cqw -.5cqw .7cqw rgba(0,0,0,.4),
    0 .12cqw 0 var(--pink-edge),
    0 .25cqw .4cqw rgba(0,0,0,.3);
}

/* SELECT / START */
.pill-slot {
  border-radius: 3cqw;
  background: linear-gradient(#c3c1b6, #cbc9be);
  box-shadow: inset .3cqw .35cqw .5cqw rgba(0,0,0,.3), 0 .25cqw 0 rgba(255,255,255,.5);
}
.pill {
  position: absolute; left: .7cqw; right: .7cqw; top: .6cqw; bottom: .8cqw; border-radius: 2cqw;
  background: linear-gradient(#8f8e9b, #747380);
  box-shadow: inset 0 .25cqw 0 rgba(255,255,255,.3), inset 0 -.25cqw .3cqw rgba(0,0,0,.3), 0 .3cqw 0 #4c4b57, 0 .5cqw .5cqw rgba(0,0,0,.25);
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
}
.pill::after { content: ""; position: absolute; inset: -3cqw -1.6cqw; }
.pill.is-pressed {
  transform: translateY(.3cqw);
  box-shadow: inset 0 .25cqw 0 rgba(255,255,255,.2), inset 0 -.25cqw .3cqw rgba(0,0,0,.35), 0 .06cqw 0 #4c4b57, 0 .15cqw .2cqw rgba(0,0,0,.25);
}

/* Printed labels */
.label {
  position: absolute; left: calc(var(--x) * 1cqw); top: calc(var(--y) * 1cqw);
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  color: var(--ink); font-family: var(--font-brand); font-weight: 800; white-space: nowrap; pointer-events: none;
}
.label--ab { font-size: 3.4cqw; font-style: italic; }
.label--pill { font-size: 1.85cqw; letter-spacing: .1em; }

/* ---- Speaker grille ---------------------------------------------------- */
.speaker {
  position: absolute; left: 70cqw; top: 141cqw;
  display: flex; gap: 2.05cqw; transform: skewX(-28deg); transform-origin: 0 0;
  /* the grille is also the mute switch */
  appearance: none; border: 0; background: none; margin: 0; padding: 0; cursor: pointer; pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.speaker::after { content: ""; position: absolute; inset: -2cqw -1.5cqw; }       /* generous tap area */
.speaker:focus-visible { outline: .45cqw solid #ffcf3a; outline-offset: .6cqw; }
.speaker i { transition: opacity 120ms, transform 120ms; }
.speaker:active i { transform: translateY(.25cqw); }
.gb[data-sound="off"] .speaker i { opacity: .38; }
.speaker i {
  display: block; width: 1.4cqw; height: 12cqw; border-radius: .7cqw;
  background: #a4a296;
  box-shadow: inset .3cqw .35cqw .4cqw rgba(0,0,0,.55), .15cqw .25cqw 0 rgba(255,255,255,.55);
}

/* ==========================================================================
   Lower half. Mobile/tablet: an overlay on the one-piece console.
   Its children are positioned in cqw of this box, which equals the console
   width there, so the layout is identical to before.
   ========================================================================== */
.gb__lower { position: absolute; inset: 0; container-type: inline-size; pointer-events: none; }
.gb__frame { position: absolute; inset: 0; }
.gb__body--lower { display: none; }

/* ==========================================================================
   Desktop split
   ========================================================================== */
@media (min-width: 1025px) {
  .gb {
    aspect-ratio: auto;
    height: calc(var(--gb-w) * 0.84);
    margin-right: calc(var(--ctl-w) + var(--split-gap));
  }
  /* Upper half: sliced off just under the branding */
  .gb__body:not(.gb__body--lower) {
    inset: 0 0 auto 0; height: 84cqw;
    border-radius: 4.4cqw 4.4cqw .8cqw .8cqw;
  }
  .gb__body:not(.gb__body--lower) .gb__panel { border-radius: 3.4cqw 3.4cqw .3cqw .3cqw; }

  /* Lower half: its own panel, vertically centred beside the upper half */
  .gb__lower {
    inset: auto;
    left: calc(100% + var(--split-gap));
    top: calc((var(--gb-w) * 0.84 - var(--ctl-w) * 0.864) / 2);
    width: var(--ctl-w);
    height: calc(var(--ctl-w) * 0.864);
    pointer-events: none;
  }
  .gb__body--lower {
    display: block;
    inset: 0;
    border-radius: .8cqw .8cqw 18cqw 5.6cqw;
  }
  .gb__body--lower .gb__panel { border-radius: .3cqw .3cqw 16.8cqw 4.3cqw; }
  /* Same coordinates as the one-piece console, shifted up so the cut starts at y = 78 */
  .gb__frame { inset: auto; left: 0; top: -78cqw; width: 100%; height: 164.4cqw; }
}

/* ==========================================================================
   Seamless plastic (every screen size): the page IS the Game Boy's casing.
   The shell shapes are dropped, so the bezel, screen and buttons sit
   directly on one continuous warm-grey surface with the same grain.
   ========================================================================== */
@media screen {
  html { background: #cfcdc2; }
  body {
    background:
      radial-gradient(90% 45% at 22% 0%, rgba(255,255,255,.2), transparent 70%) fixed,
      linear-gradient(172deg, #dad8ce 0%, #d0cec3 42%, #c6c4b8 100%) fixed;
  }
  body::before {
    content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    opacity: .22;                       /* the grain is black-with-alpha, so no blend mode is needed (blend modes on a fixed full-screen layer are costly) */
  }
  .stage { position: relative; z-index: 1; }
  .gb__body, .gb__top { display: none; }
}

/* ==========================================================================
   Pixel cursor (images are generated in cursor.js; native cursors are the fallback)
   ========================================================================== */
:where(html, html *) { cursor: var(--cur-default, auto); }
html button, html a, html [role="button"], html [role="switch"],
.item, .chip-btn, .nav { cursor: var(--cur-point, pointer); }
.power { cursor: var(--cur-grab, grab); }
html button:active, html .power:active { cursor: var(--cur-grab, grabbing); }
.px-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9999; }

/* LCD elements that respond to the pointer */
.chip-btn:hover .key, .nav:hover { background: var(--lcd-dark); color: var(--lcd-light); }
.nav { display: inline-block; padding: 0 calc(var(--p) * 2); margin: 0 calc(var(--p) * -1); }

/* ==========================================================================
   PROJECT WINDOW: pixelated Windows XP, Game Boy LCD palette
   ========================================================================== */
.xp {
  position: fixed; inset: 0; z-index: 8000; pointer-events: none;
  font-family: var(--font-lcd); font-size: 9px; line-height: 1.8; text-transform: uppercase;
  color: var(--lcd-deep); -webkit-font-smoothing: none;
  --hi: rgba(255,255,255,.38);
  scrollbar-color: var(--lcd-dark) var(--lcd-mid);
}
.xp[hidden] { display: none; }
.xp button { font: inherit; text-transform: inherit; color: inherit; }
.xp__win {
  pointer-events: auto; outline: none;
  position: absolute; left: 50%; top: calc(50% - 14px);
  width: min(900px, 94vw); height: min(640px, calc(100vh - 96px));
  transform: translate(calc(-50% + var(--dx, 0px) + var(--ts, 0px)), calc(-50% + var(--dy, 0px)));   /* --ts nudges it left to make room for a mini window */
  display: flex; flex-direction: column;
  padding: 0 3px 3px;
  background: var(--lcd-dark);
  border: 2px solid var(--lcd-deep);
  box-shadow: 6px 6px 0 rgba(31,42,27,.5);
}
.xp.is-open .xp__win { animation: xp-in 200ms steps(3) both; }
@keyframes xp-in { from { scale: .85; opacity: 0; } to { scale: 1; opacity: 1; } }
.xp.is-min .xp__win { display: none; }

/* Title bar: stepped bands instead of a smooth gradient */
.xp__title {
  flex: none; height: 24px; margin: 0 -3px; padding: 0 4px 0 7px;
  display: flex; align-items: center; gap: 7px; touch-action: none;
  background: linear-gradient(#a9b886 0 2px, #7f8f61 2px 6px, #667650 6px 15px, #55653f 15px 100%);
  border-bottom: 2px solid var(--lcd-deep);
  color: var(--lcd-light); text-shadow: 1px 1px 0 var(--lcd-deep);
}
.xp__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.xp__icon {                                   /* pixel folder */
  flex: none; position: relative; width: 14px; height: 11px; margin-top: 2px;
  background: var(--lcd-light); border: 2px solid var(--lcd-deep); box-sizing: border-box;
}
.xp__icon::before { content: ""; position: absolute; left: -2px; top: -5px; width: 6px; height: 3px; background: var(--lcd-light); border: 2px solid var(--lcd-deep); border-bottom: 0; }
.xp__btns { display: flex; gap: 3px; }
.xp__btn {
  position: relative; width: 22px; height: 20px; padding: 0; margin: 0; cursor: pointer;
  background: var(--lcd-light); border: 2px solid var(--lcd-deep);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 rgba(31,42,27,.35);
}
.xp__btn:active { box-shadow: inset 2px 2px 0 rgba(31,42,27,.45); }
.xp__btn:focus-visible, .xp__tbtn:focus-visible, .xp__link:focus-visible, .xp__task:focus-visible { outline: 2px solid var(--lcd-deep); outline-offset: 1px; }
.xp__btn--min::before { content: ""; position: absolute; left: 4px; bottom: 3px; width: 10px; height: 3px; background: var(--lcd-deep); }
.xp__btn--max::before { content: ""; position: absolute; inset: 3px 4px; border: 2px solid var(--lcd-deep); border-top-width: 3px; }
/* Close: a bold 8x8 pixel X (2px thick strokes), light on the dark button */
.xp__btn--close {
  background: var(--lcd-deep) center / 14px 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23dfe8bd' d='M0 0h2v1H0zM6 0h2v1H6zM1 1h2v1H1zM5 1h2v1H5zM2 2h4v1H2zM3 3h2v1H3zM2 4h4v1H2zM1 5h2v1H1zM5 5h2v1H5zM0 6h2v1H0zM6 6h2v1H6zM0 7h1v1H0zM7 7h1v1H7z'/%3E%3C/svg%3E");
  image-rendering: pixelated;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.22), inset -2px -2px 0 rgba(0,0,0,.4);
}
.xp__btn--close:hover { background-color: var(--lcd-dark); }

/* Toolbar + address bar */
.xp__toolbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 4px; background: var(--lcd-mid); border-bottom: 2px solid var(--lcd-dark); }
.xp__tbtn {
  padding: 3px 8px; cursor: pointer; background: var(--lcd-light); border: 2px solid var(--lcd-deep);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 rgba(31,42,27,.3);
}
.xp__tbtn:active { box-shadow: inset 2px 2px 0 rgba(31,42,27,.4); }
.xp__tbtn:disabled { opacity: .45; cursor: default; }
.xp__addr { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.xp__addr > span { color: var(--lcd-dark); }
.xp__path { flex: 1; min-width: 0; padding: 3px 6px; overflow: hidden; white-space: nowrap; background: var(--lcd-light); border: 2px solid var(--lcd-deep); box-shadow: inset 2px 2px 0 rgba(31,42,27,.25); }

/* Body */
.xp__body { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px 1fr; background: var(--lcd-mid); border: 2px solid var(--lcd-deep); border-top: 0; }
.xp__side { overflow: auto; padding: 10px; }
.xp__main { overflow: auto; padding: 16px 20px 28px; background: var(--lcd-light); border-left: 2px solid var(--lcd-deep); }
.xp__panel { margin-bottom: 10px; background: var(--lcd-light); border: 2px solid var(--lcd-deep); box-shadow: 3px 3px 0 var(--lcd-dark); }
.xp__panel h3 { margin: 0; padding: 4px 8px 2px; font: inherit; background: var(--lcd-deep); color: var(--lcd-light); }
.xp__kv { display: grid; gap: 1px; padding: 6px 8px; border-bottom: 2px dotted var(--lcd-mid); }
.xp__kv:last-child { border-bottom: 0; }
.xp__kv b { font-weight: 400; color: var(--lcd-dark); }
.xp__hint { padding: 6px 8px; color: var(--lcd-dark); }
.xp__hint .key { display: inline-block; padding: 0 3px 0 4px; margin-right: 3px; background: var(--lcd-deep); color: var(--lcd-light); }
.xp__link { display: block; margin: 8px; padding: 5px 6px 3px; text-align: center; text-decoration: none; cursor: pointer; background: var(--lcd-dark); color: var(--lcd-light); border: 2px solid var(--lcd-deep); box-shadow: inset 2px 2px 0 rgba(255,255,255,.2), 3px 3px 0 var(--lcd-deep); }
.xp__link:active { box-shadow: inset 2px 2px 0 rgba(0,0,0,.3); }


.xp__status { flex: none; display: flex; justify-content: space-between; padding: 3px 8px 1px; margin-top: 3px; background: var(--lcd-mid); border: 2px solid var(--lcd-deep); font-size: 8px; }

/* Taskbar */
.xp__taskbar {
  pointer-events: auto; position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  display: flex; align-items: center; gap: 8px; padding: 0 6px 0 0;
  background: linear-gradient(#7f8f61 0 2px, #5a6a45 2px 100%); border-top: 2px solid var(--lcd-deep);
}
.xp__start { align-self: stretch; display: flex; align-items: center; padding: 0 16px 0 12px; background: var(--lcd-dark); color: var(--lcd-light); font: italic 700 13px/1 var(--font-brand); text-transform: none; border-right: 2px solid var(--lcd-deep); box-shadow: inset 2px 2px 0 rgba(255,255,255,.2); }
.xp__tasks { flex: 1; min-width: 0; display: flex; gap: 4px; overflow: hidden; }
.xp__task {
  flex: 0 1 190px; min-width: 56px; height: 22px; padding: 2px 8px 0; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: clip; cursor: pointer;
  background: var(--lcd-mid); border: 2px solid var(--lcd-deep); box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 rgba(31,42,27,.3);
}
.xp__task.is-active { background: var(--lcd-light); box-shadow: inset 2px 2px 0 rgba(31,42,27,.35); }
.xp__task.is-min { opacity: .75; }
.xp__clock { margin-left: auto; padding: 4px 8px 0; color: var(--lcd-light); border-left: 2px solid var(--lcd-deep); }

.xp ::-webkit-scrollbar { width: 12px; height: 12px; }
.xp ::-webkit-scrollbar-track { background: var(--lcd-mid); border-left: 2px solid var(--lcd-deep); }
.xp ::-webkit-scrollbar-thumb { background: var(--lcd-dark); border: 2px solid var(--lcd-deep); box-shadow: inset 2px 2px 0 rgba(255,255,255,.2); }

/* Maximised, and phones: the window fills the screen above the taskbar */
.xp.is-max .xp__win {
  left: 0; top: 0; width: 100%; height: calc(100% - 30px); transform: none; border-width: 0 0 2px; box-shadow: none;
}
@media (max-width: 767px) {
  .xp__win { left: 0; top: 0; width: 100%; height: calc(100% - 30px); transform: none; border-width: 0 0 2px; box-shadow: none; }
  .xp__body { grid-template-columns: 1fr; overflow: auto; }
  .xp__side { overflow: visible; padding-bottom: 0; }
  .xp__main { overflow: visible; border-left: 0; border-top: 2px solid var(--lcd-deep); }
  .xp__addr > span, .xp__btn--max { display: none; }
  .xp__task { flex-basis: 110px; min-width: 44px; }
}

/* ==========================================================================
   PROJECT CONTENT BLOCKS
   ========================================================================== */
.xp__main { container-type: inline-size; }
.xp__main > h1 { margin: 0 0 18px; font: inherit; font-size: 20px; line-height: 1.35; }
.b { margin: 0 0 24px; }
.b-p { max-width: 60ch; font-size: 10px; line-height: 2.1; margin: 0 0 22px; }
.b-h { display: inline-block; margin: 6px 0 14px; padding: 5px 9px 2px; font: inherit; font-size: 11px; background: var(--lcd-deep); color: var(--lcd-light); }
.b img, .b .gbc, .b-fig img, .b-fig .gbc, .b-strip img {
  display: block; width: 100%; height: auto; background: var(--lcd-mid);
  border: 2px solid var(--lcd-deep); box-shadow: 4px 4px 0 var(--lcd-dark);
}
.b-hero img { box-shadow: 5px 5px 0 var(--lcd-dark); }
.b img.is-broken { min-height: 80px; padding: 10px; font-size: 8px; line-height: 1.7; color: var(--lcd-deep); }
figure.b { margin: 0 0 28px; }          /* top-level images and videos keep a gap before the next block */
.b figure, .b-fig { margin: 0; }        /* figures inside grids and splits are spaced by their container */
.b-fig { margin: 0; }
figcaption, .b-cap { margin: 10px 0 0; max-width: 60ch; color: var(--lcd-dark); font-size: 8px; line-height: 1.8; }
.b-cap { margin: -8px 0 24px; }
.b-grid { display: grid; gap: 16px; grid-template-columns: repeat(var(--c, 2), minmax(0, 1fr)); align-items: start; }
.cols-1 { --c: 1; } .cols-2 { --c: 2; } .cols-3 { --c: 3; } .cols-4 { --c: 4; }
.b-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.b-split > .b { margin: 0; }
.b-split > .b-p { align-self: center; }
@container (max-width: 560px) {
  .b-split { grid-template-columns: 1fr; }
  .cols-3, .cols-4 { --c: 2; }
}
@container (max-width: 330px) { .b-grid { --c: 1; } .cols-4 { --c: 2; } }

/* Big number and quote moments */
.b-stat {
  position: relative; padding: 16px 18px 14px; background: var(--lcd-deep); color: var(--lcd-light); box-shadow: 5px 5px 0 var(--lcd-dark);
  background-image: linear-gradient(45deg, rgba(255,255,255,.07) 25%, transparent 25% 50%, rgba(255,255,255,.07) 50% 75%, transparent 75%); background-size: 4px 4px;
}
.b-stat b { display: block; font-weight: 400; font-size: 34px; line-height: 1.2; color: var(--lcd-paper, #dfe8bd); text-shadow: 3px 3px 0 var(--lcd-dark); }
.b-stat p { margin: 10px 0 0; max-width: 46ch; font-size: 9px; line-height: 2; color: var(--lcd-light); }
.b-stat i { display: block; margin-top: 8px; font-style: normal; font-size: 8px; color: var(--lcd-mid); }
.b-stat i::before { content: "- "; }
.b-quote { margin: 8px 0 28px; padding: 22px 20px 18px; background: var(--lcd-dark); color: #dfe8bd; border: 2px solid var(--lcd-deep); box-shadow: 5px 5px 0 var(--lcd-deep); font-size: 15px; line-height: 1.8; }
.b-quote span { background: var(--lcd-deep); padding: 2px 8px 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.b-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 8px; align-items: end; padding: 14px; background: var(--lcd-deep); border: 2px solid var(--lcd-deep); box-shadow: 5px 5px 0 var(--lcd-dark); }
.b-strip img, .b-strip .gbc { border: 0; box-shadow: none; background: none; }
.b-strip img:hover { animation: hop 400ms steps(4); }
@keyframes hop { 40% { transform: translateY(-8px); } }

/* Video */
.b-vbox { position: relative; background: #000; border: 2px solid var(--lcd-deep); box-shadow: 4px 4px 0 var(--lcd-dark); overflow: hidden; }
.b-vbox video { display: block; width: 100%; height: 100%; object-fit: cover; }
.b-play {
  position: absolute; inset: 0; margin: auto; width: 60px; height: 60px; padding: 0; cursor: pointer;
  background: var(--lcd-light); border: 2px solid var(--lcd-deep); box-shadow: 4px 4px 0 var(--lcd-deep), inset 2px 2px 0 rgba(255,255,255,.4);
  display: grid; place-items: center;
}
.b-play span { width: 22px; height: 26px; background: var(--lcd-deep); clip-path: polygon(0 0, 100% 50%, 0 100%); margin-left: 5px; }
.b-play:hover { background: #dfe8bd; }
.b-play:focus-visible { outline: 3px solid var(--lcd-deep); outline-offset: 3px; }
.b-vid.is-playing .b-play { display: none; }
.xp.is-gb .b-vbox { background: var(--lcd-light); }
.xp.is-gb .b-vbox video { filter: grayscale(1) contrast(1.35) brightness(1.05); mix-blend-mode: multiply; }

/* GB MODE: images are swapped for 4-tone dithered canvases */
.gbc { display: none; image-rendering: pixelated; }
.xp.is-gb .gbc { display: block; }
.xp.is-gb img.gb-done { display: none; }
.xp.is-gb .b-strip .gbc { border: 0; box-shadow: none; }

/* Buttons in the TASKS panel */
.xp__link--btn { width: calc(100% - 16px); font: inherit; border-radius: 0; color: var(--lcd-light); }
.xp .xp__link { color: var(--lcd-light); }
.xp .xp__link[aria-pressed="true"] { color: var(--lcd-deep); }
.xp__link[aria-pressed="true"] { background: var(--lcd-light); color: var(--lcd-deep); }

/* ==========================================================================
   MINI 8-BIT WINDOWS (pint.exe, candle.exe, spray.exe, watch.exe)
   ========================================================================== */
.xp-mini {
  position: fixed; z-index: 8100; pointer-events: auto; padding: 0 3px 3px;
  background: var(--lcd-dark); border: 2px solid var(--lcd-deep); box-shadow: 6px 6px 0 rgba(31,42,27,.5);
  animation: xp-in 220ms steps(3) both; text-transform: uppercase;
}
.xp-mini[hidden] { display: none; }
.xp-mini__title {
  height: 22px; margin: 0 -3px; padding: 0 3px 0 6px; display: flex; align-items: center; gap: 6px; touch-action: none;
  background: linear-gradient(#a9b886 0 2px, #7f8f61 2px 6px, #667650 6px 14px, #55653f 14px 100%);
  border-bottom: 2px solid var(--lcd-deep); color: var(--lcd-light); text-shadow: 1px 1px 0 var(--lcd-deep);
}
.xp-mini__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-transform: none; }
.xp-mini__title .xp__btn { width: 20px; height: 18px; }
.xp-mini__stage { margin-top: 3px; line-height: 0; background: var(--lcd-deep); border: 2px solid var(--lcd-deep); }
.xp-mini canvas { display: block; image-rendering: pixelated; touch-action: none; user-select: none; -webkit-user-select: none; cursor: var(--cur-point, pointer); }
.xp-mini__hint { padding: 7px 4px 4px; max-width: 290px; font-size: 8px; line-height: 1.7; color: var(--lcd-light); }
.xp-mini.is-inline { position: relative; left: auto; top: auto; z-index: auto; margin: 0 0 26px; max-width: 380px; box-shadow: 5px 5px 0 var(--lcd-deep); }
.xp-mini.is-inline .xp-mini__hint { max-width: none; }

/* ==========================================================================
   TOY BOX PAGE
   ========================================================================== */
.b-toybox { margin: 4px 0 8px; }
.tb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@container (max-width: 560px) { .tb-grid { grid-template-columns: 1fr; } }
.tb-card { padding: 0 3px 3px; background: var(--lcd-dark); border: 2px solid var(--lcd-deep); box-shadow: 5px 5px 0 var(--lcd-deep); }
.tb-card__title {
  height: 22px; margin: 0 -3px; padding: 0 6px; display: flex; align-items: center; gap: 6px;
  background: linear-gradient(#a9b886 0 2px, #7f8f61 2px 6px, #667650 6px 14px, #55653f 14px 100%);
  border-bottom: 2px solid var(--lcd-deep); color: var(--lcd-light); text-shadow: 1px 1px 0 var(--lcd-deep);
}
.tb-card__title span { text-transform: none; }
.tb-card__stage { margin-top: 3px; display: grid; place-items: center; line-height: 0; background: var(--lcd-deep); border: 2px solid var(--lcd-deep); }
.tb-card canvas { display: block; image-rendering: pixelated; touch-action: none; user-select: none; -webkit-user-select: none; cursor: var(--cur-point, pointer); }
.tb-card canvas:focus-visible { outline: 3px solid #ffcf3a; outline-offset: 2px; }
.tb-card__hint { margin: 0; padding: 7px 4px 4px; color: var(--lcd-light); font-size: 8px; line-height: 1.7; }
/* ==========================================================================
   LIGHTBOX VIEWER WINDOWS (one per opened image or video, each with its own taskbar tab)
   ========================================================================== */
.b img[data-view], .b-fig img[data-view], .b-strip img[data-view], .b .gbc { cursor: var(--cur-point, zoom-in); }
.b img[data-view]:focus-visible { outline: 3px solid var(--lcd-deep); outline-offset: 3px; }
.b-zoom {
  position: absolute; right: 8px; top: 8px; width: 30px; height: 28px; padding: 0; cursor: pointer; z-index: 2;
  background: var(--lcd-light); border: 2px solid var(--lcd-deep); box-shadow: 3px 3px 0 var(--lcd-deep), inset 2px 2px 0 rgba(255,255,255,.4);
}
.b-zoom::before {                      /* a little "expand" glyph: a box with an arrow corner */
  content: ""; position: absolute; left: 6px; top: 5px; width: 10px; height: 10px; border: 2px solid var(--lcd-deep); border-right-width: 0; border-bottom-width: 0;
}
.b-zoom::after { content: ""; position: absolute; right: 6px; bottom: 5px; width: 10px; height: 10px; border: 2px solid var(--lcd-deep); border-left-width: 0; border-top-width: 0; }
.b-zoom:hover { background: #dfe8bd; }
.b-zoom:focus-visible { outline: 3px solid var(--lcd-deep); outline-offset: 2px; }

.xp-view {
  position: fixed; left: 50%; top: calc(50% - 14px); pointer-events: auto; outline: none;
  transform: translate(calc(-50% + var(--vx, 0px)), calc(-50% + var(--vy, 0px)));
  width: max-content; max-width: min(96vw, 1240px); padding: 0 3px 3px;
  background: var(--lcd-dark); border: 2px solid var(--lcd-deep); box-shadow: 6px 6px 0 rgba(31,42,27,.5);
  animation: xp-in 200ms steps(3) both; text-transform: uppercase;
}
.xp-view.is-min { display: none; }
.xp-view__title {
  height: 24px; margin: 0 -3px; padding: 0 4px 0 7px; display: flex; align-items: center; gap: 7px; touch-action: none;
  background: linear-gradient(#a9b886 0 2px, #7f8f61 2px 6px, #667650 6px 15px, #55653f 15px 100%);
  border-bottom: 2px solid var(--lcd-deep); color: var(--lcd-light); text-shadow: 1px 1px 0 var(--lcd-deep);
}
.xp-view__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-transform: none; }
.xp-view__bar { display: flex; align-items: center; gap: 6px; padding: 5px 4px; background: var(--lcd-mid); border-bottom: 2px solid var(--lcd-dark); }
.xp-view__count { margin-left: auto; padding-right: 4px; color: var(--lcd-deep); }
.xp-view__stage { position: relative; display: grid; place-items: center; min-width: min(90vw, 360px); min-height: 200px; line-height: 0; background: var(--lcd-deep); border: 2px solid var(--lcd-deep); }
.xp-view__stage.is-loading::after { content: "LOADING"; position: absolute; color: var(--lcd-light); font-size: 9px; line-height: 1; animation: blink 800ms steps(1) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.xp-view__stage img, .xp-view__stage video { display: block; width: auto; height: auto; max-width: min(92vw, 1200px); max-height: calc(100vh - 250px); background: #000; }
.xp-view__cap { padding: 8px 6px 4px; max-width: 70ch; color: var(--lcd-light); font-size: 8px; line-height: 1.8; text-transform: none; }

/* ==========================================================================
   PHONES AND TOUCH: bigger title bars, so minimise and close are easy to read and tap
   ========================================================================== */
@media (max-width: 767px), (pointer: coarse) {
  .xp__title, .xp-view__title, .xp-mini__title { height: 44px; padding: 0 6px 0 10px; font-size: 12px; gap: 10px; }
  .xp__icon { transform: scale(1.3); margin-left: 2px; }
  .xp__btn, .xp-mini__title .xp__btn, .xp-view__title .xp__btn { width: 42px; height: 34px; }
  .xp__btn--close { background-size: 22px 22px; }
  .xp__btn--min::before { left: 10px; bottom: 8px; width: 18px; height: 5px; }
  .xp__btn--max::before { inset: 7px 11px; }
  .xp__btns { gap: 6px; }
  .xp__name, .xp-view__name, .xp-mini__name { letter-spacing: .02em; }
  .xp__task { height: 26px; padding-top: 4px; }
  .xp-mini__hint { font-size: 9px; }
}
@media (max-width: 767px) {
  .xp-view { left: 0; top: 0; right: 0; bottom: 30px; transform: none; width: auto; max-width: none; border-width: 0 0 2px; box-shadow: none; display: flex; flex-direction: column; }
  .xp-view.is-min { display: none; }
  .xp-view__stage { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
  .xp-view__stage img, .xp-view__stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
  .xp-view__cap { max-width: none; }
}

/* ==========================================================================
   CORNER RESIZING (desktop with a mouse only)
   ========================================================================== */
.xp__rs, .xp-mini__rs { position: absolute; z-index: 6; width: 18px; height: 18px; display: none; touch-action: none; }
.xp__rs[data-rs="nw"], .xp-mini__rs[data-rs="nw"] { left: -7px; top: -7px; cursor: nwse-resize; }
.xp__rs[data-rs="ne"], .xp-mini__rs[data-rs="ne"] { right: -7px; top: -7px; cursor: nesw-resize; }
.xp__rs[data-rs="sw"], .xp-mini__rs[data-rs="sw"] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.xp__rs[data-rs="se"], .xp-mini__rs[data-rs="se"] { right: -7px; bottom: -7px; cursor: nwse-resize; }
/* a small pixel grip in the bottom-right corner shows that it can be dragged */
.xp__rs[data-rs="se"]::after, .xp-mini__rs[data-rs="se"]::after {
  content: ""; position: absolute; right: 9px; bottom: 9px; width: 8px; height: 8px; pointer-events: none;
  background: linear-gradient(135deg, transparent 0 46%, var(--lcd-deep) 46% 58%, transparent 58% 74%, var(--lcd-deep) 74% 86%, transparent 86%);
}
@media (min-width: 1025px) and (pointer: fine) {
  .xp__rs { display: block; }
  .xp.is-max .xp__rs { display: none; }
  .xp-mini:not(.is-inline) .xp-mini__rs { display: block; }
}
.xp.is-max .xp__win { width: 100% !important; height: calc(100% - 30px) !important; }
.xp-mini:not(.is-inline) .xp-mini__hint { max-width: none; }

/* ==========================================================================
   Reduced motion: no flicker, wipes, blinking or tilt
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .lcd__wipe { display: none; }
  .bl { transform: none; }
}
