/* ==========================================================
   Fenestra
   Colours live in :root. Change them here and the whole page follows.
   ========================================================== */

:root {
  --hold:      #0b1114;   /* page background, the deep hold      */
  --bilge:     #16201f;   /* raised dark surfaces                */
  --brass:     #a88452;   /* trim, rivets, frame                 */
  --brass-dim: #5e4a2c;   /* quiet trim                          */
  --lantern:   #e9a74e;   /* warm glow                           */
  --porthole:  #6fd6c8;   /* arcane teal glow                    */
  --bone:      #dccfb2;   /* text                                */

  --font-display: "IM Fell English SC", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body:    "IM Fell English", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --stage-height: min(64svh, 42.7vw);   /* 42.7vw is the image's height minus its transparent top */

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: inherit; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(111, 214, 200, 0.07), transparent 60%),
    radial-gradient(80% 60% at 85% 70%, rgba(111, 214, 200, 0.05), transparent 70%),
    radial-gradient(90% 60% at 10% 75%, rgba(233, 167, 78, 0.05), transparent 70%),
    var(--hold);
  color: var(--bone);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* ---------- Atmosphere ---------- */

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.fog {
  position: absolute;
  inset: -20%;
  opacity: 0.5;
  filter: blur(40px);
}

.fog-a {
  background:
    radial-gradient(40% 20% at 30% 55%, rgba(120, 140, 140, 0.12), transparent 70%),
    radial-gradient(35% 18% at 70% 40%, rgba(120, 140, 140, 0.10), transparent 70%);
  animation: drift 90s linear infinite alternate;
}

.fog-b {
  background:
    radial-gradient(45% 22% at 60% 65%, rgba(90, 120, 120, 0.12), transparent 70%),
    radial-gradient(30% 15% at 20% 35%, rgba(90, 120, 120, 0.08), transparent 70%);
  animation: drift 130s linear infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate3d(-6%, 0, 0); }
  to   { transform: translate3d(6%, -2%, 0); }
}

.motes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Top half ---------- */

.masthead {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.25rem, 3vh, 2.25rem);
  padding: clamp(2rem, 7vh, 5rem) 1.25rem clamp(1.5rem, 4vh, 3rem);
  text-align: center;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  line-height: 1;
  letter-spacing: 0.08em;
  color: #cdbd98;
  text-shadow:
    0 2px 0 #000,
    0 0 18px rgba(233, 167, 78, 0.35),
    0 0 60px rgba(233, 167, 78, 0.15);
  animation: ignite 2.4s ease-out both;
}

@keyframes ignite {
  0%   { color: #3a3326; text-shadow: 0 2px 0 #000; }
  35%  { color: #6e5f45; text-shadow: 0 2px 0 #000, 0 0 10px rgba(233, 167, 78, 0.15); }
  45%  { color: #4b4131; }
  100% {
    color: #cdbd98;
    text-shadow: 0 2px 0 #000, 0 0 18px rgba(233, 167, 78, 0.35), 0 0 60px rgba(233, 167, 78, 0.15);
  }
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem 1.1rem;
  max-width: 60rem;
}

.notice {
  margin: 0;
  max-width: 34rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #b9a98a;
}

/* ---------- Plaque buttons ----------
   Structure (built by main.js):
   <a class="plaque"><span class="plaque-face"><span class="plaque-tex"></span></span>
     <span class="plaque-label">Label</span></a>
   The face carries the shape and texture; the anchor carries the glow,
   so the glow isn't clipped by the notched corners.
   ------------------------------------ */

.plaque {
  --accent: var(--lantern);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.7em 1.55em 0.62em;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  letter-spacing: 0.04em;
  color: var(--bone);
  text-decoration: none;
  cursor: pointer;
  border: 0;
  background: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7));
  transition: filter 0.35s ease, transform 0.35s ease, color 0.35s ease;
}

.plaque-face {
  position: absolute;
  inset: 0;
  z-index: -1;
  --notch: 9px;
  clip-path: polygon(
    var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch),
    100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%,
    var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch)
  );
  background:
    /* grain */
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(88deg, rgba(255, 220, 160, 0.03) 0 2px, transparent 2px 11px),
    /* body */
    linear-gradient(180deg, #3b2c1b 0%, #24190f 48%, #150e08 100%);
  box-shadow:
    inset 0 1px 0 rgba(233, 167, 78, 0.28),
    inset 0 -3px 8px rgba(0, 0, 0, 0.7);
}

/* Inner brass rule, notched to match */
.plaque-face::before {
  content: "";
  position: absolute;
  inset: 4px;
  --n: 6px;
  clip-path: polygon(
    var(--n) 0, calc(100% - var(--n)) 0, 100% var(--n),
    100% calc(100% - var(--n)), calc(100% - var(--n)) 100%,
    var(--n) 100%, 0 calc(100% - var(--n)), 0 var(--n)
  );
  background:
    linear-gradient(var(--brass-dim), var(--brass-dim)) top    / 100% 1px no-repeat,
    linear-gradient(var(--brass-dim), var(--brass-dim)) bottom / 100% 1px no-repeat,
    linear-gradient(var(--brass-dim), var(--brass-dim)) left   / 1px 100% no-repeat,
    linear-gradient(var(--brass-dim), var(--brass-dim)) right  / 1px 100% no-repeat;
  opacity: 0.9;
  transition: opacity 0.35s ease;
}

/* Rivets at the four corners */
.plaque-face::after {
  content: "";
  position: absolute;
  inset: 0;
  --r: radial-gradient(circle at 40% 35%, #d9b57a 0 1px, #7a5f36 1.6px, #2a1e10 2.6px, transparent 3px);
  background:
    var(--r) 12px 10px / 6px 6px no-repeat,
    var(--r) calc(100% - 12px) 10px / 6px 6px no-repeat,
    var(--r) 12px calc(100% - 10px) / 6px 6px no-repeat,
    var(--r) calc(100% - 12px) calc(100% - 10px) / 6px 6px no-repeat;
}

/* Optional texture image from links.json sits under a darkening wash
   so the label stays readable whatever texture you drop in. */
.plaque-tex {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.plaque-tex::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.55));
}

.plaque-label {
  position: relative;
  text-shadow: 0 1px 0 #000, 0 0 0 transparent;
  transition: text-shadow 0.35s ease;
}

.plaque-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.2em;
  height: 1.2em;
}

.plaque-icon img { width: 100%; height: 100%; object-fit: contain; }

.plaque:hover,
.plaque:focus-visible {
  transform: translateY(-2px);
  color: #f3e7cc;
  filter:
    drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 55%, transparent));
}

.plaque:hover .plaque-face::before,
.plaque:focus-visible .plaque-face::before {
  opacity: 1;
  background:
    linear-gradient(var(--accent), var(--accent)) top    / 100% 1px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom / 100% 1px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left   / 1px 100% no-repeat,
    linear-gradient(var(--accent), var(--accent)) right  / 1px 100% no-repeat;
}

.plaque:hover .plaque-label,
.plaque:focus-visible .plaque-label {
  text-shadow: 0 1px 0 #000, 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent);
}

.plaque:active { transform: translateY(0); }

.plaque:focus-visible {
  outline: 2px solid var(--porthole);
  outline-offset: 5px;
}

/* ---------- Link groups (a plaque that drops down a menu) ---------- */

.masthead.has-open-menu { z-index: 7; } /* above the scene while a menu is open */

.link-group { position: relative; }

.plaque-caret {
  position: relative;
  width: 0.42em;
  height: 0.42em;
  margin: -0.2em 0 0 0.1em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.8;
  transition: transform 0.3s ease, margin 0.3s ease;
}

.link-group.is-open .plaque-caret {
  margin: 0.2em 0 0 0.1em;
  transform: rotate(-135deg);
}

.link-group.is-open > .plaque--group {
  color: #f3e7cc;
  filter:
    drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 55%, transparent));
}

.link-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 50%;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  min-width: 100%;
  width: max-content;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateX(-50%);
  animation: menu-drop 0.28s ease-out both;
}

.link-menu[hidden] { display: none; }

/* A thin chain linking the menu to its plaque */
.link-menu::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 2px;
  height: 0.6rem;
  background: repeating-linear-gradient(to bottom, #8a6b3d 0 2px, transparent 2px 4px);
  transform: translateX(-50%);
}

.link-menu .plaque {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.plaque--small {
  font-size: clamp(0.92rem, 1.3vw, 1rem);
  padding: 0.6em 1.9em 0.55em;
}

@keyframes menu-drop {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 600px) {
  /* Keep the menu on screen on narrow phones */
  .link-menu { max-width: calc(100vw - 2rem); }
}

@media (prefers-reduced-motion: reduce) {
  .link-menu, .plaque-caret { animation: none; transition: none; }
}

/* ---------- Bottom half ---------- */

.stage {
  position: relative;
  z-index: 3; /* above the masthead, so open player panels aren't covered by the buttons */
  flex: 0 0 auto;
  height: var(--stage-height);
  min-height: 16rem;
}

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* Blend mode "fade": the scene dissolves at the top, sides, and bottom */
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 12%, #000 88%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 7%, #000 74%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(to right, transparent 0%, #000 12%, #000 88%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 7%, #000 74%, transparent 100%);
          mask-composite: intersect;
}

/* Size and position are set by main.js so the transparent top is cropped first */
.scene-img {
  position: absolute;
  display: block;
  max-width: none;
  left: 0;
  bottom: 0;
  width: 100%;
  animation: lanterns-up 3s ease-out both;
}

@keyframes lanterns-up {
  from { filter: brightness(0.35) saturate(0.7); }
  to   { filter: brightness(1) saturate(1); }
}

/* Mist rising off the floor */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(11, 17, 20, 0.85) 0%, rgba(11, 17, 20, 0.35) 12%, transparent 30%);
}

.stage[data-blend="fade"] .frame { display: none; }

/* Blend mode "frame": the image sits inside a brass-trimmed window */
.stage[data-blend="frame"] {
  margin: 0 clamp(0.75rem, 3vw, 2.5rem) clamp(0.75rem, 3vw, 2.5rem);
}

.stage[data-blend="frame"] .scene {
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 5%, #000 95%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 7%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(to right, transparent 0%, #000 5%, #000 95%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 7%);
          mask-composite: intersect;
}

.frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid var(--brass-dim);
  border-top: 0;
  box-shadow:
    inset 0 0 0 5px rgba(11, 17, 20, 0.9),
    inset 0 0 0 6px rgba(168, 132, 82, 0.35),
    inset 0 -40px 60px -20px rgba(0, 0, 0, 0.8);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 40%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 40%);
}

.stud {
  position: absolute;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle at 40% 35%, #d9b57a 0 1px, #8a6b3d 2px, #2a1e10 4.5px);
  transform: rotate(45deg);
}

.stud.tl { top: 40%; left: -5px; }
.stud.tr { top: 40%; right: -5px; }
.stud.bl { bottom: -5px; left: -5px; }
.stud.br { bottom: -5px; right: -5px; }

/* ---------- Game sign, hanging from chains ---------- */

.game-slot {
  position: absolute;
  left: 50%;
  bottom: 21%;
  transform: translateX(-50%);
  z-index: 3;
}

.game-sign {
  --accent: var(--porthole);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  padding: 0.85em 1.9em 0.75em;
}

/* Two chains running up out of view */
.game-sign::before,
.game-sign::after {
  content: "";
  position: absolute;
  bottom: 100%;
  width: 4px;
  height: 90px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 2px,
      #6e5632 2px 4px,
      #2b2012 4px 7px,
      #8a6b3d 7px 8px,
      transparent 8px 10px
    );
  -webkit-mask-image: linear-gradient(to top, #000 40%, transparent);
          mask-image: linear-gradient(to top, #000 40%, transparent);
}

.game-sign::before { left: 18%; }
.game-sign::after  { right: 18%; }

.game-sign.is-sealed {
  cursor: not-allowed;
  color: #9d9179;
  animation: sealed-pulse 4.5s ease-in-out infinite;
}

@keyframes sealed-pulse {
  0%, 100% {
    filter:
      drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7))
      drop-shadow(0 0 4px rgba(111, 214, 200, 0.15));
  }
  50% {
    filter:
      drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7))
      drop-shadow(0 0 14px rgba(111, 214, 200, 0.45));
  }
}

.game-sign.is-sealed:hover,
.game-sign.is-sealed:focus-visible {
  transform: none;
  color: #b8ab8f;
}

/* "Not yet..." hint */
.game-hint {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.7rem);
  transform: translate(-50%, -4px);
  white-space: nowrap;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--porthole);
  text-shadow: 0 1px 2px #000, 0 0 10px rgba(111, 214, 200, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.game-sign.is-sealed:hover .game-hint,
.game-sign.is-sealed:focus-visible .game-hint,
.game-sign.is-sealed.show-hint .game-hint {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  :root { --stage-height: 62svh; }

  .links { gap: 0.7rem; }

  .plaque { font-size: 0.98rem; padding: 0.62em 1.55em 0.56em; }

  .plaque-face::after {
    background:
      var(--r) 8px 50% / 6px 6px no-repeat,
      var(--r) calc(100% - 8px) 50% / 6px 6px no-repeat;
  }

  .game-slot { bottom: 17%; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .fog, .wordmark, .scene-img, .game-sign.is-sealed { animation: none; }
  .plaque, .plaque-label, .game-hint { transition: none; }
}

/* ==========================================================
   Scene objects (music box, microphone)
   ========================================================== */

.scene-obj {
  position: absolute;
  z-index: 4;
  width: var(--obj-size, 64px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.8));
  transition: filter 0.35s ease;
}

.scene-obj[hidden] { display: none; }

.scene-obj svg { display: block; width: 100%; height: 100%; overflow: visible; }

.music-box { aspect-ratio: 64 / 52; }
.mic       { aspect-ratio: 48 / 64; }

.scene-obj:hover,
.scene-obj:focus-visible {
  filter:
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.8))
    drop-shadow(0 0 8px rgba(233, 167, 78, 0.55));
}

.scene-obj:focus-visible {
  outline: 2px solid var(--porthole);
  outline-offset: 6px;
}

.scene-obj.is-playing {
  filter:
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.8))
    drop-shadow(0 0 12px rgba(111, 214, 200, 0.5));
}

.obj-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.35rem);
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--lantern);
  text-shadow: 0 1px 2px #000, 0 0 8px rgba(233, 167, 78, 0.5);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.scene-obj:hover .obj-tip,
.scene-obj:focus-visible .obj-tip { opacity: 1; }

.scene-obj[aria-expanded="true"] .obj-tip { opacity: 0; }

/* Music box: the lid lifts */
.mb-lid {
  transform-origin: 57px 22px;
  transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.mb-light {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.music-box:hover .mb-lid,
.music-box:focus-visible .mb-lid { transform: rotate(8deg); }

.music-box[aria-expanded="true"] .mb-lid,
.music-box.is-playing .mb-lid { transform: rotate(28deg); }

.music-box[aria-expanded="true"] .mb-light,
.music-box.is-playing .mb-light { opacity: 1; }

.mb-notes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mb-notes i {
  position: absolute;
  left: 50%;
  top: 20%;
  font-style: normal;
  font-size: calc(var(--obj-size, 64px) * 0.28);
  color: var(--porthole);
  text-shadow: 0 0 6px rgba(111, 214, 200, 0.8);
  opacity: 0;
}

.music-box.is-playing .mb-notes i { animation: note-rise 3.6s ease-out infinite; }
.music-box.is-playing .mb-notes i:nth-child(2) { animation-delay: 1.2s; left: 35%; }
.music-box.is-playing .mb-notes i:nth-child(3) { animation-delay: 2.4s; left: 62%; }

@keyframes note-rise {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-8deg); }
  20%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(10px, -70px) rotate(10deg); }
}

/* Microphone: the broadcast waves light up */
.mic-waves path { opacity: 0.35; transition: opacity 0.4s ease, stroke 0.4s ease; }
.mic-light { opacity: 0; transition: opacity 0.5s ease; }

.mic:hover .mic-waves path,
.mic:focus-visible .mic-waves path,
.mic[aria-expanded="true"] .mic-waves path { opacity: 0.9; }

.mic[aria-expanded="true"] .mic-light,
.mic.is-playing .mic-light { opacity: 1; }

.mic.is-playing .mic-waves path { stroke: var(--porthole); animation: wave-pulse 1.8s ease-in-out infinite; }
.mic.is-playing .mic-waves .w2 { animation-delay: 0.3s; }

@keyframes wave-pulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}

/* ==========================================================
   Player panels
   ========================================================== */

.player {
  position: absolute;
  z-index: 6;
  width: min(22rem, calc(100vw - 1.5rem));
  padding: 1rem 1.1rem 0.9rem;
  color: var(--bone);
  isolation: isolate;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.85));
}

.player--podcast { width: min(25rem, calc(100vw - 1.5rem)); }

.player[hidden] { display: none; }

.player-face {
  position: absolute;
  inset: 0;
  z-index: -1;
  --notch: 12px;
  clip-path: polygon(
    var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch),
    100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%,
    var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch)
  );
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 9px),
    radial-gradient(120% 60% at 50% 0%, rgba(111, 214, 200, 0.08), transparent 70%),
    linear-gradient(180deg, #2a1f14 0%, #1a130c 55%, #100b07 100%);
  box-shadow:
    inset 0 1px 0 rgba(233, 167, 78, 0.25),
    inset 0 0 0 5px rgba(0, 0, 0, 0.35),
    inset 0 0 0 6px rgba(168, 132, 82, 0.4);
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.player-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: #cdbd98;
  text-shadow: 0 1px 0 #000;
}

/* Now playing: artwork beside title and meta */
.np {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 0.6rem;
}

.np-art {
  flex: none;
  width: 3.6rem;
  height: 3.6rem;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--brass-dim), 0 3px 6px rgba(0, 0, 0, 0.7);
}

.np-art[hidden] { display: none; }

.np-text { min-width: 0; }

.now-playing {
  margin: 0;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--porthole);
  text-shadow: 0 0 8px rgba(111, 214, 200, 0.35);
}

.now-playing.is-error { color: #e08a7e; text-shadow: none; font-style: normal; font-size: 0.95rem; }

.np-meta {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: #9d9179;
}

.np-meta:empty { display: none; }

.np-notes {
  margin: 0 0 0.6rem;
  max-height: 5.2em;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #c3b596;
  scrollbar-width: thin;
  scrollbar-color: var(--brass-dim) transparent;
}

.np-notes[hidden] { display: none; }

/* Buttons */
.p-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--brass-dim);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #3b2c1b, #150e08 75%);
  color: var(--bone);
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(233, 167, 78, 0.25), 0 2px 4px rgba(0, 0, 0, 0.6);
  transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.p-btn svg { width: 55%; height: 55%; }
.p-skip svg { width: 70%; height: 70%; }

.p-btn:hover,
.p-btn:focus-visible {
  color: #f3e7cc;
  border-color: var(--lantern);
  box-shadow: inset 0 1px 0 rgba(233, 167, 78, 0.35), 0 0 10px rgba(233, 167, 78, 0.35);
}

.p-btn:focus-visible { outline: 2px solid var(--porthole); outline-offset: 3px; }

.p-close { width: 2rem; height: 2rem; border-color: transparent; background: none; box-shadow: none; }

.p-play { width: 3.1rem; height: 3.1rem; border-color: var(--brass); }
.p-play .i-pause { display: none; }
.player.is-playing .p-play .i-play { display: none; }
.player.is-playing .p-play .i-pause { display: block; }
.player.is-playing .p-play {
  border-color: var(--porthole);
  box-shadow: inset 0 1px 0 rgba(111, 214, 200, 0.3), 0 0 12px rgba(111, 214, 200, 0.35);
}

.p-speed {
  width: auto;
  min-width: 3rem;
  height: 2rem;
  padding: 0 0.6rem;
  border-radius: 1rem;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}

.volume {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  color: #b9a98a;
}

.volume svg { width: 1.2rem; height: 1.2rem; flex: none; }

.vol { width: 5rem; }

.player--podcast .vol { width: 4rem; }

/* Seek row */
.seek-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.time {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: #b9a98a;
  min-width: 2.6em;
}

.t-dur { text-align: right; }

.seek { flex: 1; min-width: 0; }

/* Range inputs styled as a brass rail with a rivet thumb */
.player input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 1.2rem;
  background: transparent;
  cursor: pointer;
  --fill: 0%;
}

.player input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--brass) var(--fill), #2b2012 var(--fill));
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
}

.player input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #2b2012;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
}

.player input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--brass);
}

.player input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 40% 35%, #f0d39a 0 1.5px, #a88452 3px, #3b2a15 7px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.player input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 40% 35%, #f0d39a 0 1.5px, #a88452 3px, #3b2a15 7px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.player input[type="range"]:focus-visible { outline: 2px solid var(--porthole); outline-offset: 3px; }

/* Track and episode lists */
.tracklist {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0;
  border-top: 1px solid rgba(168, 132, 82, 0.35);
  max-height: 11.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--brass-dim) transparent;
}

.player--podcast .tracklist { max-height: 13rem; }

.track {
  display: grid;
  grid-template-columns: 1.8em 1fr;
  align-items: baseline;
  column-gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.45rem;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.track-num {
  font-size: 0.9rem;
  color: #8f8068;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.track-meta {
  grid-column: 2;
  font-size: 0.88rem;
  color: #9d9179;
}

.track-meta:empty { display: none; }

.track:hover,
.track:focus-visible { background: rgba(233, 167, 78, 0.08); color: #f3e7cc; }

.track:focus-visible { outline: 1px solid var(--porthole); outline-offset: -1px; }

.track[aria-current="true"],
.track[aria-current="true"] .track-num { color: var(--porthole); }

.tracklist-empty {
  padding: 0.5rem 0.45rem;
  font-style: italic;
  color: #9d9179;
}

/* On phones the panel becomes a sheet along the bottom of the screen */
@media (max-width: 600px) {
  .player,
  .player--podcast {
    position: fixed;
    left: 0.75rem !important;
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto;
    max-height: calc(100svh - 1.5rem);
    overflow-y: auto;
  }

  .controls { gap: 0.4rem; }
  .player--podcast .volume { display: none; }  /* phones use their own volume buttons */
}

@media (prefers-reduced-motion: reduce) {
  .mb-lid, .mb-light, .mic-waves path, .mic-light, .obj-tip, .scene-obj, .track, .p-btn { transition: none; }
  .music-box.is-playing .mb-notes i,
  .mic.is-playing .mic-waves path { animation: none; }
}

/* ==========================================================
   Games page
   ========================================================== */

.games-page .masthead { flex: 0 0 auto; }

.games-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 21rem));
  justify-content: center;
  gap: 1.5rem;
  width: min(68rem, 100% - 2rem);
  margin: 0 auto;
  padding: 0 0 4rem;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.8));
}

.game-card .player-face { --notch: 14px; }

.game-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  margin: 7px 7px 0;
  overflow: hidden;
  background:
    radial-gradient(80% 90% at 50% 100%, rgba(111, 214, 200, 0.18), transparent 70%),
    linear-gradient(180deg, #16201f, #0b1114);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%, 0 8px);
}

.game-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #1a130c 0%, transparent 45%);
}

.game-cover-blank {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 4rem;
  color: rgba(205, 189, 152, 0.25);
  text-shadow: 0 0 20px rgba(111, 214, 200, 0.3);
}

.game-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  flex: 1;
  padding: 0.6rem 1.2rem 1.3rem;
}

.game-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: 0.03em;
  color: #cdbd98;
  text-shadow: 0 1px 0 #000;
}

.game-desc {
  margin: 0;
  flex: 1;
  font-size: 1.02rem;
  line-height: 1.5;
  color: #c3b596;
}

.game-card.is-sealed .game-cover img,
.game-card.is-sealed .game-cover-blank { filter: grayscale(0.8) brightness(0.55); }

.game-card.is-sealed .game-title { color: #9d9179; }

.game-sealed-note {
  font-style: italic;
  color: var(--porthole);
  text-shadow: 0 0 10px rgba(111, 214, 200, 0.4);
}
