/* =========================================================
   1 LYRIC FAMILY — Theme Reveal Interactive Touchscreen UI
   Western Emerald, Warm Cream Gold & Terracotta Palette
   ========================================================= */

:root {
  --rv-bg-deep: #071918;
  --rv-surface: rgba(11, 34, 32, 0.84);
  --rv-surface-solid: #0c2624;
  --rv-surface-soft: rgba(19, 54, 50, 0.72);
  --rv-teal: #2fa38a;
  --rv-sage: #88beaa;
  --rv-cream: #f0e1b6;
  --rv-gold: #ffd166;
  --rv-copper: #d88552;
  --rv-copper-dark: #b96838;
  --rv-text: #f9f4e7;
  --rv-muted: #b6cfc5;
  --rv-border: rgba(240, 225, 182, 0.28);
  --rv-border-strong: rgba(240, 225, 182, 0.65);
  --rv-font-display: "Cinzel", "Orbitron", "Trebuchet MS", Georgia, serif;
  --rv-font-body: "Exo 2", "Segoe UI", system-ui, -apple-system, sans-serif;
  --rv-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  background-color: var(--rv-bg-deep);
  color: var(--rv-text);
  font-family: var(--rv-font-body);
}

/* Atmospheric backdrop using configured theme background */
.rv-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--rv-bg-deep);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(18px) brightness(0.36) saturate(1.15);
  transform: scale(1.08);
  transition: filter 0.7s var(--rv-ease), opacity 0.7s var(--rv-ease);
}

.rv-backdrop-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 35%, rgba(47, 163, 138, 0.22) 0%, rgba(7, 25, 24, 0.78) 72%),
    linear-gradient(180deg, rgba(7, 25, 24, 0.55) 0%, rgba(7, 25, 24, 0.85) 100%);
}

/* Discreet Settings trigger (top-right) */
.rv-settings-link {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(11, 34, 32, 0.65);
  border: 1px solid var(--rv-border);
  color: var(--rv-cream);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.45;
  backdrop-filter: blur(8px);
  transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.rv-settings-link:hover,
.rv-settings-link:focus-visible {
  opacity: 1;
  border-color: var(--rv-cream);
  transform: translateY(-1px);
}

.rv-settings-link svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* =========================================================
   SCREEN 1: ENTRY SCREEN ("PUZZLE 1 — ENTER")
   ========================================================= */
.rv-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition: opacity 0.5s var(--rv-ease), transform 0.55s var(--rv-ease);
}

.rv-screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.rv-entry {
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
}

.rv-entry-card {
  position: relative;
  width: min(92vw, 980px);
  padding: clamp(28px, 4.5vh, 52px) clamp(24px, 4.5vw, 56px);
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(16, 46, 43, 0.92), rgba(7, 25, 24, 0.94));
  border: 2px solid var(--rv-border-strong);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.55),
    inset 0 0 0 6px rgba(240, 225, 182, 0.06),
    0 0 60px rgba(47, 163, 138, 0.18);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 2.8vh, 28px);
}

/* Decorative western corner chevrons */
.rv-entry-card::before,
.rv-entry-card::after {
  content: "★";
  position: absolute;
  color: var(--rv-cream);
  font-size: 1.15rem;
  opacity: 0.75;
}
.rv-entry-card::before { top: 18px; left: 22px; }
.rv-entry-card::after { top: 18px; right: 22px; }

.rv-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(240, 225, 182, 0.12);
  border: 1px solid rgba(240, 225, 182, 0.35);
  color: var(--rv-cream);
  font-size: clamp(0.75rem, 1.15vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.rv-entry-title {
  font-family: var(--rv-font-display);
  font-size: clamp(2.1rem, 4.8vw, 3.8rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
  background: linear-gradient(180deg, #fff9ea 0%, #f0e1b6 58%, #d88552 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.45));
}

.rv-entry-sub {
  max-width: 660px;
  font-size: clamp(0.95rem, 1.45vw, 1.2rem);
  color: var(--rv-muted);
  line-height: 1.5;
}

/* 3-Stage Preview Cards */
.rv-stage-roadmap {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 20px);
  margin: 4px 0;
}

.rv-road-card {
  position: relative;
  padding: clamp(14px, 2vh, 22px) 16px;
  border-radius: 16px;
  background: rgba(8, 25, 24, 0.72);
  border: 1.5px solid rgba(240, 225, 182, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.25s var(--rv-ease), border-color 0.25s ease, box-shadow 0.25s ease;
}

.rv-road-card.is-unlocked {
  background: linear-gradient(180deg, rgba(47, 163, 138, 0.22), rgba(11, 34, 32, 0.88));
  border-color: var(--rv-cream);
  box-shadow: 0 10px 28px rgba(47, 163, 138, 0.22);
}

.rv-road-card.is-locked {
  opacity: 0.65;
}

.rv-road-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--rv-font-display);
  font-weight: 800;
  font-size: 1rem;
  background: rgba(240, 225, 182, 0.14);
  border: 1.5px solid var(--rv-border-strong);
  color: var(--rv-cream);
}

.rv-road-card.is-unlocked .rv-road-num {
  background: linear-gradient(135deg, var(--rv-copper), var(--rv-gold));
  color: #121a19;
  border-color: #fff6dc;
}

.rv-road-title {
  font-family: var(--rv-font-display);
  font-size: clamp(0.9rem, 1.3vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--rv-text);
}

.rv-road-desc {
  font-size: clamp(0.75rem, 1vw, 0.88rem);
  color: var(--rv-muted);
}

.rv-road-badge {
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.rv-road-card.is-unlocked .rv-road-badge {
  background: rgba(47, 163, 138, 0.3);
  color: #a7f3d0;
  border: 1px solid rgba(167, 243, 208, 0.45);
}

.rv-road-card.is-locked .rv-road-badge {
  background: rgba(255, 255, 255, 0.06);
  color: var(--rv-muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Primary Enter Button (Touch-friendly giant target) */
.rv-enter-btn {
  position: relative;
  overflow: hidden;
  border: 2px solid #fff3d1;
  border-radius: 999px;
  padding: clamp(16px, 2.2vh, 22px) clamp(38px, 5vw, 68px);
  background: linear-gradient(135deg, #e08d57 0%, #c86f3b 52%, #b15928 100%);
  color: #fffaf0;
  font-family: var(--rv-font-display);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  box-shadow:
    0 14px 36px rgba(216, 133, 82, 0.42),
    0 0 0 6px rgba(240, 225, 182, 0.12);
  transition: transform 0.2s var(--rv-ease), box-shadow 0.2s ease, filter 0.2s ease;
}

.rv-enter-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 250, 232, 0.38), transparent);
  animation: btn-sheen 3.2s ease-in-out infinite;
}

@keyframes btn-sheen {
  0%, 60% { left: -120%; }
  100% { left: 160%; }
}

.rv-enter-btn:hover,
.rv-enter-btn:focus-visible {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 18px 46px rgba(216, 133, 82, 0.56),
    0 0 0 8px rgba(240, 225, 182, 0.2);
}

.rv-enter-btn:active {
  transform: scale(0.98);
}

.rv-entry-hint {
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(240, 225, 182, 0.65);
}

/* =========================================================
   SCREEN 2: ACTIVE PUZZLE WORKSPACE
   ========================================================= */
.rv-play {
  display: flex;
  flex-direction: column;
}

.rv-header {
  height: 74px;
  flex-shrink: 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  background: rgba(7, 25, 24, 0.88);
  border-bottom: 1.5px solid var(--rv-border);
  backdrop-filter: blur(12px);
  z-index: 100;
  transition: opacity 0.5s ease, transform 0.5s var(--rv-ease);
}

.rv-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rv-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rv-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(240, 225, 182, 0.18);
  color: var(--rv-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: all 0.3s var(--rv-ease);
}

.rv-step-pill .step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(240, 225, 182, 0.14);
  color: var(--rv-cream);
}

.rv-step-pill.is-active {
  background: linear-gradient(135deg, rgba(216, 133, 82, 0.28), rgba(47, 163, 138, 0.25));
  border-color: var(--rv-cream);
  color: #fffaf0;
  box-shadow: 0 0 18px rgba(240, 225, 182, 0.2);
}

.rv-step-pill.is-active .step-dot {
  background: var(--rv-copper);
  color: #fff;
}

.rv-step-pill.is-done {
  background: rgba(47, 163, 138, 0.25);
  border-color: rgba(167, 243, 208, 0.55);
  color: #d1fae5;
}

.rv-step-pill.is-done .step-dot {
  background: var(--rv-teal);
  color: #06211d;
}

.rv-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rv-stage-heading {
  font-family: var(--rv-font-display);
  font-size: clamp(0.95rem, 1.5vw, 1.25rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rv-cream);
}

.rv-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(260px, 28vw);
}

.rv-progress-track {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(240, 225, 182, 0.14);
  overflow: hidden;
  border: 1px solid rgba(240, 225, 182, 0.2);
}

.rv-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rv-teal), var(--rv-cream), var(--rv-copper));
  transition: width 0.22s var(--rv-ease);
}

.rv-progress-text {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--rv-cream);
  min-width: 58px;
  text-align: right;
}

.rv-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-right: 126px; /* clear discreet settings link */
}

.rv-tool-btn {
  border: 1.5px solid var(--rv-border);
  background: rgba(16, 46, 43, 0.8);
  color: var(--rv-cream);
  padding: 9px 14px;
  border-radius: 10px;
  font-family: var(--rv-font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.rv-tool-btn:hover,
.rv-tool-btn:focus-visible {
  background: rgba(47, 163, 138, 0.3);
  border-color: var(--rv-cream);
}

#rvHomeBtn {
  border-color: #F6CF75;
  background: linear-gradient(180deg, rgba(242, 139, 36, 0.92) 0%, rgba(195, 76, 19, 0.95) 100%);
  color: #FFFBF0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(242, 139, 36, 0.32);
}

#rvHomeBtn:hover,
#rvHomeBtn:focus-visible {
  filter: brightness(1.08);
  border-color: #FFF6DC;
  transform: translateY(-1px);
}

.rv-tool-btn.is-active {
  background: var(--rv-copper);
  border-color: var(--rv-cream);
  color: #fffaf0;
}

/* Main workspace: Left Tray | Center Board | Right Tray */
.rv-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(185px, 21vw) minmax(0, 1fr) minmax(185px, 21vw);
  grid-template-areas: "tray-l board tray-r";
  gap: 18px;
  padding: 18px 22px 22px;
  align-items: stretch;
  transition: opacity 0.45s var(--rv-ease), transform 0.45s var(--rv-ease);
}

.rv-workspace.is-transitioning {
  opacity: 0;
  transform: scale(0.96);
}

.rv-tray {
  position: relative;
  border-radius: 18px;
  background: rgba(9, 30, 29, 0.74);
  border: 1.5px solid var(--rv-border);
  box-shadow:
    inset 0 2px 18px rgba(0, 0, 0, 0.32),
    0 12px 32px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: opacity 0.55s var(--rv-ease), transform 0.55s var(--rv-ease);
}

.rv-tray-left { grid-area: tray-l; }
.rv-tray-right { grid-area: tray-r; }

.rv-tray-box {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.rv-board-wrap {
  grid-area: board;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  min-height: 0;
}

#rvBoard {
  position: relative;
  border-radius: 12px;
  background: rgba(8, 25, 24, 0.62);
  border: 2px solid var(--rv-border-strong);
  box-shadow:
    0 20px 56px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(240, 225, 182, 0.14);
  overflow: visible;
  transition: box-shadow 0.55s var(--rv-ease), transform 0.55s var(--rv-ease), border-color 0.55s ease;
}

#rvBoard.is-solved {
  border-color: var(--rv-gold);
  box-shadow:
    0 0 42px rgba(255, 209, 102, 0.52),
    0 0 90px rgba(47, 163, 138, 0.42),
    0 24px 64px rgba(0, 0, 0, 0.55);
  transform: scale(1.018);
}

#rvGuide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.45s ease;
}

#rvBoard.is-solved #rvGuide {
  opacity: 0;
}

#rvHintImg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.28s ease;
}

#rvBoard.show-hint #rvHintImg {
  opacity: 0.42;
}

#rvBoard.is-solved #rvHintImg {
  opacity: 0;
}

/* Jigsaw pieces */
.rv-piece {
  position: absolute;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.42));
  transition: transform 0.14s var(--rv-ease), filter 0.14s ease;
  will-change: left, top, transform;
}

.rv-piece.dragging {
  cursor: grabbing;
  transition: none;
  z-index: 2000 !important;
  transform: scale(1.045);
  filter:
    drop-shadow(0 14px 22px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 12px rgba(240, 225, 182, 0.4));
}

.rv-piece.locked {
  cursor: default;
  pointer-events: none;
  z-index: 2;
  filter: none;
  transition: none;
}

.rv-piece.just-snapped {
  animation: piece-snap 0.42s var(--rv-ease);
}

@keyframes piece-snap {
  0% {
    transform: scale(1.07);
    filter: drop-shadow(0 0 18px rgba(255, 209, 102, 0.95));
  }
  100% {
    transform: scale(1);
    filter: none;
  }
}

/* =========================================================
   STAGE UNLOCK TRANSITION OVERLAY (Puzzle 1 -> 2 -> 3)
   ========================================================= */
.rv-unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 18, 17, 0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--rv-ease);
}

.rv-unlock-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.rv-unlock-card {
  width: min(90vw, 620px);
  padding: 36px 34px;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(16, 48, 44, 0.96), rgba(7, 24, 23, 0.98));
  border: 2px solid var(--rv-gold);
  box-shadow:
    0 24px 72px rgba(0, 0, 0, 0.6),
    0 0 55px rgba(255, 209, 102, 0.24);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: translateY(20px) scale(0.94);
  transition: transform 0.45s var(--rv-ease);
}

.rv-unlock-overlay.is-visible .rv-unlock-card {
  transform: translateY(0) scale(1);
}

.rv-unlock-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--rv-gold), var(--rv-copper));
  color: #0d1d1c;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 0 30px rgba(255, 209, 102, 0.55);
  animation: unlock-pop 0.55s var(--rv-ease);
}

@keyframes unlock-pop {
  0% { transform: scale(0.4) rotate(-18deg); }
  70% { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

.rv-unlock-kicker {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rv-gold);
}

.rv-unlock-title {
  font-family: var(--rv-font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fffaf0;
}

.rv-unlock-sub {
  font-size: 1rem;
  color: var(--rv-muted);
}

.rv-unlock-bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(240, 225, 182, 0.16);
  overflow: hidden;
  margin-top: 4px;
}

.rv-unlock-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rv-teal), var(--rv-gold), var(--rv-copper));
}

.rv-unlock-btn {
  margin-top: 6px;
  border: 1.5px solid #fff3d1;
  border-radius: 999px;
  padding: 13px 34px;
  background: linear-gradient(135deg, var(--rv-copper), var(--rv-copper-dark));
  color: #fffaf0;
  font-family: var(--rv-font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(216, 133, 82, 0.4);
  transition: transform 0.18s ease;
}

.rv-unlock-btn:hover {
  transform: scale(1.04);
}

/* =========================================================
   SEAMLESS PIECE MERGE + STAGE COMPLETION CEREMONY
   ========================================================= */
.rv-board-merged {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.65s ease;
}

#rvBoard.is-merged {
  border-color: rgba(246, 207, 117, 0.95);
  box-shadow:
    0 0 42px rgba(246, 207, 117, 0.52),
    0 0 90px rgba(8, 123, 117, 0.45),
    0 24px 64px rgba(0, 0, 0, 0.72);
  transform: scale(1.045);
  transition: transform 1.1s var(--rv-ease), box-shadow 0.8s ease, border-color 0.6s ease;
}

#rvBoard.is-merged .rv-board-merged {
  opacity: 1;
}

#rvBoard.is-merged #rvGuide,
#rvBoard.is-merged .rv-piece {
  opacity: 0;
  transition: opacity 0.55s ease;
}

.rv-board-sweep {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  z-index: 35;
}

.rv-board-sweep::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -80%;
  width: 44%;
  height: 140%;
  background: linear-gradient(
    108deg,
    transparent 0%,
    rgba(255, 248, 225, 0.42) 46%,
    rgba(255, 214, 102, 0.65) 52%,
    transparent 100%
  );
  transform: skewX(-20deg);
  opacity: 0;
}

#rvBoard.is-sweeping .rv-board-sweep::before {
  animation: rv-board-gold-sweep 1.35s var(--rv-ease) forwards;
}

@keyframes rv-board-gold-sweep {
  0% { left: -75%; opacity: 0; }
  18% { opacity: 1; }
  85% { opacity: 0.95; }
  100% { left: 145%; opacity: 0; }
}

/* Fade out header & side trays cleanly during stage reveal / finale prep */
.rv-play.is-stage-revealing .rv-tray {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.rv-play.is-finale-prep .rv-header,
.rv-play.is-finale-prep .rv-tray {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

/* Stage Completion Reveal Banner + Unlock Next Chapter Button */
.rv-stage-reveal {
  position: fixed;
  inset: 0;
  z-index: 3200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(66px, 8.6vh, 96px) 24px clamp(26px, 4vh, 46px);
  opacity: 0;
  transition: opacity 0.55s var(--rv-ease);
}

.rv-stage-reveal.is-visible {
  opacity: 1;
}

.rv-stage-reveal-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(10px, 1.4vh, 16px) clamp(26px, 3vw, 48px);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(4, 38, 39, 0.92) 0%, rgba(2, 24, 25, 0.94) 100%);
  border: 2px solid #E8BF70;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.62), 0 0 28px rgba(242, 183, 5, 0.34);
  transform: translateY(-16px) scale(0.94);
  transition: transform 0.6s var(--rv-ease);
  text-align: center;
}

.rv-stage-reveal.is-visible .rv-stage-reveal-top {
  transform: translateY(0) scale(1);
}

.rv-stage-reveal-kicker {
  font-family: var(--rv-font-display);
  font-size: clamp(0.82rem, 1.1vw, 1.05rem);
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #F6CF75;
}

.rv-stage-reveal-title {
  margin: 0;
  font-family: "RyeLocal", var(--rv-font-display), Georgia, serif;
  font-size: clamp(1.45rem, 2.5vw, 2.45rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #FFF6DC;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.7), 0 0 22px rgba(242, 183, 5, 0.35);
}

.rv-stage-reveal-bottom {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rv-stage-next-btn {
  appearance: none;
  border: 2.5px solid #F6CF75;
  border-radius: 999px;
  padding: clamp(13px, 1.5vh, 18px) clamp(32px, 3.6vw, 56px);
  background: linear-gradient(180deg, #F69D36 0%, #F28B24 46%, #C34C13 100%);
  color: #FFF7DE;
  font-family: "RyeLocal", var(--rv-font-display), Georgia, serif;
  font-size: clamp(1rem, 1.45vw, 1.38rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(56, 18, 2, 0.72);
  box-shadow:
    inset 0 2px 1px rgba(255, 244, 214, 0.52),
    inset 0 -3px 6px rgba(105, 32, 4, 0.5),
    0 12px 34px rgba(0, 0, 0, 0.65),
    0 0 32px rgba(242, 139, 36, 0.62);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.9);
  transition: opacity 0.5s var(--rv-ease), transform 0.5s var(--rv-ease), filter 0.16s ease;
}

.rv-stage-next-btn.is-ready {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.rv-stage-next-btn.is-ready:hover {
  filter: brightness(1.08);
  transform: translateY(-2px) scale(1.03);
}

.rv-stage-next-btn.is-ready:active,
.rv-stage-next-btn.is-ready.is-pressed {
  transform: translateY(1px) scale(0.97);
}

/* =========================================================
   SCREEN 3: 10-SECOND LAYERED CINEMATIC GRAND REVEAL
   ========================================================= */
.rv-finale {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.8vh, 22px);
  background:
    radial-gradient(circle at 50% 50%, rgba(8, 123, 117, 0.34) 0%, rgba(0, 39, 40, 0.98) 68%),
    #002021;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s var(--rv-ease);
}

.rv-finale.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Phase 0 (0-2s): Suspense ring & banner */
.rv-finale-suspense {
  position: fixed;
  inset: 0;
  z-index: 4300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.75s var(--rv-ease);
}

.rv-finale.phase-0 .rv-finale-suspense {
  opacity: 1;
}

.rv-suspense-ring {
  width: clamp(150px, 20vh, 220px);
  height: clamp(150px, 20vh, 220px);
  border-radius: 50%;
  border: 2.5px solid rgba(232, 191, 112, 0.7);
  box-shadow: 0 0 48px rgba(242, 183, 5, 0.45), inset 0 0 36px rgba(8, 123, 117, 0.5);
  animation: rv-suspense-pulse 2s ease-in-out infinite;
}

@keyframes rv-suspense-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.72; }
  50% { transform: scale(1.08); opacity: 1; }
}

.rv-suspense-label {
  margin-top: 22px;
  font-family: "RyeLocal", var(--rv-font-display), Georgia, serif;
  font-size: clamp(1.3rem, 2.2vw, 2.1rem);
  letter-spacing: 0.24em;
  color: #FFF2C8;
  text-shadow: 0 0 24px rgba(242, 183, 5, 0.75);
}

/* Exact 16:9 layered cinematic reveal stage */
.rv-finale-stage {
  position: relative;
  width: min(96vw, calc(94vh * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 2.5px solid rgba(240, 225, 182, 0.75);
  background: #002728;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 1.1s var(--rv-ease), transform 1.4s var(--rv-ease);
  animation: grand-aura 4.2s ease-in-out infinite;
}

.rv-finale.phase-1 .rv-finale-stage,
.rv-finale.phase-2 .rv-finale-stage,
.rv-finale.phase-3 .rv-finale-stage,
.rv-finale.phase-4 .rv-finale-stage {
  opacity: 1;
  transform: scale(1);
}

.rv-finale-layer {
  position: absolute;
  pointer-events: none;
  user-select: none;
}

/* Phase 1 (2-4s): Western theme backdrop with cinematic zoom */
.rv-finale-backdrop {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 1.2s ease, transform 2.2s var(--rv-ease);
}

.rv-finale.phase-1 .rv-finale-backdrop,
.rv-finale.phase-2 .rv-finale-backdrop,
.rv-finale.phase-3 .rv-finale-backdrop {
  opacity: 1;
  transform: scale(1);
}

/* Golden light sweep during Phase 1 */
.rv-finale-sweep {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}

.rv-finale-sweep::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -80%;
  width: 45%;
  height: 140%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 248, 225, 0.36) 47%,
    rgba(255, 209, 102, 0.58) 52%,
    transparent 100%
  );
  transform: skewX(-18deg);
  opacity: 0;
}

.rv-finale.phase-1 .rv-finale-sweep::before {
  animation: rv-board-gold-sweep 1.6s var(--rv-ease) 0.25s forwards;
}

/* Phase 2 (4-6s): Radiant golden glow + Corporate Logo + Event Title animating into original position */
.rv-finale-title-glow {
  position: absolute;
  left: 50%;
  top: 31%;
  transform: translate(-50%, -50%) scale(0.5);
  width: 52%;
  height: 48%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 232, 145, 0.88) 0%, rgba(242, 183, 5, 0.42) 45%, transparent 72%);
  filter: blur(22px);
  opacity: 0;
  z-index: 8;
  pointer-events: none;
  transition: opacity 0.9s ease, transform 1.1s var(--rv-ease);
}

.rv-finale.phase-2 .rv-finale-title-glow,
.rv-finale.phase-3 .rv-finale-title-glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.06);
}

.rv-finale-corp-logo {
  left: 52.5%;
  top: 4.5%;
  width: 14.5%;
  height: auto;
  transform: translate(-50%, -18px) scale(0.86);
  opacity: 0;
  z-index: 10;
  transition: opacity 0.85s var(--rv-ease), transform 0.95s var(--rv-ease);
}

.rv-finale.phase-2 .rv-finale-corp-logo,
.rv-finale.phase-3 .rv-finale-corp-logo {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.rv-finale-title-logo {
  left: 51.5%;
  top: 13.5%;
  width: 40.5%;
  height: auto;
  transform: translate(-50%, 16px) scale(0.76);
  opacity: 0;
  z-index: 11;
  filter: drop-shadow(0 10px 28px rgba(0, 38, 39, 0.45));
  transition: opacity 0.95s var(--rv-ease) 0.28s, transform 1.15s var(--rv-ease) 0.28s;
}

.rv-finale.phase-2 .rv-finale-title-logo,
.rv-finale.phase-3 .rv-finale-title-logo {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* Phase 3 (6-10s+): Complete Unmodified Original Client Artwork crossfades in seamlessly */
.rv-finale-original {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  z-index: 15;
  transition: opacity 0.95s ease;
}

.rv-finale.phase-3 .rv-finale-original,
.rv-finale.phase-4 .rv-finale-original {
  opacity: 1;
}

.rv-finale.no-cinematic .rv-finale-stage,
.rv-finale.no-cinematic .rv-finale-original {
  opacity: 1;
  transform: none;
  transition: none;
}

@keyframes grand-aura {
  0%, 100% {
    box-shadow:
      0 0 36px rgba(240, 225, 182, 0.38),
      0 0 90px rgba(47, 163, 138, 0.34),
      0 26px 80px rgba(0, 0, 0, 0.7);
  }
  50% {
    box-shadow:
      0 0 64px rgba(255, 209, 102, 0.65),
      0 0 135px rgba(216, 133, 82, 0.42),
      0 30px 95px rgba(0, 0, 0, 0.75);
  }
}

.rv-finale-shimmer {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.rv-finale.phase-3 .rv-finale-shimmer,
.rv-finale.phase-4 .rv-finale-shimmer {
  opacity: 1;
}

.rv-finale-shimmer::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -90%;
  width: 48%;
  height: 140%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 248, 225, 0.18) 48%,
    rgba(255, 209, 102, 0.28) 52%,
    transparent 100%
  );
  transform: skewX(-18deg);
  animation: grand-shimmer 5.5s ease-in-out infinite;
}

@keyframes grand-shimmer {
  0%, 45% { left: -90%; opacity: 0; }
  55% { opacity: 1; }
  100% { left: 150%; opacity: 0; }
}

/* Visible touchscreen-friendly finale controls (bottom-right) */
.rv-finale-controls {
  position: fixed;
  bottom: 20px;
  right: 22px;
  z-index: 4600;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.rv-finale-btn {
  border: 2px solid #F6CF75;
  background: linear-gradient(180deg, rgba(10, 56, 54, 0.94) 0%, rgba(4, 30, 29, 0.96) 100%);
  color: #FFF7DF;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55), 0 0 14px rgba(246, 207, 117, 0.28);
  transition: transform 0.16s ease, background 0.18s ease, box-shadow 0.18s ease;
}

#rvFinaleHomeBtn {
  background: linear-gradient(180deg, #F69D36 0%, #E0781B 55%, #B94812 100%);
  border-color: #FFF0C5;
  color: #FFFBF0;
  text-shadow: 0 1px 3px rgba(56, 18, 2, 0.65);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6), 0 0 18px rgba(242, 139, 36, 0.52);
}

.rv-finale-btn:hover,
.rv-finale-btn:focus-visible {
  background: var(--rv-copper);
  color: #fff;
  transform: translateY(-1px) scale(1.03);
}

#rvFinaleHomeBtn:hover,
#rvFinaleHomeBtn:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px) scale(1.04);
}

/* =========================================================
   RESPONSIVE (Portrait / Smaller Tablets)
   ========================================================= */
@media (max-width: 1120px), (orientation: portrait) {
  .rv-header {
    height: auto;
    padding: 10px 14px;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .rv-header-left,
  .rv-header-center,
  .rv-header-right {
    justify-content: center;
    padding-right: 0;
  }
  .rv-stepper {
    flex-wrap: wrap;
    justify-content: center;
  }
  .rv-workspace {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(130px, 26vh);
    grid-template-areas:
      "board board"
      "tray-l tray-r";
    padding: 10px 12px 14px;
    gap: 10px;
  }
  .rv-stage-roadmap {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-enter-btn::after,
  .rv-finale-shimmer::before,
  .rv-finale-frame {
    animation: none !important;
  }
}
