/* ============================================================
   Emberhold — Spritehood-style mint site rebuild
   Palette + technique notes from the teardown of spritehood.io
   ============================================================ */

:root {
  --bg: #26202b;
  --panel: #2e2733;
  --well: #1d1822;
  --border: #3a3242;
  --text-hi: #f0e3bd;
  --text: #cfc9c0;
  --text-mut: #918b85;
  --gold: #f0b541;
  --teal: #52c2b8;
  --green: #6fa348;
  --danger: #c93b3b;

  --font-black: "Jacquard 24", serif;      /* big blackletter headings */
  --font-black-sm: "Jacquard 12", serif;   /* small blackletter labels */
  --font-body: "VT323", monospace;         /* terminal body copy */
  --font-micro: "Silkscreen", monospace;   /* tiny pixel UI labels */
  --font-pix: "Press Start 2P", monospace; /* chunky pixel accents */

  --header-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* art pages: no scrolling, ever — the scene is the viewport */
body:has(.art-stage) {
  overflow: hidden;
  height: 100svh;
}

/* phones held sideways get a rotate prompt instead of a broken layout */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 620px) {
  body:has(.art-stage)::after {
    content: "rotate your device";
    position: fixed;
    inset: 0;
    z-index: 99;
    background: #07060b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-micro);
    font-size: 12px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--gold);
  }
}

html { background: var(--bg); }

html, body { margin: 0; padding: 0; }

body {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  min-height: 100svh;
}

/* Cobble wall: tiny procedural tile (set as --cobble by js/pixel.js),
   upscaled + pixelated, with vignettes layered on top — same trick as
   the original site. */
/* The hall is nearly black — stone exists only where firelight
   touches it. A heavy veil sits over the wall; every light source
   (torches, brazier) punches through it with screen-blended glows. */
body.df-theme::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  image-rendering: pixelated;
  background:
    linear-gradient(#07060bcf, #07060bcf),
    radial-gradient(46% 22% at 50% 104%, #d8a0520f 0%, #d8a05200 100%),
    var(--cobble, none) 0 0 / 512px 256px repeat,
    #0a0910;
}

a { color: var(--gold); text-decoration: none; }

/* ---------- depth layer: floor, tunnel edges, foreground props ---------- */

.fg-floor {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22vh;
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
  background: var(--floor, none) center bottom / auto 100% repeat-x;
}

.fg-floor::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -7vh;
  height: 7vh;
  background: linear-gradient(#07060b00, #07060bd9);
}

.fg-floor::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(#00000000 45%, #000000b3);
}

.tunnel-edge {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 7vw;
  min-width: 60px;
  z-index: 2;
  pointer-events: none;
  image-rendering: pixelated;
  background: var(--cobble, none) 0 0 / 680px 340px;
  filter: brightness(0.42);
}

.tunnel-edge.left { left: 0; box-shadow: inset -22px 0 26px -8px #000000e6; }
.tunnel-edge.right { right: 0; box-shadow: inset 22px 0 26px -8px #000000e6; }

.fg-prop {
  position: fixed;
  bottom: 0;
  z-index: 3;
  pointer-events: none;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 18px #000000cc);
}

.fg-prop.left {
  left: max(0.5vw, 6px);
  width: 36vh;
  aspect-ratio: 64 / 56;
  background: var(--prop-left, none) 0 0 / 100% 100% no-repeat;
}

.fg-prop.right {
  right: max(0.5vw, 6px);
  width: 32vh;
  aspect-ratio: 64 / 52;
  background: var(--prop-right, none) 0 0 / 100% 100% no-repeat;
}

/* warm pool from the crate lantern, bottom right */
.corner-glow {
  position: fixed;
  right: 6vh;
  bottom: 16vh;
  width: 56vh;
  height: 56vh;
  transform: translate(50%, 50%);
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(closest-side, #f5c06842 0%, #e8975228 30%, #b3611f14 60%, #b3611f00 95%);
  mix-blend-mode: screen;
  animation: torch-glow 0.96s steps(3, end) infinite;
}

@media (max-width: 860px) {
  .fg-prop.left { width: 26vh; }
  .fg-prop.right { width: 23vh; }
  .tunnel-edge { display: none; }
}

@media (prefers-reduced-motion: reduce) { .corner-glow { animation: none; } }

/* ---------- header ---------- */

.site-header {
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 18px;
  position: relative;
  z-index: 5;
}

.site-nav { display: flex; gap: 18px; }

.site-nav a {
  font-family: var(--font-micro);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mut);
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover { color: var(--text-hi); }

.site-nav a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.site-nav a.dead { cursor: default; opacity: 0.8; }

.site-title {
  font-family: var(--font-black);
  font-size: 34px;
  color: var(--text-hi);
  text-align: center;
  line-height: 1;
}

.title-tick {
  display: block;
  width: 10px;
  height: 4px;
  margin: 2px auto 0;
  background: var(--gold);
}

.connect-btn {
  justify-self: end;
  font-family: var(--font-micro);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  background: #00000055;
  border: 1px solid var(--gold);
  padding: 6px 14px;
  cursor: pointer;
}

.connect-btn:hover { background: #f0b54122; }

/* ---------- mint count strip ---------- */

.mintcount-strip {
  color: var(--text-mut);
  font-variant-numeric: tabular-nums;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  column-gap: 6px;
  padding: 5px 12px;
  font-family: var(--font-micro);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mintcount-item strong { color: var(--gold); font-weight: 700; }

/* ---------- mint ticker ---------- */

/* quiet feed of recent kindlings — dim text, no boxes, fades at the edges */
.ticker {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 9px 8px;
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18% 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18% 82%, transparent);
}

.ticker-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-micro);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #6a6058;
  flex: 0 0 auto;
  animation: chip-in 0.35s ease-out;
}

.ticker-chip strong { color: var(--gold); font-weight: 400; }

.ticker-chip canvas {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  filter: brightness(0.9);
}

@keyframes chip-in {
  0% { opacity: 0; transform: translateX(-14px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ---------- hero ---------- */

.mint-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 16px 26vh;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: var(--font-black);
  font-weight: 400;
  font-size: 64px;
  color: var(--text-hi);
  text-align: center;
  margin: 30px 0 10px;
  text-shadow: 0 0 30px #f0b54140, 0 0 70px #d8a05226, 0 3px 0 #000000aa;
}

.hero-copy {
  text-align: center;
  color: var(--text);
  font-size: 20px;
  margin: 0 auto 10px;
  max-width: 900px;
}

.section-title {
  font-family: var(--font-black);
  font-weight: 400;
  font-size: 44px;
  color: var(--text-hi);
  text-align: center;
  margin: 44px 0 26px;
  text-shadow: 0 0 24px #f0b54133, 0 3px 0 #000000aa;
}

/* ---------- the brazier: Emberhall's centerpiece ---------- */

.brazier {
  position: relative;
  width: 112px;
  height: 120px;
  margin: 40px auto 0;
  image-rendering: pixelated;
  background: var(--brazier, none) 0 0 / 336px 120px no-repeat;
  animation: brazier-flicker 0.96s steps(3, end) infinite;
}

@keyframes brazier-flicker { to { background-position: -336px 0; } }

.brazier::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 640px;
  height: 640px;
  background: radial-gradient(closest-side, #f5c06840 0%, #e897522b 25%, #b3611f18 50%, #b3611f0a 72%, #b3611f00 96%);
  mix-blend-mode: screen;
  animation: torch-glow 0.96s steps(3, end) infinite;
}

.brazier::after {
  content: "";
  position: absolute;
  bottom: 88px;
  left: 50%;
  width: 3px;
  height: 3px;
  background: transparent;
  box-shadow:
    -34px -6px #f0b54188, 22px -30px #e08a2e77, -10px -52px #f0c04a66,
    38px -74px #e08a2e55, -28px -96px #f0b54144, 8px -120px #f0c04a33,
    -44px -140px #e08a2e2a, 30px -158px #f0b54122;
  animation: brazier-embers 3.4s linear infinite;
}

@keyframes brazier-embers {
  0% { transform: translateY(0); opacity: 1; }
  85% { opacity: 0.7; }
  100% { transform: translateY(-90px); opacity: 0; }
}

/* ---------- class grid ---------- */

.class-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 26px 12px;
  justify-items: center;
  max-width: 860px;
  margin: 0 auto;
}

.class-card {
  background: #0b0a10a6;
  border: 1px solid #201b28;
  padding: 14px 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.class-card canvas {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  filter: brightness(0.78) drop-shadow(0 3px 0 #00000066);
  transition: filter 0.15s, transform 0.15s;
}

.class-card .class-name {
  font-family: var(--font-black-sm);
  font-size: 22px;
  color: #a89c86;
  transition: color 0.15s;
}

.class-card:hover {
  border-color: #3a3242;
  background: #14101acc;
}

.class-card:hover canvas {
  transform: translateY(-2px);
  filter: brightness(1.05) drop-shadow(0 0 10px #f0b54140);
}

.class-card:hover .class-name { color: var(--text-hi); }

.class-card.selected {
  border-color: var(--gold);
  background: #f0b54112;
  box-shadow: 0 0 30px #f0b54126, inset 0 0 20px #f0b5410d;
}

.class-card.selected canvas {
  filter: brightness(1.12) drop-shadow(0 0 12px #f0b54166);
}

.class-card.selected .class-name { color: var(--gold); }

.badge-enhanced {
  font-family: var(--font-micro);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-mut);
  border: 1px solid var(--border);
  padding: 2px 7px;
  text-transform: uppercase;
}

.class-card.selected .badge-enhanced { color: var(--gold); border-color: var(--gold); }

/* ---------- actions ---------- */

.mint-actions { text-align: center; margin-top: 44px; }

.big-btn {
  font-family: var(--font-black-sm);
  font-size: 26px;
  color: var(--text-hi);
  background: linear-gradient(180deg, #3c3322, #241d12);
  border: 1px solid var(--gold);
  outline: 1px solid #00000088;
  padding: 12px 60px;
  cursor: pointer;
  box-shadow: 0 0 24px #f0b54122, inset 0 1px 0 #f0b54133;
}

.big-btn:hover { filter: brightness(1.15); }
.big-btn:disabled { opacity: 0.5; cursor: default; }

.price-line {
  margin-top: 16px;
  font-family: var(--font-body);
  font-size: 19px;
  color: var(--text-mut);
}

.price-sep { margin: 0 12px; opacity: 0.5; }

#chosenPrice { color: var(--gold); }

/* ---------- owed panel ---------- */

.owed-panel {
  border: 1px solid #201b28;
  background: #0b0a10c9;
  max-width: 860px;
  margin: 60px auto 0;
  padding: 18px 26px 22px;
  text-align: center;
}

.owed-panel h3 {
  font-family: var(--font-micro);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text-hi);
  margin: 0 0 10px;
}

.owed-panel p { margin: 0; color: var(--text-mut); font-size: 18px; }

/* ---------- torches (3-frame sprite sheet via steps(), set by JS) ---------- */

.mg-torch {
  z-index: 1;
  pointer-events: none;
  width: 42px;
  height: 78px;
  image-rendering: pixelated;
  background: var(--torch, none) 0 0 / 126px 78px no-repeat;
  animation: torch-flicker 0.96s steps(3, end) infinite;
  display: none;
  position: fixed;
}

.mg-torch::before {
  content: "";
  z-index: -1;
  background: radial-gradient(closest-side, #f5c06838 0%, #e8975224 25%, #b3611f14 50%, #b3611f08 70%, #b3611f00 95%);
  mix-blend-mode: screen;
  width: 440px;
  height: 440px;
  animation: torch-glow 0.96s steps(3, end) infinite;
  position: absolute;
  top: 24px;
  left: 21px;
  transform: translate(-50%, -50%);
}

.mg-torch::after {
  content: "";
  z-index: -1;
  background: radial-gradient(closest-side, #ffd98a42 0%, #ffd98a1c 45%, #ffd98a00 90%);
  mix-blend-mode: screen;
  width: 150px;
  height: 150px;
  animation: torch-glow 0.96s steps(3, end) infinite;
  position: absolute;
  top: 24px;
  left: 21px;
  transform: translate(-50%, -50%);
}

@media (min-width: 1240px) {
  .mg-torch { display: block; }
  .mg-torch-l { top: 168px; left: 8vw; }
  .mg-torch-r { top: 224px; right: 8vw; animation-duration: 1.08s; animation-delay: -0.32s; }
  .mg-torch-r::before, .mg-torch-r::after { animation-duration: 1.08s; animation-delay: -0.32s; }
}

@keyframes torch-flicker { to { background-position: -126px 0; } }

@keyframes torch-glow {
  0%, 100% { opacity: 1; }
  33% { opacity: 0.84; }
  66% { opacity: 0.93; }
}

/* ---------- drifting embers / spores (box-shadow particle trick) ---------- */

.ember {
  position: fixed;
  top: 0;
  left: 24%;
  width: 2px;
  height: 2px;
  background: transparent;
  pointer-events: none;
  animation: ember-rise 52s linear infinite;
  display: none;
}

.ember-a {
  box-shadow:
    2px 12vh #8cc46a42, 30px 34vh 0 1px #5a8a4829, 14px 57vh #5a8a4838,
    40px 81vh #8cc46a29, 60vw 20vh #f0b54126, 55vw 66vh #8cc46a2e,
    2px 112vh #8cc46a42, 30px 134vh 0 1px #5a8a4829, 14px 157vh #5a8a4838,
    40px 181vh #8cc46a29, 60vw 120vh #f0b54126, 55vw 166vh #8cc46a2e;
}

.ember-b {
  animation-duration: 83s;
  animation-delay: -31s;
  box-shadow:
    22px 8vh #5a8a4824, 6px 46vh 0 1px #9a9aa51a, 36px 70vh #8cc46a26,
    16px 93vh #3f5c3333, 45vw 30vh #f0b5411f, 70vw 80vh #8cc46a22,
    22px 108vh #5a8a4824, 6px 146vh 0 1px #9a9aa51a, 36px 170vh #8cc46a26,
    16px 193vh #3f5c3333, 45vw 130vh #f0b5411f, 70vw 180vh #8cc46a22;
}

@media (min-width: 1240px) { .ember { display: block; } }

@keyframes ember-rise {
  0% { transform: translateY(0); }
  100% { transform: translateY(-100vh); }
}

/* ---------- modal ---------- */

.modal-backdrop[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #0a080ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modal-fade 0.2s ease-out;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  outline: 1px solid #00000088;
  padding: 28px 40px 30px;
  text-align: center;
  max-width: 420px;
  animation: modal-rise 0.25s ease-out;
}

.modal canvas { width: 96px; height: 96px; image-rendering: pixelated; }

.modal h3 {
  font-family: var(--font-black-sm);
  font-size: 30px;
  font-weight: 400;
  color: var(--text-hi);
  margin: 12px 0 6px;
}

.modal p { color: var(--text-mut); margin: 0 0 20px; }

@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  background: #16121b;
  border: 1px solid var(--gold);
  color: var(--text-hi);
  font-family: var(--font-micro);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 10px 20px;
  animation: toast-in 0.25s ease-out;
}

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); } }

/* ---------- scene pages (tavern / dungeon) ---------- */

.scene {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  padding-bottom: 15vh; /* the door stands on the depth-layer floor */
  z-index: 1;
}

.scene-door {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}

.scene-door canvas {
  height: min(78vh, 640px);
  image-rendering: pixelated;
  filter: brightness(0.72) drop-shadow(0 0 40px #000000aa);
}

.scene-door:hover canvas { filter: brightness(0.85) drop-shadow(0 0 40px #000000aa); }

.scene-door.shaking canvas { animation: door-shake 0.4s ease-in-out; }

@keyframes door-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.scene-closed {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-micro);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--text-hi);
  background: #0d0b10d9;
  border: 1px solid var(--border);
  padding: 10px 20px;
  animation: toast-in 0.25s ease-out;
}

/* ---------- The Ember Flagon (tavern interior market) ---------- */

.market-wrap {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
  padding-bottom: 9vh;
  z-index: 1;
}

.market-title {
  font-family: var(--font-black);
  font-weight: 400;
  font-size: 40px;
  color: var(--text-hi);
  margin: 0;
  text-shadow: 0 0 26px #f0b54136, 0 3px 0 #000000aa;
}

.market-scene {
  position: relative;
  height: min(72vh, 660px);
  aspect-ratio: 320 / 130;
  max-width: 96vw;
}

.market-scene canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  display: block;
  filter: drop-shadow(0 0 60px #000000cc);
}

/* lantern light pools — anchored at the in-canvas lantern positions */
.lamp-glow {
  position: absolute;
  top: 24%;
  width: 40vh;
  height: 40vh;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(closest-side, #f5c06830 0%, #e897521c 28%, #b3611f0e 55%, #b3611f00 95%);
  mix-blend-mode: screen;
  animation: torch-glow 0.96s steps(3, end) infinite;
}

.lamp-glow.g2 { animation-duration: 1.08s; animation-delay: -0.32s; }
.lamp-glow.g3 { animation-duration: 0.9s; animation-delay: -0.55s; }
.lamp-glow.g4 { animation-duration: 1.14s; animation-delay: -0.7s; }

.stall-sign {
  position: absolute;
  top: 32.5%;
  transform: translateX(-50%);
  font-family: var(--font-micro);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b3925a;
  text-shadow: 0 2px 0 #000000cc;
  pointer-events: none;
}

.stall-zone {
  position: absolute;
  top: 28%;
  bottom: 12%;
  width: 23%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.stall-zone:hover { background: #f0b54108; }

@media (prefers-reduced-motion: reduce) { .lamp-glow { animation: none; } }

.tavern-sign {
  position: fixed;
  top: 16vh;
  left: 62vw;
  z-index: 2;
  background: linear-gradient(180deg, #6b4a2b, #52371e);
  border: 5px solid #3a2712;
  outline: 2px solid #00000088;
  box-shadow: 0 6px 0 #00000066;
  padding: 20px 26px;
  text-align: center;
  font-family: var(--font-pix);
  font-size: 22px;
  line-height: 1.6;
  color: var(--gold);
  text-shadow: 0 2px 0 #00000088;
  transform: rotate(-2deg);
}

.tavern-sign small {
  display: block;
  margin-top: 10px;
  font-size: 9px;
  color: #c9a26a;
}

.scene .mg-torch { display: block; }
.scene .mg-torch.t-a { top: 30vh; left: 12vw; position: absolute; }
.scene .mg-torch.t-b { top: 34vh; right: 12vw; left: auto; position: absolute; animation-duration: 1.08s; animation-delay: -0.32s; }
.scene .mg-torch.t-c { top: 30vh; left: 28vw; position: absolute; animation-duration: 0.88s; animation-delay: -0.5s; }
.scene .mg-torch.t-d { top: 34vh; right: 28vw; left: auto; position: absolute; animation-duration: 1.14s; animation-delay: -0.7s; }

/* ---------- generated-art scenes (Media/*.webp) ----------
   .art-stage sizes itself like background-size: cover but as a real
   element, so children placed in % coordinates always line up with
   the artwork. Landscape art is 1672x941 (ratio 1.7768). */

.art-stage {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max(100vw, 177.7vh);
  height: max(100vh, 56.3vw);
  z-index: 1;
}

@media (orientation: portrait) {
  .art-stage {
    width: max(100vw, 56.3vh);
    height: max(100vh, 177.7vw);
  }
}

/* .fit pages sit on near-black; side bands continue the cave by
   mirroring the artwork's own edge strips — no visible border */
body:has(.art-stage.fit) { background: #060509; }
body:has(.art-stage.fit)::before { display: none; }

.art-band {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 0;
  width: max(0px, calc((100vw - 177.7vh) / 2));
  background-repeat: no-repeat;
  background-size: auto 100vh;
  transform: scaleX(-1);
  pointer-events: none;
  /* dim + soften so mirrored structures aren't recognizable */
  filter: brightness(0.4) blur(2px) saturate(1.1);
}

.art-band.left { left: 0; background-position: left top; }
.art-band.right { right: 0; background-position: right top; }

/* the eerie part: the cave hint sinks into blackness toward the screen edge */
.art-band::after {
  content: "";
  position: absolute;
  inset: 0;
}

.art-band.left::after { background: linear-gradient(to right, #06050966 0%, #060509f2 100%); }
.art-band.right::after { background: linear-gradient(to left, #06050966 0%, #060509f2 100%); }

/* .fit: show the WHOLE artwork (letterboxed) — for scenes whose
   content reaches the edges, like the mint mine's shrine columns */
.art-stage.fit {
  width: min(100vw, 177.7vh);
  height: min(100vh, 56.3vw);
}

@media (orientation: portrait) {
  .art-stage.fit {
    width: min(100vw, 56.3vh);
    height: min(100vh, 177.7vw);
  }

  /* scenes that only have landscape art keep landscape geometry
     (letterboxed above/below) until the portrait version exists */
  .art-stage.fit.landscape-only {
    width: min(100vw, 177.7vh);
    height: min(100vh, 56.3vw);
  }
}

.art-stage .art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
}

/* breathing light pools over the painted flames */
.art-glow {
  position: absolute;
  width: 34vh;
  height: 34vh;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(closest-side, #f5c06842 0%, #e8975228 30%, #b3611f14 60%, #b3611f00 95%);
  mix-blend-mode: screen;
  animation: torch-glow 0.96s steps(3, end) infinite;
}

.art-glow.big { width: 60vh; height: 60vh; }
.art-glow.small { width: 20vh; height: 20vh; }

.art-glow.purple {
  background: radial-gradient(closest-side, #8a4fc03a 0%, #8a4fc022 35%, #8a4fc000 90%);
}

.art-glow.red {
  background: radial-gradient(closest-side, #c93b3b33 0%, #c93b3b1e 35%, #c93b3b00 90%);
}

/* breathing variant: permanent glow that swells slowly — for tunnel
   mouths and magical light, vs the stepped flicker of firelight */
.art-glow.breathe {
  animation: glow-breathe 4.8s ease-in-out infinite;
}

.art-glow.breathe.b2 { animation-duration: 5.9s; animation-delay: -2.1s; }
.art-glow.breathe.b3 { animation-duration: 6.8s; animation-delay: -3.4s; }

@keyframes glow-breathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.art-glow.mid { width: 46vh; height: 46vh; }

.art-glow.g2 { animation-duration: 1.08s; animation-delay: -0.32s; }
.art-glow.g3 { animation-duration: 0.9s; animation-delay: -0.55s; }
.art-glow.g4 { animation-duration: 1.14s; animation-delay: -0.7s; }

/* flame clones: a cropped copy of the artwork's own flame pixels,
   stretched and brightened in a stepped rhythm — the painted flame
   itself appears to burn. Configured per page via window.SCENE_FX. */
.flame-clone {
  position: absolute;
  pointer-events: none;
}

.flame-clone-img {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 55%, #000 25%, transparent 70%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 55%, #000 25%, transparent 70%);
  animation: clone-glow 0.5s steps(3, end) infinite;
}

@keyframes clone-glow {
  0%, 100% { filter: brightness(1); }
  33% { filter: brightness(1.38) saturate(1.12); }
  66% { filter: brightness(1.14); }
}

/* big wall torches: a livelier roar than the standard flicker */
.flame-clone-img.roar {
  animation-name: clone-roar;
}

@keyframes clone-roar {
  0%, 100% { filter: brightness(1); }
  33% { filter: brightness(1.6) saturate(1.2); }
  66% { filter: brightness(1.22); }
}

/* crystals + pool: slow magical breathing on the artwork's own pixels */
.flame-clone-img.crystal {
  -webkit-mask-image: radial-gradient(ellipse 55% 55% at 50% 50%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 55% 55% at 50% 50%, #000 30%, transparent 75%);
  animation: crystal-breathe 5s ease-in-out infinite;
}

@keyframes crystal-breathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.62) saturate(1.4); }
}

/* blue sparks rising off the summoning pool */
.flame-embers.blue { animation-name: fx-embers-blue; }

@keyframes fx-embers-blue {
  0% {
    box-shadow: 0 -1vh #6fd4ffcc, 1vh -2.5vh #3fa8ff88, -1vh -4vh #6fd4ff55;
    opacity: 1;
  }
  100% {
    box-shadow: 0.6vh -8vh #6fd4ff00, 2vh -10vh #3fa8ff00, -2vh -11vh #6fd4ff00;
    opacity: 0;
  }
}

/* rune-rings rippling out of the pool surface */
.pool-ripple {
  position: absolute;
  left: 50.6%;
  top: 59.5%;
  width: 26%;
  height: 10%;
  border: 3px solid #8fe0ff73;
  border-radius: 50%;
  box-shadow: 0 0 10px #52c2ff2e, inset 0 0 10px #52c2ff2e;
  pointer-events: none;
  mix-blend-mode: screen;
  animation: pool-ripple 3.6s ease-out infinite;
}

.pool-ripple.r2 { animation-delay: -0.9s; }
.pool-ripple.r3 { animation-delay: -1.8s; }
.pool-ripple.r4 { animation-delay: -2.7s; }

@keyframes pool-ripple {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.05); opacity: 0; }
}

/* the chosen class, hovering above the summoning pool */
.chosen-logo {
  position: absolute;
  z-index: 3;
  display: block;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 20px #52c2ff80) drop-shadow(0 10px 18px #000000a6);
  animation: logo-float 3.2s ease-in-out infinite;
}

.chosen-logo[hidden] { display: none; }

.chosen-logo.summon {
  animation: logo-summon 0.6s ease-out, logo-float 3.2s 0.6s ease-in-out infinite;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0) scale(var(--logo-scale, 1)); }
  50% { transform: translateY(-1.1vh) scale(var(--logo-scale, 1)); }
}

@keyframes logo-summon {
  0% { opacity: 0; transform: translateY(4vh) scale(calc(var(--logo-scale, 1) * 0.6)); }
  100% { opacity: 1; transform: translateY(0) scale(var(--logo-scale, 1)); }
}

/* the mint button: rises with the chosen emblem, sits on the pool steps */
.mint-btn {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-micro);
  font-size: clamp(11px, min(1.9vh, 2vw), 17px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #dfc08b;
  background: #0d0b10d9;
  border: 1px solid #56462e;
  outline: 1px solid #000000cc;
  box-shadow: 0 4px 0 #00000080, inset 0 1px 0 #ffffff0d;
  cursor: pointer;
  animation: mint-btn-in 0.5s 0.25s ease-out both;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.mint-btn[hidden] { display: none; }

.mint-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 4px 0 #00000080, 0 0 24px #f0b54133, inset 0 1px 0 #ffffff0d;
}

@keyframes mint-btn-in {
  0% { opacity: 0; transform: translateY(2.5vh); }
  100% { opacity: 1; transform: translateY(0); }
}

/* cool light bleeding off the wall crystals */
.art-glow.cyan {
  background: radial-gradient(closest-side, #52c2ff36 0%, #3fa8ff1e 35%, #3fa8ff00 90%);
}

@media (prefers-reduced-motion: reduce) { .pool-ripple { animation: none; opacity: 0; } }

/* potions: liquid slowly swirling — brightness wave + hue drift */
.flame-clone-img.swirl {
  -webkit-mask-image: radial-gradient(ellipse 52% 52% at 50% 55%, #000 30%, transparent 74%);
  mask-image: radial-gradient(ellipse 52% 52% at 50% 55%, #000 30%, transparent 74%);
  animation: potion-swirl 4.4s ease-in-out infinite;
}

@keyframes potion-swirl {
  0%, 100% { filter: brightness(1) hue-rotate(0deg); }
  33% { filter: brightness(1.3) saturate(1.3) hue-rotate(9deg); }
  66% { filter: brightness(1.12) hue-rotate(-7deg); }
}

/* tiny bubbles breaking the surface of the quench barrel */
.flame-embers.bubbles { animation: fx-bubbles 2.8s linear infinite; }

@keyframes fx-bubbles {
  0% {
    box-shadow: 0 0 #9fd8ff99, 0.5vh -0.3vh #cfeaff66, -0.5vh -0.1vh #9fd8ff55;
    opacity: 0.9;
  }
  100% {
    box-shadow: 0.2vh -1.4vh #9fd8ff00, 0.7vh -1.8vh #cfeaff00, -0.7vh -1.6vh #9fd8ff00;
    opacity: 0;
  }
}

/* the hall sigil: energizes every few seconds, then settles */
.flame-clone-img.sigil {
  -webkit-mask-image: radial-gradient(ellipse 55% 55% at 50% 50%, #000 35%, transparent 75%);
  mask-image: radial-gradient(ellipse 55% 55% at 50% 50%, #000 35%, transparent 75%);
  animation: sigil-surge 4.6s ease-in-out infinite;
}

@keyframes sigil-surge {
  0%, 70%, 100% { filter: brightness(1); }
  78% { filter: brightness(1.5) saturate(1.35); }
  88% { filter: brightness(1.12); }
}

.art-glow.sigil-halo {
  width: 46vh;
  height: 46vh;
  background: radial-gradient(closest-side, #ff3b2e30 0%, #c9302e1e 35%, #c9302e00 90%);
  animation: sigil-halo 4.6s ease-in-out infinite;
}

/* constant-glow variant: always energized, never flashing */
.flame-clone-img.sigil-static {
  -webkit-mask-image: radial-gradient(ellipse 55% 55% at 50% 50%, #000 35%, transparent 75%);
  mask-image: radial-gradient(ellipse 55% 55% at 50% 50%, #000 35%, transparent 75%);
  animation: none;
  filter: brightness(1.28) saturate(1.2);
}

.art-glow.sigil-halo-static {
  width: 46vh;
  height: 46vh;
  background: radial-gradient(closest-side, #ff3b2e2b 0%, #c9302e1a 35%, #c9302e00 90%);
  animation: none;
  opacity: 0.85;
}

@keyframes sigil-halo {
  0%, 68%, 100% { opacity: 0.25; }
  78% { opacity: 1; }
  90% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .flame-clone, .flame-clone-img { animation: none; }
}

/* portrait art: calibrated positions for the mobile images */
@media (orientation: portrait) {
  .panel-content.gate-panel {
    left: 27% !important;
    top: 56.5% !important;
    width: 46% !important;
    height: 18% !important;
  }

  #gateZone {
    left: 27% !important;
    top: 20% !important;
    width: 46% !important;
    height: 34% !important;
  }

  .art-zone.z-fight { left: 21% !important; top: 28% !important; width: 22% !important; height: 32% !important; }
  .art-zone.z-tav { left: 55% !important; top: 28% !important; width: 22% !important; height: 32% !important; }
  .art-zone.z-mint { left: 37% !important; top: 58% !important; width: 26% !important; height: 24% !important; }
}

/* dancing flame cores + rising embers, overlaid on painted flames */
.flame-fx {
  position: absolute;
  width: 2.6vh;
  height: 4.6vh;
  transform: translate(-50%, -78%);
  pointer-events: none;
  mix-blend-mode: screen;
  background: radial-gradient(50% 62% at 50% 68%, #ffd98a8c 0%, #f0a04059 42%, #f0a04000 78%);
  animation: flame-dance 0.44s steps(2, end) infinite;
}

.flame-fx.big { width: 6vh; height: 9vh; }
.flame-fx.f2 { animation-duration: 0.52s; animation-delay: -0.2s; }
.flame-fx.f3 { animation-duration: 0.38s; animation-delay: -0.31s; }

@keyframes flame-dance {
  0%, 100% { transform: translate(-50%, -78%) scaleY(1); opacity: 0.9; }
  50% { transform: translate(-53%, -83%) scaleY(1.16); opacity: 1; }
}

.flame-embers {
  position: absolute;
  width: 2px;
  height: 2px;
  pointer-events: none;
  animation: fx-embers 2.6s linear infinite;
}

.flame-embers.e2 { animation-duration: 3.4s; animation-delay: -1.4s; }

@keyframes fx-embers {
  0% {
    box-shadow: 0 -1vh #f0c04acc, 1vh -2.5vh #e08a2e88, -1vh -4vh #f0c04a55;
    opacity: 1;
  }
  100% {
    box-shadow: 0.6vh -7vh #f0c04a00, 2vh -9vh #e08a2e00, -2vh -10vh #f0c04a00;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) { .flame-fx, .flame-embers { animation: none; opacity: 0; } }

/* drifting colored mist inside tunnel mouths */
.mist {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 30%, transparent 74%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 30%, transparent 74%);
}

.mist-layer {
  position: absolute;
  inset: -45%;
  background-image:
    radial-gradient(closest-side at 30% 62%, var(--mist-a) 0%, transparent 58%),
    radial-gradient(closest-side at 72% 38%, var(--mist-b) 0%, transparent 54%),
    radial-gradient(closest-side at 52% 82%, var(--mist-a) 0%, transparent 48%);
  animation: mist-drift 14s ease-in-out infinite alternate;
  opacity: 0.5;
}

.mist-layer.b {
  animation-duration: 21s;
  animation-delay: -9s;
  opacity: 0.32;
}

@keyframes mist-drift {
  0% { transform: translate(-5%, 2%); }
  100% { transform: translate(5%, -3%); }
}

@media (prefers-reduced-motion: reduce) { .mist-layer { animation: none; } }

/* clickable regions on the artwork */
.art-zone {
  position: absolute;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.art-zone:hover { background: none; box-shadow: none; }

.art-zone:focus-visible { outline: none; }

/* back to the hall — a pixel chevron pointing out of the room */
.back-btn {
  position: fixed;
  bottom: 2.6vh;
  left: 50%;
  z-index: 10;
  width: clamp(34px, 6.5vh, 60px);
  aspect-ratio: 1;
  background: var(--arrow, none) center / contain no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 10px #f0b54130);
  animation: back-bob 1.9s ease-in-out infinite;
  text-decoration: none;
  font-size: 0;
}

@keyframes back-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

.back-btn:hover {
  filter: brightness(1.3) drop-shadow(0 0 16px #f0b54159);
}

@media (prefers-reduced-motion: reduce) { .back-btn { animation: none; transform: translate(-50%, 0); } }

/* the hall landing title: retro game-logo wordmark + location subtitle */
.hall-title {
  position: fixed;
  top: 4.5vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  text-align: center;
}

.brand-mark {
  font-family: var(--font-pix);
  font-weight: 400;
  font-size: clamp(24px, 3.6vw, 52px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
  background: linear-gradient(180deg, #f8ecc2 0%, #e8c06a 52%, #b97a2e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #000000d9) drop-shadow(0 0 18px #f0b54142);
  animation: title-in 1s ease-out both;
}

.brand-sub {
  font-family: var(--font-micro);
  font-size: clamp(12px, 1.4vw, 17px);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: #dfc08b;
  margin: 0;
  text-shadow: 0 2px 0 #000000f2, 0 0 14px #00000080;
  animation: title-in 1s 0.3s ease-out both;
}

.brand-sub::before { content: "—\2002"; opacity: 0.45; }
.brand-sub::after { content: "\2002—"; opacity: 0.45; }

@keyframes title-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* page location tag: letterspaced, stays out of the art's way */
.art-title {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--font-micro);
  font-weight: 400;
  font-size: clamp(13px, 1.4vw, 17px);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #dfc08b;
  margin: 0;
  text-shadow: 0 2px 0 #000000f2, 0 0 14px #00000080;
  pointer-events: none;
}

.art-title::before { content: "—\2002"; opacity: 0.45; }
.art-title::after { content: "\2002—"; opacity: 0.45; }

/* .epic: the big blackletter treatment for scene titles */
.art-title.epic {
  top: 12px;
  font-family: var(--font-black);
  font-size: clamp(30px, 3.4vw, 60px);
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: none;
  background: linear-gradient(180deg, #f8ecc2 0%, #e8c06a 52%, #b97a2e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #000000d9) drop-shadow(0 0 20px #f0b5413d);
  text-shadow: none;
  animation: fade-in 1.1s ease-out both;
}

.art-title.epic::before, .art-title.epic::after { content: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* text living inside a painted empty panel */
.panel-content {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.2vh;
  padding: 2%;
}

.panel-content h2 {
  font-family: var(--font-black);
  font-weight: 400;
  font-size: clamp(22px, 4.2vh, 44px);
  color: var(--text-hi);
  margin: 0;
  text-shadow: 0 0 24px #c93b3b33, 0 3px 0 #000000cc;
}

.panel-content p {
  font-family: var(--font-body);
  font-size: clamp(14px, 2.4vh, 22px);
  color: var(--text-mut);
  margin: 0;
}

.panel-content .hint {
  font-family: var(--font-micro);
  font-size: clamp(8px, 1.3vh, 11px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6a6058;
}

/* vendor POV conversation screens */
.pov {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  animation: modal-fade 0.25s ease-out;
}

.pov[hidden] { display: none; }

.pov .pov-stage { z-index: 1; }

.pov .pov-dialog { z-index: 2; }

.art-glow.green {
  background: radial-gradient(closest-side, #6fa34838 0%, #6fa34820 35%, #6fa34800 90%);
}

.pov-dialog {
  position: absolute;
  left: 50%;
  bottom: 5vh;
  transform: translateX(-50%);
  width: min(720px, 92vw);
  background: #0d0b10e6;
  border: 1px solid #3a3242;
  outline: 1px solid #000;
  padding: 18px 24px 16px;
  animation: modal-rise 0.3s ease-out;
}

.pov-dialog .pov-name {
  font-family: var(--font-micro);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 8px;
}

.pov-dialog .pov-line {
  font-family: var(--font-body);
  font-size: 21px;
  color: var(--text);
  margin: 0 0 14px;
  min-height: 2.6em;
}

.pov-actions { display: flex; gap: 10px; justify-content: flex-end; }

.pov-btn {
  font-family: var(--font-micro);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-hi);
  background: #1a1520;
  border: 1px solid #3a3242;
  padding: 8px 16px;
  cursor: pointer;
}

.pov-btn:hover { border-color: var(--gold); color: var(--gold); }

/* the mint mine */
.connect-btn.floating {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 10;
}

.class-plate {
  /* a flex box traced over the carved frame — geometric centering,
     no font metrics involved */
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-black-sm);
  font-size: clamp(9px, min(3.7vh, 2.2vw), 39px);
  line-height: 1;
  color: #cbb894;
  text-shadow: 0 2px 0 #000000e6;
  pointer-events: none;
  white-space: nowrap;
  transition: color 0.15s, text-shadow 0.15s;
}

/* the carved banner above the pool */
.mine-banner {
  /* a flex box traced over the carved banner (coords measured from
     the image pixels) — geometric centering like the class plates */
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  margin: 0;
  font-family: var(--font-black);
  font-weight: 400;
  line-height: 1;
  font-size: clamp(14px, min(6.6vh, 3.9vw), 68px);
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: linear-gradient(180deg, #f8ecc2 0%, #e8c06a 52%, #b97a2e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #000000d9) drop-shadow(0 0 22px #f0b5413d);
  pointer-events: none;
  animation: fade-in 1.2s ease-out both;
}

.class-plate.selected {
  color: var(--gold);
  text-shadow: 0 0 16px #f0b54173, 0 2px 0 #000000e6;
}

.art-glow.pool {
  width: 76vh;
  height: 48vh;
  background: radial-gradient(closest-side, #3fa8ff2e 0%, #2b6fd41a 42%, #2b6fd400 92%);
  animation: pool-breathe 5.2s ease-in-out infinite;
}

@keyframes pool-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* red flash when the gate answers */
.gate-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #c93b3b;
  opacity: 0;
  pointer-events: none;
}

/* keep the extreme top/bottom edges dark so mobile browsers tint their
   status/nav bars black — never sampling a scene's red or blue edges */
.edge-guard {
  position: fixed;
  left: 0;
  right: 0;
  height: 40px;
  z-index: 6;
  pointer-events: none;
}

.edge-guard.top { top: 0; background: linear-gradient(#060509, #06050900); }
.edge-guard.bottom { bottom: 0; background: linear-gradient(#06050900, #060509); }

.gate-flash.on { animation: gate-flash 0.5s ease-out; }

@media (prefers-reduced-motion: reduce) { .gate-flash { display: none; } }

/* real portrait mint art: text scales with the stage, capped by width
   so long names (Ratcatcher, Brewmaster) stay inside their boxes */
@media (orientation: portrait) {
  .class-plate { font-size: clamp(11px, min(2.9vh, 3.2vw), 34px); }
  .mine-banner { font-size: clamp(20px, min(4.8vh, 9vw), 60px); }
  .art-title.epic { font-size: clamp(18px, 7vw, 42px); }

  /* the dungeon sign: text must fit the carved board on phones */
  .panel-content h2 { font-size: clamp(15px, 2.8vh, 30px); }
  .panel-content p { font-size: clamp(10px, 1.6vh, 15px); line-height: 1.35; }
  .panel-content .hint { font-size: clamp(7px, 1vh, 10px); }
}

@keyframes gate-flash {
  0% { opacity: 0.55; }
  100% { opacity: 0; }
}

/* ---------- music toggle ---------- */

.sound-btn {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 60;
  width: 38px;
  height: 34px;
  font-size: 16px;
  line-height: 1;
  color: var(--gold);
  background: #00000066;
  border: 1px solid #3a3242;
  cursor: pointer;
  padding: 0;
}

.sound-btn:hover { border-color: var(--gold); }

.sound-btn.muted { color: #6a6058; }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .mg-torch, .mg-torch::before, .ember, .ticker-chip { animation: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .class-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-title { font-size: 46px; }
  .section-title { font-size: 34px; }
  .site-title { font-size: 26px; }
  .tavern-sign { left: auto; right: 4vw; font-size: 14px; }
}

@media (max-width: 520px) {
  .class-grid { grid-template-columns: repeat(2, 1fr); }
  .site-nav { gap: 10px; }
  .site-nav a { font-size: 9px; }
}
