/* ── Variables ─────────────────────────────────── */
:root {
  --parchment: #f5ead6;
  --red:        #8B1A1A;
  --navy:       #1a3a6e;
  --brown-dark: #3d2b1f;
  --brown-mid:  #6b4c38;
  --gold:       #c9a87a;
  --green:      #2d7a2d;
  --cream:      #f5ead6;
}

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

body {
  background: #1a1008;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.015) 0px,
      rgba(255,255,255,0.015) 1px,
      transparent 1px,
      transparent 40px
    );
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 64px;
  font-family: 'Special Elite', cursive;
}

.hidden { display: none !important; }

/* ── Skull Cursor (set by JS) ──────────────────── */

/* ── Ticket Shell ──────────────────────────────── */
.ticket {
  width: 100%;
  max-width: 580px;
  background: var(--parchment);
  border-radius: 3px;
  overflow: visible;
  box-shadow:
    0 0 0 1px rgba(139,26,26,0.25),
    0 8px 40px rgba(0,0,0,0.7),
    0 2px 8px rgba(0,0,0,0.5);
  position: relative;
}

/* ticket edge texture */
.ticket::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: 3px;
  z-index: 0;
}

.ticket > * { position: relative; z-index: 1; }

/* ── Header / Footer Bars ─────────────────────── */
.ticket-header,
.ticket-footer {
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  padding: 9px 16px;
  color: var(--cream);
}

.ticket-header { background: var(--red); }
.ticket-footer { background: var(--navy); }

.hdot { margin: 0 8px; opacity: 0.6; }

/* ── Title Area ────────────────────────────────── */
.title-area {
  padding: 22px 24px 18px;
  text-align: center;
}

.game-title {
  font-family: 'Special Elite', cursive;
  color: var(--red);
  font-size: clamp(52px, 12vw, 72px);
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 2px 2px 0 rgba(139,26,26,0.15);
}

.game-subtitle {
  font-family: 'Arvo', serif;
  font-weight: 700;
  color: var(--navy);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* ── Perforation Divider ──────────────────────── */
.perf {
  position: relative;
  height: 0;
  border-top: 2px dashed var(--red);
  opacity: 0.45;
  margin: 0 -0px;
}

/* little notch circles on the sides */
.perf::before,
.perf::after {
  content: '';
  position: absolute;
  top: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a1008;
  border: 1px solid rgba(139,26,26,0.3);
}
.perf::before { left: -5px; }
.perf::after  { right: -5px; }

/* ── Audio Player ─────────────────────────────── */
.player-wrap {
  padding: 16px 16px;
}

.player-box {
  background: var(--brown-dark);
  border: 2px solid var(--brown-mid);
  border-radius: 4px;
  padding: 16px 18px;
  position: relative;
  overflow: visible;
  min-height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.player-inner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 10px;
}

/* Play / Pause Button */
.play-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: var(--red);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: inherit;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.play-btn:hover:not(:disabled) { background: #a52020; transform: scale(1.05); }
.play-btn:active:not(:disabled) { transform: scale(0.95); }
.play-btn:disabled { opacity: 0.45; }

.play-btn.pulse-play {
  animation: pulse-play-btn 1.5s ease-in-out infinite;
}

@keyframes pulse-play-btn {
  0%, 100% { box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0px rgba(201,168,122,0); }
  50%       { box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 18px rgba(201,168,122,0.55), 0 0 6px rgba(139,26,26,0.4); }
}

.play-btn svg {
  fill: var(--cream);
  width: 22px;
  height: 22px;
}

/* Right column */
.player-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Waveform — full-width bar at top of player */
.waveform {
  display: flex;
  align-items: flex-end;
  height: 36px;
  gap: 2px;
  padding-right: 30px; /* clear the fuse */
}

.wbar {
  flex: 1;
  background: var(--gold);
  border-radius: 2px 2px 0 0;
  height: 4px;
  opacity: 0.55;
  transition: height 0.08s;
}

/* static idle state — show a gentle random height so waveform looks alive */
.wbar:nth-child(odd)  { height: 6px; }
.wbar:nth-child(3n)   { height: 10px; }
.wbar:nth-child(5n)   { height: 14px; }
.wbar:nth-child(7n)   { height: 8px; }
.wbar:nth-child(11n)  { height: 16px; }

@keyframes wave-pulse {
  0%   { height: 3px; }
  100% { height: var(--peak, 22px); }
}

.wbar.playing {
  animation: wave-pulse var(--dur, 0.7s) ease-in-out infinite alternate;
  opacity: 1;
  height: var(--peak, 22px);
}

/* Track info */
.now-playing-label {
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}


/* ── Burning Fuse Timer ─────────────────────────── */
.fuse-container {
  position: absolute;
  top: 13px;
  right: 14px;
  width: 22px;
  height: 120px;
  z-index: 4;
}

.fuse-track {
  position: relative;
  width: 22px;
  height: 120px;
}

/* The unburned rope */
.fuse-rope {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 120px;
  background: repeating-linear-gradient(
    to bottom,
    #c9a87a 0px,
    #b09060 4px,
    #c9a87a 8px
  );
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(201,168,122,0.25);
}

/* Burned overlay — expands from top, covering the rope */
.fuse-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  background: var(--brown-dark);
  z-index: 1;
}

/* Flame wrapper — moves down as rope burns */
.fuse-flame-pos {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: none;
}

.fuse-flame-pos.active {
  display: block;
}

/* Flame shape via pseudo-elements */
.fuse-flame {
  width: 14px;
  height: 18px;
  position: relative;
  animation: flame-flicker 0.7s ease-in-out infinite;
}

.fuse-flame::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 14px;
  background: radial-gradient(ellipse at 50% 85%, #FF6B35 0%, #ff2200 55%, #8B1A1A 100%);
  border-radius: 50% 50% 35% 35%;
  box-shadow: 0 0 8px #FF6B35, 0 0 14px rgba(255,107,53,0.45);
}

.fuse-flame::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 6px;
  background: #FFDD44;
  border-radius: 50%;
  box-shadow: 0 0 5px #FFDD44;
}

@keyframes flame-flicker {
  0%, 100% { transform: scale(1)    rotate(0deg);  opacity: 1; }
  25%       { transform: scale(1.15) rotate(-4deg); opacity: 0.9; }
  50%       { transform: scale(0.92) rotate(3deg);  opacity: 1; }
  75%       { transform: scale(1.08) rotate(-2deg); opacity: 0.95; }
}

@keyframes flame-flicker-fast {
  0%, 100% { transform: scale(1)    rotate(0deg);  opacity: 1; }
  20%       { transform: scale(1.35) rotate(-8deg); opacity: 0.75; }
  50%       { transform: scale(0.75) rotate(7deg);  opacity: 1; }
  80%       { transform: scale(1.25) rotate(-5deg); opacity: 0.85; }
}

.fuse-flame.urgent {
  animation: flame-flicker-fast 0.12s ease-in-out infinite;
}

.fuse-flame.urgent::before {
  box-shadow: 0 0 12px #FF6B35, 0 0 22px rgba(255,107,53,0.65);
}

@keyframes fuse-burn {
  from { height: 0; }
  to   { height: 112px; }
}

@keyframes flame-pos-move {
  from { top: 0px; }
  to   { top: 104px; }
}

/* ── Press Play message ─────────────────────────── */
.press-play-msg {
  font-family: 'Special Elite', cursive;
  color: var(--gold);
  font-size: 13px;
  margin-top: 5px;
  letter-spacing: 0.06em;
  animation: press-play-pulse 1.5s ease-in-out infinite;
}

@keyframes press-play-pulse {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 1; }
}

.track-title {
  font-family: 'Special Elite', cursive;
  color: var(--cream);
  font-size: 14px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.get-ready {
  font-family: 'Arvo', serif;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: pulse-ready 1s infinite;
}

@keyframes pulse-ready {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.post-guess-details {
  font-family: 'Special Elite', cursive;
  color: var(--cream);
  font-size: 11px;
  margin-top: 6px;
  line-height: 1.4;
}

.post-guess-details div {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Loading overlay */
.player-loading {
  position: absolute;
  inset: 0;
  background: var(--brown-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
  padding: 20px;
}

.loading-msg {
  font-family: 'Special Elite', cursive;
  color: var(--gold);
  font-size: 13px;
  text-align: center;
  letter-spacing: 0.03em;
  line-height: 1.5;
  min-height: 2.8em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-dots {
  display: flex;
  gap: 7px;
}

.loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.4;
  animation: dot-bounce 1.1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.18s; }
.loading-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dot-bounce {
  0%, 100% { transform: translateY(0);   opacity: 0.35; }
  50%       { transform: translateY(-7px); opacity: 1; }
}

/* ── Year Grid ─────────────────────────────────── */
.grid-wrap {
  padding: 16px 16px;
  position: relative;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.year-btn {
  font-family: 'Special Elite', cursive;
  font-size: 15px;
  color: var(--brown-dark);
  background: transparent;
  border: 1px solid rgba(139,26,26,0.3);
  border-radius: 2px;
  padding: 10px 2px;
  text-align: center;
  cursor: inherit;
  transition: background 0.12s, border-color 0.12s, opacity 0.2s, color 0.15s;
  position: relative;
  line-height: 1;
}

.year-btn:hover:not(:disabled):not(.guessed):not(.correct):not(.faded) {
  background: rgba(139,26,26,0.08);
  border-color: var(--red);
}

.year-btn:disabled { cursor: default; }

.year-btn.guessed {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--cream);
}

.year-btn.correct {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.year-btn.faded {
  opacity: 0.28;
}

/* Center 1995 in the last slot */
.year-btn:last-child {
  grid-column: 3 / span 2;
}

/* ── Stamp ─────────────────────────────────────── */
.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-2deg) scale(0);
  transform-origin: center center;
  border: 3px solid var(--red);
  color: var(--red);
  padding: 12px 28px;
  text-align: center;
  pointer-events: none;
  z-index: 20;
  background: rgba(245,234,214,0.94);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 2px 2px 0 rgba(139,26,26,0.2), 0 4px 20px rgba(0,0,0,0.15);
}

.stamp.visible {
  transform: translate(-50%, -50%) rotate(-2deg) scale(1);
}

.stamp.dead-on {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 2px 2px 0 rgba(45,122,45,0.2), 0 4px 20px rgba(0,0,0,0.15);
}

.stamp-label {
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.stamp-year {
  font-family: 'Special Elite', cursive;
  font-size: 42px;
  line-height: 1.05;
}

.stamp-sub {
  font-family: 'Arvo', serif;
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

/* ── Score Row ─────────────────────────────────── */
.score-row {
  display: flex;
  border-top: 2px dashed rgba(139,26,26,0.4);
}

.score-cell {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
}

.sc-mid {
  border-left:  2px dashed rgba(139,26,26,0.4);
  border-right: 2px dashed rgba(139,26,26,0.4);
}

.score-label {
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 9px;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.score-value {
  font-family: 'Special Elite', cursive;
  font-size: 28px;
  color: var(--brown-dark);
  margin-top: 2px;
  transition: color 0.3s;
}

@keyframes score-flash {
  0%   { color: var(--green); transform: scale(1.18); }
  100% { color: var(--brown-dark); transform: scale(1); }
}

.score-value.flash {
  animation: score-flash 0.45s ease-out forwards;
}

/* ── Score Breakdown ───────────────────────────── */
.score-breakdown {
  font-family: 'Special Elite', cursive;
  color: var(--brown-dark);
  font-size: 12px;
  text-align: center;
  padding: 11px 16px 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 5px 8px;
  line-height: 1.4;
  animation: bd-fade-in 0.4s ease-out both;
}

@keyframes bd-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bd-item { white-space: nowrap; }
.bd-item strong { color: var(--brown-dark); font-weight: normal; }
.bd-item.bd-total strong { color: var(--red); }
.bd-note { color: var(--brown-mid); opacity: 0.8; font-size: 11px; }
.bd-dot { color: var(--red); opacity: 0.5; }

/* ── Instructions Overlay ──────────────────────── */
#instructions-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 6, 3, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.35s ease;
}

#instructions-overlay.dismissed {
  opacity: 0;
  pointer-events: none;
}

.instructions-panel {
  width: 100%;
  max-width: 440px;
  background: var(--parchment);
  border-radius: 3px;
  border: 1px solid rgba(139,26,26,0.25);
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
  padding: 26px 24px 24px;
  text-align: center;
}

.instructions-header {
  font-family: 'Special Elite', cursive;
  color: var(--red);
  font-size: 26px;
  letter-spacing: 0.03em;
  margin-bottom: 18px;
}

.instructions-body {
  text-align: left;
  margin-bottom: 22px;
}

.instr-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-family: 'Special Elite', cursive;
  color: var(--brown-dark);
  font-size: 14px;
  line-height: 1.5;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(139,26,26,0.18);
}

.instr-row:last-child { border-bottom: none; }

.instr-row strong { color: var(--red); font-weight: normal; }

.instr-icon {
  font-size: 19px;
  line-height: 1.3;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.instructions-panel .next-btn {
  width: 100%;
  max-width: 280px;
}

@media (max-width: 380px) {
  .instructions-header { font-size: 23px; }
  .instr-row { font-size: 13px; }
}

/* ── Next Button ───────────────────────────────── */
.next-area { }

.next-inner {
  padding: 14px 24px;
  text-align: center;
}

.next-btn {
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--red);
  color: var(--cream);
  border: none;
  padding: 13px 40px;
  border-radius: 2px;
  cursor: inherit;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.next-btn:hover { background: #a52020; }
.next-btn:active { transform: scale(0.97); }

/* ── Tip Jar (final screen + leaderboard only) ──── */
.tip-jar {
  font-family: 'Special Elite', cursive;
  font-size: 11px;
  color: var(--brown-mid);
  text-align: center;
  line-height: 1.6;
  letter-spacing: 0.02em;
  padding: 2px 26px 16px;
}

.tip-link {
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px dotted rgba(139,26,26,0.55);
  transition: color 0.15s, border-color 0.15s;
}

.tip-link:hover {
  color: #a52020;
  border-bottom-color: var(--red);
}

/* ── Final Score Screen ────────────────────────── */
#final-screen { padding: 32px 16px 64px; }

.final-body {
  padding: 32px 24px;
  text-align: center;
}

.final-score-label {
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.final-score-value {
  font-family: 'Special Elite', cursive;
  font-size: clamp(60px, 16vw, 90px);
  color: var(--red);
  line-height: 1;
  margin-top: 6px;
}

.final-out-of {
  font-family: 'Arvo', serif;
  color: var(--brown-mid);
  font-size: 13px;
  margin-top: 2px;
}

.final-rank {
  font-family: 'Special Elite', cursive;
  font-size: clamp(22px, 6vw, 30px);
  color: var(--navy);
  margin-top: 20px;
  letter-spacing: 0.04em;
}

.final-flavor {
  font-family: 'Arvo', serif;
  font-size: 13px;
  color: var(--brown-mid);
  margin-top: 8px;
  font-style: italic;
  line-height: 1.5;
}

/* ── Lightning bolt ────────────────────────────── */
.lightning {
  position: fixed;
  font-size: 26px;
  pointer-events: none;
  z-index: 999;
  transform: translateX(-50%);
  user-select: none;
}

/* ── Audio error banner ────────────────────────── */
.audio-error {
  font-family: 'Arvo', serif;
  font-size: 11px;
  color: #c9a87a;
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.05em;
}

/* ── Easter Eggs ───────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%  { transform: translateX(-3px); }
  30%  { transform: translateX(3px); }
  45%  { transform: translateX(-2px); }
  60%  { transform: translateX(2px); }
  75%  { transform: translateX(-1px); }
  90%  { transform: translateX(1px); }
}

@keyframes pulse {
  0%   { background: transparent; }
  50%  { background: radial-gradient(circle, rgba(255,107,107,0.5), rgba(255,215,0,0.3)); }
  100% { background: transparent; }
}

/* ── Name Entry Screen ─────────────────────────── */
#name-screen { padding: 32px 16px 64px; }

.name-body {
  padding: 28px 24px 24px;
  text-align: center;
}

.name-teaser {
  font-family: 'Special Elite', cursive;
  font-size: 15px;
  color: var(--brown-dark);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.name-teaser2 {
  font-family: 'Arvo', serif;
  font-size: 12px;
  color: var(--brown-mid);
  font-style: italic;
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}

.name-field {
  text-align: left;
  max-width: 320px;
  margin: 0 auto;
}

.name-label {
  display: block;
  font-family: 'Arvo', serif;
  font-weight: 700;
  font-size: 10px;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-bottom: 8px;
}

.name-input {
  width: 100%;
  font-family: 'Special Elite', cursive;
  font-size: 16px;
  color: var(--brown-dark);
  background: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(139,26,26,0.35);
  border-radius: 2px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.04em;
}

.name-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(139,26,26,0.12);
}

.name-input::placeholder {
  color: var(--brown-mid);
  opacity: 0.55;
}

.name-error {
  font-family: 'Arvo', serif;
  font-size: 11px;
  color: var(--red);
  margin-top: 7px;
  letter-spacing: 0.04em;
  font-style: italic;
}

.name-note {
  max-width: 320px;
  margin: 14px auto 0;
  font-family: 'Arvo', serif;
  font-size: 11px;
  font-style: italic;
  line-height: 1.5;
  color: var(--brown-mid);
  letter-spacing: 0.03em;
}

/* ── Subordinate text-button (e.g. "View Leaderboard" below Play) ── */
.name-secondary-btn {
  display: block;
  margin: 14px auto 0;
  font-family: 'Arvo', serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--navy);
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: inherit;
  border-bottom: 1px dotted rgba(26,58,110,0.5);
  opacity: 0.75;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}

.name-secondary-btn:hover {
  opacity: 1;
  color: var(--red);
  border-bottom-color: rgba(139,26,26,0.5);
}

/* ── Name-exists modal (returning player / collision) ── */
#name-exists-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(10, 6, 3, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.name-modal-panel {
  width: 100%;
  max-width: 420px;
  background: var(--parchment);
  border-radius: 3px;
  border: 1px solid rgba(139,26,26,0.25);
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
  padding: 26px 24px 24px;
  text-align: center;
}

.name-modal-title {
  font-family: 'Special Elite', cursive;
  color: var(--red);
  font-size: 25px;
  letter-spacing: 0.03em;
  margin-bottom: 14px;
}

.name-modal-body {
  font-family: 'Special Elite', cursive;
  color: var(--brown-dark);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  margin-bottom: 22px;
}

.name-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.name-modal-actions .next-btn {
  width: 100%;
  max-width: 300px;
}

.name-modal-alt {
  font-family: 'Arvo', serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--navy);
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: inherit;
  border-bottom: 1px dotted rgba(26,58,110,0.5);
}

.name-modal-alt:hover { color: var(--red); border-bottom-color: rgba(139,26,26,0.5); }

@media (max-width: 380px) {
  .name-modal-title { font-size: 22px; }
  .name-modal-body  { font-size: 13px; }
}

/* ── Leaderboard Affordance ────────────────────── */
.lb-affordance {
  text-align: center;
  padding: 4px 24px 18px;
}

.lb-afford-btn {
  font-family: 'Special Elite', cursive;
  font-size: 14px;
  color: var(--navy);
  background: none;
  border: none;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: inherit;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.lb-afford-btn:hover { opacity: 1; }

.lb-afford-arrow {
  display: inline-block;
  font-size: 20px;
  animation: bounce-right 1.1s ease-in-out infinite;
  color: var(--gold);
}

@keyframes bounce-right {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(7px); }
}

/* ── Leaderboard Screen ────────────────────────── */
#leaderboard-screen {
  position: fixed;
  inset: 0;
  background: #1a1008;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.015) 0px,
    rgba(255,255,255,0.015) 1px,
    transparent 1px,
    transparent 40px
  );
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 64px;
  visibility: hidden;
}

#leaderboard-screen.lb-open {
  transform: translateX(0);
  visibility: visible;
}

.lb-body {
  padding: 0;
}

.lb-loading {
  font-family: 'Special Elite', cursive;
  color: var(--gold);
  font-size: 13px;
  text-align: center;
  padding: 28px 16px;
  letter-spacing: 0.05em;
}

.lb-error {
  font-family: 'Arvo', serif;
  font-size: 12px;
  color: var(--brown-mid);
  text-align: center;
  padding: 24px 16px;
  font-style: italic;
}

.lb-empty {
  font-family: 'Special Elite', cursive;
  font-size: 13px;
  color: var(--brown-mid);
  text-align: center;
  padding: 24px 16px;
}

.lb-list {
  max-height: 420px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lb-row {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(139,26,26,0.12);
  gap: 10px;
}

.lb-row--player {
  background: var(--navy);
}

.lb-rank {
  font-family: 'Arvo', serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  min-width: 34px;
  text-align: right;
  flex-shrink: 0;
}

.lb-row--player .lb-rank { color: var(--gold); }

.lb-name {
  flex: 1;
  font-family: 'Special Elite', cursive;
  font-size: 14px;
  color: var(--brown-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.lb-row--player .lb-name { color: var(--cream); }

.lb-score {
  font-family: 'Special Elite', cursive;
  font-size: 16px;
  color: var(--red);
  min-width: 50px;
  text-align: right;
  flex-shrink: 0;
}

.lb-row--player .lb-score { color: var(--gold); }

.lb-tier {
  font-family: 'Arvo', serif;
  font-size: 9px;
  font-weight: 700;
  color: var(--brown-mid);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 62px;
  text-align: right;
  flex-shrink: 0;
}

.lb-row--player .lb-tier { color: rgba(245,234,214,0.65); }

.lb-player-pinned {
  border-top: 2px dashed rgba(139,26,26,0.35);
  padding-top: 2px;
}

.lb-ellipsis {
  text-align: center;
  padding: 7px 0 4px;
  color: var(--brown-mid);
  font-family: 'Special Elite', cursive;
  font-size: 15px;
  letter-spacing: 0.3em;
  opacity: 0.6;
}
