:root {
  --ink: #0b0910;
  --stone: #17131f;
  --stone-2: #231c2e;
  --panel: rgba(18, 14, 26, 0.94);
  --gold: #e9c46a;
  --gold-hi: #f8e2a6;
  --gold-deep: #a8792b;
  --magic: #8b5cf6;
  --magic-hi: #c4a6ff;
  --arcane: #57c3ff;
  --text: #f1e9da;
  --muted: #c2b6a3;
  --common: #ffffff;
  --uncommon: #00ff00;
  --rare: #0080ff;
  --epic: #a03cc8;
  --legendary: #ffa500;
  --serif: "Cinzel", "Times New Roman", serif;
  --sans: "Nunito", "Segoe UI", system-ui, sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; color: var(--gold-hi); }
p { margin: 0; }
a { color: var(--gold); }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--gold-hi);
  outline-offset: 3px;
  border-radius: 8px;
}
[tabindex="-1"]:focus { outline: none; }

/* ---------- Buttons & badges ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 48px;
  padding: .7em 1.5em;
  border-radius: 999px;
  font: 800 1rem/1 var(--sans);
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: transform .2s var(--ease-out), box-shadow .2s, background-color .2s;
}
.btn:active { transform: scale(.97); }
.btn--gold {
  color: #2a1a05;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 0 2px rgba(255, 236, 180, .35) inset, 0 8px 24px rgba(233, 196, 106, .35);
}
.btn--gold:hover { box-shadow: 0 0 0 2px rgba(255, 236, 180, .6) inset, 0 10px 32px rgba(233, 196, 106, .55); }
.btn--ghost {
  color: var(--gold-hi);
  background: rgba(20, 15, 28, .6);
  box-shadow: 0 0 0 2px rgba(233, 196, 106, .55) inset;
}
.btn--ghost:hover { background: rgba(60, 44, 20, .55); }

.badge { display: inline-block; border-radius: 10px; transition: transform .2s var(--ease-out), filter .2s; }
.badge img { width: 200px; height: auto; }
.badge:hover { transform: translateY(-2px); filter: drop-shadow(0 6px 18px rgba(233, 196, 106, .35)); }
.badge--big img { width: min(300px, 70vw); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0; list-style: none; }
.chips li {
  padding: .35rem .9rem;
  border-radius: 999px;
  background: rgba(14, 10, 22, .65);
  box-shadow: 0 0 0 1px rgba(233, 196, 106, .45) inset;
  font-weight: 700;
  color: var(--muted);
}
.chips strong { color: var(--gold-hi); font-weight: 800; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  overflow: hidden;
  isolation: isolate;
}
/* hero.js sizes and places the art so the dungeon arch is centred (inline width/height/left/top). */
.hero__art { position: absolute; inset: 0; overflow: hidden; }
.hero__art img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; will-change: transform; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 40%, rgba(8, 6, 12, .7) 85%),
    linear-gradient(180deg, rgba(8, 6, 12, .7) 0%, rgba(8, 6, 12, .15) 26%, transparent 45%, rgba(8, 6, 12, .25) 70%, rgba(8, 6, 12, .85) 100%);
}
.hero__dive { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
.hero__glow {
  position: absolute;
  left: var(--depth-x, 50%);
  top: var(--depth-y, 55%);
  z-index: 3;
  width: 30vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, #ffd8f2 32%, rgba(255, 96, 220, .55) 52%, transparent 70%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.4);
  pointer-events: none;
}
.hero__embers { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.hero__embers i {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffcf7a;
  box-shadow: 0 0 8px 2px rgba(255, 170, 60, .8);
  opacity: 0;
  animation: ember var(--d, 7s) linear var(--delay, 0s) infinite;
}
@keyframes ember {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate(var(--dx, 20px), -95vh); opacity: 0; }
}
/* Logo and title above the dungeon, highlights and store badge below it; the art between stays clear. */
.hero__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 100svh;
  padding: calc(1.25rem + var(--safe-top)) clamp(1rem, 4vw, 3rem) calc(1.5rem + var(--safe-bottom));
  text-align: center;
  pointer-events: none;
}
.hero__inner a { pointer-events: auto; }
.hero__head, .hero__foot { display: grid; justify-items: center; transition: opacity .5s ease, transform .6s ease; }
.hero__head { gap: .55rem; animation: rise 1s var(--ease-out) backwards; }
.hero__foot { gap: .9rem; animation: rise 1s var(--ease-out) .15s backwards; }
.hero__logo { width: clamp(220px, 24vw, 320px); height: auto; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .6)); }
.hero__eyebrow {
  font: 800 .8rem/1.3 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--magic-hi);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .9);
}
.hero__title {
  font-size: clamp(1.3rem, 2.5vw, 2.3rem);
  text-wrap: balance;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .9), 0 1px 3px #000;
}
.hero__foot .chips { justify-content: center; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

/* "Enter the Dungeon" sits just below the dungeon arch in the art (position from hero.js). */
.enter {
  position: absolute;
  left: var(--door-x, 53%);
  top: calc(var(--door-base, 66%) + .5rem);
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: .6rem;
  translate: -50% 0;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .35s ease, scale .35s ease;
  animation: rise 1.2s var(--ease-out) .3s backwards;
}
.enter__label {
  position: relative;
  white-space: nowrap;
  padding: .8rem 1.8rem;
  border-radius: 999px;
  font: 700 1.15rem/1 var(--serif);
  letter-spacing: .06em;
  color: #2a1a05;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 0 2px rgba(255, 236, 180, .4) inset, 0 0 30px rgba(233, 196, 106, .55);
  animation: cta-pulse 2.2s ease-in-out infinite;
}
@keyframes cta-pulse { 50% { box-shadow: 0 0 0 2px rgba(255, 236, 180, .7) inset, 0 0 46px rgba(233, 196, 106, .9); } }
.enter:hover .enter__label, .enter:focus-visible .enter__label { scale: 1.05; }
.enter__label { transition: scale .25s var(--ease-out); }
.enter__loader {
  position: absolute;
  top: calc(100% + .6rem);
  left: 15%;
  width: 70%;
  height: 8px;
  border-radius: 999px;
  background: rgba(10, 8, 16, .7);
  box-shadow: 0 0 0 1px rgba(233, 196, 106, .5) inset;
  overflow: hidden;
  opacity: 0;
  transition: opacity .3s;
}
.enter__bar {
  display: block;
  height: 100%;
  width: calc(var(--progress, 0) * 100%);
  background: linear-gradient(90deg, var(--magic), var(--arcane), var(--gold-hi));
  transition: width .25s;
}
.enter.is-loading .enter__loader { opacity: 1; }
.enter.is-loading .enter__label { animation: none; opacity: .85; }

/* ---------- Static content (no WebGL / no JS) ---------- */

.room {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 4rem clamp(1.25rem, 4vw, 3rem);
}
.room__head { text-align: center; margin-bottom: 2rem; }
.room__head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.room__tagline { margin-top: .5rem; color: var(--muted); font-size: 1.1rem; }
.room__passage { margin-top: 2rem; text-align: center; font-style: italic; color: var(--magic-hi); }
.spots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.spot {
  display: grid;
  align-content: start;
  gap: .6rem;
  padding: 1.25rem;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--stone-2), var(--stone));
  box-shadow: 0 0 0 1px rgba(233, 196, 106, .35) inset;
}
.spot h3 { font-size: 1.3rem; }
.spot p { color: var(--muted); }

.visual { margin: 0 0 .4rem; display: flex; justify-content: center; align-items: flex-end; gap: .5rem; min-height: 120px; }
.visual img { height: auto; }
.visual--fan img, .visual--strip img, .visual--reveal img { width: 30%; border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
.visual--fan img:nth-child(1) { transform: rotate(-9deg) translateY(6px); }
.visual--fan img:nth-child(3) { transform: rotate(9deg) translateY(6px); }
.visual--strip { flex-wrap: wrap; }
.visual--strip img { width: 14%; }
.visual--reveal img { width: 34%; }
.visual--loot, .visual--grid, .visual--slots { flex-wrap: wrap; align-items: stretch; }
.visual--loot .rarity, .visual--grid span, .visual--slots span {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: .3rem;
  width: 74px;
  padding: .5rem .25rem .4rem;
  border-radius: 10px;
  background: rgba(8, 6, 12, .55);
  font: 700 .75rem/1.1 var(--sans);
  color: var(--muted);
  text-align: center;
}
.visual--loot img, .visual--grid img, .visual--slots img { width: 44px; height: 48px; object-fit: contain; }
.rarity { box-shadow: 0 0 0 2px var(--c) inset, 0 0 16px -2px var(--c); color: var(--c) !important; }
.rarity--common { --c: var(--common); }
.rarity--rare { --c: var(--rare); }
.rarity--epic { --c: var(--epic); }
.rarity--legendary { --c: var(--legendary); }
.visual--slots span { box-shadow: 0 0 0 1px rgba(233, 196, 106, .5) inset; }
.visual--awaken { flex-direction: column; align-items: center; }
.visual--awaken > img { width: 36%; border-radius: 6px; }
.stars { display: flex; gap: .2rem; }
.stars img { width: 28px; }
.visual--portrait img { width: 46%; }
.visual--brew img { flex: 0 1 15%; min-width: 0; }
.visual--brew .visual__ingredient { flex-basis: 10%; }
.visual--brew .visual__ingredient:nth-child(3) { margin-right: .75rem; }
.visual--icon img { width: 130px; }
.visual--pet { position: relative; }
.visual--pet > img:first-child { width: 48%; }
.visual__coin { position: absolute; right: 18%; bottom: 0; width: 64px; }
.visual--board { flex-wrap: wrap; align-items: center; gap: 1rem; }
.visual--board > img { width: 40%; }
.ranking { margin: 0; padding: 0; list-style: none; display: grid; gap: .3rem; min-width: 52%; font-size: .85rem; }
.ranking li {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  column-gap: .6rem;
  align-items: center;
  padding: .3rem .55rem;
  border-radius: 8px;
  background: rgba(8, 6, 12, .6);
}
.ranking span { font: 800 .85rem/1 var(--serif); color: var(--gold); }
.ranking b { color: var(--gold-hi); font-weight: 800; }
.ranking__you { box-shadow: 0 0 0 1px var(--magic-hi) inset; color: var(--magic-hi); }

.exit {
  position: relative;
  min-height: 100svh;
  display: grid;
  overflow: hidden;
  isolation: isolate;
}
/* The art stays clear between the title (sky) and the CTA, which sits just under the hero walking into the portal. */
.exit__art {
  position: absolute;
  inset: 0;
  z-index: -1;
  --veil: linear-gradient(180deg,
    rgba(8, 6, 12, .85) 0%, rgba(8, 6, 12, .35) 24%, rgba(8, 6, 12, 0) 40%,
    rgba(8, 6, 12, .05) 62%, rgba(8, 6, 12, .7) 80%, rgba(8, 6, 12, .92) 100%);
  background: var(--veil), url("../img/hero/splash-m.webp") center / cover no-repeat;
}
.exit__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(1100px, 100%);
  min-height: 100svh;
  margin-inline: auto;
  padding: calc(1.5rem + var(--safe-top)) 1.25rem calc(2rem + var(--safe-bottom));
  text-align: center;
}
.exit__head { display: grid; justify-items: center; gap: .5rem; }
.exit__logo { width: min(280px, 64vw); height: auto; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .6)); }
.exit__title { font-size: clamp(1.7rem, 4vw, 2.8rem); text-wrap: balance; text-shadow: 0 2px 12px rgba(0, 0, 0, .85), 0 0 30px rgba(233, 196, 106, .35); }
.exit__cta { display: grid; justify-items: center; gap: .6rem; margin-top: auto; }
.exit__cta .badge img { width: min(260px, 66vw); }
.exit__sub { color: var(--text); font-size: 1.1rem; font-weight: 700; text-shadow: 0 2px 8px rgba(0, 0, 0, .9); }
.exit__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: clamp(1.75rem, 5vh, 2.75rem); }
@media (min-width: 900px) {
  .exit__art { background: var(--veil), url("../img/hero/splash.webp") center / cover no-repeat; }
}
@media (max-width: 520px) {
  .exit__actions .btn { font-size: .9rem; padding-inline: 1.1em; }
}
@media (max-height: 520px) {
  .exit__inner { padding-top: calc(1rem + var(--safe-top)); padding-bottom: calc(1rem + var(--safe-bottom)); }
  .exit__logo { width: 180px; }
  .exit__title { font-size: 1.5rem; }
  .exit__cta .badge img { width: 200px; }
  .exit__actions { margin-top: 1rem; }
}
/* Short landscape screens: the buttons flank the badge so the CTA row stays below the hero. */
@media (max-height: 520px) and (min-aspect-ratio: 4/3) {
  .exit__inner { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto 1fr auto; align-items: end; column-gap: 1.25rem; }
  .exit__head { grid-column: 1 / -1; grid-row: 1; align-self: start; }
  .exit__cta { grid-column: 2; grid-row: 3; }
  .exit__actions { display: contents; }
  .exit__actions .btn { font-size: .9rem; padding-inline: 1.1em; white-space: nowrap; }
  .exit__actions > button { grid-column: 1; grid-row: 3; justify-self: end; }
  .exit__actions > a { grid-column: 3; grid-row: 3; justify-self: start; }
}

/* ---------- Immersive mode ---------- */

.stage, .hotspots, .floaters, .hud, .room-title, .caption, .panel, .fade, .challenge { display: none; }

.immersive { overflow: hidden; overscroll-behavior: none; }
.immersive .stage { display: block; position: fixed; inset: 0; background: #07060c; }
.immersive #scene { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.immersive .room { display: none; }
.immersive .hero, .immersive .exit { position: fixed; inset: 0; z-index: 40; }
.immersive .hero { cursor: pointer; }
.immersive .exit { z-index: 45; overflow-y: auto; }
.immersive .exit:not(.is-open) { display: none; }
.immersive .exit.is-open { animation: fade-in .6s ease both; }
@keyframes fade-in { from { opacity: 0; } }

.immersive .hotspots, .immersive .floaters { display: block; position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.immersive .floaters { z-index: 11; }
.immersive .hud { display: grid; }
.immersive .room-title, .immersive .caption, .immersive .fade { display: block; }
.immersive .panel:not([hidden]) { display: grid; }
.immersive .challenge:not([hidden]) { display: grid; }

/* The camera walks into the arch (hero.js): the copy parts above and below, the button fades. */
.hero.is-leaving .hero__head { opacity: 0; transform: translateY(-60px) scale(1.1); }
.hero.is-leaving .hero__foot { opacity: 0; transform: translateY(70px) scale(1.1); }
.hero.is-leaving .enter { opacity: 0; scale: 1.3; pointer-events: none; }
.hero.is-leaving .hero__embers { opacity: 0; transition: opacity .4s; }

.fade {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #fff, #b9c8ff 40%, #6a4cff 75%);
  opacity: 0;
  transition: opacity var(--fade-ms, 300ms) ease;
}
.fade.is-dark { background: #07060c; }
.fade.is-on { opacity: 1; }

/* HUD */
.hud {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 1rem;
  padding: calc(.75rem + var(--safe-top)) clamp(.75rem, 2vw, 1.5rem) .75rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(7, 6, 12, .75), transparent);
}
.hud > * { pointer-events: auto; }
.hud__logo { width: clamp(110px, 12vw, 170px); height: auto; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .7)); }
.hud__progress { display: grid; justify-items: center; gap: .45rem; text-align: center; }
.hud__room { font: 700 clamp(.95rem, 1.5vw, 1.15rem)/1.2 var(--serif); color: var(--gold-hi); text-shadow: 0 2px 8px #000; }
.hud__pips { display: flex; gap: .65rem; margin: .1rem 0; padding: 0; list-style: none; }
.hud__pips li {
  width: 16px;
  height: 16px;
  rotate: 45deg;
  border-radius: 2px;
  background: rgba(20, 15, 28, .9);
  box-shadow: 0 0 0 2px rgba(233, 196, 106, .45) inset;
}
.hud__pips li.is-done { background: var(--gold-deep); }
.hud__pips li.is-current { background: var(--gold-hi); box-shadow: 0 0 10px var(--gold); }
.hud__found { font: 700 clamp(.9rem, 1.2vw, 1.05rem)/1 var(--sans); color: var(--text); text-shadow: 0 1px 4px #000, 0 0 10px rgba(0, 0, 0, .8); min-height: 1em; }
.play-link { justify-self: end; border-radius: 8px; }
.play-link img { width: clamp(120px, 11vw, 160px); height: auto; }

/* Room title */
.room-title {
  position: fixed;
  z-index: 15;
  left: 50%;
  top: 22%;
  width: min(680px, 92vw);
  translate: -50% 0;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.room-title h2 {
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  text-shadow: 0 0 24px rgba(233, 196, 106, .45), 0 4px 18px #000;
}
.room-title p { margin-top: .5rem; font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 700; color: var(--text); text-shadow: 0 2px 10px #000; }
.room-title.is-on { animation: title-in 3.2s ease both; }
@keyframes title-in {
  0% { opacity: 0; transform: translateY(16px) scale(.97); }
  15%, 75% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* Caption */
.caption {
  position: fixed;
  z-index: 16;
  left: 50%;
  bottom: calc(12% + var(--safe-bottom));
  max-width: min(560px, 90vw);
  translate: -50% 0;
  padding: .7rem 1.3rem;
  border-radius: 12px;
  background: rgba(14, 10, 22, .85);
  box-shadow: 0 0 0 1px rgba(196, 166, 255, .45) inset, 0 10px 30px rgba(0, 0, 0, .5);
  font: 700 1.05rem/1.4 var(--sans);
  text-align: center;
  color: var(--text);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .35s, transform .35s var(--ease-out);
  pointer-events: none;
}
.caption.is-on { opacity: 1; transform: none; }
.caption.has-action { pointer-events: auto; display: flex; align-items: center; gap: 1rem; }

/* Hotspots */
.hotspot {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: .3rem;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  pointer-events: auto;
  translate: -50% -50%;
  will-change: transform;
  transition: opacity .3s;
}
.hotspot[disabled] { opacity: 0; pointer-events: none; }
.hotspot__rune {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 180, .95) 0 22%, rgba(233, 196, 106, .35) 23% 55%, transparent 56%);
  box-shadow: 0 0 0 2px rgba(255, 236, 180, .85), 0 0 18px rgba(233, 196, 106, .8);
}
.hotspot__rune::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 236, 180, .6);
  animation: ring 2s ease-out infinite;
}
@keyframes ring { from { transform: scale(.7); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.hotspot__label {
  padding: .3rem .75rem;
  border-radius: 999px;
  background: rgba(14, 10, 22, .88);
  box-shadow: 0 0 0 1px rgba(233, 196, 106, .55) inset;
  font: 800 .85rem/1.2 var(--sans);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s, transform .2s;
}
.hotspot:hover .hotspot__label,
.hotspot:focus-visible .hotspot__label,
.hotspots.show-labels .hotspot__label,
.hotspot.is-hover .hotspot__label { opacity: 1; transform: none; }
.hotspot.is-visited .hotspot__rune {
  background: radial-gradient(circle, rgba(20, 15, 28, .9) 0 58%, transparent 60%);
  box-shadow: 0 0 0 2px rgba(233, 196, 106, .6);
}
.hotspot.is-visited .hotspot__rune::before {
  content: "";
  width: 14px;
  height: 8px;
  margin-top: -3px;
  border: solid var(--gold-hi);
  border-width: 0 0 3px 3px;
  rotate: -45deg;
}
.hotspot.is-visited .hotspot__rune::after { animation: none; opacity: 0; }

.hotspot--door { gap: .5rem; }
.hotspot--door .hotspot__rune { display: none; }
.hotspot--door .hotspot__label {
  opacity: 1;
  transform: none;
  padding: .85rem 1.6rem;
  font: 700 1.1rem/1 var(--serif);
  letter-spacing: .05em;
  color: #2a1a05;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 0 2px rgba(255, 236, 180, .45) inset, 0 0 28px rgba(233, 196, 106, .6);
}
.hotspot--door .hotspot__label::after { content: " \2192"; }
.hotspot--door.is-calling .hotspot__label { animation: cta-pulse 1.6s ease-in-out infinite, nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-4px) scale(1.04); } }

.coach {
  position: absolute;
  width: 56px;
  height: auto;
  pointer-events: none;
  translate: -20% 10%;
  animation: tap 1.2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .6));
}
@keyframes tap { 50% { transform: translate(-6px, -8px) scale(.92); } }

/* Floating combat text */
.floater {
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% -50%;
  font: 800 clamp(1.6rem, 3vw, 2.4rem)/1 var(--serif);
  color: #ffdf8a;
  -webkit-text-stroke: 2px #4a1606;
  paint-order: stroke fill;
  text-shadow: 0 0 16px rgba(255, 120, 40, .8);
  animation: float-up 1.1s ease-out forwards;
}
.floater--good { color: #c8ffb0; -webkit-text-stroke-color: #12380a; text-shadow: 0 0 16px rgba(120, 255, 120, .7); }
.floater--legend {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  letter-spacing: .06em;
  color: #ffd25a;
  -webkit-text-stroke-color: #5a2400;
  text-shadow: 0 0 18px rgba(255, 165, 0, .95), 0 0 42px rgba(255, 120, 0, .6);
  animation-duration: 1.7s;
}
@keyframes float-up {
  0% { opacity: 0; transform: translateY(10px) scale(.6); }
  15% { opacity: 1; transform: translateY(0) scale(1.15); }
  100% { opacity: 0; transform: translateY(-60px) scale(1); }
}

/* Panel */
.panel {
  position: fixed;
  z-index: 25;
  top: calc(5.5rem + var(--safe-top));
  right: clamp(.75rem, 2vw, 1.5rem);
  bottom: 1.5rem;
  width: min(400px, 36vw);
  align-content: start;
  gap: .9rem;
  overflow-y: auto;
  padding: 1.6rem 1.5rem 1.4rem;
  border-radius: 18px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(139, 92, 246, .18), transparent 60%),
    linear-gradient(180deg, rgba(36, 28, 46, .97), var(--panel));
  box-shadow:
    0 0 0 1px rgba(255, 236, 180, .25) inset,
    0 0 0 4px rgba(20, 15, 28, .95),
    0 0 0 5px rgba(233, 196, 106, .7),
    0 24px 60px rgba(0, 0, 0, .65);
  animation: panel-in .35s var(--ease-out) both;
}
@keyframes panel-in { from { opacity: 0; transform: translateX(30px); } }
.panel.is-closing { animation: panel-out .25s ease forwards; }
@keyframes panel-out { to { opacity: 0; transform: translateX(30px); } }
.panel__close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold-hi);
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
}
.panel__close:hover { background: rgba(233, 196, 106, .15); }
.panel__visual .visual { min-height: 140px; margin: .25rem 0 0; }
.panel__title { font-size: clamp(1.4rem, 2.2vw, 1.8rem); padding-right: 2rem; }
.panel__text p { color: var(--text); font-size: 1.05rem; }
.panel__footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .25rem; }
.panel__found { font: 700 .85rem/1.2 var(--sans); color: var(--muted); }

/* Portal challenge */
.challenge {
  position: fixed;
  inset: 0;
  z-index: 35;
  place-items: center;
  overflow-y: auto;
  padding: calc(1rem + var(--safe-top)) 1rem calc(1rem + var(--safe-bottom));
  background: radial-gradient(90% 70% at 50% 40%, rgba(70, 50, 150, .55), rgba(7, 6, 12, .96) 70%);
  animation: fade-in .5s ease both;
}
.challenge.is-rewarded { cursor: pointer; }
.challenge__inner { position: relative; display: grid; justify-items: center; gap: 1rem; width: min(520px, 100%); }
/* The frame art is stretched to the banner; its side scrollwork takes ~11% of the width at each end. */
.challenge__banner {
  display: grid;
  gap: .3rem;
  width: 100%;
  padding: 1.1rem 13% 1.2rem;
  text-align: center;
  background: url("../img/ui/banner-top.webp") center / 100% 100% no-repeat;
}
.challenge__banner h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
.challenge__banner p { color: var(--text); font-weight: 600; }
.board {
  position: relative;
  width: min(440px, 88vw, 58svh);
  aspect-ratio: 1;
  background: url("../img/minigame/board.webp") center / 100% 100% no-repeat;
}
.board__grid {
  position: absolute;
  inset: 9.5%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f8e2a6, #c9952f);
  transition: gap .3s ease, padding .3s ease;
}
.board.is-blink .board__grid { background: #fff6d6; }
.board.is-closed .board__grid { gap: 0; padding: 0; background: transparent; }
.piece {
  position: relative;
  padding: 0;
  border: 0;
  background: #1a1410 center / cover no-repeat;
  cursor: pointer;
  transition: transform .25s var(--ease-out), box-shadow .2s, filter .2s;
}
.piece:hover { filter: brightness(1.12); }
.piece.is-selected { box-shadow: 0 0 0 4px var(--gold-hi), 0 0 18px var(--gold); z-index: 2; transform: scale(1.05); }
.piece.is-hint { animation: hint 1s ease-in-out infinite; z-index: 1; }
@keyframes hint { 50% { box-shadow: 0 0 0 4px var(--magic-hi), 0 0 22px var(--magic); } }
.board__lock {
  position: absolute;
  inset: 9.5%;
  background: url("../img/minigame/lock-sheet.webp") 0 0 / 200% 200% no-repeat;
  opacity: 0;
  pointer-events: none;
}
.board.is-unlocking .board__lock { opacity: 1; }
.board.is-unlocking .board__grid { visibility: hidden; }
.board__lock[data-frame="1"] { background-position: 100% 0; }
.board__lock[data-frame="2"] { background-position: 0 100%; }
.board__lock[data-frame="3"] { background-position: 100% 100%; }
.challenge__hint { color: var(--muted); font-weight: 700; text-align: center; min-height: 1.6em; }
.challenge__pet {
  position: absolute;
  right: -14%;
  bottom: -8%;
  width: 34%;
  height: auto;
  animation: cheer 1.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .6));
  pointer-events: none;
}
@keyframes cheer { 50% { transform: translateY(-12px) rotate(-4deg); } }
.challenge__skip { justify-self: center; }
.reward { display: grid; justify-items: center; gap: .8rem; text-align: center; animation: rise .5s var(--ease-out) both; }
.reward__title { font: 800 clamp(1.4rem, 4vw, 1.9rem)/1.2 var(--serif); color: var(--gold-hi); text-shadow: 0 0 20px rgba(233, 196, 106, .6); }
.reward__items { display: flex; align-items: flex-end; gap: .8rem; }
.reward__items img { width: 64px; animation: pop .6s var(--ease-out) both; }
.reward__items img:first-child { width: 96px; }
.reward__items img:nth-child(2) { animation-delay: .15s; }
.reward__items img:nth-child(3) { animation-delay: .3s; }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.4); } }

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

@media (max-width: 899px) {
  .hero__logo { width: min(250px, 64vw); }
  .hero__eyebrow { font-size: .7rem; }
  .hero__title { font-size: clamp(1.15rem, 5.2vw, 1.6rem); }
  .hero__foot .badge img { width: 180px; }
  .chips { justify-content: center; }
}

/* Short landscape screens: compact head, highlights and badge in one row under the dungeon. */
@media (max-height: 520px) and (min-aspect-ratio: 4/3) {
  .hero__inner { padding-top: calc(.6rem + var(--safe-top)); padding-bottom: calc(.6rem + var(--safe-bottom)); }
  .hero__head { gap: .3rem; }
  .hero__eyebrow { display: none; }
  .hero__logo { width: 150px; }
  .hero__title { font-size: clamp(.95rem, 2.3vw, 1.2rem); }
  .hero__foot { grid-auto-flow: column; align-items: center; gap: .8rem; }
  .hero__foot .chips { flex-wrap: nowrap; }
  .hero__foot .badge img { width: 130px; }
  .enter__label { padding: .65rem 1.4rem; font-size: 1rem; }
}

@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .hud { grid-template-columns: auto 1fr auto; gap: .5rem; }
  .hud__logo { width: 92px; }
  .hud__pips { gap: .55rem; }
  .hud__pips li { width: 14px; height: 14px; }
  .play-link img { width: 112px; }
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 52svh;
    padding: 1.3rem 1.1rem calc(1rem + var(--safe-bottom));
    border-radius: 20px 20px 0 0;
    animation-name: sheet-in;
  }
  .panel.is-closing { animation-name: sheet-out; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }
  .panel__visual .visual { min-height: 96px; }
  .panel__visual .visual--portrait img, .panel__visual .visual--board > img { width: 30%; }
  .panel__visual .visual--icon img { width: 90px; }
  .room-title { top: 16%; }
  .challenge__pet { right: -6%; }
}

/* Landscape phones: keep the copy visible; the scene already shows the object. */
@media (max-height: 520px) and (min-aspect-ratio: 4/5) {
  .panel {
    top: calc(4.2rem + var(--safe-top));
    bottom: .75rem;
    width: min(380px, 44vw);
    gap: .6rem;
    padding: 1.1rem 1.2rem 1rem;
  }
  .panel__visual { display: none; }
  .challenge__inner {
    width: min(820px, 100%);
    grid-template-columns: auto 1fr;
    grid-template-areas: "board banner" "board hint" "board reward" "board skip";
    align-content: center;
    column-gap: 1.5rem;
  }
  .challenge__banner { grid-area: banner; padding: .8rem 13% .9rem; }
  .challenge__banner h2 { font-size: 1.3rem; }
  .challenge__banner p { font-size: .85rem; }
  .board { grid-area: board; width: min(78svh, 46vw); }
  .challenge__hint { grid-area: hint; }
  .reward { grid-area: reward; }
  .challenge__skip { grid-area: skip; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hero__embers { display: none; }
  .room-title.is-on { animation: none; opacity: 1; }
}
