/* ═══════════════════════════════════════════════════════
   CRYPTEX — Da Vinci Code Glassmorphism Theme
   Viewport-based: 6 visible columns, 15-letter rings slide behind
   ═══════════════════════════════════════════════════════ */

/* Fonts loaded via <link> in index.html — no @import needed */

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  /* Da Vinci palette */
  --parchment: #1a1611;
  --parchment-light: #2a2218;
  --parchment-warm: #332a1e;
  --ink: #e8dcc8;
  --ink-dim: #a89878;
  --ink-faint: #6b5d4a;

  /* Gold */
  --gold: #d4a547;
  --gold-light: #f0d9a8;
  --gold-dark: #8b6914;
  --gold-glow: rgba(212, 165, 71, 0.3);

  /* Accent */
  --emerald: #2d6b4f;
  --emerald-glow: rgba(45, 107, 79, 0.3);

  /* Glass */
  --glass-bg: rgba(26, 22, 17, 0.7);
  --glass-border: rgba(212, 165, 71, 0.2);
  --glass-blur: 16px;
  --glass-bg-light: rgba(42, 34, 24, 0.6);

  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;

  /* Cell sizing — 6 cells fit in ~312px viewport */
  --cell-w: 52px;
  --cell-h: 56px;
  --viewport-w: calc(var(--cell-w) * 6); /* 312px */
}

/* ─── RESETS ─────────────────────────────────────────── */

* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0a0806;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--ink);
}

#game-scaler {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

#game-root {
  width: 390px; height: 844px;
  position: relative; overflow: hidden;
  background: var(--parchment);
}

#game-root::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(212, 165, 71, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(45, 107, 79, 0.04) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

#game-root::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%);
  pointer-events: none; z-index: 0;
}

/* ═══════════════════════════════════════════════════════
   TITLE SCREEN
   ═══════════════════════════════════════════════════════ */

.title-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: calc(var(--sat) + 16px) 24px calc(var(--sab) + 16px);
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.title-content {
  flex-shrink: 0;
}

.title-bg-ornament {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(212,165,71,0.02) 40px, rgba(212,165,71,0.02) 41px),
    repeating-linear-gradient(-45deg, transparent, transparent 40px, rgba(212,165,71,0.02) 40px, rgba(212,165,71,0.02) 41px);
  pointer-events: none;
}

.title-content {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px; z-index: 1;
  flex-shrink: 0;
}

.title-seal { width: 100px; height: 100px; animation: sealPulse 4s ease-in-out infinite; }

.seal-svg { width: 100%; height: 100%; filter: drop-shadow(0 0 20px var(--gold-glow)); }

@keyframes sealPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.9; }
}

.title-text {
  font-family: 'Cinzel', serif; font-size: 48px; font-weight: 700;
  letter-spacing: 12px; color: var(--gold-light);
  text-shadow: 0 0 40px var(--gold-glow), 0 2px 4px rgba(0,0,0,0.5);
}

.title-subtitle {
  font-family: 'Cormorant Garamond', serif; font-size: 16px;
  font-style: italic; color: var(--ink-dim); letter-spacing: 3px; margin-top: -8px;
}

.difficulty-select { display: flex; gap: 10px; margin-top: 16px; }

.diff-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 18px; border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--ink-dim); cursor: pointer; transition: var(--transition); min-width: 90px;
}

.diff-btn.active {
  border-color: var(--gold); background: rgba(212,165,71,0.12); color: var(--gold-light);
  box-shadow: 0 0 20px var(--gold-glow), inset 0 0 20px rgba(212,165,71,0.05);
}

.diff-btn:active { transform: scale(0.96); }

.diff-label { font-family: 'Cinzel', serif; font-size: 14px; font-weight: 600; }

.diff-detail { font-size: 11px; opacity: 0.6; }

.diff-reward-line {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: 'Cinzel', serif; font-size: 14px; font-weight: 600;
  color: var(--gold-light); letter-spacing: 1px;
  margin-top: 4px;
}

.diff-reward-line .token-icon {
  width: 16px; height: 16px;
}

.start-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 36px; margin-top: 12px;
  border: 1px solid var(--gold); border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(212,165,71,0.15) 0%, rgba(139,105,20,0.1) 100%);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--gold-light); cursor: pointer; transition: var(--transition);
  box-shadow: 0 0 30px var(--gold-glow), inset 0 1px 0 rgba(240,217,168,0.1);
}

.start-btn:active { transform: scale(0.97); box-shadow: 0 0 15px var(--gold-glow); }

.start-btn-text { font-family: 'Cinzel', serif; font-size: 16px; font-weight: 600; letter-spacing: 2px; }

.start-btn-arrow { font-size: 18px; opacity: 0.7; }

.title-hint { font-size: 13px; color: var(--ink-faint); font-style: italic; margin-top: 8px; }

.exit-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 24px; margin-top: 8px;
  border: 1px solid var(--ink-faint); border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--ink-dim); cursor: pointer; transition: var(--transition);
}

.exit-btn:active { transform: scale(0.97); opacity: 0.7; }

.exit-btn-text { font-family: 'Cinzel', serif; font-size: 13px; font-weight: 500; letter-spacing: 1px; }

/* ═══════════════════════════════════════════════════════
   GAME SCREEN
   ═══════════════════════════════════════════════════════ */

.game-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  justify-content: center;
  padding-top: var(--sat); padding-bottom: var(--sab);
  z-index: 1;
}

.game-header {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center;
  padding: calc(var(--sat) + 12px) 16px 12px; gap: 12px;
  z-index: 5;
}

.back-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--glass-border); border-radius: 50%;
  background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--ink-dim); cursor: pointer; transition: var(--transition);
}

.back-btn:active { transform: scale(0.9); background: var(--glass-bg-light); }

.vol-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--glass-border); border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--ink-dim); cursor: pointer; transition: var(--transition);
}

.vol-btn:active { transform: scale(0.9); background: var(--glass-bg-light); }

.word-counter {
  flex: 1; display: flex; align-items: baseline;
  gap: 3px; justify-content: center;
}

.counter-found {
  font-family: 'Cinzel', serif; font-size: 28px; font-weight: 700;
  color: var(--gold-light); text-shadow: 0 0 20px var(--gold-glow);
}

.counter-sep { font-size: 20px; color: var(--ink-faint); margin: 0 1px; }

.counter-total { font-family: 'Cinzel', serif; font-size: 20px; color: var(--ink-dim); }

.counter-label { font-size: 12px; color: var(--ink-faint); font-style: italic; margin-left: 6px; }

.move-counter { display: flex; flex-direction: column; align-items: center; min-width: 44px; }

.moves-num {
  font-family: 'Cinzel', serif; font-size: 22px; font-weight: 700;
  color: var(--ink);
  transition: color 0.3s, text-shadow 0.3s;
}

.moves-label { font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 1px; }

/* Round indicator dots */

.round-indicator {
  display: flex; gap: 6px; align-items: center;
}

.round-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid var(--ink-faint);
  background: transparent;
  transition: var(--transition);
}

.round-dot.active {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
}

.round-dot.done {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
}

/* Theme banner */

.theme-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 6px 16px;
}

.theme-round {
  font-family: 'Cinzel', serif; font-size: 11px;
  color: var(--ink-faint); text-transform: uppercase;
  letter-spacing: 2px;
}

.theme-name {
  font-family: 'Cinzel', serif; font-size: 16px;
  font-weight: 600; color: var(--gold-light);
  letter-spacing: 3px;
  text-shadow: 0 0 12px var(--gold-glow);
}

/* Low moves warning */

.move-counter.low .moves-num {
  color: #e0a030;
  text-shadow: 0 0 10px rgba(224, 160, 48, 0.4);
}

.move-counter.danger .moves-num {
  color: #c44;
  text-shadow: 0 0 15px rgba(204, 68, 68, 0.5);
  animation: dangerPulse 0.8s ease-in-out infinite;
}

@keyframes dangerPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

/* ─── CRYPTEX DEVICE ─────────────────────────────────── */

.cryptex-body {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 12px 12px 8px;
}

.cryptex-device {
  position: relative;
  width: var(--viewport-w);
  display: flex; flex-direction: column;
}

/* The gold viewport frame — sits on top of the rings */

.viewport-frame {
  position: absolute;
  top: -6px; bottom: -6px;
  left: -8px; right: -8px;
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  pointer-events: none;
  z-index: 10;
  box-shadow:
    0 0 30px var(--gold-glow),
    inset 0 0 30px rgba(212,165,71,0.05);
}

.frame-corner {
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--gold-light);
  border-style: solid;
}

.frame-corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }

.frame-corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }

.frame-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }

.frame-corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

/* Shadow overlays that fade out the ring edges beyond viewport */

.viewport-overlay {
  display: none; /* rings are clipped, no need for fade overlays */
}

.rings-container {
  display: flex; flex-direction: column;
  gap: 2px;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(0,0,0,0.3);
}

/* ─── RING ───────────────────────────────────────────── */

.ring {
  display: flex; align-items: center;
  position: relative;
  height: var(--cell-h);
  overflow: hidden;
}

/* Row numbers (positioned absolutely to the left of the cryptex) */

.cryptex-row-wrap {
  position: relative;
}

.row-numbers {
  position: absolute;
  top: 0; bottom: 0;
  right: 100%;
  display: flex; flex-direction: column;
  gap: 2px;
  /* center between viewport left edge and cryptex left edge */
  /* viewport is 390px, cryptex is ~312px, gap is ~39px per side */
  /* place numbers in the middle of that gap */
  transform: translateX(-50%);
  margin-right: 19px;
}

.row-num {
  height: var(--cell-h);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-dim);
}

.col-spacer { display: none; }

.ring-edge {
  position: absolute;
  top: 0; bottom: 0;
  width: 6px;
  z-index: 5;
  pointer-events: none;
}

.ring-edge.left {
  left: 0;
  background: linear-gradient(90deg, var(--gold-dark) 0%, var(--gold) 40%, transparent 100%);
}

.ring-edge.right {
  right: 0;
  background: linear-gradient(-90deg, var(--gold-dark) 0%, var(--gold) 40%, transparent 100%);
}

/* The sliding strip of all 15+ letters */

.ring-strip {
  display: flex;
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  transition: transform 0.15s ease-out;
  cursor: grab;
  touch-action: pan-y;
}

.ring-strip:active { cursor: grabbing; }

/* ─── CELLS ──────────────────────────────────────────── */

.cell {
  width: var(--cell-w);
  height: var(--cell-h);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  flex-shrink: 0;
  position: relative;
  transition: color var(--transition), background var(--transition);
  border-right: 1px solid rgba(212,165,71,0.06);
  background: linear-gradient(180deg,
    rgba(42,34,24,0.95) 0%,
    rgba(26,22,17,0.98) 40%,
    rgba(26,22,17,0.98) 60%,
    rgba(20,16,12,0.95) 100%
  );
}

.cell::after {
  content: '';
  position: absolute; left: 15%; right: 15%; bottom: 0;
  height: 1px;
  background: rgba(212,165,71,0.06);
}

/* Found word cells — gold glow */

.cell-found {
  color: var(--gold-light) !important;
  background: rgba(212,165,71,0.15) !important;
  text-shadow: 0 0 15px var(--gold-glow);
  opacity: 1 !important;
}

.cell-found::before {
  content: '';
  position: absolute; inset: 0;
  border: 1px solid rgba(212,165,71,0.2);
  pointer-events: none;
}

/* Aligned but not yet solved (need ALL aligned) — soft blue glow */

.cell-aligned {
  color: #8ec8e8 !important;
  background: rgba(100, 160, 220, 0.1) !important;
  text-shadow: 0 0 10px rgba(100, 160, 220, 0.4);
  opacity: 1 !important;
}

/* Bonus word cells — emerald */

.cell-bonus {
  color: #7fcea0 !important;
  background: rgba(45,107,79,0.12) !important;
  text-shadow: 0 0 10px var(--emerald-glow);
  opacity: 1 !important;
}

/* Hint flash */

.cell-hint { animation: hintFlash 1.5s ease; }

@keyframes hintFlash {
  0%, 100% { background: transparent; }
  25%, 75% { background: rgba(212,165,71,0.3); box-shadow: 0 0 20px var(--gold-glow); }
}

/* ─── COLUMN MARKERS (top of cryptex) ────────────────── */

.column-markers {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 6px;
  padding: 0 22px;
}

.col-marker {
  width: var(--cell-w);
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-dim);
}

/* ─── WORD LIST ──────────────────────────────────────── */

.word-list {
  padding: 4px 16px 4px;
}

.word-list-title {
  font-family: 'Cinzel', serif; font-size: 16px; font-weight: 600;
  color: var(--gold-light); letter-spacing: 3px;
  text-align: center; margin-bottom: 8px;
  text-shadow: 0 0 12px var(--gold-glow);
}

.word-list-items {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}

.word-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: var(--transition-slow);
}

.word-item.found {
  border-color: var(--gold);
  background: rgba(212,165,71,0.1);
  box-shadow: 0 0 15px var(--gold-glow);
}

.word-item.aligned {
  border-color: rgba(100, 160, 220, 0.4);
  background: rgba(100, 160, 220, 0.08);
}

.word-item.aligned .word-dots {
  color: #8ec8e8;
}

.word-dots {
  font-family: 'Cinzel', serif; font-size: 14px; font-weight: 600;
  color: var(--ink-dim); letter-spacing: 2px;
}

.word-item.found .word-dots {
  color: var(--gold-light); text-shadow: 0 0 8px var(--gold-glow);
}

.word-len { font-size: 11px; color: var(--ink-faint); opacity: 0.6; }

.bonus-section {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 7px; margin-top: 8px; justify-content: center;
}

.bonus-label { font-size: 12px; color: var(--emerald); font-style: italic; }

.bonus-word {
  font-family: 'Cinzel', serif; font-size: 12px; color: #7fcea0;
  padding: 3px 9px;
  border: 1px solid rgba(45,107,79,0.3); border-radius: var(--radius);
  background: rgba(45,107,79,0.08);
}

/* Hint button */

.hint-btn {
  display: flex; align-items: center; gap: 8px;
  margin: 4px auto 8px;
  padding: 9px 22px;
  border: 1px solid rgba(212,165,71,0.15); border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--ink-faint);
  font-family: 'Cormorant Garamond', serif; font-size: 14px;
  cursor: pointer; transition: var(--transition);
}

.hint-btn:active { transform: scale(0.95); color: var(--gold); border-color: var(--gold-dark); }

.hint-btn:disabled { opacity: 0.5; pointer-events: none; }

.hint-cost {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px;
  color: var(--gold);
  padding: 2px 7px;
  border: 1px solid rgba(212,165,71,0.3);
  border-radius: 4px;
  margin-left: 4px;
  background: rgba(212,165,71,0.08);
}

/* Token wallet icon */

.token-icon {
  width: 14px; height: 14px;
  color: var(--gold);
  flex-shrink: 0;
}

/* Token reward display on complete screen */

.token-reward {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  background: rgba(212,165,71,0.1);
  box-shadow: 0 0 20px var(--gold-glow);
  animation: rewardPulse 1.5s ease-in-out infinite;
}

.token-reward .token-icon {
  width: 20px; height: 20px;
}

.token-reward-amount {
  font-family: 'Cinzel', serif; font-size: 22px; font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 0 15px var(--gold-glow);
}

.token-reward-label {
  font-size: 13px; color: var(--ink-dim); font-style: italic;
}

@keyframes rewardPulse {
  0%, 100% { box-shadow: 0 0 20px var(--gold-glow); }
  50% { box-shadow: 0 0 35px var(--gold-glow), 0 0 60px rgba(212,165,71,0.15); }
}

.revealed-hints {
  display: flex; flex-wrap: wrap; gap: 7px;
  justify-content: center;
  padding: 0 16px 8px;
}

.revealed-hint {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--gold-light);
  padding: 4px 11px;
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  background: rgba(212,165,71,0.08);
  letter-spacing: 1px;
}

.revealed-hint strong {
  color: var(--gold);
  font-size: 15px;
}

/* ═══════════════════════════════════════════════════════
   COMPLETE SCREEN
   ═══════════════════════════════════════════════════════ */

.complete-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--sat) 24px var(--sab);
  z-index: 1;
  animation: fadeIn 0.6s ease;
}

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

.complete-seal { width: 120px; height: 120px; animation: sealReveal 1s ease; }

.complete-seal-svg { filter: drop-shadow(0 0 30px var(--gold-glow)); }

@keyframes sealReveal {
  from { transform: scale(0.5) rotate(-180deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

.complete-title {
  font-family: 'Cinzel', serif; font-size: 36px; font-weight: 700;
  color: var(--gold-light); letter-spacing: 8px;
  text-shadow: 0 0 30px var(--gold-glow); margin-top: 16px;
}

.complete-sub { font-size: 14px; font-style: italic; color: var(--ink-dim); margin-top: 4px; }

.complete-stats {
  display: flex; align-items: center; gap: 20px;
  margin-top: 28px; padding: 16px 24px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-xl);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
}

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

.stat-value {
  font-family: 'Cinzel', serif; font-size: 24px; font-weight: 700;
  color: var(--gold-light); text-shadow: 0 0 15px var(--gold-glow);
}

.stat-label { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 2px; }

.stat-divider {
  width: 1px; height: 36px;
  background: linear-gradient(180deg, transparent, var(--gold-dark), transparent);
}

.complete-bonus { margin-top: 16px; }

.complete-bonus .bonus-label { font-size: 13px; color: #7fcea0; font-style: italic; }

.complete-words {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-top: 20px; max-width: 320px;
}

.revealed-word {
  font-family: 'Cinzel', serif; font-size: 13px; font-weight: 600;
  color: var(--gold-light); padding: 4px 12px;
  border: 1px solid var(--gold-dark); border-radius: var(--radius);
  background: rgba(212,165,71,0.08); letter-spacing: 2px;
  animation: wordReveal 0.5s ease backwards;
}

.revealed-word:nth-child(1) { animation-delay: 0.1s; }

.revealed-word:nth-child(2) { animation-delay: 0.2s; }

.revealed-word:nth-child(3) { animation-delay: 0.3s; }

.revealed-word:nth-child(4) { animation-delay: 0.4s; }

.revealed-word:nth-child(5) { animation-delay: 0.5s; }

.revealed-word:nth-child(6) { animation-delay: 0.6s; }

.revealed-word:nth-child(7) { animation-delay: 0.7s; }

.revealed-word:nth-child(8) { animation-delay: 0.8s; }

@keyframes wordReveal {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.complete-actions {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px; margin-top: 28px;
}

.exit-btn {
  padding: 10px 28px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: transparent; color: var(--ink-dim);
  font-family: 'Cormorant Garamond', serif; font-size: 14px;
  cursor: pointer; transition: var(--transition);
}

.exit-btn:active { transform: scale(0.95); color: var(--ink); }

/* ═══════════════════════════════════════════════════════
   LOADING SPLASH
   ═══════════════════════════════════════════════════════ */

#loading-splash {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--parchment); z-index: 100;
}

#loading-splash .loading-text {
  font-family: 'Cinzel', serif; font-size: 14px;
  color: var(--ink-faint); letter-spacing: 4px;
  animation: loadPulse 1.5s ease-in-out infinite;
}

@keyframes loadPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════
   GAME OVER
   ═══════════════════════════════════════════════════════ */

.gameover-screen .complete-seal-svg {
  filter: drop-shadow(0 0 20px rgba(107, 68, 68, 0.4)) !important;
}

.gameover-title {
  color: #8b5a5a !important;
  text-shadow: 0 0 20px rgba(139, 90, 90, 0.4) !important;
}

.gameover-screen .stat-value {
  color: #a08060 !important;
  text-shadow: none !important;
}

.gameover-screen .stat-divider {
  background: linear-gradient(180deg, transparent, #5a4030, transparent) !important;
}

/* ═══════════════════════════════════════════════════════
   ROUND WIN INTERSTITIAL
   ═══════════════════════════════════════════════════════ */

.roundwin-screen { gap: 16px; }

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

.round-badge-num {
  font-family: 'Cinzel', serif; font-size: 48px; font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 0 30px var(--gold-glow);
  line-height: 1;
}

.round-badge-label {
  font-family: 'Cinzel', serif; font-size: 14px;
  color: var(--ink-dim); letter-spacing: 3px; text-transform: uppercase;
}

.roundwin-theme {
  font-family: 'Cinzel', serif; font-size: 18px; font-weight: 600;
  color: var(--gold); letter-spacing: 2px;
  margin-top: -4px;
}

.roundwin-next {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; margin-top: 8px;
}

.roundwin-next-label {
  font-size: 13px; color: var(--ink-faint); font-style: italic;
}

/* Continue button (after solution reveal) */

.continue-btn {
  position: absolute;
  bottom: calc(var(--sab) + 30px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 12px 36px;
  font-family: 'Cinzel', serif; font-size: 16px; font-weight: 600;
  letter-spacing: 2px;
  color: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: var(--radius-xl);
  background: rgba(212,165,71,0.12);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 25px var(--gold-glow);
  cursor: pointer;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.continue-btn.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.continue-btn:active {
  transform: translateX(-50%) scale(0.95);
}

/* ═══════════════════════════════════════════════════════
   GAME OVER OVERLAY (sits on top of solved cryptex)
   ═══════════════════════════════════════════════════════ */

.gameover-overlay {
  position: absolute;
  inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(var(--sab) + 20px);
  background: linear-gradient(to bottom, transparent 20%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0.85) 100%);
  z-index: 20;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.gameover-overlay.visible { opacity: 1; }

.gameover-panel {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  padding: 24px 28px;
  border: 1px solid rgba(107, 68, 68, 0.4);
  border-radius: var(--radius-xl);
  background: rgba(26, 22, 17, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  max-width: 340px;
  width: 100%;
  transform: translateY(30px);
  animation: panelSlideUp 0.5s ease forwards;
  animation-delay: 0.2s;
}

@keyframes panelSlideUp {
  to { transform: translateY(0); }
}

.gameover-panel-title {
  font-family: 'Cinzel', serif; font-size: 22px; font-weight: 700;
  color: #8b5a5a;
  text-shadow: 0 0 15px rgba(139, 90, 90, 0.3);
}

.gameover-panel-sub {
  font-size: 14px; color: var(--ink-dim); font-style: italic;
  margin-top: -4px;
}

.gameover-words {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}

.gameover-panel-actions {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-top: 8px;
}

.missed-word {
  color: var(--ink-faint) !important;
  border-color: rgba(107, 68, 68, 0.3) !important;
  background: rgba(107, 68, 68, 0.08) !important;
  text-decoration: line-through;
  opacity: 0.7;
}
