/* ══════════════════════════════════════════════════════════════
   Multitap Portfolio — Wii Menu replica styles
   Desktop: 16:9 letterboxed stage, all dims in --u (1% stage width).
   Stage height = 56.25u. Letterbox is invisible (body shares bg).
   ══════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bot));
  color: var(--txt-dark);
}

/* faint horizontal plastic lines over everything gray */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 42%, transparent 60%, rgba(90, 100, 106, 0.06)),
    repeating-linear-gradient(180deg, transparent 0 3px, var(--bg-line) 3px 4px);
  z-index: 1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 300;
  background: #fff;
  padding: 8px 16px;
  border-radius: 8px;
}
.skip-link:focus { left: 12px; top: 12px; }

button { font-family: inherit; }

/* ══ BOOT ═══════════════════════════════════════════════════ */

#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: grid;
  place-items: center;
  color: #fff;
  text-align: center;
  padding: 6vmin;
  cursor: pointer;
}
.boot-box {
  max-width: 72ch;
  border: 2px solid #fff;
  border-radius: 12px;
  padding: 5vmin 6vmin;
}
.boot-title {
  font-weight: 700;
  font-size: clamp(17px, 3.2vmin, 34px);
  letter-spacing: 0.04em;
  margin: 0 0 3vmin;
}
.boot-warn { color: #f6c445; }
.boot-body {
  color: #cfcfcf;
  font-size: clamp(14px, 2.2vmin, 20px);
  line-height: 1.6;
  margin: 1.2vmin 0;
}
.boot-continue {
  margin-top: 5vmin;
  font-size: clamp(14px, 2.4vmin, 22px);
  animation: bootPulse 1.4s ease-in-out infinite;
}
@keyframes bootPulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ══ STAGE (16:9 letterbox on desktop) ══════════════════════ */

#stage {
  position: fixed;
  width: calc(100 * var(--u));
  height: calc(56.25 * var(--u));
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* ══ CHANNEL GRID ═══════════════════════════════════════════ */

#grid-viewport {
  position: absolute;
  inset: 0 0 calc(11.8 * var(--u)) 0;
  overflow: hidden;
}
#pages {
  display: flex;
  height: 100%;
  transition: transform var(--page-ms) var(--ease-menu);
}
.page {
  flex: 0 0 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: calc(1.9 * var(--u)) calc(1.7 * var(--u));
  padding: calc(1.8 * var(--u)) calc(3.4 * var(--u)) calc(1.3 * var(--u));
}

.channel {
  position: relative;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: calc(1.9 * var(--u));
  min-width: 0;
  min-height: 0;
}
.channel-face {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: inherit;
  border: calc(0.3 * var(--u)) solid var(--ch-border);
  background: linear-gradient(180deg, var(--ch-face-top), var(--ch-face-bot));
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65), 0 1px 3px rgba(80, 90, 95, 0.12);
}
/* glass reflection band across the top of every channel face */
.channel-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.10) 34%, transparent 42%);
  pointer-events: none;
  z-index: 3;
}
.channel-face img,
.channel-face video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.channel-name {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 6.5%;
  z-index: 4;
  font-size: calc(1.35 * var(--u));
  font-weight: 700;
  color: #5f6568;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1em;
  padding: 0.1em 0.55em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(70, 80, 85, 0.18);
}

/* hover / keyboard focus = the blue pulse */
.channel:hover .channel-face,
.channel:focus-visible .channel-face {
  border-color: rgba(255, 255, 255, 0.9);
  animation: wiiGlow var(--pulse-ms) ease-in-out infinite;
}
.channel:focus { outline: none; }

@keyframes wiiGlow {
  0%, 100% { box-shadow: 0 0 0 calc(0.3 * var(--u)) var(--glow-1), 0 0 calc(1.4 * var(--u)) var(--glow-shadow), inset 0 1px 0 #fff; }
  50%      { box-shadow: 0 0 0 calc(0.3 * var(--u)) var(--glow-2), 0 0 calc(2.4 * var(--u)) var(--glow-shadow), inset 0 1px 0 #fff; }
}
.glow { animation: wiiGlow var(--pulse-ms) ease-in-out infinite; outline: none; }

/* empty channel */
.channel--empty { cursor: default; }
.channel--empty .channel-face {
  background: linear-gradient(180deg, var(--ch-empty-top), var(--ch-empty-bot));
  border-color: var(--ch-empty-border);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}
.channel--empty .channel-face::before {
  content: "";
  position: absolute;
  right: 6%;
  bottom: 9%;
  width: calc(2.4 * var(--u));
  height: calc(2.4 * var(--u));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='1' y='1' width='10' height='10' rx='3' fill='%239ba1a5'/%3E%3Crect x='13' y='1' width='10' height='10' rx='3' fill='%239ba1a5'/%3E%3Crect x='1' y='13' width='10' height='10' rx='3' fill='%239ba1a5'/%3E%3Crect x='13' y='13' width='10' height='10' rx='3' fill='%239ba1a5'/%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0.35;
}

/* CTA channel = an empty channel that speaks */
.channel--cta .channel-face {
  background: linear-gradient(180deg, var(--ch-empty-top), var(--ch-empty-bot));
  border-color: var(--ch-empty-border);
  border-style: dashed;
}
.cta-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(1.7 * var(--u));
  font-weight: 700;
  color: #a6acaf;
  z-index: 2;
}

/* ══ PAGE ARROWS ════════════════════════════════════════════ */

.page-arrow {
  position: absolute;
  top: calc(19.5 * var(--u));
  width: calc(2.4 * var(--u));
  height: calc(3.6 * var(--u));
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  z-index: 5;
  color: var(--arrow-blue);
}
.page-arrow svg { width: 100%; height: 100%; display: block; }
.page-arrow path { fill: currentColor; stroke: #fff; stroke-width: 1.5; }
.page-arrow--left { left: calc(0.7 * var(--u)); }
.page-arrow--right { right: calc(0.7 * var(--u)); }
.page-arrow:hover, .page-arrow:focus-visible {
  color: var(--glow-1);
  filter: drop-shadow(0 0 calc(0.8 * var(--u)) var(--glow-shadow));
  outline: none;
}
.arrow--off { visibility: hidden; }

/* ══ BOTTOM BAR ═════════════════════════════════════════════ */

#bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(15 * var(--u));
  pointer-events: none;         /* children re-enable */
}
#bar-edge {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#bar > button { pointer-events: auto; }

.bar-btn {
  position: absolute;
  bottom: calc(0.9 * var(--u));
  width: calc(10.2 * var(--u));
  height: calc(10.2 * var(--u));
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #d3d6d7, var(--btn-ring));
  padding: calc(0.55 * var(--u));
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(70, 80, 85, 0.25);
}
.bar-btn--left { left: calc(3.7 * var(--u)); }
.bar-btn--right { right: calc(3.7 * var(--u)); }
.bar-btn-face {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--btn-face-top), var(--btn-face-bot));
  box-shadow: inset 0 calc(-0.3 * var(--u)) calc(0.5 * var(--u)) rgba(0, 0, 0, 0.07), inset 0 2px 2px #fff;
  color: var(--btn-icon);
}
.bar-btn:hover .bar-btn-face,
.bar-btn:focus-visible .bar-btn-face {
  color: var(--blue-text);
  animation: wiiGlow var(--pulse-ms) ease-in-out infinite;
}
.bar-btn:focus { outline: none; }

/* Multitap brand mark: four squares in a row, first filled blue
   (matches the real logo from multitap.space) */
.logo-mark {
  display: flex;
  gap: 9%;
  width: 58%;
}
.logo-mark i {
  flex: 1;
  aspect-ratio: 1;
  display: block;
  background: #ffffff;
  border: 2px solid #2a2e31;
  box-shadow: 2px 2px 0 #0f92d0;
}
.logo-mark i.on {
  background: #0f92d0;
}

.envelope { width: 46%; }

#board-badge {
  position: absolute;
  top: 4%;
  right: 4%;
  min-width: 1.6em;
  height: 1.6em;
  border-radius: 1em;
  background: var(--badge-red);
  color: #fff;
  font-size: calc(1.3 * var(--u));
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 0.35em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* SD card button */
#btn-sd {
  position: absolute;
  left: calc(15.6 * var(--u));
  bottom: calc(1.5 * var(--u));
  width: calc(3.1 * var(--u));
  height: calc(3.7 * var(--u));
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--btn-icon);
  opacity: 0.85;
}
#btn-sd svg { width: 100%; height: 100%; display: block; }
#btn-sd:hover, #btn-sd:focus-visible {
  color: var(--blue-text);
  filter: drop-shadow(0 0 calc(0.6 * var(--u)) var(--glow-shadow));
  outline: none;
}

/* ══ CLOCK ══════════════════════════════════════════════════ */

#clock {
  position: absolute;
  left: 50%;
  top: calc(4.6 * var(--u));
  transform: translateX(-50%);
  text-align: center;
  color: var(--txt-clock);
  user-select: none;
  z-index: 2;
}
#clock-time {
  font-family: var(--font-clock);
  font-size: calc(5.4 * var(--u));
  line-height: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
}
#clock-colon {
  animation: colonBlink 1s steps(1) infinite;
  margin: 0 0.06em;
}
@keyframes colonBlink { 50% { opacity: 0; } }
#clock-ampm {
  font-family: var(--font);
  font-size: calc(1.7 * var(--u));
  font-weight: 500;
  margin-left: 0.45em;
}

/* recessed date groove strip across the bar */
#clock-date-groove {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin-top: calc(1.15 * var(--u));
  width: calc(58 * var(--u));
  padding: calc(0.28 * var(--u)) 0;
  background: var(--bar-groove);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.10), inset 0 -1px 0 rgba(255, 255, 255, 0.75);
  border-radius: calc(0.5 * var(--u));
}
#clock-date {
  font-size: calc(1.9 * var(--u));
  font-weight: 500;
  color: #8f959a;
}

/* ══ FULL-SCREEN SCREENS (channel / board / settings / list) ═ */

.screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--scr-bg);
}
.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 4vh 6vw;
  width: 100%;
  max-width: 1150px;
  margin: 0 auto;
}
.screen-footer {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6vw;
  padding: 2.2vh 4vw;
  background: linear-gradient(180deg, #f0f2f2, var(--scr-footer));
  border-top: 2px solid #d5d8d9;
  box-shadow: inset 0 2px 0 #fff;
}
.pill {
  min-width: min(32vw, 320px);
  padding: 1.6vh 4vw;
  border-radius: 999px;
  border: 3px solid var(--pill-border);
  background: linear-gradient(180deg, var(--pill-face-top), var(--pill-face-bot));
  font-size: clamp(16px, 2.6vh, 25px);
  font-weight: 700;
  color: var(--txt-gray);
  cursor: pointer;
  text-align: center;
}
.pill:hover, .pill:focus-visible {
  color: var(--blue-text);
  animation: wiiGlow var(--pulse-ms) ease-in-out infinite;
  border-color: rgba(255, 255, 255, 0.9);
  outline: none;
}

.banner {
  aspect-ratio: 16 / 9;
  /* definite width, not fit-content: WebKit resolves fit-content +
     aspect-ratio against %-sized children to 0x0 */
  width: min(100%, calc(44vh * 16 / 9));
  margin: 0 auto 2.5vh;
  border-radius: 14px;
  overflow: hidden;
  background: #e2e5e6;
  box-shadow: inset 0 0 0 3px #fff, 0 2px 12px rgba(70, 80, 85, 0.18);
}
.banner img, .banner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.screen-title {
  font-size: clamp(26px, 4.6vh, 44px);
  font-weight: 700;
  color: var(--txt-dark);
  text-align: center;
  margin: 0.2em 0 0;
}
.screen-tagline {
  text-align: center;
  color: var(--txt-gray);
  font-size: clamp(15px, 2.4vh, 22px);
  margin: 0.25em 0 1.1em;
}
.screen-desc {
  color: var(--txt-dark);
  font-size: clamp(15px, 2.2vh, 19px);
  line-height: 1.75;
  max-width: 70ch;
  margin: 0 auto;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  justify-content: center;
  margin: 1.6em 0 0.4em;
}
.chip {
  background: #fff;
  border: 2px solid var(--ch-border);
  border-radius: 999px;
  padding: 0.28em 0.95em;
  color: var(--txt-gray);
  font-weight: 500;
  font-size: clamp(13px, 1.9vh, 16px);
  text-decoration: none;
}
a.chip:hover, a.chip:focus-visible {
  color: var(--blue-text);
  border-color: var(--glow-1);
  outline: none;
}
.chips-caption {
  width: 100%;
  text-align: center;
  color: var(--txt-gray);
  font-size: clamp(13px, 2vh, 16px);
  margin: 0 0 0.3em;
}
.case {
  max-width: 70ch;
  margin: 3em auto 1em;
  color: var(--txt-dark);
  font-size: clamp(14px, 2.1vh, 17px);
  line-height: 1.75;
}
.case h3 { color: var(--blue-text); margin-top: 1.8em; }
.case ul { padding-left: 1.2em; }

/* ══ PLAYER STATS (Tapped In profile style) ═════════════════ */

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  max-width: 760px;
  margin: 3vh auto 1vh;
}
.stats-card {
  background: #fff;
  border: 2px solid var(--ch-border);
  border-radius: 16px;
  padding: 18px 20px 10px;
  box-shadow: 0 1px 4px rgba(80, 90, 95, 0.08);
}
.stats-card--wide { grid-column: 1 / -1; }
.stats-card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--txt-gray);
  margin: 0 0 10px;
  border-bottom: 2px solid #eef0f0;
  padding-bottom: 8px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f2f4f4;
}
.stats-card .stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--txt-gray); font-size: 14.5px; }
.stat-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 22px;
  color: var(--txt-dark);
}
.perf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f2f4f4;
  color: var(--txt-dark);
  font-size: 14.5px;
  line-height: 1.5;
}
.stats-card .perf:last-child { border-bottom: none; }
.perf-badge {
  flex: none;
  min-width: 44px;
  text-align: center;
  background: linear-gradient(180deg, var(--glow-1), #2fa3dc);
  color: #fff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 15px;
  box-shadow: 0 1px 2px rgba(31, 143, 199, 0.35);
}

/* ══ MESSAGE BOARD ══════════════════════════════════════════ */

.board-notes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.2em;
  margin-top: 2vh;
}
.note {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(70, 80, 85, 0.12);
  border: 1px solid #e2e5e6;
}
.note-strip { height: 9px; }
.note-inner { padding: 0.9em 1em 1em; }
.note-name {
  font-weight: 700;
  color: var(--txt-dark);
  font-size: 15px;
  margin: 0 0 0.3em;
  overflow-wrap: anywhere;
}
.note-msg {
  color: var(--txt-dark);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.note-date {
  color: var(--txt-gray);
  font-size: 12px;
  margin: 0.6em 0 0;
}
.board-form {
  background: #fff;
  border: 2px solid var(--ch-border);
  border-radius: 14px;
  padding: 1.2em;
  margin-top: 2.5vh;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.board-form label {
  display: block;
  font-weight: 700;
  color: var(--txt-gray);
  font-size: 14px;
  margin: 0.7em 0 0.25em;
}
.board-form input[type="text"],
.board-form textarea {
  width: 100%;
  border: 2px solid var(--ch-border);
  border-radius: 10px;
  padding: 0.55em 0.8em;
  font-family: inherit;
  font-size: 15px;
  color: var(--txt-dark);
  background: #fbfcfc;
}
.board-form input:focus, .board-form textarea:focus {
  outline: none;
  border-color: var(--glow-1);
  box-shadow: 0 0 8px var(--glow-shadow);
}
.board-form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.9em;
}
.board-count { color: var(--txt-gray); font-size: 13px; }
.board-send {
  border: 2px solid var(--pill-border);
  background: linear-gradient(180deg, var(--pill-face-top), var(--pill-face-bot));
  border-radius: 999px;
  padding: 0.5em 1.8em;
  font-weight: 700;
  font-size: 15px;
  color: var(--txt-gray);
  cursor: pointer;
}
.board-send:hover:not(:disabled) { color: var(--blue-text); border-color: var(--glow-1); }
.board-send:disabled { opacity: 0.5; cursor: default; }
.board-error {
  color: var(--badge-red);
  font-weight: 500;
  font-size: 14px;
  margin: 0.8em 0 0;
  min-height: 1.2em;
}
.hp-field { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

/* ══ SETTINGS ═══════════════════════════════════════════════ */

.settings-card {
  background: #fff;
  border: 3px solid var(--ch-border);
  border-radius: 22px;
  padding: clamp(18px, 4vh, 40px) clamp(18px, 4vw, 48px);
  max-width: 640px;
  margin: 0 auto;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1em 0;
  border-bottom: 1px solid #eceeee;
}
.setting-row-label { font-weight: 700; color: var(--txt-dark); font-size: clamp(15px, 2.3vh, 19px); }
.toggle {
  position: relative;
  width: 3.4em;
  height: 1.7em;
  border-radius: 1em;
  border: none;
  cursor: pointer;
  background: #c9cdcf;
  transition: background 160ms;
  flex: none;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 0.15em;
  left: 0.15em;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: left 160ms;
}
.toggle[aria-pressed="true"] { background: var(--glow-1); }
.toggle[aria-pressed="true"]::after { left: 1.85em; }
.toggle:focus-visible { outline: 3px solid var(--glow-shadow); }
.settings-about {
  color: var(--txt-dark);
  line-height: 1.7;
  font-size: clamp(14px, 2.1vh, 17px);
  margin-top: 1.4em;
}
.settings-about a { color: var(--blue-text); font-weight: 700; text-decoration: none; }
.settings-about a:hover { text-decoration: underline; }

/* ══ ALL-CHANNELS QUICK LIST (SD card menu) ═════════════════ */

.sd-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.6em;
  margin-top: 1.5vh;
}
.sd-item {
  display: block;
  background: #fff;
  border: 2px solid var(--ch-border);
  border-radius: 10px;
  padding: 0.55em 0.9em;
  color: var(--txt-dark);
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-item small { display: block; color: var(--txt-gray); font-weight: 400; font-size: 12px; }
.sd-item:hover, .sd-item:focus-visible {
  border-color: var(--glow-1);
  color: var(--blue-text);
  outline: none;
}

/* ══ GLOVE CURSOR ═══════════════════════════════════════════ */

body.wii-cursor, body.wii-cursor * { cursor: none !important; }
#glove {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  width: 38px;
  will-change: transform;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.30));
}

/* ══ RESPONSIVE ═════════════════════════════════════════════ */

/* tablets / small landscape: 3x4 grid inside the same stage */
@media (max-width: 1023px) and (min-width: 640px) {
  .page {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
  }
  .channel {
    justify-self: center;
    width: auto;
    max-width: 100%;
    aspect-ratio: 8 / 5;
    /* explicit height: WebKit sizes an empty aspect-ratio grid item to 0x0
       when the inline axis is center-aligned (stretch doesn't transfer) */
    height: 100%;
  }
}

/* phones: fluid stage, 2×3 grid, compact bar with explicit geometry */
@media (max-width: 639px) {
  #stage {
    width: 100vw;
    height: 100dvh;
    left: 0;
    top: 0;
    transform: none;
  }
  #grid-viewport { inset: 0 0 132px 0; }
  .page {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(6, 1fr);
    align-content: stretch;
    gap: min(2.6vw, 14px);
    padding: 3vw 5vw;
  }
  .channel {
    border-radius: 14px;
    justify-self: center;
    width: auto;
    max-width: 100%;
    aspect-ratio: 8 / 5;
    height: 100%; /* same WebKit 0x0 guard as the tablet rule above */
  }
  .channel-face { border-width: 2.5px; }
  .channel-name { font-size: 12px; }
  .cta-label { font-size: 15px; }
  .channel--empty .channel-face::before { width: 18px; height: 18px; }

  /* bar: fixed 132px; buttons 62px in the corners; SD tucked beside the
     left button at button-height; clock stacked in the middle, clear of both */
  #bar { height: 132px; }
  .bar-btn {
    width: 62px;
    height: 62px;
    bottom: 12px;
    padding: 4px;
  }
  .bar-btn--left { left: 12px; }
  .bar-btn--right { right: 12px; }
  #btn-sd {
    left: 84px;
    bottom: 30px;
    width: 19px;
    height: 23px;
  }
  #clock {
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
  }
  #clock-time { font-size: 30px; }
  #clock-ampm { font-size: 11px; }
  #clock-date-groove {
    width: min(40vw, 168px);
    margin-top: 6px;
    padding: 2px 0;
  }
  #clock-date { font-size: 12px; }
  #board-badge { font-size: 11px; }
  .page-arrow {
    top: auto;
    bottom: 140px;
    width: 20px;
    height: 30px;
  }
  .page-arrow--left { left: 6px; }
  .page-arrow--right { right: 6px; }
  .screen-footer { gap: 12px; padding: 12px; }
  .pill { min-width: 0; flex: 1; max-width: 300px; padding: 12px 10px; }
  .screen-body { padding: 3vh 5vw; }
}

/* ══ REDUCED MOTION ═════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  #pages { transition: none; }
  .boot-continue { animation: none; opacity: 1; }
  .channel:hover .channel-face,
  .channel:focus-visible .channel-face,
  .pill:hover, .pill:focus-visible,
  .bar-btn:hover .bar-btn-face,
  .bar-btn:focus-visible .bar-btn-face,
  .glow {
    animation: none;
    box-shadow: 0 0 0 3px var(--glow-1), 0 0 14px var(--glow-shadow);
  }
  #clock-colon { animation: none; }
}
:root[data-motion="off"] #pages { transition: none; }
:root[data-motion="off"] .boot-continue { animation: none; opacity: 1; }
:root[data-motion="off"] .channel:hover .channel-face,
:root[data-motion="off"] .channel:focus-visible .channel-face,
:root[data-motion="off"] .pill:hover,
:root[data-motion="off"] .pill:focus-visible,
:root[data-motion="off"] .bar-btn:hover .bar-btn-face,
:root[data-motion="off"] .bar-btn:focus-visible .bar-btn-face,
:root[data-motion="off"] .glow {
  animation: none;
  box-shadow: 0 0 0 3px var(--glow-1), 0 0 14px var(--glow-shadow);
}
:root[data-motion="off"] #clock-colon { animation: none; }
