/* =====================================================================
   THEME TOKENS — tweak colours/textures here
   ===================================================================== */
:root {
  --wood-deep:   #24160b;
  --wood-dark:   #3b2414;
  --wood:        #6b4423;
  --wood-light:  #8e5c30;
  --straw:       #dcbc6c;
  --straw-dark:  #a9843a;
  --paper:       #efe0bd;
  --paper-dark:  #d4bd8f;
  --ink:         #2a1a0e;
  --madness:     #8f1d1d;

  --font-title: "IM Fell English SC", "Palatino Linotype", Georgia, serif;
  --font-body:  "IM Fell English", "Palatino Linotype", Georgia, serif;

  /* Procedural textures (SVG noise) so the theme works before any art is uploaded */
  --wood-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.22' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.07 0 0 0 0 0.03 1.6 0 0 0 -0.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --paper-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' seed='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.24 0 0 0 0 0.12 0.9 0 0 0 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  --straw-rope: repeating-linear-gradient(55deg, var(--straw) 0 4px, var(--straw-dark) 4px 6px, #c9a553 6px 9px);
}

/* =====================================================================
   BASE
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;              /* no scrolling unless a room opts in */
  background: var(--wood-deep);
  color: var(--paper);
  font-family: var(--font-body);
}

button { font: inherit; }
.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.screen.scrollable { overflow-y: auto; }

.screen-bg {
  position: absolute;
  inset: 0;
  background-color: var(--wood-deep);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Fallback earthy "cave" look shown until an image loads / if none exists */
.screen-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    var(--wood-grain),
    radial-gradient(ellipse at 50% 35%, #5a3a1f 0%, #2e1c0e 55%, #120a04 100%);
  background-size: 600px 160px, cover;
  opacity: .9;
}
.screen-bg { isolation: isolate; }
.screen-bg.has-image::before { display: none; }

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .8s ease;
}
.bg-video.ready { opacity: 1; }

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(10, 5, 2, .75) 100%);
}

/* =====================================================================
   WOOD PLANK BUTTONS
   ===================================================================== */
.plank-btn {
  position: relative;
  cursor: pointer;
  color: #f6e6c3;
  font-family: var(--font-title);
  letter-spacing: .04em;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(0, 0, 0, .7);
  padding: .65em 1.9em;
  border: 2px solid #1f1208;
  border-radius: 7px 11px 8px 10px / 10px 7px 11px 8px;
  background:
    var(--wood-grain),
    linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 55%, #4e3019 100%);
  background-size: 600px 160px, auto;
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 160, .22),
    inset 0 -3px 0 rgba(0, 0, 0, .35),
    0 6px 16px rgba(0, 0, 0, .65);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.plank-btn:hover,
.plank-btn:focus-visible {
  filter: brightness(1.15);
  transform: translateY(-2px) rotate(-1deg);
  outline: none;
}
.plank-btn:nth-child(even):hover,
.plank-btn:nth-child(even):focus-visible { transform: translateY(-2px) rotate(1deg); }
.plank-btn:focus-visible { box-shadow: 0 0 0 3px var(--straw), 0 6px 16px rgba(0, 0, 0, .65); }
.plank-btn:active { transform: translateY(1px); filter: brightness(.95); }

/* Iron nail heads */
.exit-btn::before,
.exit-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c9c2b5, #55504a 55%, #1d1b18);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .6);
}
.exit-btn::before { left: 9px; }
.exit-btn::after  { right: 9px; }

/* =====================================================================
   TITLE SCREEN
   ===================================================================== */
.title-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding: 16px;
  text-align: center;
}

.campaign-title {
  position: relative;
  margin: 0;
  font-family: var(--font-title);
  font-weight: normal;
  font-size: clamp(2.6rem, 9vw, 7rem);
  line-height: 1;
  color: var(--paper);
  text-shadow:
    0 2px 0 var(--wood-dark),
    0 4px 0 #1b1008,
    0 10px 30px rgba(0, 0, 0, .9);
  animation: unease 7s infinite;
}
/* A red "echo" of the title that flickers — the madness seeping in */
.campaign-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--madness);
  text-shadow: none;
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  animation: echo 7s infinite;
}
@keyframes unease {
  0%, 88%, 100% { transform: none; }
  90% { transform: skewX(-2deg) translateX(-2px); }
  92% { transform: skewX(1.5deg) translateX(2px); }
  94% { transform: none; }
}
@keyframes echo {
  0%, 87%, 96%, 100% { opacity: 0; transform: none; }
  90% { opacity: .7; transform: translate(4px, -2px); }
  93% { opacity: .4; transform: translate(-3px, 2px); }
}

/* Torn paper scrap */
.credits {
  margin: 0;
  padding: .45em 1.3em .5em;
  font-style: italic;
  font-size: clamp(.95rem, 1.6vw, 1.15rem);
  color: var(--ink);
  background: var(--paper-noise), linear-gradient(170deg, var(--paper), var(--paper-dark));
  transform: rotate(-1.5deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .55);
  clip-path: polygon(0 8%, 6% 0, 18% 6%, 33% 1%, 47% 7%, 62% 0, 78% 5%, 92% 0, 100% 9%,
                     98% 92%, 88% 100%, 72% 94%, 55% 100%, 40% 95%, 24% 100%, 10% 94%, 2% 100%);
}

.play-btn {
  margin-top: .8rem;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  padding: .4em 2.6em .45em;
  letter-spacing: .12em;
}
/* Straw rope lashings around the plank */
.play-btn::before,
.play-btn::after {
  content: "";
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 14px;
  background: var(--straw-rope);
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(60, 40, 10, .4);
}
.play-btn::before { left: 12%; }
.play-btn::after  { right: 12%; }
.play-btn:hover { transform: translateY(-3px) scale(1.03); }

/* =====================================================================
   CHAPTER PICKER — a scroll that unrolls after Play is pressed
   ===================================================================== */
#title-screen .title-content { transition: opacity .45s ease, transform .45s ease; }
#title-screen.picking .title-content {
  opacity: 0;
  transform: scale(.96);
  pointer-events: none;
}

.chapter-picker {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 16px;
  opacity: 0;
  transition: opacity .4s ease;
}
.chapter-picker[hidden] { display: none; }
.chapter-picker.open { opacity: 1; }

.scroll {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .8));
}

/* The wooden rods at each end, with turned knobs */
.scroll-rod {
  position: relative;
  z-index: 1;
  width: calc(100% + 28px);
  height: 24px;
  border-radius: 12px;
  border: 2px solid #1f1208;
  background:
    var(--wood-grain),
    linear-gradient(180deg, var(--wood-light) 0%, #a8733f 30%, var(--wood) 60%, #3e2512 100%);
  background-size: 600px 160px, auto;
  box-shadow: inset 0 2px 0 rgba(255, 220, 160, .25), 0 3px 6px rgba(0, 0, 0, .5);
}
.scroll-rod::before,
.scroll-rod::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 22px;
  height: 34px;
  margin-top: -17px;
  border: 2px solid #1f1208;
  border-radius: 45%;
  background: radial-gradient(circle at 40% 35%, var(--straw), var(--straw-dark) 55%, #5a4316);
}
.scroll-rod::before { left: -16px; }
.scroll-rod::after  { right: -16px; }

/* The parchment between them — unrolls from nothing to full height */
.scroll-paper {
  width: 100%;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .6s cubic-bezier(.3, .8, .3, 1);
  background: var(--paper-noise), linear-gradient(175deg, var(--paper), var(--paper-dark));
  box-shadow: inset 0 0 50px rgba(120, 80, 30, .45), inset 0 10px 14px -8px rgba(0, 0, 0, .55),
              inset 0 -10px 14px -8px rgba(0, 0, 0, .55);
}
.chapter-picker.open .scroll-paper { grid-template-rows: 1fr; }
.scroll-inner {
  min-height: 0;
  overflow: hidden;
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  padding: 0 clamp(1.2rem, 6vw, 2.4rem);
  text-align: center;
  color: var(--ink);
}
.scroll-heading {
  margin: 1.5rem 0 .4rem;
  font-family: var(--font-title);
  font-weight: normal;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  color: var(--wood-dark);
}
.scroll-heading::after {
  content: "";
  display: block;
  width: 60%;
  height: 1px;
  margin: .5rem auto 0;
  background: linear-gradient(90deg, transparent, var(--wood), transparent);
}

.chapter-list { display: flex; flex-direction: column; gap: .2rem; padding: .4rem 0; }
.chapter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  width: 100%;
  padding: .55em .8em;
  cursor: pointer;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 6px;
  transition: color .15s, background-color .15s, transform .15s;
}
.chapter-num {
  font-family: var(--font-title);
  font-size: clamp(1.35rem, 5vw, 1.7rem);
  letter-spacing: .05em;
}
.chapter-title { font-style: italic; font-size: 1.05rem; opacity: .8; }
.chapter-btn:hover,
.chapter-btn:focus-visible {
  outline: none;
  color: var(--madness);
  background: rgba(143, 29, 29, .08);
  transform: scale(1.03);
}
.chapter-btn:focus-visible { box-shadow: inset 0 0 0 2px rgba(143, 29, 29, .45); }
.chapter-btn:disabled { cursor: default; opacity: .4; transform: none; color: var(--ink); background: none; }

.scroll-back {
  margin: .6rem 0 1.4rem;
  padding: .2em .8em;
  cursor: pointer;
  font-style: italic;
  font-size: 1rem;
  color: var(--wood);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.scroll-back:hover, .scroll-back:focus-visible { color: var(--madness); outline: none; }

/* =====================================================================
   ROOM SCREEN
   ===================================================================== */
.room-hero {
  position: relative;
  height: 100vh;
  height: 100dvh;
}

/* Hanging wooden sign, top centre */
.room-tag {
  position: fixed;
  top: 34px;
  left: 50%;
  z-index: 5;
  max-width: calc(100% - 150px);
  transform: translateX(-50%);
  transform-origin: 50% -34px;
  padding: .35em 1.5em .4em;
  font-family: var(--font-title);
  font-size: clamp(1.15rem, 3vw, 2.1rem);
  text-align: center;
  color: #f6e6c3;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(0, 0, 0, .7);
  border: 2px solid #1f1208;
  border-radius: 6px;
  background:
    var(--wood-grain),
    linear-gradient(180deg, var(--wood-light), var(--wood) 60%, #4e3019);
  background-size: 600px 160px, auto;
  box-shadow: inset 0 2px 0 rgba(255, 220, 160, .2), inset 0 -3px 0 rgba(0, 0, 0, .35), 0 8px 20px rgba(0, 0, 0, .7);
}
/* Straw ropes it hangs from */
.room-tag::before,
.room-tag::after {
  content: "";
  position: absolute;
  top: -36px;
  width: 5px;
  height: 36px;
  background: var(--straw-rope);
  border-radius: 2px;
}
.room-tag::before { left: 16%; }
.room-tag::after  { right: 16%; }

.room-tag.swing { animation: swing 1.6s ease-out; }
@keyframes swing {
  0%   { transform: translateX(-50%) rotate(4deg); }
  30%  { transform: translateX(-50%) rotate(-2.5deg); }
  55%  { transform: translateX(-50%) rotate(1.2deg); }
  80%  { transform: translateX(-50%) rotate(-.4deg); }
  100% { transform: translateX(-50%) rotate(0); }
}

/* Exit buttons along the bottom */
.exits {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .8rem 1.1rem;
  padding: 3rem 16px 1.6rem;
  background: linear-gradient(to top, rgba(18, 10, 4, .85), rgba(18, 10, 4, 0));
  pointer-events: none;
}
/* Leave room for the ⚔ combat button in the bottom-left corner. */
body.combat-ready .exits { padding-left: 80px; padding-right: 80px; }
.exits .plank-btn {
  pointer-events: auto;
  font-size: clamp(1rem, 1.7vw, 1.3rem);
}

/* Placeholder shown when a room has no image yet */
.missing-note {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-2deg);
  max-width: calc(100% - 32px);
  padding: 1.1em 1.6em;
  text-align: center;
  color: var(--ink);
  font-size: 1.05rem;
  background: var(--paper-noise), linear-gradient(170deg, var(--paper), var(--paper-dark));
  box-shadow: 0 6px 18px rgba(0, 0, 0, .6);
}
.missing-note code { font-size: .9em; overflow-wrap: anywhere; }

/* Secret hotspots — completely invisible to players (no cursor change,
   no tap flash on phones). Only outlined in DM view. */
.hotspots {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.hotspot {
  position: absolute;
  pointer-events: auto;
  cursor: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
body.dm .hotspot {
  outline: 2px dashed var(--straw);
  outline-offset: -2px;
  background: rgba(220, 188, 108, .14);
}
/* Ordinary (non-secret) travel spots show a pointer, so players can
   feel out where the image leads. */
.hotspot.travel-spot { cursor: pointer; }
body.dm .hotspot.travel-spot::after { content: "→ " attr(data-label); }
body.dm .hotspot::after {
  content: "Secret → " attr(data-label);
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: .15em .5em;
  font-size: .85rem;
  color: var(--ink);
  background: var(--straw);
  border-radius: 3px;
}
/* Ethereal buttons — every secret exit looks like a ghostly, glowing
   apparition instead of a wooden plank. */
.exit-btn.ethereal {
  color: #f0f4ff;
  text-shadow: 0 0 6px rgba(170, 200, 255, .95), 0 0 16px rgba(140, 110, 255, .7);
  background: radial-gradient(ellipse at 50% 50%,
              rgba(180, 205, 255, .30) 0%, rgba(130, 100, 220, .20) 55%, rgba(40, 20, 90, .18) 100%);
  background-size: auto;
  border: 1px solid rgba(200, 220, 255, .6);
  border-radius: 16px;
  box-shadow:
    0 0 14px rgba(150, 180, 255, .55),
    0 0 34px rgba(120, 90, 230, .35),
    inset 0 0 18px rgba(180, 205, 255, .35);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  overflow: hidden;
  animation: ethereal-pulse 3.5s ease-in-out infinite;
}
/* No iron nails on a ghost — reuse ::before as a drifting shimmer */
.exit-btn.ethereal::after { display: none; }
.exit-btn.ethereal::before {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: inherit;
  box-shadow: none;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: ethereal-shimmer 4s linear infinite;
}
.exit-btn.ethereal:hover,
.exit-btn.ethereal:focus-visible {
  filter: brightness(1.25);
  box-shadow:
    0 0 20px rgba(170, 200, 255, .8),
    0 0 48px rgba(140, 110, 255, .55),
    inset 0 0 22px rgba(200, 220, 255, .5);
}

/* Fades in from nothing when a secret is first discovered */
.exit-btn.ethereal.materialize {
  animation: materialize 1.6s ease-out, ethereal-pulse 3.5s 1.6s ease-in-out infinite;
}

/* DM view only: secrets the players haven't found yet */
.exit-btn.ethereal.secret-exit {
  opacity: .5;
  border-style: dashed;
  animation: none;
}

@keyframes ethereal-pulse {
  0%, 100% { opacity: .82; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-3px); }
}
@keyframes ethereal-shimmer {
  from { background-position: 150% 0; }
  to   { background-position: -100% 0; }
}
@keyframes materialize {
  0%   { opacity: 0; filter: blur(14px); transform: scale(.8); }
  60%  { opacity: 1; filter: blur(3px);  transform: scale(1.06); }
  100% { opacity: 1; filter: none;       transform: none; }
}

/* DM view badge */
.dm-badge {
  position: fixed;
  top: 70px;
  left: 14px;
  z-index: 10;
  max-width: calc(100% - 28px);
  padding: .5em .9em;
  font-size: .9rem;
  color: var(--ink);
  background: var(--paper-noise), linear-gradient(170deg, var(--paper), var(--paper-dark));
  box-shadow: 0 3px 10px rgba(0, 0, 0, .5);
}
.dm-badge kbd {
  padding: 0 .35em;
  border: 1px solid var(--ink);
  border-radius: 3px;
}
.dm-badge button {
  display: block;
  margin-top: .4em;
  padding: .2em .6em;
  font-size: .85rem;
  cursor: pointer;
  color: var(--paper);
  background: var(--wood);
  border: 1px solid var(--wood-deep);
  border-radius: 3px;
}

/* Title-style room layout (e.g. The End): big heading, paper scrap and a
   large button in the middle; no hanging sign or bottom buttons. */
.room-title-layout {
  position: absolute;
  inset: 0;
  z-index: 3;
  height: auto;
  display: none;
}
.layout-title .room-title-layout { display: flex; }

/* "For now..." — fades in under the heading after a pause */
.room-subheading {
  margin: -.4rem 0 0;
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(1.3rem, 3.2vw, 2.1rem);
  letter-spacing: .04em;
  color: var(--paper);
  text-shadow: 0 2px 0 var(--wood-dark), 0 6px 18px rgba(0, 0, 0, .85);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1s ease, transform 1s ease;
}
.room-subheading.show { opacity: 1; transform: none; }

/* A smaller big button (e.g. "Start over" on The End) */
.play-btn.small {
  margin-top: .4rem;
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  padding: .35em 1.9em .4em;
  letter-spacing: .08em;
}
.play-btn.small::before, .play-btn.small::after { width: 9px; top: -3px; bottom: -3px; }
/* The title screen's Combat button (a link to the 3D combat page) */
.combat-home-btn { display: inline-block; margin-top: -.4rem; text-decoration: none; }
.layout-title .room-tag,
.layout-title .exits,
.layout-title .missing-note { display: none; }

/* Optional long-form content for scrollable rooms */
.room-content {
  position: relative;
  padding: 3.5rem 16px 10rem;
  background:
    var(--wood-grain),
    linear-gradient(180deg, #2a190c, var(--wood-deep));
  background-size: 600px 160px, auto;
}
.parchment {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.2rem clamp(1.2rem, 4vw, 3rem);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1.6;
  background: var(--paper-noise), linear-gradient(175deg, var(--paper), var(--paper-dark));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .7), inset 0 0 60px rgba(120, 80, 30, .35);
}
.parchment h1, .parchment h2, .parchment h3 {
  font-family: var(--font-title);
  font-weight: normal;
  color: var(--wood-dark);
  margin-top: 0;
}

/* =====================================================================
   HUD (home + sound buttons)
   ===================================================================== */
.hud-btn {
  position: fixed;
  top: 14px;
  z-index: 10;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #f6e6c3;
  border: 2px solid #1f1208;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 38%, rgba(0, 0, 0, .25) 40%, transparent 44%),
    radial-gradient(circle at 40% 35%, var(--wood-light), var(--wood) 60%, #4e3019);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
  transition: filter .15s, transform .15s;
}
.hud-btn:hover { filter: brightness(1.2); transform: rotate(-8deg); }
.hud-btn:focus-visible { outline: 3px solid var(--straw); outline-offset: 2px; }
.hud-home  { left: 14px; }
.hud-sound { right: 14px; }

.hud-sound .icon-off { display: none; }
body.muted .hud-sound .icon-on  { display: none; }
body.muted .hud-sound .icon-off { display: block; }

.sound-hint {
  position: fixed;
  top: 70px;
  right: 14px;
  z-index: 10;
  padding: .35em .9em;
  font-style: italic;
  font-size: .95rem;
  color: var(--ink);
  background: var(--paper-noise), linear-gradient(170deg, var(--paper), var(--paper-dark));
  box-shadow: 0 3px 10px rgba(0, 0, 0, .5);
  transform: rotate(1.5deg);
  pointer-events: none;
}

/* =====================================================================
   SCREEN TRANSITION
   ===================================================================== */
#fade {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
#fade.on { opacity: 1; }

/* Full-screen video (e.g. the svirfneblin in the void) */
.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: #000;
  opacity: 0;
  transition: opacity .7s ease;
}
.video-overlay.on { opacity: 1; }
.video-overlay video { width: 100%; height: 100%; object-fit: contain; }
.video-skip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: .4em .9em;
  font-family: var(--font-title);
  font-size: 1rem;
  cursor: pointer;
  color: #f6e6c3;
  border: 1px solid rgba(246, 230, 195, .5);
  border-radius: 5px;
  background: rgba(30, 18, 8, .65);
  opacity: .7;
  transition: opacity .2s;
}
.video-skip:hover, .video-skip:focus-visible { opacity: 1; }
#fade.slow { transition-duration: .9s; }   /* sound-effect transitions */

@media (prefers-reduced-motion: reduce) {
  .campaign-title, .campaign-title::after, .room-tag.swing,
  .exit-btn.ethereal, .exit-btn.ethereal::before { animation: none; }
  #fade, .scroll-paper { transition: none; }
}

@media (max-width: 520px) {
  .room-tag { top: 28px; max-width: calc(100% - 130px); }
  .exits { gap: .6rem; padding-bottom: 1rem; }
  .exits .plank-btn { padding: .6em 1.5em; }
}
