/* =========================================================
   1 LYRIC FAMILY — Theme Reveal Interactive Touchscreen UI
   Android 8 (Chromium 58+) & Modern Browser Compatible
   Zero reliance on inset, clamp(), min(), max(), aspect-ratio,
   flex gap, or CSS Grid for core layout.
   ========================================================= */

:root {
  --rv-bg-deep: #071918;
  --rv-surface: rgba(11, 34, 32, 0.88);
  --rv-surface-solid: #0c2624;
  --rv-surface-soft: rgba(19, 54, 50, 0.76);
  --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.3);
  --rv-border-strong: rgba(240, 225, 182, 0.65);
  --rv-font-display: "CinzelLocal", "Cinzel", "Trebuchet MS", Georgia, serif;
  --rv-font-body: "RobotoSlabLocal", "Segoe UI", Arial, 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;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
  background-color: #071918;
  color: #f9f4e7;
  font-family: "RobotoSlabLocal", "Segoe UI", Arial, sans-serif;
}

/* Atmospheric backdrop using configured theme background */
.rv-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  background-color: #071918;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  -webkit-filter: blur(16px) brightness(0.36) saturate(1.15);
  filter: blur(16px) brightness(0.36) saturate(1.15);
  -webkit-transform: scale(1.06);
  transform: scale(1.06);
}

.rv-backdrop-scrim {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 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%);
}

/* =========================================================
   SCREEN BASE
   ========================================================= */
.rv-screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-transition: opacity 0.45s ease;
  transition: opacity 0.45s ease;
}

.rv-screen.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================================
   SCREEN 2: ACTIVE PUZZLE WORKSPACE (Flexible No-Transform Layout)
   ========================================================= */
.rv-play {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
}

.rv-header {
  height: 68px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  padding: 0 116px 0 18px; /* clear top-right fullscreen + settings buttons */
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  background: rgba(7, 25, 24, 0.92);
  border-bottom: 1.5px solid rgba(240, 225, 182, 0.3);
  z-index: 100;
  -webkit-transition: opacity 0.45s ease;
  transition: opacity 0.45s ease;
}

@supports ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .rv-header {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.rv-header-left {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.rv-header-left > * + * {
  margin-left: 8px;
}

.rv-stepper {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.rv-stepper > * + * {
  margin-left: 6px;
}

.rv-step-pill {
  display: -webkit-inline-box;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(240, 225, 182, 0.2);
  color: #b6cfc5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.rv-step-pill .step-dot {
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border-radius: 50%;
  display: -webkit-inline-box;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  background: rgba(240, 225, 182, 0.16);
  color: #f0e1b6;
}

.rv-step-pill.is-active {
  background: linear-gradient(135deg, rgba(216, 133, 82, 0.3), rgba(47, 163, 138, 0.28));
  border-color: #f0e1b6;
  color: #fffaf0;
}

.rv-step-pill.is-active .step-dot {
  background: #d88552;
  color: #fff;
}

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

.rv-step-pill.is-done .step-dot {
  background: #2fa38a;
  color: #06211d;
}

.rv-header-center {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin: 0 12px;
  min-width: 0;
}

.rv-stage-heading {
  font-family: "CinzelLocal", "Trebuchet MS", Georgia, serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0e1b6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.rv-progress-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  width: 240px;
  max-width: 100%;
}

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

.rv-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2fa38a, #f0e1b6, #d88552);
  -webkit-transition: width 0.22s ease;
  transition: width 0.22s ease;
}

.rv-progress-text {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #f0e1b6;
  min-width: 52px;
  margin-left: 8px;
  text-align: right;
}

.rv-header-right {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
  justify-content: flex-end;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.rv-header-right > * + * {
  margin-left: 8px;
}

.rv-tool-btn {
  border: 1.5px solid rgba(240, 225, 182, 0.35);
  background: rgba(16, 46, 43, 0.88);
  color: #f0e1b6;
  padding: 8px 13px;
  border-radius: 10px;
  font-family: "RobotoSlabLocal", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  display: -webkit-inline-box;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-transition: background 0.16s ease, border-color 0.16s ease;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.rv-tool-btn:hover,
.rv-tool-btn:focus {
  background: rgba(47, 163, 138, 0.32);
  border-color: #f0e1b6;
}

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

.rv-tool-btn.is-active {
  background: #d88552;
  border-color: #f0e1b6;
  color: #fffaf0;
}

/* Main workspace: Flexbox Left Tray | Center Board | Right Tray */
.rv-workspace {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-height: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  align-items: stretch;
  padding: 16px 18px 18px 18px;
  overflow: hidden;
  -webkit-transition: opacity 0.4s ease;
  transition: opacity 0.4s ease;
}

.rv-workspace.is-transitioning {
  opacity: 0;
}

.rv-tray {
  position: relative;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 20%;
  flex: 0 0 20%;
  min-width: 170px;
  max-width: 390px;
  border-radius: 16px;
  background: rgba(9, 30, 29, 0.82);
  border: 1.5px solid rgba(240, 225, 182, 0.3);
  box-shadow: inset 0 2px 16px rgba(0, 0, 0, 0.34), 0 10px 26px rgba(0, 0, 0, 0.26);
  overflow: hidden;
  -webkit-transition: opacity 0.5s ease;
  transition: opacity 0.5s ease;
}

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

.rv-board-wrap {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  margin: 0 16px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  min-height: 0;
}

#rvBoard {
  position: relative;
  border-radius: 12px;
  background: rgba(8, 25, 24, 0.68);
  border: 2px solid rgba(240, 225, 182, 0.65);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(240, 225, 182, 0.14);
  overflow: visible;
  -webkit-transition: box-shadow 0.5s ease, -webkit-transform 0.5s ease, border-color 0.5s ease;
  transition: box-shadow 0.5s ease, transform 0.5s ease, border-color 0.5s ease;
}

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

#rvHintImg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  -webkit-transition: opacity 0.25s ease;
  transition: opacity 0.25s ease;
}

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

/* Jigsaw pieces */
.rv-piece {
  position: absolute;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -ms-touch-action: none;
  touch-action: none;
  z-index: 10;
  -webkit-filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.42));
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.42));
}

.rv-piece.dragging {
  cursor: grabbing;
  z-index: 2000 !important;
  -webkit-transform: scale(1.04);
  transform: scale(1.04);
  -webkit-filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.55));
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.55));
}

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

.rv-piece.just-snapped {
  -webkit-animation: piece-snap 0.38s ease;
  animation: piece-snap 0.38s ease;
}

@-webkit-keyframes piece-snap {
  0% { -webkit-transform: scale(1.06); transform: scale(1.06); }
  100% { -webkit-transform: scale(1); transform: scale(1); }
}
@keyframes piece-snap {
  0% { -webkit-transform: scale(1.06); transform: scale(1.06); }
  100% { -webkit-transform: scale(1); transform: scale(1); }
}

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

#rvBoard.is-merged {
  border-color: rgba(246, 207, 117, 0.95);
  box-shadow:
    0 0 38px rgba(246, 207, 117, 0.5),
    0 20px 56px rgba(0, 0, 0, 0.68);
  -webkit-transform: scale(1.035);
  transform: scale(1.035);
}

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

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

.rv-board-sweep {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 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.62) 52%,
    transparent 100%
  );
  -webkit-transform: skewX(-20deg);
  transform: skewX(-20deg);
  opacity: 0;
}

#rvBoard.is-sweeping .rv-board-sweep::before {
  -webkit-animation: rv-board-gold-sweep 1.3s ease forwards;
  animation: rv-board-gold-sweep 1.3s ease forwards;
}

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

.rv-play.is-stage-revealing .rv-tray {
  opacity: 0;
  pointer-events: none;
}

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

/* Stage Completion Banner + Next Chapter Button */
.rv-stage-reveal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3200;
  pointer-events: none;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 76px 24px 28px 24px;
  opacity: 0;
  -webkit-transition: opacity 0.5s ease;
  transition: opacity 0.5s ease;
}

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

.rv-stage-reveal-top {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 12px 34px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(4, 38, 39, 0.94) 0%, rgba(2, 24, 25, 0.96) 100%);
  border: 2px solid #E8BF70;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  -webkit-transform: translateY(-14px) scale(0.95);
  transform: translateY(-14px) scale(0.95);
  -webkit-transition: -webkit-transform 0.55s ease;
  transition: transform 0.55s ease;
  text-align: center;
}

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

.rv-stage-reveal-kicker {
  font-family: "CinzelLocal", Georgia, serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #F6CF75;
  margin-bottom: 4px;
}

.rv-stage-reveal-title {
  margin: 0;
  font-family: "RyeLocal", "CinzelLocal", Georgia, serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #FFF6DC;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.7);
}

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

.rv-stage-next-btn {
  -webkit-appearance: none;
  appearance: none;
  border: 2.5px solid #F6CF75;
  border-radius: 999px;
  padding: 15px 42px;
  background: linear-gradient(180deg, #F69D36 0%, #F28B24 46%, #C34C13 100%);
  color: #FFF7DE;
  font-family: "RyeLocal", "CinzelLocal", Georgia, serif;
  font-size: 20px;
  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 10px 28px rgba(0, 0, 0, 0.62);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  -webkit-transform: translateY(16px) scale(0.92);
  transform: translateY(16px) scale(0.92);
  -webkit-transition: opacity 0.45s ease, -webkit-transform 0.45s ease;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

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

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

/* =========================================================
   SCREEN 3: 10-SECOND LAYERED CINEMATIC GRAND REVEAL
   ========================================================= */
.rv-finale {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4000;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 14px;
  background-color: #002021;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(8, 123, 117, 0.34) 0%, rgba(0, 39, 40, 0.98) 68%);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-transition: opacity 0.85s ease;
  transition: opacity 0.85s ease;
}

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

/* Phase 0 (Paused until tapped): Interactive Grand Reveal Button */
.rv-finale-suspense {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4300;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  -webkit-transition: opacity 0.65s ease;
  transition: opacity 0.65s ease;
}

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

.rv-suspense-trigger {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  padding: 28px 44px;
  border-radius: 28px;
  cursor: pointer;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  outline: none;
  -webkit-transition: -webkit-transform 0.2s ease, opacity 0.2s ease;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.rv-suspense-trigger:hover,
.rv-suspense-trigger:focus {
  -webkit-transform: scale(1.04);
  transform: scale(1.04);
}

.rv-suspense-trigger:active,
.rv-suspense-trigger.is-pressed {
  -webkit-transform: scale(0.96);
  transform: scale(0.96);
}

.rv-suspense-ring {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2.5px solid rgba(232, 191, 112, 0.85);
  background: radial-gradient(circle at center, rgba(242, 183, 5, 0.16) 0%, rgba(8, 123, 117, 0.26) 58%, rgba(0, 32, 33, 0.65) 100%);
  box-shadow: 0 0 42px rgba(242, 183, 5, 0.48), inset 0 0 32px rgba(8, 123, 117, 0.52);
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-animation: rv-suspense-pulse 2s ease-in-out infinite;
  animation: rv-suspense-pulse 2s ease-in-out infinite;
}

.rv-suspense-star {
  font-size: 62px;
  line-height: 1;
  color: #FFE49E;
  text-shadow: 0 0 24px rgba(242, 183, 5, 0.85), 0 3px 10px rgba(0, 0, 0, 0.6);
}

@-webkit-keyframes rv-suspense-pulse {
  0%, 100% { -webkit-transform: scale(0.94); transform: scale(0.94); opacity: 0.82; }
  50% { -webkit-transform: scale(1.06); transform: scale(1.06); opacity: 1; }
}
@keyframes rv-suspense-pulse {
  0%, 100% { -webkit-transform: scale(0.94); transform: scale(0.94); opacity: 0.82; }
  50% { -webkit-transform: scale(1.06); transform: scale(1.06); opacity: 1; }
}

.rv-suspense-label {
  margin-top: 26px;
  padding: 16px 42px;
  border-radius: 999px;
  border: 2.5px solid #F6CF75;
  background: linear-gradient(180deg, #F69D36 0%, #E0781B 52%, #B94812 100%);
  font-family: "RyeLocal", "CinzelLocal", Georgia, serif;
  font-size: 28px;
  letter-spacing: 0.18em;
  color: #FFF9E6;
  text-shadow: 0 2px 8px rgba(56, 18, 2, 0.78);
  box-shadow:
    inset 0 2px 1px rgba(255, 244, 214, 0.52),
    inset 0 -3px 6px rgba(105, 32, 4, 0.5),
    0 0 32px rgba(242, 139, 36, 0.55),
    0 12px 30px rgba(0, 0, 0, 0.65);
}

.rv-suspense-cta {
  margin-top: 14px;
  font-family: "RobotoSlabLocal", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #F0E1B6;
  opacity: 0.88;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

/* Exact 16:9 layered stage (width & height set explicitly by viewport-manager.js) */
.rv-finale-stage {
  position: relative;
  width: 92%;
  height: 86%;
  max-width: 1760px;
  max-height: 990px;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid rgba(240, 225, 182, 0.75);
  background: #002728;
  opacity: 0;
  -webkit-transform: scale(0.92);
  transform: scale(0.92);
  -webkit-transition: opacity 1s ease, -webkit-transform 1.2s ease;
  transition: opacity 1s ease, transform 1.2s ease;
  box-shadow: 0 0 40px rgba(240, 225, 182, 0.38), 0 24px 72px rgba(0, 0, 0, 0.72);
}

.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;
  -webkit-transform: scale(1);
  transform: scale(1);
}

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

.rv-finale-backdrop {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  -webkit-transform: scale(1.06);
  transform: scale(1.06);
  -webkit-transition: opacity 1.1s ease, -webkit-transform 2s ease;
  transition: opacity 1.1s ease, transform 2s ease;
}

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

.rv-finale-sweep {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 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.56) 52%,
    transparent 100%
  );
  -webkit-transform: skewX(-18deg);
  transform: skewX(-18deg);
  opacity: 0;
}

.rv-finale.phase-1 .rv-finale-sweep::before {
  -webkit-animation: rv-board-gold-sweep 1.5s ease 0.25s forwards;
  animation: rv-board-gold-sweep 1.5s ease 0.25s forwards;
}

.rv-finale-title-glow {
  position: absolute;
  left: 50%;
  top: 31%;
  -webkit-transform: translate(-50%, -50%) scale(0.5);
  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.85) 0%, rgba(242, 183, 5, 0.4) 45%, transparent 72%);
  -webkit-filter: blur(20px);
  filter: blur(20px);
  opacity: 0;
  z-index: 8;
  pointer-events: none;
  -webkit-transition: opacity 0.85s ease, -webkit-transform 1s ease;
  transition: opacity 0.85s ease, transform 1s ease;
}

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

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

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

.rv-finale-title-logo {
  left: 51.5%;
  top: 13.5%;
  width: 40.5%;
  height: auto;
  -webkit-transform: translate(-50%, 16px) scale(0.76);
  transform: translate(-50%, 16px) scale(0.76);
  opacity: 0;
  z-index: 11;
  -webkit-transition: opacity 0.9s ease 0.25s, -webkit-transform 1.1s ease 0.25s;
  transition: opacity 0.9s ease 0.25s, transform 1.1s ease 0.25s;
}

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

.rv-finale-original {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  z-index: 15;
  -webkit-transition: opacity 0.9s ease;
  transition: opacity 0.9s 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;
  -webkit-transform: none;
  transform: none;
  -webkit-transition: none;
  transition: none;
}

.rv-finale-shimmer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 18;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  -webkit-transition: opacity 0.8s ease;
  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.26) 52%,
    transparent 100%
  );
  -webkit-transform: skewX(-18deg);
  transform: skewX(-18deg);
  -webkit-animation: grand-shimmer 5.5s ease-in-out infinite;
  animation: grand-shimmer 5.5s ease-in-out infinite;
}

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

/* Always-visible touchscreen-friendly finale controls (bottom-right) */
.rv-finale-controls {
  position: fixed;
  bottom: 18px;
  right: 20px;
  z-index: 4600;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  opacity: 1;
}

.rv-finale-controls > * + * {
  margin-left: 10px;
}

.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: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  -webkit-transition: -webkit-transform 0.16s ease, background 0.16s ease;
  transition: transform 0.16s ease, background 0.16s 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 20px rgba(0, 0, 0, 0.6);
}

.rv-finale-btn:hover,
.rv-finale-btn:focus {
  -webkit-transform: translateY(-1px) scale(1.03);
  transform: translateY(-1px) scale(1.03);
}

/* =========================================================
   RESPONSIVE BREAKPOINTS (1024x600 up to 3840x2160 & Portrait)
   ========================================================= */
@media (max-width: 1180px), (max-height: 680px) {
  .rv-header {
    height: 58px;
    padding: 0 106px 0 12px;
  }
  .rv-step-pill {
    padding: 5px 9px;
    font-size: 11px;
  }
  .rv-stage-heading {
    font-size: 14px;
  }
  .rv-progress-row {
    width: 175px;
  }
  .rv-tool-btn {
    padding: 7px 10px;
    font-size: 11px;
  }
  .rv-workspace {
    padding: 10px 12px 12px 12px;
  }
  .rv-tray {
    min-width: 152px;
  }
  .rv-board-wrap {
    margin: 0 10px;
  }
  .rv-stage-reveal {
    padding: 62px 16px 18px 16px;
  }
  .rv-stage-reveal-title {
    font-size: 24px;
  }
  .rv-stage-next-btn {
    padding: 11px 30px;
    font-size: 16px;
  }
  .rv-suspense-ring {
    width: 140px;
    height: 140px;
  }
  .rv-suspense-star {
    font-size: 48px;
  }
  .rv-suspense-label {
    margin-top: 20px;
    padding: 12px 32px;
    font-size: 22px;
  }
  .rv-top-actions {
    top: 10px;
    right: 12px;
  }
  .rv-icon-action {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 1060px) {
  .rv-stepper {
    display: none;
  }
}

/* Portrait layout fallback */
html.vp-portrait .rv-workspace {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
}

html.vp-portrait .rv-board-wrap {
  margin: 0 0 10px 0;
  -webkit-box-ordinal-group: 1;
  -webkit-order: 1;
  order: 1;
}

html.vp-portrait .rv-tray {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 18%;
  flex: 0 0 18%;
  min-width: 0;
  max-width: none;
  width: 100%;
  margin-bottom: 8px;
}

html.vp-portrait .rv-tray-left { -webkit-order: 2; order: 2; }
html.vp-portrait .rv-tray-right { -webkit-order: 3; order: 3; margin-bottom: 0; }

/* 4K / UHD crisp scaling */
@media (min-width: 2400px) {
  .rv-header {
    height: 86px;
    padding: 0 140px 0 28px;
  }
  .rv-stage-heading {
    font-size: 23px;
  }
  .rv-tool-btn {
    padding: 11px 18px;
    font-size: 16px;
  }
  .rv-step-pill {
    padding: 8px 16px;
    font-size: 15px;
  }
  .rv-progress-row {
    width: 320px;
  }
  .rv-tray {
    max-width: 560px;
  }
}

/* =========================================================
   LOW-SPEC COMPATIBILITY MODE (Play & Finale Screens)
   ========================================================= */
html.gfx-compatibility .rv-backdrop {
  -webkit-filter: brightness(0.32) !important;
  filter: brightness(0.32) !important;
  -webkit-transform: none !important;
  transform: none !important;
}

html.gfx-compatibility .rv-header,
html.gfx-compatibility .rv-tray,
html.gfx-compatibility .rv-finale-btn {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html.gfx-compatibility .rv-piece {
  -webkit-filter: none !important;
  filter: none !important;
}

html.gfx-compatibility .rv-piece.dragging {
  -webkit-filter: none !important;
  filter: none !important;
}

html.gfx-compatibility .rv-finale-title-glow {
  -webkit-filter: none !important;
  filter: none !important;
}

html.gfx-compatibility .rv-finale-shimmer,
html.gfx-compatibility .rv-finale-sweep {
  display: none !important;
}

html.gfx-compatibility .rv-suspense-ring {
  -webkit-animation: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .rv-finale-shimmer::before,
  .rv-suspense-ring {
    -webkit-animation: none !important;
    animation: none !important;
  }
}
