
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dmsans-regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dmsans-semibold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Inconsolata";
  src: url("fonts/inconsolata-regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
:root {
  /* Site theme contract (shared with /nerbous/, see assets/site-theme.js).
     Brand defaults here; html[data-site-theme="custom"] swaps them for
     hsl(var(--site-hue) ...). Reset removes the attribute = exact brand. */
  --site-accent: #c9a36a;
  --site-accent-soft: rgba(201, 163, 106, 0.35);
  --site-line: #2c2824;
  --site-surface: #141210;
  /* Root-only shades of the same gold (brand values), also themed below */
  --gold-hi: #e4c48a;      /* display type: AK Ai LLC, Coming soon, Enter Nerbous */
  --gold-sh1: #a7844e;     /* 3D text-shadow steps */
  --gold-sh2: #6e5732;
  --gold-sh3: #3e2e1c;
  --gold-dim: #6d5a3e;     /* rules, door border */
  --line-2: #3a3228;       /* control borders */
  --line-3: #5a4c38;
  --panel-bg: rgba(16, 14, 12, 0.92);
  --player-bg: rgba(16, 14, 12, 0.94);
  --card-bg: rgba(18, 15, 13, 0.88);
  --glow-0: rgba(201, 163, 106, 0);
  --glow-1: rgba(201, 163, 106, 0.04);
  --glow-2: rgba(201, 163, 106, 0.08);
  --glow-3: rgba(201, 163, 106, 0.18);
  --bg: #0c0b0a;
  --surface: var(--site-surface);
  --fg: #f4efe6;
  --muted: #9c9488;
  --line: var(--site-line);
  --accent: var(--site-accent);
  --accent-soft: var(--site-accent-soft);
  --ink: #1a140c;
  --stage: #0e0d0c;
  --player: 3.55rem;
  --sans: "DM Sans", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "Inconsolata", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --display: "Fraunces", "Times New Roman", serif;
}
html[data-site-theme="custom"] {
  --site-accent: hsl(var(--site-hue) 47% 60%);
  --site-accent-soft: hsl(var(--site-hue) 47% 60% / 0.35);
  --site-line: hsl(var(--site-hue) 12% 17%);
  --site-surface: hsl(var(--site-hue) 10% 7%);
  --gold-hi: hsl(var(--site-hue) 62% 72%);
  --gold-sh1: hsl(var(--site-hue) 36% 48%);
  --gold-sh2: hsl(var(--site-hue) 37% 31%);
  --gold-sh3: hsl(var(--site-hue) 38% 18%);
  --gold-dim: hsl(var(--site-hue) 28% 34%);
  --line-2: hsl(var(--site-hue) 18% 19%);
  --line-3: hsl(var(--site-hue) 23% 29%);
  --panel-bg: hsl(var(--site-hue) 14% 5.5% / 0.92);
  --player-bg: hsl(var(--site-hue) 14% 5.5% / 0.94);
  --card-bg: hsl(var(--site-hue) 16% 6% / 0.88);
  --glow-0: hsl(var(--site-hue) 47% 60% / 0);
  --glow-1: hsl(var(--site-hue) 47% 60% / 0.04);
  --glow-2: hsl(var(--site-hue) 47% 60% / 0.08);
  --glow-3: hsl(var(--site-hue) 47% 60% / 0.18);
}
* { box-sizing: border-box; }
html {
  color-scheme: dark; scroll-behavior: smooth;
  /* Anchor jumps (#shop etc.) land below the sticky header and above the player */
  scroll-padding-top: 3.75rem;
  scroll-padding-bottom: calc(var(--player-h, var(--player)) + 0.75rem);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
#space-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}
/* Full-site hypercube layer (Nerbous pattern): over content, never steals clicks */
#tesser-page,
.tesser-page {
  position: fixed;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}
button, a { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  /* --player-h = measured player height (set by studio.js); fallback to token */
  padding-bottom: calc(var(--player-h, calc(var(--player) + env(safe-area-inset-bottom, 0px))) + 1rem);
  background: transparent;
}

.site-header {
  position: sticky; top: 0; z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 3.5rem;
  padding: 0 0.85rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line-2);
  backdrop-filter: blur(12px);
}
.brand a { color: var(--accent); text-decoration: none; }
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--accent); text-decoration: none;
  font-weight: 650; letter-spacing: 0.01em;
}
.corner-logo {
  /* Transparent PNG, so no blend mode is needed inside the sticky, see-through header */
  display: block; flex: none;
  width: 44px; height: 44px; object-fit: contain; object-position: center;
  filter: drop-shadow(0 0 6px var(--accent-soft));
  pointer-events: none;
}
.nav {
  display: flex; gap: 1.15rem;
}
.nav a {
  color: #d9d0c4;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}
.nav a:hover { color: var(--accent); }
.header-end { display: flex; justify-content: flex-end; align-items: center; gap: 0.45rem; }
.not-sale {
  min-height: 2.4rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line-3);
  background: transparent;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.not-sale:hover { border-color: var(--accent); color: var(--accent); }

.mast {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.85rem;
  padding: 2.4rem 1.25rem 1.7rem;
  border-bottom: 1px solid var(--line);
}
.mast h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 460;
  font-size: clamp(1.85rem, 3.2vw, 2.7rem);
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--gold-hi);
  text-shadow:
    0 1px 0 var(--gold-sh1),
    0 2px 0 var(--gold-sh2),
    0 3px 0 var(--gold-sh3),
    0 10px 18px rgba(0, 0, 0, 0.45);
}
.mast-rule {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
}
.mast-rule span.line { width: 42px; height: 1px; background: var(--gold-dim); }
.mast-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.mast-actions a {
  min-height: 2.5rem; padding: 0 1rem;
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-2);
  color: var(--fg); text-decoration: none;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em;
}
.mast-actions a:hover { border-color: var(--accent); color: var(--accent); }

.stage-wrap {
  display: grid;
  grid-template-columns: 240px 1fr 220px;
  min-height: 640px;
  border-bottom: 1px solid var(--line);
}
.rail, .side {
  padding: 1.15rem 1.1rem 1.4rem;
  background: #100e0c;
}
.rail { border-right: 1px solid var(--line); }
.side { border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.55rem; }
.kicker {
  margin: 0 0 0.35rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em;
  color: var(--muted); text-transform: uppercase;
}
.piece-name { margin: 0; font-size: 1.85rem; font-weight: 650; letter-spacing: -0.03em; }
.price { margin: 0.15rem 0 0.7rem; color: var(--accent); font-family: var(--mono); }
.spec { margin: 0 0 1rem; color: #d7d0c6; font-size: 0.95rem; }
.lbl {
  margin: 0.85rem 0 0.4rem;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; color: var(--muted);
}
.pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pills button, .side button.ctrl, .cloth button {
  min-height: 2.45rem; padding: 0 0.75rem;
  border: 1px solid var(--line-2); background: transparent; color: var(--fg);
}
.pills button.on, .cloth button.on, .ctrl.on { background: #f4efe6; color: #141210; border-color: #f4efe6; }
.swatches { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; padding: 0;
}
.swatch.on { box-shadow: 0 0 0 2px var(--accent); }
.stage {
  position: relative; background: radial-gradient(ellipse at 50% 62%, #1a1816 0%, #0e0d0c 62%);
  height: 640px;
  min-height: 640px;
}
.stage canvas { width: 100%; height: 640px; display: block; }
.side .gold {
  background: var(--accent); color: #1a140c; border: 0; font-weight: 650; min-height: 2.7rem;
}
.hint { margin: 0.2rem 0 0; color: var(--muted); font-family: var(--mono); font-size: 0.68rem; text-align: center; }

.packs { padding: 1.4rem 1.25rem 2rem; }
.pack-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card {
  background: transparent; border: 0; padding: 0; text-align: left; color: inherit;
}
.card figure {
  margin: 0; aspect-ratio: 1 / 0.92; background: #070707;
  border: 1px solid var(--line); overflow: hidden; position: relative;
}
.card img { width: 100%; height: 100%; object-fit: contain; display: block; background: #070707; }
.card h3 { margin: 0.7rem 0 0.15rem; font-size: 1.25rem; }
.card .price { margin: 0 0 0.55rem; }
.card .line {
  display: inline-block; border: 1px solid var(--line-2); padding: 0.45rem 0.6rem;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; color: #d7d0c6;
}
.draft {
  position: absolute; top: 0.55rem; left: 0.55rem;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em;
  padding: 0.2rem 0.4rem; background: rgba(12, 11, 10, 0.72);
}
.card.on figure { border-color: var(--accent); }
/* Pack brand mark (music pack identity) — not LLC header chrome */
.card figure .pack-print { width: 100%; height: 100%; object-fit: contain; display: block; background: #070707; }
.card figure .pack-mark {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  width: 3.4rem;
  height: auto;
  max-height: 38%;
  object-fit: contain;
  background: rgba(7, 7, 7, 0.88);
  border: 1px solid var(--line-2);
  padding: 0.28rem;
  box-sizing: border-box;
  pointer-events: none;
}
.cloth-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-top: 1.1rem; }
.cloth-tile {
  background: #1a1714; border: 1px solid var(--line); min-height: 150px;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 1.1rem;
}
.tee { width: 74px; height: 78px; clip-path: polygon(20% 18%, 0 28%, 8% 42%, 18% 36%, 18% 100%, 82% 100%, 82% 36%, 92% 42%, 100% 28%, 80% 18%, 62% 18%, 50% 28%, 38% 18%); }
.note { margin: 1rem 0 0; color: var(--muted); font-size: 0.85rem; }

.shelf { padding: 0 1.25rem 2.2rem; }
.shelf h2 { margin: 0 0 0.2rem; font-size: 1.4rem; }
.credit { margin: 0 0 0.8rem; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.row {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 0.8rem; align-items: center;
  border-top: 1px solid var(--line); padding: 0.75rem 0;
}
.row button.play {
  width: 2.4rem; height: 2.4rem; border: 1px solid var(--line-2); background: transparent; color: var(--fg);
}
.row .meta { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.rules { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.4rem 0 0.8rem; }
.rules span {
  border: 1px solid var(--line-2); padding: 0.35rem 0.55rem;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; color: #d7d0c6;
}

/* One bottom bar: optional Hypercube panel (Nerbous controls) on top,
   audio + Hypercube toggle + cube Color + Theme in the row below. */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; flex-direction: column;
  padding: 0 0.8rem env(safe-area-inset-bottom, 0px);
  background: #100e0c;
  border-top: 1px solid var(--line-2);
}
.player-row {
  min-height: var(--player);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto minmax(15rem, 25rem);
  column-gap: 0.7rem; align-items: center;
}
.player-panel {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 0.9rem;
  padding: 0.6rem 0 0.55rem;
  border-bottom: 1px solid var(--line);
  max-height: 46vh; overflow-y: auto; overscroll-behavior: contain;
}
.player-panel[hidden] { display: none; }
.cube-open, .cube-toggle button, .spin-reset, .theme-reset {
  min-height: 2.3rem; padding: 0 0.75rem;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  white-space: nowrap;
}
.cube-open[aria-expanded="true"], .cube-toggle button[aria-pressed="true"] {
  background: var(--accent); color: var(--bg);
}
.theme-reset { border-color: var(--line-3); color: var(--fg); padding: 0 0.6rem; }
.theme-reset:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.theme-reset:disabled { opacity: 0.45; cursor: default; }
.cube-toggle { display: flex; gap: 0.4rem; }
.spin {
  display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 8.5rem;
  color: var(--muted); font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.spin input { flex: 1; min-width: 4rem; accent-color: var(--accent); cursor: pointer; }
.cube-sliders { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.cube-sliders .spin { min-width: 0; }
.player .transport { display: flex; gap: 0.35rem; }
.player .transport button, .player .audio-btn {
  min-width: 2.3rem; height: 2.3rem;
  border: 1px solid var(--line-2); background: transparent; color: var(--fg);
  font-family: var(--mono); font-size: 0.72rem;
}
.now { display: flex; flex-direction: column; min-width: 0; }
.now strong { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now span { color: var(--muted); font-family: var(--mono); font-size: 0.68rem; }
.clock { font-family: var(--mono); font-size: 0.75rem; color: #d7d0c6; }
#cube { width: 46px; height: 36px; }
.toast {
  position: fixed; bottom: calc(var(--player-h, var(--player)) + 0.7rem); left: 50%; transform: translateX(-50%);
  z-index: 41;
  background: #1c1916; border: 1px solid var(--accent); color: var(--fg);
  padding: 0.55rem 0.8rem; font-family: var(--mono); font-size: 0.75rem;
  opacity: 0; pointer-events: none; transition: opacity 160ms;
}
.toast.on { opacity: 1; }
.local-flag { display: none; }
.ventures, .about { padding: 0 1.25rem 2.4rem; }
.ventures h2, .about h2 { margin: 0 0 0.8rem; font-size: 1.35rem; }
.venture-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.venture {
  border: 1px solid var(--line); padding: 0.9rem 0.85rem; background: #120f0d;
}
.venture strong { display: block; margin-bottom: 0.3rem; }
.venture p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.venture em { display: block; margin-top: 0.55rem; color: var(--accent); font-style: normal; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; }
.about p { margin: 0.25rem 0; color: #d7d0c6; max-width: 40rem; }
.lights {
  display: none; border: 1px solid var(--line-2); padding: 0.65rem; margin-top: 0.2rem;
}
.lights.on { display: grid; gap: 0.4rem; }
/* Stage fallback (no WebGL): show the pack print instead of an empty box */
.stage .stage-fallback {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 2rem; background: #0e0d0c;
}
/* Headings / controls that anchor jumps or the Lights panel scroll to stay clear of the player */
.rail, .side, .coming-soon, #lights-btn, .lights, .piece-name, .kicker {
  scroll-margin-top: 4rem;
  scroll-margin-bottom: calc(var(--player-h, var(--player)) + 1rem);
}
.lights label { display: grid; gap: 0.15rem; font-family: var(--mono); font-size: 0.66rem; color: var(--muted); letter-spacing: 0.08em; }
.seek { width: 140px; accent-color: var(--accent); }
@media (max-width: 980px) {
  .venture-grid { grid-template-columns: 1fr; }
  .seek { display: none; }
}
@media (min-width: 561px) and (max-width: 1180px) {
  .player-row {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
    grid-template-areas:
      "transport now clock cube audio open"
      "sliders sliders sliders sliders sliders sliders";
    row-gap: 0.15rem;
    padding: 0.35rem 0;
  }
  .player .transport { grid-area: transport; }
  .now { grid-area: now; }
  .clock { grid-area: clock; }
  #cube { grid-area: cube; }
  .player .audio-btn { grid-area: audio; }
  .cube-open { grid-area: open; }
  .cube-sliders { grid-area: sliders; }
}
@media (max-width: 980px) {
  /* Nav is hidden here, so keep the right logo group pinned to the right corner */
  .site-header { grid-template-columns: auto 1fr auto; }
  .header-end { grid-column: 3; }
  .stage-wrap { grid-template-columns: 1fr; }
  .rail, .side { border: 0; border-top: 1px solid var(--line); }
  .pack-grid, .cloth-row { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
  .local-flag { display: none; }
}

/* Packages — offer overview (after Goods; stage picker stays in #goods) */
.packages { padding: 0 1.25rem 2.4rem; }
.packages h2, .goods-heading {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
}
.packages .credit { margin: 0 0 0.8rem; }
.packages-grid {
  grid-template-columns: repeat(4, 1fr);
  align-items: stretch;
}
.package-card {
  text-decoration: none;
  display: block;
  color: inherit;
}
.package-card:hover figure { border-color: var(--accent); }
.package-service {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
}
@media (max-width: 980px) {
  .packages-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .packages-grid { grid-template-columns: 1fr; }
}
/* Coming soon (replaces prices) — same gold display type as the AK Ai LLC title */
.coming-soon {
  margin: 0.35rem 0 0.8rem;
  font-family: var(--display);
  font-weight: 460;
  font-size: 2.05rem;
  letter-spacing: 0.04em;
  line-height: 1.02;
  color: var(--gold-hi);
  text-shadow:
    0 1px 0 var(--gold-sh1),
    0 2px 0 var(--gold-sh2),
    0 3px 0 var(--gold-sh3),
    0 8px 14px rgba(0, 0, 0, 0.45);
}
/* Tesser hypercube is full-page (#tesser-page); boxed shelf mount removed */
.tesser-box { display: none; }
/* Enter Nerbous doorway (music section) */
.nerbous-door {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 2rem;
  margin: 0 0 1.1rem;
  padding: 1rem 2rem;
  min-height: 12rem;
  background: radial-gradient(ellipse at 50% 50%, #17120b 0%, #070707 70%);
  border: 1px solid var(--gold-dim);
  color: var(--gold-hi); text-decoration: none;
  overflow: hidden;
  animation: door-glow 3.6s ease-in-out infinite;
  transition: border-color 200ms, transform 200ms;
}
.nerbous-door:hover, .nerbous-door:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
/* Slot for the real Nerbous logo (none yet; see the comment in index.html) */
.nerbous-mark {
  display: block; flex: none;
  height: 7.5rem; width: auto; max-width: 30%; object-fit: contain;
  transition: transform 300ms;
}
.nerbous-door:hover .nerbous-mark, .nerbous-door:focus-visible .nerbous-mark { transform: scale(1.05); }
.door-text { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; }
.door-kicker {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
}
.door-label {
  font-family: var(--display); font-weight: 460;
  font-size: clamp(2.3rem, 4.6vw, 3.6rem); letter-spacing: 0.06em; line-height: 1;
  color: var(--gold-hi);
  text-shadow: 0 1px 0 var(--gold-sh1), 0 2px 0 var(--gold-sh2), 0 3px 0 var(--gold-sh3), 0 10px 18px rgba(0, 0, 0, 0.45);
}
.door-arrow {
  font-family: var(--display); font-size: 2.8rem; line-height: 1; color: var(--accent);
  transition: transform 250ms;
}
.nerbous-door:hover .door-arrow, .nerbous-door:focus-visible .door-arrow { transform: translateX(8px); }
@keyframes door-glow {
  0%, 100% { box-shadow: 0 0 0 var(--glow-0), inset 0 0 24px var(--glow-1); }
  50% { box-shadow: 0 0 28px var(--glow-3), inset 0 0 40px var(--glow-2); }
}
@media (prefers-reduced-motion: reduce) {
  .nerbous-door { animation: none; }
  .nerbous-door, .nerbous-mark, .door-arrow { transition: none; }
}
/* Mobile fixes (phone widths only; desktop rules above are untouched) */
@media (max-width: 980px) {
  /* Stage column must not be held open by the 3D canvas's inline pixel width
     (e.g. after a rotate/resize), which pushed the whole control panel,
     including the Studio slider, past the right edge. */
  .stage-wrap { grid-template-columns: minmax(0, 1fr); }
  .rail, .stage, .side { min-width: 0; }
  .stage { overflow: hidden; }
  .stage canvas { max-width: 100%; }
}
@media (max-width: 560px) {
  /* Two-row player: title, subtitle and time on top; controls below. */
  :root { --player: 5rem; }
  .player {
    padding: 0 0.8rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  }
  .player-row {
    min-height: 0;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "now now now clock"
      "transport open cube audio"
      "sliders sliders sliders sliders";
    column-gap: 0.6rem;
    row-gap: 0.3rem;
    padding-top: 0.45rem;
  }
  .cube-open { grid-area: open; justify-self: center; padding: 0 0.6rem; }
  .cube-sliders { grid-area: sliders; gap: 0.7rem; }
  .player-panel { gap: 0.45rem 0.8rem; padding: 0.5rem 0 0.45rem; max-height: 42vh; }
  .player-panel .spin { min-width: 42%; }
  .cube-toggle { flex: 1 1 100%; }
  .player .transport { grid-area: transport; }
  .now {
    grid-area: now;
    flex-direction: row; align-items: baseline; gap: 0.55rem;
    min-width: 0; overflow: hidden;
  }
  .now strong { flex: 0 1 auto; min-width: 0; }
  .now span {
    flex: 0 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .clock { grid-area: clock; white-space: nowrap; justify-self: end; }
  #cube { grid-area: cube; }
  .player .audio-btn { grid-area: audio; justify-self: end; }
  .toast { max-width: calc(100vw - 2rem); }
  .coming-soon { font-size: 2.6rem; margin: 0.3rem 0 0.9rem; }
  .nerbous-door { gap: 1rem; padding: 0.9rem 1rem; min-height: 9.5rem; }
  .nerbous-mark { height: 5rem; }
  .door-label { font-size: 2rem; }
  .door-kicker { font-size: 0.62rem; }
  .door-arrow { font-size: 1.8rem; }
}

/* Mobile Tesseract: fixed to the large viewport so the phone URL bar
   showing/hiding doesn't resize (and wipe) the canvas mid-bounce; stays
   above page content but under the sticky header (30) and player (40). */
@media (max-width: 760px), (pointer: coarse) {
  /* Space background also sized to the large viewport, so the URL bar
     showing/hiding never reallocates its bitmap */
  #space-bg {
    inset: auto;
    top: 0; left: 0; right: 0;
    height: 100vh;
    height: 100lvh;
  }
  #tesser-page, .tesser-page {
    top: 0; left: 0; right: 0; bottom: auto;
    height: 100vh;
    height: 100lvh;
    z-index: 8;
    contain: strict;
    transform: translateZ(0);
  }
}

/* Space background switcher (mast) */
.bg-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem 0.75rem;
  margin-top: 0.35rem;
}
.bg-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.bg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}
.bg-pills button {
  min-height: 2.1rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line-2);
  background: rgba(12, 11, 10, 0.55);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.bg-pills button:hover { border-color: var(--accent); color: var(--accent); }
.bg-pills button.on {
  background: #f4efe6;
  color: #141210;
  border-color: #f4efe6;
}

.look-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.1rem;
  margin-top: 0.55rem;
}
.look-ctrl {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.look-ctrl input[type="range"] {
  width: min(9.5rem, 36vw);
  accent-color: var(--accent);
  cursor: pointer;
}

/* Let space peek through open sections; keep interactive panels solid */
.mast {
  background: transparent;
  border-bottom-color: color-mix(in srgb, var(--line) 85%, transparent);
}
.packs, .packages, .shelf, .ventures, .about {
  background: transparent;
}
.rail, .side {
  background: var(--panel-bg);
}
.site-header {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}
.player {
  background: var(--player-bg);
}
.venture {
  background: var(--card-bg);
}
@media (prefers-reduced-motion: reduce) {
  .bg-pills button { transition: none; }
}
