/* ═══════════════════════════════════════════════════════════════════════════
   THE PATRONS' TOUR — public/static/patron-tour.js

   The guided first-run tour. Two presentations share one root:
     stage  a full-screen painted scene (chapter cards, the council, gifts,
            the finale and the Patrons' Hall), Ken-Burns drift + particles.
     spot   the live game under a dimmed veil, one element lit by a gilt
            spotlight, the speaking patron in a dialogue box beside it.
   Everything reads the Gilt & Obsidian tokens at the top of game.css. The
   patron's own colour arrives as --pt-accent (set from the script).
   ═══════════════════════════════════════════════════════════════════════════ */

.ptour {
  position: fixed;
  inset: 0;
  z-index: 10400;               /* over boss-card (10000), under the intro film (11000) */
  pointer-events: none;
  color: var(--tx-1);
  font-family: var(--font-serif);
  --pt-accent: #e0bc6a;
  --pt-accent-soft: rgba(224, 188, 106, 0.35);
  --pt-dlg-w: min(calc(100vw - 20px), 460px);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
}
.ptour.is-on { opacity: 1; }
.ptour *, .ptour *::before, .ptour *::after { box-sizing: border-box; }
.ptour button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.ptour img.px { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ── Veil: swallows taps on the game while a patron speaks. For an
      interactive step the script cuts the spotlight out of it with a
      clip-path, so only the lit element can be pressed. ─────────────────── */
.ptour-veil {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  background: transparent;
}

/* ── Spotlight ──────────────────────────────────────────────────────────── */
.ptour-hole {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0;
  height: 0;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(6, 5, 10, 0.78);
  opacity: 0;
  transition:
    left 0.6s var(--ease-out), top 0.6s var(--ease-out),
    width 0.6s var(--ease-out), height 0.6s var(--ease-out),
    border-radius 0.6s var(--ease-out), opacity 0.45s ease;
}
.ptour[data-mode="spot"] .ptour-hole { opacity: 1; }
.ptour-hole.is-empty::before, .ptour-hole.is-empty::after { opacity: 0; }
.ptour-hole::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1.5px solid rgba(247, 230, 176, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 22px 3px var(--pt-accent-soft), inset 0 0 18px var(--pt-accent-soft);
  animation: ptour-ring 2.6s ease-in-out infinite;
  transition: opacity 0.3s;
}
/* a slow glint that travels round the ring */
.ptour-hole::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--ptour-glint, 0deg), transparent 0deg, rgba(255, 246, 214, 0.95) 24deg, transparent 60deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: ptour-glint 3.2s linear infinite;
  transition: opacity 0.3s;
}
@property --ptour-glint { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes ptour-glint { to { --ptour-glint: 360deg; } }
@keyframes ptour-ring {
  0%, 100% { transform: scale(1);     opacity: 0.9; }
  50%      { transform: scale(1.012); opacity: 1;   }
}

/* "Tap here": two ripples on the lit element of an interactive step */
.ptour-tap {
  position: absolute;
  width: 0; height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, left 0.6s var(--ease-out), top 0.6s var(--ease-out);
}
.ptour-tap.is-on { opacity: 1; }
.ptour-tap::before, .ptour-tap::after {
  content: '';
  position: absolute;
  left: -22px; top: -22px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(247, 230, 176, 0.9);
  box-shadow: 0 0 14px var(--pt-accent-soft);
  animation: ptour-ripple 1.8s var(--ease-out) infinite;
}
.ptour-tap::after { animation-delay: 0.9s; }
@keyframes ptour-ripple {
  0%   { transform: scale(0.45); opacity: 0.95; }
  100% { transform: scale(1.7);  opacity: 0;    }
}

/* ── Stage: the painted scene behind chapter cards ─────────────────────── */
.ptour-stage {
  position: absolute;
  inset: 0;
  background: var(--ob-0);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.65s var(--ease-out);
}
.ptour[data-mode="stage"] .ptour-stage { opacity: 1; }
.ptour-scene { position: absolute; inset: 0; }
.ptour-scene img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  opacity: 0;
  transition: opacity 1.2s ease;
  will-change: transform, opacity;
}
.ptour-scene img.is-in {
  opacity: 1;
  animation: ptour-kb 26s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}
.ptour-scene img.is-in.kb-rev { animation-name: ptour-kb-rev; }
/* Ken Burns: a slow push-in and drift. object-position does the drift so a
   portrait phone, which sees only a slice of the wide painting, pans across it. */
@keyframes ptour-kb {
  from { transform: scale(1.14); object-position: 30% 50%; }
  to   { transform: scale(1.02); object-position: 62% 50%; }
}
@keyframes ptour-kb-rev {
  from { transform: scale(1.14); object-position: 70% 50%; }
  to   { transform: scale(1.02); object-position: 40% 50%; }
}
.ptour-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 130% 85% at 50% 38%, transparent 35%, rgba(5, 4, 9, 0.6) 100%),
    linear-gradient(180deg, rgba(5, 4, 9, 0.62) 0%, rgba(5, 4, 9, 0.1) 20%, rgba(5, 4, 9, 0.05) 42%, rgba(5, 4, 9, 0.78) 70%, rgba(5, 4, 9, 0.97) 100%);
}
canvas.ptour-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Chapter medallions: the six patrons' coins, the current one lit */
.ptour-medals {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.6s 0.3s;
}
.ptour-medals.is-on { opacity: 1; }
.ptour-medal {
  position: relative;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 8, 14, 0.7);
  box-shadow: 0 0 0 1px rgba(224, 188, 106, 0.18), 0 4px 10px rgba(0, 0, 0, 0.6);
  opacity: 0.4;
  filter: grayscale(0.85);
  transition: transform 0.5s var(--ease-spring), opacity 0.4s, filter 0.4s, box-shadow 0.4s;
}
.ptour-medal img { width: 24px; height: 24px; object-fit: contain; }
.ptour-medal.is-done { opacity: 0.95; filter: none; box-shadow: 0 0 0 1px rgba(224, 188, 106, 0.55), 0 4px 10px rgba(0, 0, 0, 0.6); }
.ptour-medal.is-now {
  opacity: 1; filter: none;
  transform: scale(1.35);
  box-shadow: 0 0 0 1.5px var(--gilt-hi), 0 0 18px var(--pt-accent-soft), 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* Chapter title, assembled letter by letter */
.ptour-title {
  position: absolute;
  left: 0; right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 19vh);
  padding: 0 22px;
  text-align: center;
  pointer-events: none;
}
.ptour-title__kicker {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--pt-accent);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.8s, transform 0.8s var(--ease-out);
}
.ptour-title__name {
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 8.6vw, 50px);
  line-height: 1.06;
  letter-spacing: 0.02em;
  color: var(--gilt-hi);
  filter: drop-shadow(0 3px 14px rgba(0, 0, 0, 0.95));
}
.ptour-title__name .ch {
  display: inline-block;
  background: var(--gilt-text);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateY(0.18em);
  filter: blur(6px);
  transition: opacity 0.7s ease, transform 0.9s var(--ease-out), filter 0.8s ease;
}
.ptour-title__name .wd { display: inline-block; white-space: nowrap; }
.ptour-title__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px auto 10px;
  width: min(260px, 70%);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.9s, transform 1.1s var(--ease-out);
}
.ptour-title__rule::before, .ptour-title__rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224, 188, 106, 0.75));
}
.ptour-title__rule::after { background: linear-gradient(270deg, transparent, rgba(224, 188, 106, 0.75)); }
.ptour-title__rule i {
  width: 7px; height: 7px;
  transform: rotate(45deg);
  background: var(--gilt);
  box-shadow: 0 0 10px var(--pt-accent-soft);
}
.ptour-title__sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--tx-2);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transition: opacity 0.9s;
}
.ptour-title.is-in .ptour-title__kicker { opacity: 1; transform: none; }
.ptour-title.is-in .ptour-title__name .ch { opacity: 1; transform: none; filter: none; }
.ptour-title.is-in .ptour-title__rule { opacity: 1; transform: none; transition-delay: 0.5s; }
.ptour-title.is-in .ptour-title__sub { opacity: 1; transition-delay: 0.8s; }

/* ── The council: six patrons in arched niches ─────────────────────────── */
.ptour-council {
  position: absolute;
  left: 0; right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  margin: 0 auto;
  max-width: 400px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 12px;
}
.ptour-council__head {
  grid-column: 1 / -1;
  text-align: center;
  margin-bottom: 2px;
  opacity: 0;
  transition: opacity 0.9s;
}
.ptour-council__head.is-in { opacity: 1; }
.ptour-council__kicker {
  font-family: var(--font-ui); font-weight: 800; font-size: 10.5px;
  letter-spacing: 0.32em; text-transform: uppercase; color: var(--gilt);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}
.ptour-council__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(22px, 6.4vw, 30px);
  background: var(--gilt-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.95));
  margin-top: 4px;
}
.ptour-niche {
  --acc: var(--gilt);
  text-align: center;
  opacity: 0;
  transform: translateY(18px) scale(0.94);
  transition: opacity 0.7s ease, transform 0.8s var(--ease-spring), filter 0.5s;
}
.ptour-niche.is-in { opacity: 1; transform: none; }
.ptour-niche__arch {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 50% 50% 10px 10px / 34% 34% 10px 10px;
  overflow: hidden;
  border: 1px solid rgba(224, 188, 106, 0.4);
  background:
    radial-gradient(ellipse 90% 70% at 50% 30%, color-mix(in srgb, var(--acc) 34%, transparent), transparent 72%),
    linear-gradient(180deg, rgba(30, 25, 42, 0.92), rgba(9, 7, 13, 0.96));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.5s var(--ease-spring), box-shadow 0.5s, border-color 0.5s;
}
.ptour-niche__arch img {
  width: 112%;
  margin-bottom: -7%;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6));
}
.ptour-niche__name {
  margin-top: 7px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 11px; line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--gilt-hi);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
}
.ptour-niche__dom {
  margin-top: 2px;
  font-family: var(--font-ui); font-weight: 500;
  font-size: 10.5px; line-height: 1.2;
  color: var(--tx-3);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
}
.ptour-council.has-speaker .ptour-niche:not(.is-speaking) { filter: brightness(0.55) saturate(0.6); }
.ptour-niche.is-speaking .ptour-niche__arch {
  transform: translateY(-4px) scale(1.06);
  border-color: var(--acc);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.7), 0 0 26px rgba(224, 188, 106, 0.45);
  /* the glow breathes with the speaker's voice (--amp, 0-1, from the tour) */
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.7), 0 0 calc(20px + var(--amp, 0) * 26px) color-mix(in srgb, var(--acc) calc(45% + var(--amp, 0) * 40%), transparent);
  transition: transform 0.5s var(--ease-spring), border-color 0.5s, box-shadow 0.08s linear;
}

/* ── Gift: the patron's token, spun out of the light ───────────────────── */
.ptour-gift {
  position: absolute;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 15vh);
  transform: translateX(-50%);
  width: 280px;
  text-align: center;
  pointer-events: none;
}
.ptour-gift__coin {
  position: relative;
  width: 132px; height: 132px;
  margin: 0 auto;
}
.ptour-gift__rays {
  position: absolute;
  inset: -70px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(247, 230, 176, 0.22) 0deg 6deg, transparent 6deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%);
          mask: radial-gradient(circle, #000 18%, transparent 68%);
  opacity: 0;
  animation: ptour-rays 24s linear infinite;
  transition: opacity 1.2s;
}
.ptour-gift.is-in .ptour-gift__rays { opacity: 1; }
@keyframes ptour-rays { to { transform: rotate(360deg); } }
.ptour-gift__glow {
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--pt-accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity 1s;
}
.ptour-gift.is-in .ptour-gift__glow { opacity: 1; }
.ptour-gift__coin img {
  position: relative;
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.7));
  opacity: 0;
}
.ptour-gift.is-in .ptour-gift__coin img { animation: ptour-coin 1.5s var(--ease-out) both; }
@keyframes ptour-coin {
  0%   { opacity: 0; transform: translateY(-40px) scale(0.3) rotateY(0deg); }
  55%  { opacity: 1; transform: translateY(6px) scale(1.08) rotateY(540deg); }
  75%  { transform: translateY(-3px) scale(0.98) rotateY(700deg); }
  100% { opacity: 1; transform: none; }
}
.ptour-gift__amount {
  margin-top: 16px;
  font-family: var(--font-display); font-weight: 900;
  font-size: 40px; line-height: 1;
  background: var(--gilt-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.9));
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.5s 0.9s, transform 0.7s 0.9s var(--ease-spring);
}
.ptour-gift__label {
  margin-top: 6px;
  font-family: var(--font-display); font-weight: 600;
  font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gilt-hi);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transition: opacity 0.6s 1.15s;
}
.ptour-gift__hint {
  margin-top: 6px;
  font-family: var(--font-serif); font-style: italic;
  font-size: 14px;
  color: var(--tx-2);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transition: opacity 0.6s 1.4s;
}
.ptour-gift__extra {
  margin-top: 6px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 13px; letter-spacing: 0.06em;
  color: var(--tx-1);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transition: opacity 0.6s 1.3s;
}
.ptour-gift.is-in .ptour-gift__extra { opacity: 1; }
.ptour-gift.is-in .ptour-gift__amount { opacity: 1; transform: none; }
.ptour-gift.is-in .ptour-gift__label,
.ptour-gift.is-in .ptour-gift__hint { opacity: 1; }
.ptour-gift.is-claimed .ptour-gift__amount { font-size: 20px; letter-spacing: 0.06em; }

/* ── Finale: what each patron taught, on one page ───────────────────────── */
.ptour-finale {
  position: absolute;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 22px);
  transform: translateX(-50%);
  width: var(--pt-dlg-w);
  pointer-events: none;
}
.ptour-finale__head { text-align: center; margin-bottom: 12px; }
.ptour-finale__list {
  display: grid;
  gap: 6px;
}
.ptour-finale__row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 12px 7px 8px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(19, 16, 27, 0.9), rgba(12, 10, 18, 0.72));
  border: 1px solid rgba(224, 188, 106, 0.16);
  opacity: 0;
  transform: translateX(-14px);
  transition: opacity 0.6s, transform 0.7s var(--ease-out);
}
.ptour-finale__row.is-in { opacity: 1; transform: none; }
.ptour-finale__row img { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; }
.ptour-finale__row b {
  display: block;
  font-family: var(--font-display); font-weight: 700;
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--gilt-hi);
}
.ptour-finale__row span {
  display: block;
  font-family: var(--font-ui); font-weight: 500;
  font-size: 12.5px; line-height: 1.3;
  color: var(--tx-2);
}

/* ── Dialogue box ───────────────────────────────────────────────────────── */
.ptour-dlg {
  position: absolute;
  left: 50%;
  width: var(--pt-dlg-w);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 0);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.45s var(--ease-out);
}
.ptour-dlg.is-in { opacity: 1; }
.ptour-dlg.is-top {
  bottom: auto;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
}
.ptour-dlg.is-shift { opacity: 0; transform: translate(-50%, 10px); pointer-events: none; }
.ptour-dlg.is-top.is-shift { transform: translate(-50%, -10px); }

.ptour-dlg__box {
  position: relative;
  border-radius: 16px;
  padding: 12px 14px 10px;
  background:
    radial-gradient(ellipse 80% 120% at 0% 0%, color-mix(in srgb, var(--pt-accent) 12%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(27, 22, 38, 0.97) 0%, rgba(12, 10, 18, 0.98) 100%);
  border: 1px solid rgba(224, 188, 106, 0.3);
  box-shadow:
    0 22px 50px -10px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
/* gilt corner flourishes */
.ptour-dlg__box::before, .ptour-dlg__box::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 1.5px solid rgba(224, 188, 106, 0.75);
  pointer-events: none;
}
.ptour-dlg__box::before { top: 5px; right: 5px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.ptour-dlg__box::after  { bottom: 5px; left: 5px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }

.ptour-dlg__head {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 44px;
  padding-left: var(--pt-portrait-gap, 84px);
  transition: padding-left 0.5s var(--ease-out);
}
.ptour-dlg__who { flex: 1; min-width: 0; padding-bottom: 3px; }
.ptour-dlg__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.15;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gilt-hi);
}
.ptour-dlg__dom {
  margin-top: 2px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--pt-accent);
}
.ptour-icon-btn {
  flex-shrink: 0;
  width: 36px; height: 36px;
  margin-bottom: -2px;
  border-radius: 50%;
  border: 1px solid rgba(224, 188, 106, 0.22);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  color: var(--tx-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ptour-icon-btn svg { width: 17px; height: 17px; }
.ptour-icon-btn:hover { color: var(--gilt-hi); border-color: rgba(224, 188, 106, 0.5); }
.ptour-icon-btn:active { background: rgba(224, 188, 106, 0.12); }
.ptour-icon-btn.is-off { color: var(--tx-4); }

/* The speaking patron stands on the box, breathing; while their voice plays
   the glow follows the recorded loudness of the line. */
.ptour-dlg__portrait {
  position: absolute;
  z-index: 2;                    /* in front of the box: the whole bust shows */
  left: 6px;
  bottom: calc(100% - 60px);
  width: 82px;
  height: 82px;
  pointer-events: none;
  transition: width 0.55s var(--ease-out), height 0.55s var(--ease-out), bottom 0.55s var(--ease-out);
}
.ptour-dlg__portrait::before {
  content: '';
  position: absolute;
  left: 8%; right: 8%; bottom: 8%; top: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--pt-accent-soft), transparent 70%);
  opacity: calc(0.35 + var(--amp, 0) * 0.9);
  transform: scale(calc(1 + var(--amp, 0) * 0.18));
  transition: opacity 0.08s linear, transform 0.08s linear;
}
.ptour-dlg__portrait img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.75));
  transform-origin: 50% 100%;
  animation: ptour-breathe 4.2s ease-in-out infinite;
  transition: opacity 0.35s;
}
.ptour-dlg__portrait img.is-out { opacity: 0; }
@keyframes ptour-breathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.006, 1.014); }
}
/* On a stage the patron is drawn large, standing behind the box */
.ptour[data-mode="stage"] .ptour-dlg__portrait { z-index: 0; width: 136px; height: 136px; bottom: calc(100% - 50px); }
.ptour[data-mode="stage"] .ptour-dlg { --pt-portrait-gap: 112px; }
.ptour[data-mode="stage"] .ptour-dlg__name { font-size: 13px; letter-spacing: 0.08em; }
.ptour[data-mode="stage"] .ptour-dlg.no-portrait { --pt-portrait-gap: 0px; }
.ptour-dlg.no-portrait { --pt-portrait-gap: 0px; }
.ptour-dlg.no-portrait .ptour-dlg__portrait { opacity: 0; }

.ptour-dlg__text {
  margin-top: 8px;
  min-height: 3em;
  font-family: var(--font-serif);
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--tx-1);
  -webkit-user-select: text;
  user-select: text;
  cursor: pointer;
}
.ptour-dlg__text strong { color: var(--gilt-hi); font-weight: 700; }
.ptour-dlg__text .w {
  opacity: 0;
  transition: opacity 0.32s ease;
}
.ptour-dlg__text .w.on { opacity: 1; }

.ptour-dlg__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.ptour-pips {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.ptour-pips i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(224, 188, 106, 0.2);
  transition: background 0.3s, transform 0.3s, width 0.3s;
}
.ptour-pips i.on { background: rgba(224, 188, 106, 0.55); }
.ptour-pips i.now { width: 16px; border-radius: 3px; background: var(--gilt); }
.ptour-pips em {
  margin-left: 6px;
  font-family: var(--font-ui);
  font-style: normal;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tx-3);
  white-space: nowrap;
}
.ptour-back {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(224, 188, 106, 0.2);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  color: var(--tx-2);
  cursor: pointer;
}
.ptour-back svg { width: 18px; height: 18px; }
.ptour-back:disabled { opacity: 0.3; cursor: default; }
.ptour-next {
  position: relative;
  min-width: 112px;
  height: 42px;
  padding: 0 18px 0 20px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display) !important;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a1a07 !important;
  background: var(--gilt-metal);
  box-shadow: 0 0 0 1px rgba(110, 82, 38, 0.9), inset 0 1px 0 rgba(255, 249, 225, 0.75), 0 8px 18px -6px rgba(0, 0, 0, 0.8);
  transition: transform 0.12s, filter 0.2s, box-shadow 0.3s;
}
.ptour-next svg { width: 16px; height: 16px; }
.ptour-next:active { transform: translateY(1px) scale(0.98); filter: brightness(0.95); }
.ptour button:focus { outline: none; }
.ptour button:focus-visible { outline: 2px solid var(--gilt-hi); outline-offset: 3px; }
.ptour-next.is-ready { animation: ptour-ready 1.8s ease-in-out infinite; }
@keyframes ptour-ready {
  0%, 100% { box-shadow: 0 0 0 1px rgba(110, 82, 38, 0.9), inset 0 1px 0 rgba(255, 249, 225, 0.75), 0 8px 18px -6px rgba(0, 0, 0, 0.8); }
  50%      { box-shadow: 0 0 0 1px rgba(110, 82, 38, 0.9), inset 0 1px 0 rgba(255, 249, 225, 0.75), 0 0 22px 2px rgba(247, 230, 176, 0.45); }
}
.ptour-ghost {
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  font-family: var(--font-ui) !important;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--tx-3) !important;
  cursor: pointer;
}
.ptour-ghost:hover { color: var(--tx-2) !important; }
.ptour-ghost:active { background: rgba(255, 255, 255, 0.05); }

/* The opening choice (and the resume prompt) stacks its buttons */
.ptour-dlg__choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
}
.ptour-dlg__choice .ptour-next { width: 100%; height: 46px; }
.ptour-dlg__choice .ptour-ghost { width: 100%; }
.ptour-dlg__meta {
  margin-top: 2px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 11.5px;
  color: var(--tx-3);
}

/* ── Leave-the-tour sheet ──────────────────────────────────────────────── */
.ptour-exit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 4, 9, 0.62);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.25s;
}
.ptour-exit.is-in { opacity: 1; }
.ptour-exit__card {
  width: min(100%, 340px);
  padding: 20px 18px 14px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(180deg, rgba(29, 24, 40, 0.99), rgba(13, 11, 19, 0.99));
  border: 1px solid rgba(224, 188, 106, 0.32);
  box-shadow: var(--shadow-pop);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.35s var(--ease-spring);
}
.ptour-exit.is-in .ptour-exit__card { transform: none; }
.ptour-exit__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px; color: var(--gilt-hi);
}
.ptour-exit__body {
  margin: 8px 0 14px;
  font-size: 14.5px; line-height: 1.45;
  color: var(--tx-2);
}
.ptour-exit__card .ptour-next, .ptour-exit__card .ptour-ghost { width: 100%; }
.ptour-exit__card .ptour-ghost + .ptour-ghost { margin-top: -2px; }

/* ── The Patrons' Hall: replay any chapter ─────────────────────────────── */
.ptour-hall {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 0 calc(env(safe-area-inset-bottom, 0px) + 24px);
}
.ptour-hall__inner { width: var(--pt-dlg-w); margin: 0 auto; }
.ptour-hall__top { display: flex; justify-content: flex-end; }
.ptour-hall__head { text-align: center; margin: 4px 0 18px; }
.ptour-hall__sub {
  margin-top: 6px;
  font-style: italic;
  font-size: 15px;
  color: var(--tx-2);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
}
.ptour-hall__list { display: grid; gap: 9px; }
.ptour-hall__row {
  --acc: var(--gilt);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 8px 14px 8px 6px;
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
  border: 1px solid rgba(224, 188, 106, 0.2);
  background:
    radial-gradient(ellipse 50% 120% at 0% 50%, color-mix(in srgb, var(--acc) 22%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(25, 21, 35, 0.94), rgba(12, 10, 18, 0.94));
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, border-color 0.2s;
}
.ptour-hall__row:active { transform: scale(0.985); }
.ptour-hall__row:hover { border-color: rgba(224, 188, 106, 0.45); }
.ptour-hall__row > img { width: 70px; height: 70px; object-fit: contain; flex-shrink: 0; margin-bottom: -8px; align-self: flex-end; }
.ptour-hall__txt { flex: 1; min-width: 0; }
.ptour-hall__txt > span { display: block; }
.ptour-hall__num {
  font-family: var(--font-ui); font-weight: 800;
  font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--acc);
}
.ptour-hall__name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 15px; line-height: 1.2;
  color: var(--gilt-hi);
}
.ptour-hall__dom {
  font-family: var(--font-ui); font-weight: 500;
  font-size: 12px;
  color: var(--tx-3);
}
.ptour-hall__state { flex-shrink: 0; text-align: right; }
.ptour-hall__state img { width: 26px; height: 26px; object-fit: contain; }
.ptour-hall__chip {
  display: block;
  margin-top: 2px;
  font-family: var(--font-ui); font-weight: 700;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--tx-3);
  white-space: nowrap;
}
.ptour-hall__chip.is-gift { color: var(--gilt); }
.ptour-hall__chip.is-done { color: var(--jade); }
.ptour-hall__cta { margin-top: 16px; }
.ptour-hall__cta .ptour-next { width: 100%; height: 48px; }

/* ── Short screens: tighten the council and the stage portrait ─────────── */
@media (max-height: 720px) {
  .ptour-council { max-width: 296px; gap: 6px 10px; top: calc(env(safe-area-inset-top, 0px) + 34px); }
  .ptour-council__title { font-size: 22px; }
  .ptour-niche__name { font-size: 10px; }
  .ptour-niche__dom { display: none; }
  .ptour-title { top: calc(env(safe-area-inset-top, 0px) + 13vh); }
  .ptour-gift { top: calc(env(safe-area-inset-top, 0px) + 9vh); }
  .ptour[data-mode="stage"] .ptour-dlg__portrait { width: 112px; height: 112px; }
  .ptour[data-mode="stage"] .ptour-dlg { --pt-portrait-gap: 104px; }
  .ptour-dlg__text { font-size: 15.5px; }
  .ptour-finale__row { padding-top: 5px; padding-bottom: 5px; }
  .ptour-finale__row span { font-size: 11.5px; }
}
@media (max-height: 620px) {
  .ptour-niche__name { display: none; }
  .ptour-finale__list { gap: 4px; }
}
/* ── Wide screens: the council stands in one row ───────────────────────── */
@media (min-width: 760px) and (min-height: 700px) {
  .ptour-council { max-width: 760px; grid-template-columns: repeat(6, 1fr); top: calc(10vh); }
  .ptour-title__name { font-size: 54px; }
}

/* ── Reduced motion: no drift, no particles, no typing ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ptour-scene img.is-in,
  .ptour-hole::before, .ptour-hole::after,
  .ptour-tap::before, .ptour-tap::after,
  .ptour-dlg__portrait img,
  .ptour-gift__rays,
  .ptour-next.is-ready { animation: none !important; }
  .ptour-gift.is-in .ptour-gift__coin img { animation: none !important; opacity: 1; }
  .ptour-hole { transition-duration: 0.01ms !important; }
}

/* The More sheet's "The Patrons' Tour" row: Aldric's face, not the whole bust */
.more-row__icon:has(img[src*="/patrons/"]) { overflow: hidden; }
.more-row__icon img[src*="/patrons/"] {
  width: 42px;
  height: 42px;
  object-fit: cover;
  image-rendering: pixelated;
  transform: scale(1.7) translateY(9%);
  transform-origin: 50% 20%;
}
