/* =============================================================
   Self-hosted fonts (replaces Google Fonts)
============================================================= */
@font-face {
  font-family: 'Cinzel Decorative';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/cinzel-decorative-v19-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel Decorative';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/cinzel-decorative-v19-latin-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/cinzel-v26-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/cinzel-v26-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/crimson-pro-v28-latin-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/crimson-pro-v28-latin-300italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/crimson-pro-v28-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/crimson-pro-v28-latin-italic.woff2') format('woff2');
}

/* =============================================================
   Commander Quest — style.css
   Dark fantasy aesthetic inspired by Magic: The Gathering.
   CSS custom properties used throughout for easy theming.

   TABLE OF CONTENTS
   ─────────────────────────────────────────────────────────────
   1.  Custom Properties (design tokens)
   2.  Reset & Base
   3.  Screen System (show/hide + fade transitions)
   4.  Landing Screen
   5.  Buttons
   6.  Quest Screen Layout (header, progress bar, main)
   7.  Step Header & Description
   8.  Step 1 — Color Wheel
   9.  Step 1 — Color Slots
   10. Step 1 — Result Area
   11. Steps 2 & 3 — Flip Cards
   12. Step 3 — Quest Complete Summary
   13. Step 4 — Crossroads Path System
   14. Responsive Overrides (≤ 600px)
   ─────────────────────────────────────────────────────────────
   To theme the app: edit the CSS variables in section 1.
   All colors, spacing, and fonts are defined there.
============================================================= */

/* ── Custom Properties ────────────────────────────────────── */
:root {
  /* Colors */
  --ink:        #0a0a0f;
  --parchment:  #f5edd6;
  --gold:       #c9a84c;
  --gold-bright:#f0c96e;
  --gold-dark:  #8a6a20;
  --silver:     #9eaab8;
  --glow:       rgba(201, 168, 76, 0.35);
  --glow-soft:  rgba(201, 168, 76, 0.12);

  /* Mana colors */
  --mana-white: #f8f0d0;
  --mana-blue:  #1a5fa8;
  --mana-black: #1a1020;
  --mana-red:   #c0392b;
  --mana-green: #1a6b3a;

  /* Mana accent rings */
  --mana-white-ring: #e8d8a0;
  --mana-blue-ring:  #4a9fef;
  --mana-black-ring: #8855cc;
  --mana-red-ring:   #ff6644;
  --mana-green-ring: #44cc66;

  /* Surfaces */
  --surface:    #12111a;
  --surface-2:  #1c1b28;
  --surface-3:  #252438;
  --border:     rgba(201, 168, 76, 0.2);
  --border-bright: rgba(201, 168, 76, 0.55);

  /* Typography */
  --font-display: 'Cinzel Decorative', serif;
  --font-heading: 'Cinzel', serif;
  --font-body:    'Crimson Pro', Georgia, serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* overflow-x on html is required — without it the browser composites
   animated layers against the html viewport and the clipping is ignored,
   causing edge-flicker on Android when box-shadows repaint near the edges */
html { scroll-behavior: smooth; font-size: 16px; overflow-x: hidden; }

/* Suppress Android/iOS tap highlight rectangle on all interactive elements */
a, button, [role="button"], input, label, select, textarea,
.color-wheel, .color-slot, .flip-card, .deck-stack, .reroll-intro-overlay {
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--ink);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Screen System ────────────────────────────────────────── */
/*  Each "screen" is full-page. Only the `.active` one is shown.
    JS toggles the `active` class to navigate between screens. */

.screen {
  display: none;
  min-height: 100dvh;
  width: 100%;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
}

.screen.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

.screen.fade-in {
  animation: screenFadeIn 0.6s var(--ease-out) forwards;
}

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

/* ── Landing Screen ───────────────────────────────────────── */
#screen-landing {
  position: relative;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  overflow: hidden;
}

/* Atmospheric background */
.landing-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 65% at 50% 45%, rgba(45, 30, 85, 0.75) 0%, transparent 68%),
    radial-gradient(ellipse 45% 45% at 15% 85%, rgba(20, 10, 55, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 35% 35% at 85% 10%, rgba(60, 25, 10, 0.3) 0%, transparent 60%);
  pointer-events: none;
}

/* Floating arcane rune decorations */
.rune {
  position: absolute;
  font-size: clamp(3rem, 8vw, 7rem);
  color: var(--gold);
  opacity: 0.04;
  animation: runeFloat 8s ease-in-out infinite;
  user-select: none;
  pointer-events: none;
  will-change: transform;
}
.rune-1 { top: 10%;  left: 5%;  animation-delay: 0s;    font-size: 5rem; }
.rune-2 { top: 15%;  right: 8%; animation-delay: 2.5s;  font-size: 7rem; opacity: 0.03; }
.rune-3 { bottom: 20%; left: 10%; animation-delay: 1.2s; font-size: 4rem; }
.rune-4 { bottom: 10%; right: 6%; animation-delay: 3.8s; font-size: 6rem; opacity: 0.03; }

@keyframes runeFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-18px) rotate(5deg); }
}

/* Landing content */
.landing-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

.sigil {
  font-size: 2.2rem;
  color: var(--gold);
  animation: sigilPulse 3s ease-in-out infinite;
  text-shadow: 0 0 20px var(--gold), 0 0 40px rgba(201, 168, 76, 0.4);
}
.sigil-large { font-size: 3rem; }

@keyframes sigilPulse {
  0%, 100% { text-shadow: 0 0 20px var(--gold), 0 0 40px rgba(201, 168, 76, 0.4); transform: scale(1); }
  50%       { text-shadow: 0 0 30px var(--gold), 0 0 60px rgba(201, 168, 76, 0.6); transform: scale(1.1); }
}

@keyframes landingSigilPulse {
  0%, 100% {
    text-shadow: 0 0 28px var(--gold), 0 0 60px rgba(201, 168, 76, 0.65), 0 0 100px rgba(201, 168, 76, 0.28);
    transform: scale(1);
  }
  50% {
    text-shadow: 0 0 50px var(--gold-bright), 0 0 95px rgba(240, 201, 110, 0.85), 0 0 150px rgba(201, 168, 76, 0.45);
    transform: scale(1.18);
  }
}

#screen-landing .sigil {
  animation: landingSigilPulse 1.3s ease-in-out infinite;
  text-shadow: 0 0 28px var(--gold), 0 0 60px rgba(201, 168, 76, 0.65), 0 0 100px rgba(201, 168, 76, 0.28);
}

.title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--parchment);
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.title-accent {
  color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(240, 201, 110, 0.5);
}

.landing-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
}

.btn-lobby {
  position: relative;
  width: fit-content;
}

.btn-badge {
  display: inline-block;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--silver);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  margin-left: var(--space-sm);
  vertical-align: middle;
  opacity: 0.7;
}

.tagline {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: rgba(158, 170, 184, 0.9);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.9rem 2.8rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s var(--ease-out);
  box-shadow: 0 0 20px var(--glow), 0 4px 15px rgba(0,0,0,0.4);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 35px var(--glow), 0 8px 25px rgba(0,0,0,0.5);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, transparent 60%);
  pointer-events: none;
}

.btn-secondary {
  padding: 0.85rem 2.4rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s var(--ease-bounce);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--glow-soft);
  transform: translateY(-1px);
}

.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--silver);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: var(--space-sm) var(--space-md);
}

.btn-ghost:hover { opacity: 1; }

.btn-complete {
  font-size: 1rem;
  padding: 1rem 3rem;
  letter-spacing: 0.15em;
}

/* ── Quest Screen ─────────────────────────────────────────── */
#screen-quest {
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 65% at 50% 45%, rgba(45, 30, 85, 0.75) 0%, transparent 68%),
    radial-gradient(ellipse 45% 45% at 15% 85%, rgba(20, 10, 55, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 35% 35% at 85% 10%, rgba(60, 25, 10, 0.3) 0%, transparent 60%),
    var(--ink);
}

/* Quest header / progress bar */
.quest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 20, 0.6);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.quest-progress {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.progress-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.progress-group:not(:last-child) > .progress-step::after {
  content: '·';
  margin-left: var(--space-sm);
  color: var(--border-bright);
  opacity: 0.3;
}

.progress-step {
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--silver);
  opacity: 0.35;
  transition: opacity 0.3s, color 0.3s;
}

.progress-step.active {
  color: var(--gold);
  opacity: 1;
}

.progress-step.complete {
  color: var(--gold-bright);
  opacity: 0.7;
}


/* Progress dots */
.progress-dots {
  display: flex;
  gap: 4px;
  justify-content: flex-start;
  padding-left: 2px;
}

.progress-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.progress-dot--done {
  background: var(--gold-bright);
  box-shadow: 0 0 6px 1px rgba(201, 168, 76, 0.6);
}

/* Nav arrow buttons in quest header */
.nav-arrows {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.btn-nav-arrow {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--gold);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s, border-color 0.2s;
  opacity: 0.85;
}

.btn-nav-arrow:hover:not(:disabled) {
  opacity: 1;
}

.btn-nav-arrow:disabled {
  opacity: 0.25;
  cursor: default;
  color: var(--silver);
}

/* Retreat button — fixed bottom-left */
.btn-retreat {
  position: fixed;
  bottom: var(--space-lg);
  left: var(--space-lg);
  z-index: 50;
  background: none;
  border: none;
  color: var(--silver);
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s;
  padding: var(--space-sm);
}

.btn-retreat:hover {
  opacity: 0.9;
}

/* Hide Continue buttons when viewing a past step read-only */
.quest-main.view-mode .btn-primary {
  display: none !important;
}


/* ── Quest Main ───────────────────────────────────────────── */
.quest-main {
  flex: 1;
  padding: var(--space-xl) var(--space-md) 5rem;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

/* ── Step Components ──────────────────────────────────────── */
/* Steps are hidden by default. `.active-step` is displayed. */
.step { display: none; }
.step.active-step {
  display: block;
  animation: screenFadeIn 0.5s var(--ease-out) forwards;
}

.step-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.step-label {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border);
  padding: 0.3rem 1rem;
  border-radius: 999px;
}

.step-group-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--silver);
  opacity: 0.45;
  margin-bottom: 0.3rem;
}

.step-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--parchment);
  margin: var(--space-md) 0 var(--space-sm);
  font-weight: 400;
}

.step-desc {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  color: rgba(245, 237, 214, 0.65);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Step 0 — Difficulty Selection ───────────────────────── */
#step-difficulty {
  position: relative;
  overflow: hidden;
}

#step-difficulty.active-step,
#step-1.active-step,
#step-2.active-step,
#step-3.active-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}


#step-difficulty .step-header {
  margin-bottom: var(--space-lg);
}

.difficulty-options {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: stretch;
  width: 100%;
  max-width: 320px;
}

.difficulty-wrap {
  position: relative;
  width: 100%;
}

.difficulty-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.9rem 2.8rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  overflow: hidden;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s var(--ease-out);
}

.difficulty-label { position: relative; z-index: 1; }

.difficulty-card:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }
.difficulty-card:active:not(:disabled) { transform: translateY(0) scale(0.98); }

/* Easy — bright gold */
.difficulty-card--easy {
  background: linear-gradient(135deg, #ffe484 0%, #f0c96e 50%, #c9a84c 100%);
  color: var(--ink);
  box-shadow: 0 0 20px rgba(240, 201, 110, 0.4), 0 4px 15px rgba(0,0,0,0.4);
}
.difficulty-card--easy:hover {
  box-shadow: 0 0 35px rgba(240, 201, 110, 0.6), 0 8px 25px rgba(0,0,0,0.5);
}

/* Normal — standard gold */
.difficulty-card--normal {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  color: var(--ink);
  box-shadow: 0 0 20px var(--glow), 0 4px 15px rgba(0,0,0,0.4);
}
.difficulty-card--normal:hover {
  box-shadow: 0 0 35px var(--glow), 0 8px 25px rgba(0,0,0,0.5);
}

/* Hard — dark gold */
.difficulty-card--hard {
  background: linear-gradient(135deg, #c9a84c 0%, #8a6a20 50%, #4a3a0a 100%);
  color: var(--ink);
  box-shadow: 0 0 20px rgba(138, 106, 32, 0.4), 0 4px 15px rgba(0,0,0,0.5);
}
.difficulty-card--hard:hover {
  box-shadow: 0 0 35px rgba(138, 106, 32, 0.6), 0 8px 25px rgba(0,0,0,0.6);
}

/* ── Hard mode — 3 cards side by side in crossroads ──────── */
.crossing-fork--triple {
  flex-wrap: nowrap;
}

/* ── Wheel of Fortune ─────────────────────────────────────── */
.wheel-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.wheel-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -1.5rem;
}

.wheel-pointer {
  margin-bottom: -32px;
  z-index: 2;
  position: relative;
  animation: pointerPulse 2s ease-in-out infinite;
  line-height: 0;
}

@keyframes pointerPulse {
  0%, 100% { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6)) drop-shadow(0 0 6px rgba(201,168,76,0.4)); }
  50%       { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6)) drop-shadow(0 0 18px rgba(201,168,76,0.85)) drop-shadow(0 0 32px rgba(201,168,76,0.3)); }
}

/* The wheel itself — a CSS conic gradient circle */
.color-wheel {
  width: clamp(200px, 40vw, 280px);
  height: clamp(200px, 40vw, 280px);
  border-radius: 50%;
  position: relative;
  border: 3px solid var(--gold);
  /* Keep only the tight inner shadow here — the large outer glow is
     handled by a pseudo-element that fades via opacity so it never
     triggers a paint on the main layer (opacity is GPU-composited) */
  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.52),
    inset 0 0 45px rgba(0, 0, 0, 0.6);
  transition: border-color 0.3s;
  will-change: transform;
  /* Rotation is set inline by JS */
}

/* Outer glow rendered in a pseudo-element so it animates via opacity,
   not box-shadow — this is compositor-only and never repaints */
.color-wheel::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.38);
  box-shadow:
    0 0 10px rgba(201, 168, 76, 0.1),
    0 0 55px var(--glow),
    0 0 90px rgba(201, 168, 76, 0.12);
  pointer-events: none;
  z-index: 3;
  opacity: 1;
  transition: opacity 0.3s;
}

/* Inner concentric ring */
.color-wheel::after {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.28);
  pointer-events: none;
  z-index: 3;
}

/* Segment divider lines */
.wheel-divider {
  position: absolute;
  top: 50%;
  left: calc(50% - 0.5px);
  width: 1px;
  height: 50%;
  transform-origin: top center;
  background: linear-gradient(to bottom, rgba(201, 168, 76, 0.55) 0%, rgba(201, 168, 76, 0.1) 72%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* Inner hub */
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #2e2b45 0%, #16132a 55%, var(--gold-dark) 100%);
  border: 2px solid var(--gold-bright);
  box-shadow:
    0 0 0 3px rgba(10, 8, 20, 0.6),
    0 0 0 4px rgba(201, 168, 76, 0.18),
    0 0 22px var(--glow),
    0 0 42px rgba(201, 168, 76, 0.18),
    inset 0 0 16px rgba(10, 8, 24, 0.5);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hub-sigil {
  font-size: 1.05rem;
  color: var(--gold-bright);
  text-shadow: 0 0 10px var(--gold), 0 0 22px rgba(201, 168, 76, 0.5);
  animation: sigilPulse 3s ease-in-out infinite;
  user-select: none;
  pointer-events: none;
  line-height: 1;
}

/* Mana symbol pip on the wheel */
.wheel-symbol {
  position: absolute;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.wheel-symbol img {
  width:  clamp(36px, 9vw, 48px);
  height: clamp(36px, 9vw, 48px);
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.7));
}

/* Clickable wheel — pointer cursor and magical hover glow */
.color-wheel:not(.wheel-spinning):not(.wheel-done):not(.wheel-reroll) {
  cursor: pointer;
}

/* Hover glow pulses the pseudo-element opacity — compositor-only, no repaint */
@keyframes wheelGlowPulse {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1.4; }
}

.color-wheel:not(.wheel-spinning):not(.wheel-done):not(.wheel-reroll):hover::before {
  animation: wheelGlowPulse 2s ease-in-out infinite;
}

.color-wheel.wheel-reroll .hub-sigil {
  animation: none;
}

/* Winning flash: pulse the glow layer via opacity — compositor-only, no repaint */
.color-wheel.color-selected::before {
  animation: wheelFlash 0.8s ease-out !important;
}

@keyframes wheelFlash {
  0%   { opacity: 1;   }
  35%  { opacity: 3.5; }
  100% { opacity: 1;   }
}

/* Wheel Controls */
.wheel-controls {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}


/* ── Rainbow Flash (triple-same result) ──────────────────── */
@keyframes rainbowCycle {
  0%   { border-color: #ff4444; box-shadow: 0 0 0 6px rgba(0,0,0,0.3), 0 0 50px #ff4444; }
  17%  { border-color: #ff8800; box-shadow: 0 0 0 6px rgba(0,0,0,0.3), 0 0 50px #ff8800; }
  33%  { border-color: #f5e600; box-shadow: 0 0 0 6px rgba(0,0,0,0.3), 0 0 50px #f5e600; }
  50%  { border-color: #33cc55; box-shadow: 0 0 0 6px rgba(0,0,0,0.3), 0 0 50px #33cc55; }
  67%  { border-color: #3388ff; box-shadow: 0 0 0 6px rgba(0,0,0,0.3), 0 0 50px #3388ff; }
  83%  { border-color: #bb44ff; box-shadow: 0 0 0 6px rgba(0,0,0,0.3), 0 0 50px #bb44ff; }
  100% { border-color: #ff4444; box-shadow: 0 0 0 6px rgba(0,0,0,0.3), 0 0 50px #ff4444; }
}

.color-wheel.rainbow-flash {
  animation: rainbowCycle 0.8s linear 5 !important;
}

.color-slot.rainbow-flash {
  animation: rainbowCycle 0.8s linear 5 !important;
}

/* ── Mercy Message ───────────────────────────────────────── */
.result-rainbow-msg {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gold-bright);
  text-align: center;
  margin-bottom: var(--space-xs);
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}


/* ── Color Combo Result Box ──────────────────────────────── */
.color-combo-box {
  border: 1px solid var(--border-bright);
  background: var(--surface-2);
  padding: var(--space-md) var(--space-lg);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 0 40px var(--glow-soft), inset 0 1px 0 rgba(255,255,255,0.05);
  max-width: 420px;
  width: 100%;
  animation: slotReveal 0.5s var(--ease-bounce) forwards;
}

.color-combo-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  color: var(--gold-bright);
  font-weight: 400;
  margin-bottom: var(--space-sm);
  text-shadow: 0 0 30px rgba(240, 201, 110, 0.5), 0 0 60px rgba(240, 201, 110, 0.2);
}

.color-combo-rule {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: rgba(245, 237, 214, 0.6);
  line-height: 1.65;
}

.combo-rule-any {
  color: var(--gold-bright);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(240, 201, 110, 0.5);
}

/* ── Next-to-fill slot pulse ─────────────────────────────── */
@keyframes nextSlotPulse {
  0%, 100% { border-color: rgba(201, 168, 76, 0.25); box-shadow: none; }
  50%       { border-color: rgba(201, 168, 76, 0.7);  box-shadow: 0 0 14px rgba(201, 168, 76, 0.3); }
}

.color-slot.next-to-fill {
  animation: nextSlotPulse 1.6s ease-in-out infinite;
}

/* ── Mercy Reroll — slots become clickable ───────────────── */
@keyframes rerollPulse {
  0%, 100% {
    box-shadow: 0 0 10px var(--glow);
    border-color: rgba(201, 168, 76, 0.6);
  }
  50% {
    box-shadow: 0 0 22px var(--gold), 0 0 45px rgba(201, 168, 76, 0.55), 0 0 70px rgba(201, 168, 76, 0.25);
    border-color: var(--gold-bright);
  }
}

.color-slot.rerollable {
  cursor: pointer;
  animation: rerollPulse 1.1s ease-in-out infinite;
  border-style: solid;
  border-width: 3px;
  border-color: var(--gold);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.color-slot.rerollable:hover {
  transform: scale(1.22);
  animation: none;
}

/* ── Selected Colors Display ──────────────────────────────── */
.selected-colors-area {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.selected-label {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--silver);
  opacity: 0.6;
  margin-bottom: var(--space-md);
}

.selected-colors {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* Individual color slot — empty state */
.color-slot {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: all 0.4s var(--ease-bounce);
  position: relative;
  overflow: hidden;
}

.color-slot.empty::after {
  content: '?';
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--border-bright);
  opacity: 0.3;
}

/* Filled slot — color set via JS inline style + this class */
.color-slot.filled {
  border-style: solid;
  border-width: 3px;
  box-shadow: 0 0 20px var(--slot-glow, var(--glow));
  animation: slotReveal 0.5s var(--ease-bounce) forwards;
}

/* Rerollable overrides slotReveal — must come after .filled */
.color-slot.filled.rerollable {
  cursor: pointer;
  animation: rerollPulse 1.1s ease-in-out infinite;
  border-color: var(--gold);
  border-width: 3px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.color-slot.filled.rerollable:hover {
  transform: scale(1.22);
  animation: none;
}

.slot-img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  display: block;
}

.color-slot.filled::after { display: none; }

@keyframes slotReveal {
  0%   { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Color-specific slot styles (set via data attributes in JS) */
.color-slot[data-color="white"]  { background: radial-gradient(circle, #f5f0d8, #c8b87a); border-color: var(--mana-white-ring); --slot-glow: rgba(248,240,208,0.4); }
.color-slot[data-color="blue"]   { background: radial-gradient(circle, #1a5fa8, #0a2550); border-color: var(--mana-blue-ring);  --slot-glow: rgba(74,159,239,0.4); }
.color-slot[data-color="black"]  { background: radial-gradient(circle, #3a2050, #10081a); border-color: var(--mana-black-ring); --slot-glow: rgba(136,85,204,0.4); }
.color-slot[data-color="red"]    { background: radial-gradient(circle, #c0392b, #5a0f0a); border-color: var(--mana-red-ring);   --slot-glow: rgba(255,102,68,0.4); }
.color-slot[data-color="green"]  { background: radial-gradient(circle, #1a6b3a, #082010); border-color: var(--mana-green-ring); --slot-glow: rgba(68,204,102,0.4); }

/* ── Step Result Card ─────────────────────────────────────── */
.step-result {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.step-result.hidden { display: none; }

/* Reserve button space so justify-content: center doesn't jump when it appears */
#step-2 .step-result.hidden,
#step-3 .step-result.hidden {
  display: flex !important;
  visibility: hidden;
  pointer-events: none;
}

.result-card {
  border: 1px solid var(--border-bright);
  background: var(--surface-2);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 16px;
  position: relative;
  box-shadow: 0 0 40px var(--glow-soft), inset 0 1px 0 rgba(255,255,255,0.05);
  max-width: 500px;
  width: 100%;
}

.result-card::before,
.result-card::after {
  content: '✦';
  position: absolute;
  top: var(--space-md);
  color: var(--gold);
  opacity: 0.4;
  font-size: 0.7rem;
}
.result-card::before { left: var(--space-md); }
.result-card::after  { right: var(--space-md); }

.result-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-lg);
}

.result-colors {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

/* Result color pill */
.pill-img {
  width: 1.4em;
  height: 1.4em;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

.result-color-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid;
  animation: pillReveal 0.4s var(--ease-bounce) both;
}

.result-color-pill:nth-child(2) { animation-delay: 0.1s; }
.result-color-pill:nth-child(3) { animation-delay: 0.2s; }

@keyframes pillReveal {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.result-color-pill.white { background: rgba(248,240,208,0.12); border-color: var(--mana-white-ring); color: #f8f0d0; }
.result-color-pill.blue  { background: rgba(26, 95,168,0.25);  border-color: var(--mana-blue-ring);  color: #6bbfff; }
.result-color-pill.black { background: rgba(58, 32, 80,0.35);  border-color: var(--mana-black-ring); color: #cc99ff; }
.result-color-pill.red   { background: rgba(192,57, 43,0.25);  border-color: var(--mana-red-ring);   color: #ff8866; }
.result-color-pill.green { background: rgba(26,107, 58,0.25);  border-color: var(--mana-green-ring); color: #66dd88; }

.result-flavor {
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(245, 237, 214, 0.5);
  line-height: 1.6;
}

.result-constraint {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: rgba(245, 237, 214, 0.4);
  margin-top: var(--space-sm);
}

.result-combo-name {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
  text-shadow: 0 0 30px rgba(240, 201, 110, 0.5), 0 0 60px rgba(240, 201, 110, 0.2);
}

/* ── Placeholder Steps ────────────────────────────────────── */
.placeholder-content {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  border: 1px dashed var(--border);
  border-radius: 16px;
  margin-bottom: var(--space-xl);
  background: var(--surface-2);
}

.placeholder-icon { font-size: 2.5rem; margin-bottom: var(--space-lg); opacity: 0.5; }

.placeholder-text {
  font-size: 1rem;
  color: rgba(245,237,214,0.45);
  line-height: 1.8;
}

/* ── Quest Complete Screen ────────────────────────────────── */
#screen-complete,
#screen-lobby-results {
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  background:
    radial-gradient(ellipse 60% 60% at 50% 40%, rgba(50, 30, 5, 0.6) 0%, transparent 65%),
    var(--ink);
}

.complete-content {
  max-width: 580px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.complete-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: var(--gold-bright);
  font-weight: 400;
  text-shadow: 0 0 30px rgba(240,201,110,0.4);
}

.complete-subtitle {
  font-size: 1.1rem;
  font-style: italic;
  color: rgba(245,237,214,0.6);
  max-width: 400px;
}

/* Quest summary card */
.quest-summary {
  width: 100%;
  border: 1px solid var(--border-bright);
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 40px var(--glow-soft);
}

.summary-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
  animation: summarySlide 0.4s var(--ease-out) both;
}

/* Rows with a rotated left label — narrower key column, no item padding */
.summary-item--rotated-key {
  grid-template-columns: 42px 1fr;
  align-items: stretch;
  padding: 0;
  gap: 0;
}

@keyframes summarySlide {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.summary-item:last-child { border-bottom: none; }

.summary-key {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
}

/* Rotated label — sits in the narrow left column */
.summary-key--rotated {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201, 168, 76, 0.04);
  border-right: 1px solid var(--border);
  padding: var(--space-md) 0;
}

.summary-value {
  font-size: 1rem;
  color: var(--parchment);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

/* Stack of criteria entries inside a rotated-key row */
.summary-criteria-stack {
  display: flex;
  flex-direction: column;
  padding: var(--space-md) var(--space-lg);
  gap: var(--space-sm);
}

.summary-criteria {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  text-align: left;
}

.summary-criteria-title {
  font-size: 1rem;
  color: var(--parchment);
  font-weight: 600;
}

.summary-criteria-rule {
  font-size: 0.88rem;
  color: rgba(245, 237, 214, 0.55);
  line-height: 1.5;
}

.summary-criteria-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-xs) 0;
}

.summary-criteria--curse .summary-criteria-title {
  color: #e06060;
}

.summary-criteria--curse .summary-criteria-rule {
  color: rgba(220, 100, 100, 0.6);
}

.summary-criteria-curse-label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(200, 60, 60, 0.65);
  margin-bottom: 0.1rem;
}

.summary-placeholder {
  font-style: italic;
  color: rgba(245,237,214,0.3);
  font-size: 0.9rem;
}

/* ── Trial II — Card Deck ─────────────────────────────────── */
.card-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
}

/* Three-card row */
.drawn-cards-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  width: 100%;
}

.deck-stack {
  position: relative;
  width: clamp(190px, 46vw, 230px);
  height: clamp(266px, 65vw, 322px);
  cursor: pointer;
  transition: transform 0.2s var(--ease-bounce);
}

.deck-stack:hover { transform: translateY(-6px) scale(1.02); }
.deck-stack:active { transform: translateY(0) scale(0.98); }

.deck-card {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 2px solid var(--gold);
  background: url('../../files/designs/card_back_burden.png') center / cover no-repeat;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.75), 0 0 18px rgba(90, 20, 60, 0.4);
}

.deck-card::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  pointer-events: none;
}

.deck-card:nth-child(1) { transform: rotate(-4deg) translate(-7px, 8px); }
.deck-card:nth-child(2) { transform: rotate(2.5deg) translate(5px, 4px); }
.deck-card:nth-child(3) { transform: rotate(0deg); }

.deck-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--gold-bright);
  opacity: 0.35;
  text-shadow: 0 0 24px rgba(240, 201, 110, 0.6);
  pointer-events: none;
}

.deck-hint {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.65;
  text-align: center;
  animation: hintPulse 2.2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.85; }
}

@keyframes deckDeal {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.96) translateY(4px); }
  65%  { transform: scale(1.03) translateY(-10px); }
  100% { transform: scale(1); }
}

.deck-stack.deck-dealing {
  animation: deckDeal 0.42s var(--ease-bounce) forwards;
  cursor: default;
}

.deck-stack.deck-dealt {
  opacity: 0.08;
  transform: scale(0.9) translateY(4px);
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

/* Drawn quest card */
.quest-card {
  width: clamp(155px, 28vw, 185px);
  height: clamp(220px, 40vw, 265px);
  border-radius: 10px;
  border: 2px solid var(--gold);
  box-shadow:
    0 0 0 1px rgba(138, 106, 32, 0.45),
    0 0 40px rgba(201, 168, 76, 0.22),
    0 12px 44px rgba(0, 0, 0, 0.75);
  background:
    radial-gradient(ellipse 65% 40% at 28% 14%, rgba(95, 65, 12, 0.38) 0%, transparent 55%),
    radial-gradient(ellipse 50% 55% at 72% 88%, rgba(38, 18, 82, 0.38) 0%, transparent 55%),
    linear-gradient(168deg, #1f1b2e 0%, #140f1e 55%, #0e0b18 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 1.1rem;
  position: relative;
  overflow: hidden;
}

.quest-card::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  pointer-events: none;
  z-index: 0;
}

.quest-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,0.035) 0%, transparent 45%);
  border-radius: 10px;
  pointer-events: none;
  z-index: 0;
}

.card-ornament {
  font-size: 0.68rem;
  color: var(--gold);
  opacity: 0.55;
  letter-spacing: 0.45em;
  text-align: center;
  flex-shrink: 0;
  z-index: 1;
}

.quest-card-title {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2.8vw, 1.08rem);
  color: var(--gold-bright);
  text-align: center;
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-shadow: 0 0 18px rgba(240, 201, 110, 0.38);
  flex-shrink: 0;
  z-index: 1;
}

.card-divider {
  width: 72%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-dark), transparent);
  flex-shrink: 0;
  z-index: 1;
}

.quest-card-text {
  font-family: var(--font-body);
  font-size: clamp(0.78rem, 2.2vw, 0.92rem);
  color: rgba(245, 237, 214, 0.82);
  text-align: center;
  line-height: 1.55;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 0 0.2rem;
}

.card-scryfall-link {
  position: absolute;
  bottom: 6px;
  right: 8px;
  z-index: 2;
  color: var(--gold);
  opacity: 0.45;
  line-height: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.card-scryfall-link img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
  image-rendering: smooth;
}

.card-scryfall-link:hover {
  opacity: 1;
  color: var(--gold-bright);
}

.card-scryfall-link--disabled {
  cursor: default;
  filter: grayscale(1);
  opacity: 0.2;
}

.card-scryfall-link--disabled:hover {
  opacity: 0.2;
}

/* ── Flip Card System ─────────────────────────────────────── */

/* Outer wrapper — sets size and perspective */
.flip-card {
  width: clamp(155px, 28vw, 185px);
  height: clamp(220px, 40vw, 265px);
  perspective: 1000px;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.25s var(--ease-bounce), opacity 0.35s var(--ease-out);
}

/* 3D rotating inner */
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flip-card-inner.flipped {
  transform: rotateY(180deg);
}

/* Shared face styles */
.flip-card-back,
.flip-card-front {
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* Card back — in normal flow so height:100% resolves reliably */
.flip-card-back {
  display: block;
  width: 100%;
  height: 100%;
  background: url('../files/designs/card_back_burden.png') center / 100% 100% no-repeat;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65);
  transition: box-shadow 0.2s;
}

.flip-card-back--lore {
  background-image: url('../files/designs/card_back_lore.png');
}

.flip-card-back--event {
  background-image: url('../files/designs/card_back_event.png');
}

/* Card front — absolutely positioned over the back, starts hidden */
.flip-card-front,
.flip-card-front.quest-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg);
}

/* Magical appear animation */
@keyframes cardAppear {
  0% {
    transform: translateY(35px) scale(0.78);
    opacity: 0;
    filter: brightness(2.8);
  }
  45% { filter: brightness(1.5); opacity: 1; }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: none;
  }
}

.flip-card.card-appear {
  animation: cardAppear 0.65s var(--ease-bounce) both;
}

/* ── Face-down hover glow ─────────────────────────────────── */
@keyframes faceDownGlow {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(240, 201, 110, 0.5),
      0 0 22px rgba(201, 168, 76, 0.35),
      0 4px 18px rgba(0, 0, 0, 0.65);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 224, 110, 0.9),
      0 0 48px rgba(240, 201, 110, 0.6),
      0 0 85px rgba(201, 168, 76, 0.3),
      0 4px 18px rgba(0, 0, 0, 0.65);
  }
}

/* Hover effects scoped to devices with a real pointer — prevents stuck
   hover state on mobile from making the last-tapped card look pre-selected */
@media (hover: hover) {
  .flip-card:not(.card-revealed):hover {
    transform: translateY(-10px) scale(1.03);
  }

  .flip-card:not(.card-revealed):hover .flip-card-back {
    animation: faceDownGlow 1s ease-in-out infinite;
  }
}

/* ── Selection phase (all cards revealed) ─────────────────── */
@keyframes cardChosenGlow {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(240, 201, 110, 0.85),
      0 0 20px rgba(240, 201, 110, 0.6),
      0 0 50px rgba(201, 168, 76, 0.35),
      0 12px 40px rgba(0, 0, 0, 0.75);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(255, 235, 130, 1),
      0 0 40px rgba(255, 210, 80, 0.85),
      0 0 90px rgba(240, 180, 60, 0.55),
      0 12px 40px rgba(0, 0, 0, 0.75);
  }
}

@keyframes cardHoverSparkle {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(240, 201, 110, 0.65),
      0 0 28px rgba(240, 201, 110, 0.5),
      0 0 55px rgba(201, 168, 76, 0.3),
      0 18px 54px rgba(0, 0, 0, 0.85);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(255, 224, 110, 0.95),
      0 0 45px rgba(255, 210, 80, 0.75),
      0 0 90px rgba(201, 168, 76, 0.45),
      0 0 130px rgba(190, 110, 255, 0.18),
      0 18px 54px rgba(0, 0, 0, 0.85);
  }
}

/* Hover on selectable cards — pointer devices only */
@media (hover: hover) {
  .flip-card.card-selectable:not(.card-reroll-holding):hover {
    transform: translateY(-14px) scale(1.06);
    opacity: 1;
  }

  .flip-card.card-selectable:not(.card-reroll-holding):hover .flip-card-front {
    border-color: var(--gold-bright);
    animation: cardHoverSparkle 1s ease-in-out infinite;
  }
}

/* Chosen card — persistent breathing glow */
.flip-card.card-chosen {
  transform: translateY(-8px) scale(1.05);
}

.flip-card.card-chosen .flip-card-front {
  border-color: var(--gold-bright);
  animation: cardChosenGlow 1.8s ease-in-out infinite;
}

/* Unchosen cards fade back */
.flip-card.card-unchosen {
  opacity: 0.35;
  transform: scale(0.95);
}

@media (hover: hover) {
  /* Hovering chosen card escalates to sparkle */
  .flip-card.card-selectable.card-chosen:hover .flip-card-front {
    animation: cardHoverSparkle 1s ease-in-out infinite;
  }

  /* Unchosen cards restore on hover */
  .flip-card.card-selectable.card-unchosen:hover {
    opacity: 1;
    transform: translateY(-14px) scale(1.06);
  }
}

/* ── Fate event overlay ──────────────────────────────────── */
.fate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 18, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.fate-overlay--visible {
  opacity: 1;
  pointer-events: all;
  cursor: pointer;
}

.fate-overlay--hiding {
  opacity: 0;
  pointer-events: none;
}

@keyframes fateModalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.fate-modal {
  max-width: 420px;
  width: 90%;
  padding: 2.5rem 2rem 1.75rem;
  border-radius: 8px;
  text-align: center;
  animation: fateModalIn 0.4s var(--ease-out) forwards;
  pointer-events: none;
}

.fate-modal--positive {
  background: linear-gradient(160deg, #1c1500 0%, #0d0e1a 100%);
  border: 1px solid rgba(201, 168, 76, 0.55);
  box-shadow: 0 0 50px rgba(201, 168, 76, 0.18), 0 12px 48px rgba(0,0,0,0.65);
}

.fate-modal--negative {
  background: linear-gradient(160deg, #1a0606 0%, #0d0e1a 100%);
  border: 1px solid rgba(180, 35, 35, 0.55);
  box-shadow: 0 0 50px rgba(180, 35, 35, 0.2), 0 12px 48px rgba(0,0,0,0.65);
}

.fate-icon {
  font-size: 2.2rem;
  margin-bottom: 0.9rem;
  line-height: 1;
}

.fate-modal--positive .fate-icon {
  color: var(--gold-bright);
  text-shadow: 0 0 22px var(--gold), 0 0 50px rgba(201, 168, 76, 0.5);
  animation: sigilPulse 3s ease-in-out infinite;
}

.fate-modal--negative .fate-icon {
  color: #e05555;
  text-shadow: 0 0 22px rgba(220, 60, 60, 0.8), 0 0 50px rgba(180, 35, 35, 0.4);
}

.fate-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
}

.fate-modal--positive .fate-title { color: var(--gold-bright); }
.fate-modal--negative .fate-title { color: #e06060; }

.fate-text {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--parchment);
  line-height: 1.65;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.fate-timer-bar {
  height: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.fate-timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
}

.fate-modal--positive .fate-timer-fill { background: var(--gold); }
.fate-modal--negative .fate-timer-fill { background: #c03030; }

.fate-dismiss-hint {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--silver);
  opacity: 0.4;
}

/* ── Curse of Greed section (appended below step-2 cards) ── */
.curse-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  width: 100%;
}

.curse-section--visible {
  opacity: 1;
  transform: translateY(0);
}

.curse-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 60px;
}

.curse-connector-svg {
  height: 60px;
}

.curse-road-line {
  stroke: rgba(180, 55, 55, 0.55);
  filter: drop-shadow(0 0 3px rgba(180, 55, 55, 0.4));
}

.curse-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
}

.curse-icon-glyph {
  font-size: 1.4rem;
  color: #e05555;
  text-shadow: 0 0 18px rgba(200, 50, 50, 0.65);
}

.curse-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: #e06060;
  text-transform: uppercase;
}

.curse-desc {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--silver);
  opacity: 0.75;
}

/* Curse card backs — same image as burden, red glow variants below */
@keyframes faceDownGlowCurse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(220, 60, 60, 0.5),
      0 0 22px rgba(180, 35, 35, 0.35),
      0 4px 18px rgba(0, 0, 0, 0.65);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(240, 80, 80, 0.9),
      0 0 48px rgba(200, 50, 50, 0.6),
      0 0 85px rgba(160, 30, 30, 0.3),
      0 4px 18px rgba(0, 0, 0, 0.65);
  }
}

@keyframes cardChosenGlowCurse {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(220, 70, 70, 0.85),
      0 0 20px rgba(200, 50, 50, 0.6),
      0 0 50px rgba(160, 30, 30, 0.35),
      0 12px 40px rgba(0, 0, 0, 0.75);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(240, 90, 90, 1),
      0 0 40px rgba(220, 60, 60, 0.85),
      0 0 90px rgba(180, 40, 40, 0.55),
      0 12px 40px rgba(0, 0, 0, 0.75);
  }
}

@keyframes cardHoverSparkleCurse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(220, 70, 70, 0.65),
      0 0 28px rgba(200, 50, 50, 0.5),
      0 0 55px rgba(160, 30, 30, 0.3),
      0 18px 54px rgba(0, 0, 0, 0.85);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(240, 90, 90, 0.95),
      0 0 45px rgba(220, 60, 60, 0.75),
      0 0 90px rgba(180, 40, 40, 0.45),
      0 18px 54px rgba(0, 0, 0, 0.85);
  }
}

@media (hover: hover) {
  #curse-section .flip-card:not(.card-revealed):hover .flip-card-back {
    animation: faceDownGlowCurse 1s ease-in-out infinite;
  }

  #curse-section .flip-card.card-selectable:not(.card-reroll-holding):hover .flip-card-front {
    border-color: #e06060;
    animation: cardHoverSparkleCurse 1s ease-in-out infinite;
  }

  #curse-section .flip-card.card-selectable.card-chosen:hover .flip-card-front {
    animation: cardHoverSparkleCurse 1s ease-in-out infinite;
  }
}

#curse-section .flip-card.card-chosen .flip-card-front {
  border-color: #e06060;
  animation: cardChosenGlowCurse 1.8s ease-in-out infinite;
}

/* ── Reroll intro overlay (step-2 intro) ────────────────── */
.reroll-intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 18, 0.82);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  opacity: 1;
  transition: opacity 0.6s ease;
  pointer-events: all;
  cursor: pointer;
  flex-direction: column;
  gap: var(--space-md);
  padding-bottom: 3rem;
  user-select: none;
  -webkit-user-select: none;
}

.reroll-intro-overlay--hiding {
  opacity: 0;
}

.reroll-intro-overlay--solid {
  background:
    radial-gradient(ellipse 80% 65% at 50% 45%, rgba(45, 30, 85, 0.75) 0%, transparent 68%),
    radial-gradient(ellipse 45% 45% at 15% 85%, rgba(20, 10, 55, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 35% 35% at 85% 10%, rgba(60, 25, 10, 0.3) 0%, transparent 60%),
    var(--ink);
  backdrop-filter: none;
}

.intro-overlay-runes {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.reroll-intro-overlay--solid .intro-overlay-runes {
  display: block;
}

/* overlay content wrapper */
.intro-overlay-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* slide container */
.intro-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  opacity: 1;
  transition: opacity 0.5s ease;
}

.intro-slide--hidden {
  display: none;
}

.intro-slide--active {
  display: flex;
}

/* slide text styles */
.intro-slide-body--gap {
  margin-top: var(--space-md);
}

.intro-slide-body {
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  text-align: center;
  margin: 0;
  padding: 0 var(--space-xl);
  max-width: 34ch;
  line-height: 1.6;
  text-shadow: 0 0 30px rgba(201, 168, 76, 0.4);
}

.intro-slide-hint {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  margin: 0;
  padding: 0 var(--space-xl);
  max-width: 36ch;
  letter-spacing: 0.04em;
}

.intro-title {
  font-family: var(--font-display);
  color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(240, 201, 110, 0.5);
}

.intro-slide-luck {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  color: var(--gold-bright);
  text-align: center;
  margin: 0;
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.7);
}

/* progress bar */
.intro-progress-bar {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.intro-progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(201, 168, 76, 0.45);
  border-radius: 999px;
}

/* skip hint */
.intro-skip-hint {
  position: absolute;
  bottom: 1rem;
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.2);
  text-align: center;
  margin: 0;
  text-transform: uppercase;
}

/* ── Reroll counter (quest header) ──────────────────────── */
.reroll-counter-wrap {
  position: relative;
  margin-left: 0.5rem;
  cursor: default;
}

.reroll-counter {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.reroll-counter-tip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  transform: none;
  white-space: nowrap;
  padding: 0.45rem 1.1rem;
  background: rgba(10, 8, 5, 0.92);
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: rgba(201, 168, 76, 0.85);
  pointer-events: none;
  z-index: 30;
}

.reroll-counter-wrap:hover .reroll-counter-tip {
  display: block;
}

.reroll-pip {
  font-size: 1rem;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold), 0 0 22px rgba(201, 168, 76, 0.5);
  animation: sigilPulse 3s ease-in-out infinite;
  user-select: none;
}

.reroll-pip:nth-child(2) { animation-delay: 0.5s; }

/* ── Hold-to-reroll ring ─────────────────────────────────── */
.flip-card {
  position: relative; /* anchor for the ring overlay */
}

.reroll-ring {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s;
}

.reroll-ring--filling {
  opacity: 1;
}

.reroll-ring svg {
  width: 68px;
  height: 68px;
  overflow: visible;
}

.reroll-ring-track {
  fill: none;
  stroke: rgba(201, 168, 76, 0.18);
  stroke-width: 5;
}

.reroll-ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-linecap: round;
  transform-origin: 32px 32px;
  transform: rotate(-90deg);
  stroke-dasharray: 163.4;
  stroke-dashoffset: 163.4;
}

/* Circumference of r=26: 2π×26 ≈ 163.4 */
.reroll-ring--filling .reroll-ring-fill {
  animation: rerollFill 1.5s linear forwards;
}

@keyframes rerollFill {
  from { stroke-dashoffset: 163.4; }
  to   { stroke-dashoffset: 0; }
}

/* ── Card glow while hold is active ─────────────────────── */
@keyframes rerollHoldGlow {
  0%, 100% { box-shadow: 0 0 14px rgba(201,168,76,0.4), 0 0 28px rgba(201,168,76,0.2); }
  50%       { box-shadow: 0 0 36px rgba(201,168,76,0.95), 0 0 70px rgba(201,168,76,0.5); }
}

.flip-card.card-reroll-holding {
  transform: translateY(-8px) scale(1.05) !important;
  transition: transform 0.2s ease-out;
  animation: rerollHoldGlow 0.55s ease-in-out infinite;
}

/* ── Rerolling state (card mid-swap) ─────────────────────── */
.flip-card.card-rerolling {
  pointer-events: none;
}

/* ── New card reveal sparkle ─────────────────────────────── */
@keyframes rerollRevealGlow {
  0%   { box-shadow: 0 0 0px rgba(201,168,76,0); }
  25%  { box-shadow: 0 0 30px rgba(201,168,76,0.85), 0 0 60px rgba(201,168,76,0.4); }
  100% { box-shadow: 0 0 8px rgba(201,168,76,0.2); }
}

.flip-card.card-reroll-reveal .flip-card-front {
  animation: rerollRevealGlow 0.9s ease-out forwards;
  border-color: var(--gold-bright);
}

/* ── Crossroads — Old Map Layout ─────────────────────────── */
.crossroads-journey {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  margin-bottom: var(--space-xl);
}

.map-corner { display: none; }

/* ── Dashed road SVG (mid-segment only) ───────────────────── */
.path-road-svg {
  width: 10px;
  overflow: visible;
  display: block;
}

.road-line {
  stroke: rgba(180, 140, 55, 0.6);
  stroke-width: 1.8;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  fill: none;
  filter: drop-shadow(0 0 3px rgba(201, 168, 76, 0.4));
}

.path-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* ── Crosshair crossing marker ────────────────────────────── */
.path-crossing {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

.crossing-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

@keyframes markerGlowPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.07), 0 0 16px rgba(201, 168, 76, 0.28); }
  50%       { box-shadow: 0 0 0 6px rgba(201, 168, 76, 0.14), 0 0 32px rgba(201, 168, 76, 0.55), 0 0 55px rgba(201, 168, 76, 0.2); }
}

@keyframes markerRipple {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(2.8); opacity: 0; }
}

.crossing-map-marker {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 168, 76, 0.75);
  background: radial-gradient(circle at 40% 38%, rgba(201, 168, 76, 0.14), var(--surface) 68%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: markerGlowPulse 2s ease-in-out infinite;
}

/* Two staggered ripple rings expanding outward */
.crossing-map-marker::before,
.crossing-map-marker::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.5);
  animation: markerRipple 2.2s ease-out infinite;
  pointer-events: none;
}

.crossing-map-marker::after {
  animation-delay: 1.1s;
}

/* Proceed button after a crossing is decided */
.crossing-proceed-btn {
  display: block;
  margin: 1.2rem auto 0.4rem;
}

/* Stop all pulsing once a decision is made */
.crossing-decided .crossing-map-marker {
  animation: none;
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.2);
}

.crossing-decided .crossing-map-marker::before,
.crossing-decided .crossing-map-marker::after {
  animation: none;
  opacity: 0;
}

/* Horizontal crosshair arm */
.crossing-map-marker-tick--h {
  position: absolute;
  width: 54px;
  height: 1px;
  background: linear-gradient(to right,
    transparent,
    rgba(180, 140, 55, 0.5) 20%,
    rgba(180, 140, 55, 0.5) 80%,
    transparent
  );
  left: 50%;
  transform: translateX(-50%);
}

/* Vertical crosshair arm */
.crossing-map-marker-tick--v {
  position: absolute;
  width: 1px;
  height: 54px;
  background: linear-gradient(to bottom,
    transparent,
    rgba(180, 140, 55, 0.5) 20%,
    rgba(180, 140, 55, 0.5) 80%,
    transparent
  );
  top: 50%;
  transform: translateY(-50%);
}

/* Center dot */
.crossing-map-marker-center {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 6px var(--gold), 0 0 12px rgba(201, 168, 76, 0.4);
  position: relative;
  z-index: 1;
  animation: sigilPulse 3s ease-in-out infinite;
}

.crossing-label {
  font-family: var(--font-heading);
  font-size: 0.63rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.65);
}

/* ── Fork SVG — dashed Y-shape ────────────────────────────── */
.fork-svg {
  width: 100%;
  height: 58px;
  display: block;
  overflow: visible;
}

.fork-path-line {
  stroke: rgba(180, 140, 55, 0.55);
  stroke-width: 1.8;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  fill: none;
  filter: drop-shadow(0 0 3px rgba(201, 168, 76, 0.3));
}

.fork-end-dot {
  fill: rgba(180, 140, 55, 0.6);
  filter: drop-shadow(0 0 4px rgba(201, 168, 76, 0.5));
}

/* ── Fork card row ────────────────────────────────────────── */
.crossing-fork {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  flex-wrap: wrap;
  margin-top: -6px;
}

.crossing-or {
  align-self: center;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(180, 140, 55, 0.4);
  flex-shrink: 0;
  padding: 0 0.3rem;
  font-style: italic;
}


/* ── Hidden / reveal animations ──────────────────────────── */
.crossing-hidden {
  visibility: hidden;
  pointer-events: none;
  height: 0;
  overflow: hidden;
  opacity: 0;
}

@keyframes pathRoadReveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.path-mid.path-road-reveal {
  visibility: visible;
  pointer-events: auto;
  height: auto;
  overflow: visible;
  animation: pathRoadReveal 0.45s var(--ease-out) forwards;
}

@keyframes crossingAppear {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.path-crossing.crossing-reveal {
  visibility: visible;
  pointer-events: auto;
  height: auto;
  overflow: visible;
  animation: crossingAppear 0.6s var(--ease-out) forwards;
}


/* ── Site Footer ──────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.78rem;
  color: #504438;
  letter-spacing: 0.04em;
}

.site-footer a {
  color: #504438;
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: #a08060;
}

.site-footer-sep {
  margin: 0 0.6rem;
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 520px) {
  .crossroads-journey {
    padding: var(--space-xl) var(--space-sm) var(--space-lg);
  }

  .fork-svg { display: none; }

  .crossing-fork,
  .crossing-fork--triple {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 1.75rem;
    margin-top: var(--space-md);
  }

  .event-choice {
    width: min(80vw, 280px);
    min-height: auto;
    padding: 0.75rem 0.6rem;
  }

}

@media (max-width: 600px) {
  .quest-header {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .nav-arrows {
    padding-top: 2px;
  }

  .step-group-label {
    display: none;
  }

  .quest-progress {
    gap: 0.35rem;
    align-items: flex-start;
  }

  .progress-step {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }

  .progress-group:not(:last-child) > .progress-step::after {
    margin-left: 0.35rem;
  }

  /* Show only the active group plus its immediate neighbours */
  .progress-group[data-rel="far"] {
    display: none;
  }

  .quest-main {
    padding: var(--space-lg) var(--space-md) 6rem;
  }

  .color-wheel {
    width: clamp(240px, 72vw, 320px);
    height: clamp(240px, 72vw, 320px);
  }



  .wheel-controls {
    flex-direction: column;
    align-items: center;
  }

  .result-card {
    padding: var(--space-lg) var(--space-lg);
  }

  .summary-item {
    grid-template-columns: 100px 1fr;
  }

  .summary-item--rotated-key {
    grid-template-columns: 36px 1fr;
  }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================================
   LOBBY SCREENS
============================================================= */

/* ── Shared lobby layout ─────────────────────────────────── */
.lobby-screen-content {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.lobby-form-header {
  text-align: center;
}

/* ── Lobby form ──────────────────────────────────────────── */
.lobby-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.lobby-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.lobby-field label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lobby-field input[type="text"] {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.65rem var(--space-md);
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.lobby-field input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
}

.lobby-code-input {
  font-family: var(--font-heading) !important;
  font-size: 1.5rem !important;
  letter-spacing: 0.25em !important;
  text-align: center;
  text-transform: uppercase;
}

/* ── Side-by-side field row ──────────────────────────────── */
.lobby-field-row {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
}

.lobby-field-row > .lobby-field {
  flex: 1;
  min-width: 0;
}

@media (max-width: 540px) {
  .lobby-field-row {
    flex-direction: column;
  }
}

/* ── Difficulty selector ─────────────────────────────────── */
.lobby-difficulty-row {
  display: flex;
  gap: var(--space-sm);
}

.lobby-diff-btn {
  flex: 1;
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--silver);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lobby-diff-btn--selected,
.lobby-diff-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,76,0.08);
}

/* ── Budget slider ───────────────────────────────────────── */
.budget-display {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--parchment);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

.budget-slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.budget-label {
  font-size: 0.72rem;
  color: var(--silver);
  white-space: nowrap;
  font-family: var(--font-heading);
  opacity: 0.6;
}

.budget-slider {
  flex: 1;
  accent-color: var(--gold);
  cursor: pointer;
  height: 4px;
}

.currency-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.currency-label {
  font-size: 0.7rem;
  color: var(--silver);
  opacity: 0.6;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.currency-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--silver);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  width: 36px;
  height: 30px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.currency-btn--selected,
.currency-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ── Form actions ────────────────────────────────────────── */
.lobby-form-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: center;
}

.lobby-form-actions .btn-primary { width: 100%; }

.lobby-error {
  color: #e07070;
  font-size: 0.85rem;
  text-align: center;
  font-family: var(--font-body);
}

/* ── Join / Re-enter mode switch ────────────────────────── */
.lobby-mode-switch {
  display: flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: var(--space-md);
}

.lobby-mode-btn {
  flex: 1;
  background: none;
  border: none;
  color: rgba(245,237,214,0.5);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 0.55rem 0.5rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}

.lobby-mode-btn--active {
  background: rgba(201,168,76,0.18);
  color: var(--gold);
}

.lobby-mode-btn:hover:not(.lobby-mode-btn--active) {
  color: rgba(245,237,214,0.8);
  background: rgba(255,255,255,0.04);
}

.caps-lock-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: rgba(245,237,214,0.45);
  font-style: italic;
}

/* ── Re-enter hint text ──────────────────────────────────── */
.lobby-rejoin-hint {
  font-size: 0.8rem;
  color: rgba(245,237,214,0.5);
  text-align: center;
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}

.lobby-pin-input {
  font-family: var(--font-heading) !important;
  font-size: 1.8rem !important;
  letter-spacing: 0.35em !important;
  text-align: center;
}

/* ── PIN overlay box ─────────────────────────────────────── */
.lobby-pin-box {
  gap: var(--space-lg);
}

.lobby-pin-value {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  letter-spacing: 0.45em;
  color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(240,201,110,0.5);
  text-align: center;
}

/* ── Lobby Room ──────────────────────────────────────────── */
.lobby-room-wrap {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.lobby-room-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}

.lobby-room-name {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: var(--gold-bright);
  margin: 0;
}

.lobby-room-subtitle {
  color: var(--silver);
  font-size: 0.85rem;
  margin-top: var(--space-xs);
}

.lobby-diff-badge {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--silver);
}

.lobby-diff-badge--easy   { border-color: #4aac68; color: #4aac68; }
.lobby-diff-badge--normal { border-color: var(--gold); color: var(--gold); }
.lobby-diff-badge--hard   { border-color: #e06060; color: #e06060; }

/* ── Share row ───────────────────────────────────────────── */
.lobby-share-row {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: var(--space-md);
  flex-wrap: wrap;
}

.lobby-code-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.lobby-code-label {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--silver);
  opacity: 0.6;
}

.lobby-code-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  letter-spacing: 0.22em;
  color: var(--gold-bright);
}

.lobby-link-block {
  display: flex;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
  align-items: center;
}

.lobby-link-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--silver);
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.4rem var(--space-sm);
}

.lobby-copy-btn {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  white-space: nowrap;
}

/* ── Player list ─────────────────────────────────────────── */
.lobby-players-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.lobby-players-heading {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.lobby-player-count {
  color: var(--silver);
  opacity: 0.6;
  font-size: 0.7rem;
}

.lobby-player-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lobby-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem var(--space-md);
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.025);
  gap: var(--space-md);
}

.lobby-player-row--me {
  border-color: rgba(201,168,76,0.25);
  background: rgba(201,168,76,0.05);
}

.lobby-player-name {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--parchment);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player-name em {
  font-size: 0.8rem;
  color: var(--silver);
  margin-left: 4px;
}


.lobby-start-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
}

.lobby-view-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 6px;
}

.lobby-view-btn:hover { border-color: var(--gold); opacity: 1; }

.lobby-status {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lobby-status--waiting { color: var(--silver); opacity: 0.5; }
.lobby-status--active  { color: var(--gold); animation: sigilPulse 2s ease-in-out infinite; }
.lobby-status--done    { color: #4aac68; }

.lobby-player-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.player-color-pips {
  display: flex;
  gap: 3px;
  align-items: center;
}

.player-color-pip {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.9;
}

.lobby-leave-btn {
  align-self: flex-start;
  font-size: 0.75rem;
  opacity: 0.5;
}

.lobby-leave-btn:hover { opacity: 0.9; }

/* ── Difficulty tooltip ──────────────────────────────────── */
.lobby-diff-wrap {
  position: relative;
  flex: 1;
}

.diff-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 8, 5, 0.92);
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
  font-style: italic;
  color: rgba(255,255,255,0.45);
  white-space: normal;
  width: max-content;
  max-width: 220px;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.6);
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.lobby-diff-wrap:hover .diff-tooltip,
.difficulty-wrap:hover .diff-tooltip {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.5s;
}

/* Anchor first/last tooltips to avoid viewport overflow */
.lobby-diff-wrap:first-child .diff-tooltip,
.difficulty-wrap:first-child .diff-tooltip {
  left: 0;
  transform: none;
}

.lobby-diff-wrap:last-child .diff-tooltip,
.difficulty-wrap:last-child .diff-tooltip {
  left: auto;
  right: 0;
  transform: none;
}

/* ── Rules chip input ────────────────────────────────────── */
.rules-input-row {
  display: flex;
  gap: var(--space-sm);
}

.rules-input-row input {
  flex: 1;
}

.rules-add-btn {
  flex-shrink: 0;
  padding: 0.5rem var(--space-md);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.rules-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.rules-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 20px;
  padding: 3px 10px 3px 12px;
  font-size: 0.82rem;
  color: var(--parchment);
  font-family: var(--font-body);
}

.rules-chip-remove {
  background: none;
  border: none;
  color: var(--silver);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.rules-chip-remove:hover { opacity: 1; }

/* ── Notes textarea ──────────────────────────────────────── */
.lobby-field textarea {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.65rem var(--space-md);
  resize: vertical;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.5;
}

.lobby-field textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.lobby-field-hint {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--silver);
  opacity: 0.6;
  margin: 0;
  line-height: 1.5;
}

.lobby-field-optional {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--silver);
  opacity: 0.5;
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
}

/* ── Lobby Room info boxes ───────────────────────────────── */
.lobby-info-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-md);
}

.lobby-info-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.lobby-info-box-label {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--silver);
  opacity: 0.55;
}

.lobby-info-box--code {
  align-items: flex-start;
  min-width: 130px;
}

.lobby-code-wrap {
  position: relative;
}

.lobby-code-wrap:hover .diff-tooltip {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.5s;
}

.lobby-info-box--notes {
  margin-top: 0;
}

.lobby-notes-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--silver);
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}

.lobby-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.lobby-link-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* ── Rules list in lobby room ────────────────────────────── */
.lobby-rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lobby-rules-list li {
  font-size: 0.88rem;
  color: var(--silver);
  font-family: var(--font-body);
  padding-left: var(--space-sm);
  border-left: 2px solid rgba(201,168,76,0.3);
  line-height: 1.4;
}

.lobby-rules-list li:first-child {
  color: var(--parchment);
  border-left-color: rgba(201,168,76,0.6);
}

/* ── Inline start confirmation overlay ───────────────────── */
.lobby-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8,6,18,0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  border-radius: inherit;
}

.lobby-confirm-box {
  background: var(--surface-2);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: var(--space-xl) var(--space-xl);
  max-width: 380px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  box-shadow: 0 0 40px rgba(201,168,76,0.15);
}

.lobby-confirm-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  margin: 0;
}

.lobby-confirm-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--silver);
  line-height: 1.6;
  margin: 0;
  text-align: center;
}

.lobby-confirm-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.lobby-confirm-actions .btn-primary {
  font-size: 0.85rem;
  padding: 0.6rem 1.8rem;
}

/* ── Mobile adjustments ──────────────────────────────────── */
@media (max-width: 600px) {
  .lobby-screen-content,
  .lobby-room-wrap {
    padding: var(--space-lg);
  }

  .lobby-info-row { grid-template-columns: 1fr; }

  .diff-tooltip {
    bottom: auto;
    top: calc(100% + 8px);
  }
}
