/* Pyxel v2 concept: CONSOLE. The whole site is the handheld's screen. Forked from v2/handheld. */

@font-face { font-family: "Silkscreen"; src: url("/assets/site/fonts/silkscreen-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "DotGothic16"; src: url("/assets/site/fonts/dotgothic16.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Archivo"; src: url("/assets/site/fonts/archivo-variable.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

:root {
  /* LCD ramp, tuned olive. Text always uses l3 on l0 (8.8:1) or l0 on l3. */
  --l0: #c3cc8f;
  --l1: #93a065;
  --l2: #556236;
  --l3: #1e2a12;

  /* Shell: translucent tangerine plastic */
  --shell: #fb6f0e;
  --shell-hi: #ff9d4d;
  --shell-lo: #e85d05;
  --print: #2a0f02;          /* ink printed on the shell, 5.6:1 on --shell */
  --bezel: #2b2232;
  --bezel-print: #d9cfe0;
  --key: #29232f;
  --berry: #9a1c52;
  --rubber: #625a6c;
  --shade: 52, 38, 32;       /* low-chroma warm dark: every shadow on the shell */

  /* Desk: a green self-healing cutting mat */
  --mat: #2c6a4b;
  --mat-line: rgba(214, 245, 226, .09);
  --mat-line-2: rgba(214, 245, 226, .2);
  --ink: #22130a;
  --paper: #f1f4f0;
  --spot: #fb6f0e;

  --pixel: "Silkscreen", ui-monospace, monospace;
  --dot: "DotGothic16", ui-monospace, monospace;
  --sans: "Archivo", system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line-2) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
}
::selection { background: var(--spot); color: var(--ink); }
img, svg, canvas { display: block; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--print); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

.defs { position: absolute; }
.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; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 50; padding: 10px 16px; background: var(--ink); color: var(--paper); font-weight: 700; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ============ One viewport: the console is the page ============ */

.console {
  min-height: 100svh;
  display: grid; place-items: center;
  padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(90% 70% at 12% 0%, rgba(255, 255, 240, .08), transparent 65%),
    linear-gradient(135deg, transparent calc(50% - 1px), var(--mat-line-2) 50%, transparent calc(50% + 1px));
}

.device {
  /* chrome around the LCD: wings 2 x 150, shell 2 x 22, face 2 x 12, bezel 2 x 26 = 420 wide;
     shell 2 x 22, bezel 30 + 12, wordmark 44 = 130 tall. The LCD takes the rest of the viewport. */
  --lcd-h: max(380px, min(calc(100svh - 32px - 130px), 720px));   /* past 720px a taller screen is only empty space */
  --lcd-w: max(400px, min(calc(var(--lcd-h) * 1.35), calc(100vw - 32px - 420px), 980px));
  position: relative;
  display: grid;
  grid-template-columns: 150px auto 150px;
  align-items: stretch;
  padding: 22px;
  border-radius: 64px;
  isolation: isolate;
  background:
    radial-gradient(90% 70% at 18% 0%, rgba(255, 236, 214, .45), transparent 55%),
    radial-gradient(70% 60% at 100% 100%, rgba(120, 30, 0, .12), transparent 60%),
    linear-gradient(165deg, var(--shell-hi) 0%, var(--shell) 32%, var(--shell) 70%, var(--shell-lo) 100%);
  box-shadow:
    inset 0 2px 1px rgba(255, 240, 225, .7),
    inset 0 -8px 14px rgba(var(--shade), .3),
    inset 0 -1px 0 rgba(var(--shade), .3),
    18px 34px 50px -18px rgba(5, 26, 15, .62),
    6px 12px 18px -4px rgba(5, 26, 15, .4);
}
/* Translucent plastic: the board and screw posts read faintly through the shell */
.device::before {
  content: ""; position: absolute; inset: 22px; z-index: -1; border-radius: 48px; pointer-events: none;
  background:
    radial-gradient(circle at 34px 34px, rgba(110, 30, 0, .22) 0 9px, transparent 10px),
    radial-gradient(circle at calc(100% - 34px) 34px, rgba(110, 30, 0, .22) 0 9px, transparent 10px),
    radial-gradient(circle at 34px calc(100% - 34px), rgba(110, 30, 0, .22) 0 9px, transparent 10px),
    radial-gradient(circle at calc(100% - 34px) calc(100% - 34px), rgba(110, 30, 0, .22) 0 9px, transparent 10px),
    radial-gradient(circle, rgba(110, 30, 0, .09) 1.5px, transparent 2px) 0 0 / 12px 12px;
  -webkit-mask: linear-gradient(90deg, #000 0 18%, transparent 30% 70%, #000 82%);
          mask: linear-gradient(90deg, #000 0 18%, transparent 30% 70%, #000 82%);
}

.wing { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 6px 0; }
.wing-left { justify-content: flex-start; gap: 40px; }
.wing-left .dpad { margin-top: 18px; }

/* ---- Printed shell labels ---- */
.print {
  font: italic 750 13px/1.15 var(--sans); font-stretch: 78%;
  letter-spacing: .07em; text-transform: uppercase; color: var(--print); text-align: center;
}

/* ---- Nap switch ---- */
.nap {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 8px; max-width: 150px; text-align: left;
  border: 0; border-radius: 12px; background: transparent; cursor: pointer;
  font: italic 750 13px/1.15 var(--sans); font-stretch: 78%; letter-spacing: .07em; text-transform: uppercase; color: var(--print);
}
.nap-track { flex: none; }
.nap-track {
  position: relative; width: 44px; height: 18px; border-radius: 4px;
  background: linear-gradient(#7a2a05, #a63e0b);
  box-shadow: inset 0 2px 3px rgba(var(--shade), .6), 0 1px 0 rgba(255, 220, 190, .5);
}
.nap-knob {
  position: absolute; top: 2px; left: 3px; width: 18px; height: 14px; border-radius: 3px;
  background: linear-gradient(var(--rubber), #4a4352);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .25s var(--ease);
}
.nap.is-asleep .nap-knob { transform: translateX(20px); }
.nap:hover .nap-track { filter: brightness(1.12); }

/* ---- D-pad ---- */
.dpad {
  display: grid; grid-template: repeat(3, 46px) / repeat(3, 46px);
  filter: drop-shadow(0 4px 5px rgba(var(--shade), .45));
}
.dp, .dp-hub {
  border: 0; padding: 0; margin: 0;
  background: linear-gradient(160deg, #3a3342, var(--key) 60%);
  cursor: pointer; position: relative;
}
.dp-up { grid-area: 1 / 2; border-radius: 7px 7px 0 0; }
.dp-left { grid-area: 2 / 1; border-radius: 7px 0 0 7px; }
.dp-hub { grid-area: 2 / 2; background: radial-gradient(circle, #1d1922 0 10px, var(--key) 12px); }
.dp-right { grid-area: 2 / 3; border-radius: 0 7px 7px 0; }
.dp-down { grid-area: 3 / 2; border-radius: 0 0 7px 7px; }
.dp::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  border: 7px solid transparent; translate: -50% -50%;
}
.dp-up::before { border-bottom-color: #575060; border-top-width: 0; }
.dp-down::before { border-top-color: #575060; border-bottom-width: 0; }
.dp-left::before { border-right-color: #575060; border-left-width: 0; }
.dp-right::before { border-left-color: #575060; border-right-width: 0; }
.dp:active, .dp.is-down { background: #1d1922; translate: 0 1px; }
.dp:focus-visible { outline: 3px solid var(--print); outline-offset: 2px; z-index: 1; }

/* ---- A / B ---- */
.ab { display: flex; align-items: flex-start; gap: 10px; transform: rotate(-22deg); margin-top: 40px; }
.key { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 74px; }
.key-b { margin-top: 34px; }
.round {
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  font: italic 800 20px/1 var(--sans); color: rgba(255, 228, 238, .85);
  background: radial-gradient(circle at 35% 30%, #c43a73 0, var(--berry) 45%, #6d0f38 100%);
  box-shadow: 0 5px 8px -2px rgba(var(--shade), .55), inset 0 -3px 5px rgba(var(--shade), .4), inset 0 2px 2px rgba(255, 210, 225, .35);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.round:active, .round.is-down { transform: translateY(2px); box-shadow: 0 2px 3px rgba(var(--shade), .5), inset 0 -1px 3px rgba(var(--shade), .4), inset 0 2px 2px rgba(255, 210, 225, .25); }
.round:hover { filter: brightness(1.08); }
.round:focus-visible { outline: 3px solid var(--print); outline-offset: 4px; }

/* ---- Select / Start pills ---- */
.pills { display: flex; gap: 4px; width: max-content; margin-top: 16px; }
.pill-key { display: flex; flex: none; flex-direction: column; align-items: center; gap: 2px; width: max-content; min-width: 88px; }
.pill-key .print { white-space: nowrap; }
.pill {
  position: relative; display: block; width: 72px; height: 44px; border: 0; padding: 0; background: transparent; cursor: pointer;
}
.pill::before {
  content: ""; position: absolute; left: 6px; right: 6px; top: 14px; height: 16px; border-radius: 99px;
  background: linear-gradient(#766d80, var(--rubber) 50%, #4c4555);
  box-shadow: inset 0 2px 3px rgba(var(--shade), .5), 0 2px 3px rgba(var(--shade), .45), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .12s var(--ease);
}
.pill:active::before, .pill.is-down::before { transform: translateY(1px); background: #4c4555; }
.pill:hover::before { filter: brightness(1.12); }
.pill:focus-visible { outline: 3px solid var(--print); outline-offset: 0; border-radius: 12px; }
.pill[aria-pressed="true"]::before { background: linear-gradient(#8a7fa0, #6a6178); }
.pill-start .print { font-size: 15px; }
.pill-start .pill::before { background: radial-gradient(circle at 35% 30%, #c43a73 0, var(--berry) 50%, #6d0f38 100%); box-shadow: 0 2px 4px rgba(var(--shade), .5), inset 0 1px 0 rgba(255, 210, 225, .35); }
.pill-start .print b { font-weight: 850; }

.grille {
  width: 90px; height: 52px; margin: 20px 0 0 0; transform: rotate(-28deg);
  background: repeating-linear-gradient(90deg, rgba(95, 25, 0, .55) 0 7px, transparent 7px 16px);
  border-radius: 6px;
  box-shadow: inset 0 2px 3px rgba(var(--shade), .25);
}

/* ============ Face: bezel and LCD ============ */

.face { display: flex; align-items: center; padding: 0 12px; }
.bezel {
  position: relative;
  padding: 30px 26px 12px;
  border-radius: 16px 16px 52px 16px;
  background: linear-gradient(170deg, #362c3e, var(--bezel) 40%, #221a28);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .08), inset 0 -2px 4px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 230, 210, .55);
}
.bezel-top {
  position: absolute; left: 26px; right: 26px; top: 11px; height: 10px;
  display: flex; align-items: center; justify-content: center;
}
.bezel-top::before {
  content: ""; position: absolute; inset: 3px 0 auto; height: 4px;
  background: linear-gradient(var(--spot) 0 1.5px, transparent 1.5px 2.5px, var(--l1) 2.5px);
}
.bezel-top span {
  position: relative; padding: 0 10px; background: var(--bezel);
  font: italic 700 10px/1 var(--sans); font-stretch: 80%; letter-spacing: .14em; text-transform: uppercase; color: var(--bezel-print);
}
.led-wrap {
  position: absolute; left: 5px; top: calc(30px + var(--lcd-h) * .32);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font: italic 700 9px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--bezel-print);
}
.led { width: 10px; height: 10px; border-radius: 50%; background: #3d3240; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); transition: background .4s, box-shadow .4s; }
.led.on { background: radial-gradient(circle at 35% 30%, #f3ffd0 0 20%, #c6ff4d 50%, #86b81a 100%); box-shadow: inset 0 -1px 1px rgba(var(--shade), .5); }
.led.blink { animation: blink .5s steps(2) 2; }
@keyframes blink { 50% { background: #3d3240; box-shadow: none; } }


.wordmark { width: auto; height: 34px; margin: 10px auto 0; }

/* ============ LCD: status, screens, Pyxel's ground, tabs ============ */

.lcd {
  --field-h: clamp(84px, calc(var(--lcd-h) * .2), 150px);
  position: relative; overflow: hidden;
  width: var(--lcd-w); height: var(--lcd-h); padding: 8px;
  display: grid; grid-template-rows: minmax(32px, auto) minmax(0, 1fr) var(--field-h) auto; grid-template-columns: minmax(0, 1fr);
  background: var(--l0); color: var(--l3);
  border-radius: 3px;
  box-shadow: inset 0 3px 6px rgba(20, 30, 10, .35), inset 0 0 0 2px rgba(30, 42, 18, .35);
  font: 400 16px/24px var(--dot);
  container: lcd / inline-size;
}
/* The pixel grid: every LCD cell has a hairline gap */
.lcd::after {
  content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(30, 42, 18, .085) 1px, transparent 1px),
    linear-gradient(rgba(30, 42, 18, .085) 1px, transparent 1px);
  background-size: 3px 3px;
}
.lcd-status {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--l3); color: var(--l0);
  font: 400 16px/16px var(--pixel); white-space: nowrap;
}
.lcd-status b { font-weight: 400; }
.needs { display: inline-flex; align-items: center; gap: 4px; }
.needs .ni { flex: none; }
.meter {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  position: relative; min-width: 44px; min-height: 28px; padding: 0 2px; border: 0; border-radius: 3px;
  background: transparent; color: inherit; cursor: pointer;
}
.meter::after { content: ""; position: absolute; inset: -8px 0; }   /* 44px tall hit area inside the 8px band padding */
.meter:focus-visible { outline: 2px solid var(--l0); outline-offset: -2px; }
.happiness { display: inline-flex; flex: none; align-items: center; gap: 3px; }
.happy-heart { flex: none; fill: var(--l1); }
.happy-segments { display: inline-flex; gap: 1px; }
.happy-segments i { width: 3px; height: 10px; background: var(--l2); }
.happy-segments i.on { background: var(--l0); }
.s0 { fill: var(--l0); }
/* Colour switch: four LCD shades, or four colours when colour mode is on */
.colour-switch { flex: none; }
.colour-switch .sw0 { fill: var(--l0); } .colour-switch .sw1 { fill: var(--l1); } .colour-switch .sw2 { fill: var(--l2); } .colour-switch .sw3 { fill: var(--l0); opacity: .45; }
.colour-switch[aria-pressed="true"] .sw0 { fill: #fb6f0e; } .colour-switch[aria-pressed="true"] .sw1 { fill: #3d8fe0; }
.colour-switch[aria-pressed="true"] .sw2 { fill: #4fb06c; } .colour-switch[aria-pressed="true"] .sw3 { fill: #ff4d7a; opacity: 1; }
.s1 { fill: var(--l1); }
.pips { display: inline-flex; gap: 2px; }
.pips i { width: 4px; height: 10px; background: var(--l2); }
.pips i.on { background: var(--l0); }
.needs.low .pips i.on { animation: blink 1s steps(2) infinite; }

.lcd > * { grid-column: 1; }   /* explicit, so the field may overlap the screens row */
.lcd-status { grid-row: 1; }
.lcd-screens { grid-row: 2; position: relative; min-height: 0; overflow: clip; }
.lcd-screens:focus { outline: none; }
.scr { padding: 16px 20px 20px; }
.js .scr { position: absolute; inset: 0; visibility: hidden; overflow: hidden auto; scrollbar-width: thin; scrollbar-color: var(--l3) transparent; }
.js .scr.is-on { visibility: visible; }

.scr h1 { margin: 0 0 14px; max-width: 19ch; font: 400 32px/40px var(--pixel); }
.scr h3 { margin: 18px 0 6px; font: 400 16px/24px var(--pixel); }
.scr h2, .scr .detail h3 { margin: 0 0 12px; font: 400 24px/32px var(--pixel); }
.scr p { margin: 0 0 10px; max-width: 62ch; }
.scr .lede { margin-bottom: 14px; max-width: 54ch; }
.scr .small { font-size: 13px; line-height: 20px; margin-top: 16px; }

.menu { list-style: none; margin: 0 0 14px; padding: 0; max-width: 44ch; }
.item {
  position: relative; display: flex; align-items: center; width: 100%; min-height: 44px;
  padding: 0 10px 0 30px; border: 0; background: transparent; cursor: pointer;
  font: 400 16px/1.2 var(--pixel); color: var(--l3); text-align: left; text-decoration: none;
}
.item::before {
  content: ""; position: absolute; left: 10px; top: 50%; width: 8px; height: 12px; translate: 0 -50%;
  clip-path: polygon(0 0, 100% 50%, 0 100%); background: currentColor; opacity: 0;
}
.item.is-sel { background: var(--l3); color: var(--l0); }
.item.is-sel::before { opacity: 1; }
.item:hover:not(.is-sel) { background: var(--l1); }
.lcd :focus-visible { outline: 3px solid var(--l3); outline-offset: -3px; }
.lcd .is-sel:focus-visible, .lcd-tabs [aria-current]:focus-visible { outline-color: var(--l1); }
.lcd [tabindex="-1"]:focus { outline: none; }
.lcd ::selection { background: var(--l3); color: var(--l0); }   /* headings take focus on screen change; no box around them */
.menu-notes p { margin: 2px 0 12px 30px; font-size: 14px; line-height: 20px; }
.item[aria-pressed="true"]::after {
  content: "On"; margin-left: auto; padding: 3px 6px 2px; border: 2px solid currentColor; font: 400 14px/1 var(--pixel);
}

/* Services: the menu, or one service in full */
.detail { border-top: 2px solid var(--l3); padding-top: 12px; margin-top: 12px; }
.js .detail { display: none; border-top: 0; padding-top: 0; margin-top: 0; }
.js .scr.show-detail > :not(.detail) { display: none; }
.js .detail.is-on { display: block; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; }
.tags li { padding: 3px 8px 2px; border: 2px solid var(--l3); font: 400 14px/20px var(--pixel); }
.scr .detail-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 16px; }
.detail-links .item { width: auto; }
.back { display: inline-flex; align-items: center; min-height: 44px; font: 400 16px/1 var(--pixel); color: var(--l3); }

.steps { list-style: none; margin: 0; padding: 0; max-width: 62ch; }
.steps li { padding: 10px 0; border-top: 2px dotted rgba(30, 42, 18, .35); }
.steps h3 { margin: 0 0 4px; }
.steps p { margin: 0; }
.steps .n { display: inline-block; min-width: 24px; margin-right: 10px; padding: 0 4px; background: var(--l3); color: var(--l0); text-align: center; }

.addr { font: 400 16px/24px var(--pixel); }
.copy-status { min-height: 24px; }

.about { display: grid; grid-template-columns: minmax(96px, 32%) minmax(0, 1fr); gap: 20px; align-items: start; }
.photo { width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; border: 3px solid var(--l3); background: var(--l1); filter: url(#lcd-quantise); }
.lcd.colour .photo { filter: none; }
.name { font: 400 16px/24px var(--pixel); }

.howto { margin: 0; max-width: 62ch; }
.howto div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 6px 0; border-top: 2px dotted rgba(30, 42, 18, .35); }
.howto dt { font: 400 14px/24px var(--pixel); }
.howto dd { margin: 0; }

/* Pyxel's field spans the screen and the ground, so a thrown ball flies over the content.
   Clicks fall through to the screen; only the ball, bowls, poops and trash can take them.
   The ground strip forwards taps and holds on Pyxel to the canvas (script.js). */
.field { grid-row: 2 / 4; position: relative; pointer-events: none; color: var(--l3); }
.field > * { pointer-events: auto; }
.field .pyxel-pet-canvas { pointer-events: none; filter: url(#lcd-quantise); }
.field .pyxel-pet-ball, .field .pyxel-bowl, .field .pyxel-poop { z-index: 3; }
.ground { grid-row: 3; position: relative; z-index: 2; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.lcd.colour .field .pyxel-pet-canvas { filter: none; }
.field .pyxel-pet-ball:focus-visible { outline: 3px solid var(--l3); outline-offset: -8px; border-radius: 50%; }

.lcd-tabs { grid-row: 4; display: flex; border-top: 2px solid var(--l3); }
.lcd-tabs a {
  flex: 1 1 auto; display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 6px;
  font: 400 16px/1 var(--pixel); color: var(--l3); text-decoration: none;
}
.lcd-tabs a + a { border-left: 2px solid var(--l3); }
.lcd-tabs a:not([aria-current]):hover { background: var(--l1); }
.lcd-tabs [aria-current] { background: var(--l3); color: var(--l0); }

.dissolve { position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }

/* ============ LCD content scales with the screen, not the window ============ */

@container lcd (min-width: 760px) {
  .scr { padding: 24px 32px 28px; font-size: 18px; line-height: 28px; }
  .scr h1 { font-size: 40px; line-height: 48px; }
  .scr h2, .scr .detail h3 { font-size: 32px; line-height: 40px; }
}
@container lcd (max-width: 519px) {
  .scr { padding: 12px 14px 16px; }
  .scr h1 { font-size: 24px; line-height: 32px; margin-bottom: 10px; }
  .scr h2, .scr .detail h3 { font-size: 20px; line-height: 28px; }
  .about { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .howto div { grid-template-columns: 1fr; gap: 0; }
}
@container lcd (max-width: 440px) {
  .st-screen { display: none; }
  .lcd-status { gap: 4px; padding-left: 6px; padding-right: 8px; }
  .scr h1 { font-size: 22px; line-height: 28px; }
  .scr .lede, .scr p { font-size: 15px; line-height: 22px; }
  .lcd-tabs a { padding: 0 2px; font: 400 14px/1 var(--dot); }
}
@container lcd (max-width: 300px) {
  .lcd-status { gap: 6px; padding: 0 6px; }
  .st-fetch { display: none; }
}

/* ============ Phone and tablet, portrait: LCD on top, controls under the thumbs ============ */

@media (orientation: portrait) and (max-width: 1024px) {
  .console { padding: 0; place-items: stretch; }
  .device {
    width: 100%; height: 100svh; min-height: 560px;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "nap nap" "face face" "dpad ab" "pills pills";
    padding: max(6px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
    border-radius: 0; align-items: center;
  }
  .device::before { inset: 8px; border-radius: 16px; -webkit-mask: none; mask: none; opacity: .6; }
  .wing { display: contents; }
  .nap { grid-area: nap; justify-self: start; max-width: none; }
  .face { grid-area: face; align-self: stretch; align-items: stretch; display: flex; min-height: 0; padding: 0; }
  .bezel { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 22px 10px 6px; border-radius: 12px 12px 36px 12px; }
  .bezel-top { left: 12px; right: 12px; top: 7px; }
  .led-wrap { left: auto; right: 14px; top: 3px; flex-direction: row; gap: 5px; }
  .led-wrap span:last-child { display: none; }
  .lcd { --field-h: 104px; width: 100%; height: auto; flex: 1; min-height: 0; }
  .lcd::after { background-size: 2px 2px; }
  .wordmark { height: 22px; margin-top: 6px; }
  .wing-left .dpad { grid-area: dpad; justify-self: center; margin: 10px 0 0; grid-template: repeat(3, 44px) / repeat(3, 44px); }
  .ab { grid-area: ab; justify-self: center; margin: 4px 0 0; gap: 8px; }
  .key { width: 70px; }
  .key-b { margin-top: 28px; }
  .round { width: 56px; height: 56px; }
  .pills { grid-area: pills; justify-self: center; margin: 4px 0 0; }
  .grille { display: none; }
}
@media (orientation: portrait) and (max-width: 1024px) and (max-height: 700px) {
  .lcd { --field-h: 80px; }
  .wordmark { display: none; }
  .key-b { margin-top: 20px; }
}

/* ============ Phone landscape and narrow windows: a real handheld turned sideways, compact ============ */

@media (orientation: landscape) and (max-height: 520px), (orientation: landscape) and (max-width: 859px) {
  .console { padding: 4px max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left)); }
  .device {
    --lcd-h: calc(100svh - 8px - 16px - 14px);
    --lcd-w: calc(100vw - 2 * max(8px, env(safe-area-inset-left)) - 2 * 132px - 16px - 12px - 16px);
    grid-template-columns: 132px auto 132px; padding: 8px; border-radius: 32px;
  }
  .device::before { inset: 8px; border-radius: 24px; }
  .wing-left { gap: 6px; }
  .wing-left .dpad { margin-top: 2px; grid-template: repeat(3, 44px) / repeat(3, 44px); }
  .nap { gap: 6px; padding: 4px; font-size: 11px; }
  .nap-track { width: 36px; }
  .nap.is-asleep .nap-knob { transform: translateX(12px); }
  .ab { margin-top: 10px; transform: rotate(-18deg); }
  .key { width: 54px; }
  .key-b { margin-top: 24px; }
  .round { width: 48px; height: 48px; }
  .pills { flex-direction: column; margin-top: 2px; }
  .pill-key { min-width: 0; }
  .grille { display: none; }
  .face { padding: 0 6px; }
  .bezel { padding: 7px 8px 7px; border-radius: 10px 10px 28px 10px; }
  .bezel-top, .led-wrap, .wordmark { display: none; }
  .lcd { --field-h: 84px; }
}

/* ============ Without JS: every screen, one after another ============ */

html:not(.js) .lcd { --field-h: 0px; height: auto; }
html:not(.js) .scr { border-bottom: 2px solid var(--l3); }
html:not(.js) .field, html:not(.js) .dpad, html:not(.js) .ab, html:not(.js) .pill-key:first-child,
html:not(.js) .nap, html:not(.js) .needs, html:not(.js) .happiness, html:not(.js) .st-fetch,
html:not(.js) [data-copy], html:not(.js) .menu-notes button, html:not(.js) .dissolve { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
