/* ===== SCREENS ===== */
/* Responsive tweaks, game-over, celebration, home screen, difficulty, settings */

/* ===== RESPONSIVE - Small screens button fix ===== */
@media (max-width: 420px) {
  .btn-roll {
    font-size: clamp(16px, 3.5vh, 28px);
    height: clamp(40px, 6vh, 70px);
  }

  .btn-play {
    font-size: clamp(16px, 3.5vh, 28px);
    height: clamp(40px, 6vh, 70px);
  }

  .roll-badge {
    width: clamp(22px, 3.5vh, 36px);
    height: clamp(22px, 3.5vh, 36px);
    font-size: clamp(11px, 2vh, 18px);
  }
}

/* ===== RESPONSIVE - Width based ===== */
@media (min-width: 600px) {
  .app-wrapper {
    max-width: 700px;
  }
}

@media (min-width: 768px) {
  .app-wrapper {
    max-width: 800px;
  }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
  .ad-banner {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(60px + env(safe-area-inset-bottom));
  }
}

/* ===== GAME OVER SCREEN ===== */
.game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: linear-gradient(180deg, #1a9ab8 0%, #22b8dc 50%, #2ec8ec 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Animated background particles for game over */
.game-over-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.game-over-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  animation: floatParticle 20s infinite ease-in-out;
}

.game-over-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.game-over-score-box {
  width: clamp(150px, 40vw, 280px);
  height: clamp(150px, 40vw, 280px);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--tile-yellow) 0%, var(--tile-orange) 100%);
  box-shadow: 0 8px 0 var(--tile-shadow), 0 20px 40px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-over-overlay.visible .game-over-score-box {
  transform: scale(1);
}

.game-over-score-value {
  font-size: clamp(48px, 15vw, 100px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 var(--text-shadow);
}

.game-over-message {
  margin-top: 30px;
  font-size: clamp(24px, 6vw, 42px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 var(--text-shadow);
  text-align: center;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.game-over-overlay.show-message .game-over-message {
  opacity: 1;
  transform: translateY(0);
}

.game-over-buttons {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

.game-over-overlay.show-message .game-over-buttons {
  opacity: 1;
  transform: translateY(0);
}

.btn-play-again {
  width: 100%;
  padding: 16px 48px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(180deg, var(--tile-yellow) 0%, var(--tile-orange) 100%);
  box-shadow: 0 6px 0 var(--tile-shadow);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 0 var(--text-shadow);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-play-again:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--tile-shadow);
}

.btn-play-again:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--tile-shadow);
}

/* Share action buttons - vertical stack */
.share-action-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.share-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 48px;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(18px, 4.5vw, 26px);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  text-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

/* Share score button - teal/cyan */
.share-action-btn#shareScoreBtn {
  background: linear-gradient(180deg, #22d3ee 0%, #0891b2 100%);
  box-shadow: 0 6px 0 #0e7490;
}

.share-action-btn#shareScoreBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #0e7490;
}

.share-action-btn#shareScoreBtn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #0e7490;
}

/* Challenge button - purple/violet */
.share-action-btn#challengeFriendBtn {
  background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 100%);
  box-shadow: 0 6px 0 #5b21b6;
}

.share-action-btn#challengeFriendBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #5b21b6;
}

.share-action-btn#challengeFriendBtn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #5b21b6;
}

.share-action-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* ===== JATZEE CELEBRATION ===== */
.jatzee-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
  perspective: 1000px;
  overflow: hidden;
}

.jatzee-letter {
  position: absolute;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(60px, 15vw, 120px);
  font-weight: 1000;
  line-height: 1;
  transform-style: preserve-3d;
  opacity: 0;
  will-change: transform, opacity;
  filter: drop-shadow(0 18px 18px rgba(0,0,0,.22));
}

.jatzee-letter .front {
  display: block;
  padding: .02em .06em;
  min-width: .65em;
  text-align: center;
  color: rgba(255,255,255,.96);
  border-radius: 14px;
  box-shadow:
    0 10px 0 rgba(0,0,0,.16),
    0 14px 22px rgba(0,0,0,.18);
}

.jatzee-letter.animating {
  animation: letterFlyIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.jatzee-letter.bounce {
  animation: letterBounce 0.5s ease-in-out;
}

.jatzee-letter.exit {
  animation: letterFlyOut 0.6s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
}

@keyframes letterFlyIn {
  0% {
    opacity: 0;
    transform: var(--start-transform);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: var(--end-transform) rotateY(0deg) rotateX(0deg);
  }
}

@keyframes letterBounce {
  0%, 100% { transform: var(--end-transform) scale(1); }
  50% { transform: var(--end-transform) scale(1.2); }
}

@keyframes letterFlyOut {
  0% {
    opacity: 1;
    transform: var(--end-transform);
  }
  100% {
    opacity: 0;
    transform: var(--exit-transform);
  }
}

/* Particle burst effect */
.jatzee-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

.jatzee-particle.animating {
  animation: particleBurst 1s ease-out forwards;
}

@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: var(--particle-end) scale(0);
  }
}

/* Glow pulse behind letters */
.jatzee-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240,160,32,0.6) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  will-change: transform, opacity;
}

.jatzee-glow.animating {
  animation: glowPulse 1.5s ease-out forwards;
}

@keyframes glowPulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2);
  }
}

/* ===== HOME SCREEN ===== */
.home-screen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: linear-gradient(180deg, #1a9ab8 0%, #22b8dc 50%, #2ec8ec 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px 20px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.home-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Animated background particles */
.home-bg-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.home-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  animation: floatParticle 20s infinite ease-in-out;
}

@keyframes floatParticle {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
  50% { transform: translateY(-100px) rotate(180deg); opacity: 0.6; }
}

/* Dice row (curved arc) */
.home-dice-row {
  display: flex;
  gap: clamp(8px, 2vw, 14px);
  filter: drop-shadow(0 10px 10px rgba(0,0,0,.16));
  margin-bottom: 14px;
}

.home-die {
  width: clamp(58px, 14vw, 82px);
  aspect-ratio: 1;
  border-radius: 14px;
  /* Default white dice - themes can override */
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,.95), rgba(255,255,255,.70) 45%, rgba(255,255,255,.92) 70%),
    linear-gradient(180deg, #fff, #f5faff);
  box-shadow:
    0 14px 0 rgba(0,0,0,.05),
    0 18px 30px rgba(0,0,0,.14);
  position: relative;
  transform: rotate(var(--rot, 0deg)) translateY(var(--y, 0px));
  animation: diceBob 2.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

.home-die .pip {
  width: 14%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(15,20,35,.85); /* themes can override */
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 0 rgba(255,255,255,.10) inset;
}

@keyframes diceBob {
  0%, 100% { transform: rotate(var(--rot)) translateY(var(--y)); }
  50% { transform: rotate(calc(var(--rot) * .85)) translateY(var(--y)) translateY(-7px); }
}

/* Logo */
.home-logo {
  display: flex;
  gap: clamp(6px, 1vw, 10px);
  align-items: flex-end;
  filter: drop-shadow(0 26px 24px rgba(0,0,0,.16));
  margin-bottom: 10px;
  animation: logoEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: scale(0.5) translateY(50px);
}

@keyframes logoEntrance {
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.home-logo .letter {
  position: relative;
  display: inline-block;
  font-size: clamp(60px, 13vw, 108px);
  font-weight: 1000;
  line-height: 1;
  animation: letterFloat 2.8s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

.home-logo .letter .front {
  display: block;
  padding: .02em .04em;
  min-width: .65em;
  text-align: center;
  color: rgba(255,255,255,.96);
  border-radius: 14px;
  background:
    radial-gradient(120% 140% at 20% 15%, rgba(255,255,255,.55), rgba(255,255,255,0) 40%),
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 48%),
    var(--fill);
  box-shadow:
    0 10px 0 rgba(0,0,0,.16),
    0 14px 22px rgba(0,0,0,.18);
}

/* Letter color fills */
.cJ { --fill: linear-gradient(180deg, #FF6A8A, #FF3E64); }
.cA { --fill: linear-gradient(180deg, #FFD35E, #FFB42A); }
.cT { --fill: linear-gradient(180deg, #61E8E2, #2ACFC8); }
.cZ { --fill: linear-gradient(180deg, #59C9F0, #1FA9E7); }
.cE1 { --fill: linear-gradient(180deg, #7CE8D7, #44D1B8); }
.cE2 { --fill: linear-gradient(180deg, #FFC74A, #FF9F19); }

@keyframes letterFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.home-subtitle {
  font-size: clamp(16px, 4vw, 24px);
  font-weight: 800;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 2px 0 rgba(0,0,0,0.15);
  margin-bottom: 40px;
  animation: fadeSlideUp 0.6s ease-out 0.3s forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes fadeSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Menu panel */
.home-menu {
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
  border-radius: 24px;
  padding: clamp(20px, 5vw, 35px);
  backdrop-filter: blur(10px);
  box-shadow:
    0 10px 40px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.3);
  animation: menuEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s forwards;
  opacity: 0;
  transform: scale(0.9) translateY(30px);
}

@keyframes menuEntrance {
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.home-btn {
  display: block;
  width: clamp(220px, 60vw, 300px);
  padding: clamp(14px, 3vw, 20px) 30px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(18px, 4.5vw, 26px);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.home-btn:last-child {
  margin-bottom: 0;
}

.home-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.home-btn:hover::before {
  left: 100%;
}

.home-btn:hover {
  transform: translateY(-3px);
}

.home-btn:active {
  transform: translateY(2px);
}

.home-btn-play {
  background: linear-gradient(180deg, var(--tile-yellow) 0%, var(--tile-orange) 100%);
  box-shadow: 0 6px 0 var(--tile-shadow), 0 10px 20px rgba(0,0,0,0.2);
  color: #fff;
  text-shadow: 0 2px 0 var(--text-shadow);
}

.home-btn-play:hover {
  box-shadow: 0 8px 0 var(--tile-shadow), 0 15px 30px rgba(0,0,0,0.25);
}

.home-btn-play:active {
  box-shadow: 0 3px 0 var(--tile-shadow), 0 5px 10px rgba(0,0,0,0.2);
}

.home-btn-solo {
  background: linear-gradient(180deg, #4ecdc4 0%, #26a69a 100%);
  box-shadow: 0 5px 0 #1a7a72, 0 8px 15px rgba(0,0,0,0.15);
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,50,50,0.3);
}

.home-btn-solo:hover {
  box-shadow: 0 7px 0 #1a7a72, 0 12px 25px rgba(0,0,0,0.2);
}

.home-btn-solo:active {
  box-shadow: 0 2px 0 #1a7a72, 0 4px 8px rgba(0,0,0,0.15);
}

.home-btn-bot {
  background: linear-gradient(180deg, #a855f7 0%, #7c3aed 100%);
  box-shadow: 0 5px 0 #5b21b6, 0 8px 15px rgba(0,0,0,0.15);
  color: #fff;
  text-shadow: 0 2px 0 rgba(50,0,70,0.3);
}

.home-btn-bot:hover {
  box-shadow: 0 7px 0 #5b21b6, 0 12px 25px rgba(0,0,0,0.2);
}

.home-btn-bot:active {
  box-shadow: 0 2px 0 #5b21b6, 0 4px 8px rgba(0,0,0,0.15);
}

.home-btn-online {
  background: linear-gradient(180deg, #ff6b6b 0%, #e53935 100%);
  box-shadow: 0 5px 0 #b71c1c, 0 8px 15px rgba(0,0,0,0.15);
  color: #fff;
  text-shadow: 0 2px 0 rgba(70,0,0,0.3);
  opacity: 0.6;
  cursor: not-allowed;
}

.home-btn-online:hover {
  transform: none;
}

.home-btn-online::after {
  content: 'Soon';
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: clamp(9px, 2vw, 12px);
  background: rgba(0,0,0,0.4);
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 800;
}

/* Challenge button - shown when visiting with challenge URL */
.home-btn-challenge {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 5px 0 #92400e, 0 8px 15px rgba(0,0,0,0.2);
  color: #fff;
  text-shadow: 0 2px 0 rgba(100,50,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: challengePulse 2s ease-in-out infinite;
}

.home-btn-challenge svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
}

.home-btn-challenge:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 #92400e, 0 12px 20px rgba(0,0,0,0.25);
}

.home-btn-challenge:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #92400e, 0 4px 8px rgba(0,0,0,0.15);
}

@keyframes challengePulse {
  0%, 100% { box-shadow: 0 5px 0 #92400e, 0 8px 15px rgba(0,0,0,0.2); }
  50% { box-shadow: 0 5px 0 #92400e, 0 8px 25px rgba(245,158,11,0.4); }
}

/* Daily challenge button - indigo gradient */
.home-btn-daily {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 5px 0 #3730a3, 0 8px 15px rgba(0,0,0,0.15);
  color: #fff;
  text-shadow: 0 2px 0 rgba(30,0,70,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.home-btn-daily svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
  flex-shrink: 0;
}

.home-btn-daily .daily-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.2;
}

.home-btn-daily .daily-countdown {
  font-size: clamp(12px, 3vw, 14px);
  opacity: 0.85;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.home-btn-daily:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 #3730a3, 0 12px 20px rgba(0,0,0,0.25);
}

.home-btn-daily:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #3730a3, 0 4px 8px rgba(0,0,0,0.15);
}

/* Daily completed state - green with checkmark */
.home-btn-daily.completed {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 5px 0 #15803d, 0 8px 15px rgba(0,0,0,0.15);
  flex-direction: row;
  gap: 8px;
}

.home-btn-daily.completed .daily-title {
  font-size: clamp(18px, 4.5vw, 24px);
}

.home-btn-daily.completed:hover {
  box-shadow: 0 8px 0 #15803d, 0 12px 20px rgba(0,0,0,0.25);
}

/* Bottom nav on home screen */
.home-nav {
  margin-top: 40px;
  display: flex;
  gap: 20px;
  animation: fadeSlideUp 0.5s ease-out 0.7s forwards;
  opacity: 0;
}

.home-nav-btn {
  width: clamp(50px, 12vw, 65px);
  height: clamp(50px, 12vw, 65px);
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}

.home-nav-btn:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.1);
}

.home-nav-btn:active {
  transform: scale(0.95);
}

.home-nav-btn svg {
  width: 50%;
  height: 50%;
  fill: #fff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Screen transition */
.game-wrapper {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.game-wrapper.visible {
  opacity: 1;
  transform: scale(1);
}

/* ===== DIFFICULTY SELECTOR SCREEN ===== */
.difficulty-screen {
  position: fixed;
  inset: 0;
  z-index: 3500;
  background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 50%, #4c1d95 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.difficulty-screen.visible {
  opacity: 1;
  visibility: visible;
}

.difficulty-title {
  font-size: clamp(32px, 8vw, 56px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0,0,0,0.3);
  margin-bottom: 10px;
  animation: fadeSlideUp 0.5s ease-out forwards;
}

.difficulty-subtitle {
  font-size: clamp(14px, 3.5vw, 20px);
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  margin-bottom: 40px;
  animation: fadeSlideUp 0.5s ease-out 0.1s forwards;
  opacity: 0;
}

.difficulty-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeSlideUp 0.5s ease-out 0.2s forwards;
  opacity: 0;
}

.difficulty-btn {
  width: clamp(240px, 65vw, 320px);
  padding: clamp(16px, 4vw, 24px) 30px;
  border-radius: 16px;
  border: none;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.difficulty-btn:hover {
  transform: translateY(-3px);
}

.difficulty-btn:active {
  transform: translateY(2px);
}

.difficulty-btn-label {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

.difficulty-btn-desc {
  font-size: clamp(11px, 2.5vw, 14px);
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
}

.difficulty-btn-easy {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  box-shadow: 0 6px 0 #16a34a, 0 10px 20px rgba(0,0,0,0.2);
}

.difficulty-btn-easy:hover {
  box-shadow: 0 8px 0 #16a34a, 0 14px 28px rgba(0,0,0,0.25);
}

.difficulty-btn-easy:active {
  box-shadow: 0 3px 0 #16a34a, 0 5px 10px rgba(0,0,0,0.2);
}

.difficulty-btn-normal {
  background: linear-gradient(180deg, var(--tile-yellow) 0%, var(--tile-orange) 100%);
  box-shadow: 0 6px 0 var(--tile-shadow), 0 10px 20px rgba(0,0,0,0.2);
}

.difficulty-btn-normal:hover {
  box-shadow: 0 8px 0 var(--tile-shadow), 0 14px 28px rgba(0,0,0,0.25);
}

.difficulty-btn-normal:active {
  box-shadow: 0 3px 0 var(--tile-shadow), 0 5px 10px rgba(0,0,0,0.2);
}

.difficulty-btn-hard {
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
  box-shadow: 0 6px 0 #b91c1c, 0 10px 20px rgba(0,0,0,0.2);
}

.difficulty-btn-hard:hover {
  box-shadow: 0 8px 0 #b91c1c, 0 14px 28px rgba(0,0,0,0.25);
}

.difficulty-btn-hard:active {
  box-shadow: 0 3px 0 #b91c1c, 0 5px 10px rgba(0,0,0,0.2);
}

.difficulty-back-btn {
  margin-top: 30px;
  padding: 12px 32px;
  border-radius: 30px;
  border: none;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(5px);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  animation: fadeSlideUp 0.5s ease-out 0.3s forwards;
  opacity: 0;
}

.difficulty-back-btn:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
}

.difficulty-back-btn:active {
  transform: scale(0.95);
}

/* ===== SETTINGS MENU ===== */
.settings-screen {
  position: fixed;
  inset: 0;
  z-index: 3500;
  background: linear-gradient(180deg, #374151 0%, #1f2937 50%, #111827 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 40px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.settings-screen.visible {
  opacity: 1;
  visibility: visible;
}

.settings-title {
  font-size: clamp(32px, 8vw, 56px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0,0,0,0.3);
  margin-bottom: 30px;
  animation: fadeSlideUp 0.5s ease-out forwards;
}

.settings-section {
  width: 90%;
  max-width: 360px;
  margin-bottom: 20px;
  animation: fadeSlideUp 0.5s ease-out 0.1s forwards;
  opacity: 0;
}

.settings-section-title {
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

/* Sound toggle row */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.settings-toggle-label {
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 700;
  color: #fff;
}

.settings-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.toggle-track {
  display: block;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  transition: background 0.2s ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.settings-toggle.active .toggle-track {
  background: #22c55e;
}

.settings-toggle.active .toggle-thumb {
  transform: translateX(24px);
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.theme-btn {
  position: relative;
  padding: 16px 12px;
  border-radius: 16px;
  border: 3px solid transparent;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
  overflow: hidden;
}

.theme-btn:hover {
  transform: translateY(-2px);
}

.theme-btn:active {
  transform: translateY(1px);
}

.theme-btn.active {
  border-color: #fff;
  box-shadow: 0 0 20px rgba(255,255,255,0.4);
}

.theme-btn-classic {
  background: linear-gradient(180deg, #22b8dc 0%, #1a9ab8 100%);
  box-shadow: 0 4px 0 #0d7a8a, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-casino {
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 4px 0 #166534, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-neon {
  background: linear-gradient(180deg, #ec4899 0%, #a855f7 100%);
  box-shadow: 0 4px 0 #7e22ce, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-dark {
  background: linear-gradient(180deg, #3f3f46 0%, #27272a 100%);
  box-shadow: 0 4px 0 #18181b, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-retro {
  background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
  box-shadow: 0 4px 0 #000, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-ocean {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 4px 0 #0369a1, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-royal {
  background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 100%);
  box-shadow: 0 4px 0 #4c1d95, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-sunset {
  background: linear-gradient(180deg, #f97316 0%, #ea580c 100%);
  box-shadow: 0 4px 0 #c2410c, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-ice {
  background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 100%);
  box-shadow: 0 4px 0 #0ea5e9, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-halloween {
  background: linear-gradient(180deg, #f97316 0%, #1c1917 50%);
  box-shadow: 0 4px 0 #0c0a09, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-pastel {
  background: linear-gradient(180deg, #f9a8d4 0%, #c4b5fd 100%);
  box-shadow: 0 4px 0 #a78bfa, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-btn-matrix {
  background: linear-gradient(180deg, #052e16 0%, #022c22 100%);
  box-shadow: 0 4px 0 #001a0f, 0 8px 16px rgba(0,0,0,0.2);
}

.theme-preview {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 8px;
}

.theme-preview-die {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-preview-die::after {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* Classic theme preview */
.theme-btn-classic .theme-preview-die {
  background: #fff;
}
.theme-btn-classic .theme-preview-die::after {
  background: #1a1a2e;
}

/* Casino theme preview */
.theme-btn-casino .theme-preview-die {
  background: #dc2626;
}
.theme-btn-casino .theme-preview-die::after {
  background: #fff;
}

/* Neon theme preview */
.theme-btn-neon .theme-preview-die {
  background: #000;
  box-shadow: 0 0 6px #0ff;
}
.theme-btn-neon .theme-preview-die::after {
  background: #0ff;
  box-shadow: 0 0 4px #0ff;
}

/* Dark theme preview */
.theme-btn-dark .theme-preview-die {
  background: #52525b;
}
.theme-btn-dark .theme-preview-die::after {
  background: #e4e4e7;
}

/* Retro theme preview */
.theme-btn-retro .theme-preview-die {
  background: #000;
  border: 1px solid #f0f;
}
.theme-btn-retro .theme-preview-die::after {
  background: #0ff;
}

/* Ocean theme preview */
.theme-btn-ocean .theme-preview-die {
  background: #fef3c7;
}
.theme-btn-ocean .theme-preview-die::after {
  background: #0369a1;
}

/* Royal theme preview */
.theme-btn-royal .theme-preview-die {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}
.theme-btn-royal .theme-preview-die::after {
  background: #4c1d95;
}

/* Sunset theme preview */
.theme-btn-sunset .theme-preview-die {
  background: #fff;
}
.theme-btn-sunset .theme-preview-die::after {
  background: #ea580c;
}

/* Ice theme preview */
.theme-btn-ice .theme-preview-die {
  background: #fff;
  box-shadow: 0 0 4px rgba(56, 189, 248, 0.5);
}
.theme-btn-ice .theme-preview-die::after {
  background: #0284c7;
}

/* Halloween theme preview */
.theme-btn-halloween .theme-preview-die {
  background: #f97316;
}
.theme-btn-halloween .theme-preview-die::after {
  background: #000;
}

/* Pastel theme preview */
.theme-btn-pastel .theme-preview-die {
  background: #fef3c7;
}
.theme-btn-pastel .theme-preview-die::after {
  background: #db2777;
}

/* Matrix theme preview */
.theme-btn-matrix .theme-preview-die {
  background: #000;
}
.theme-btn-matrix .theme-preview-die::after {
  background: #22c55e;
  box-shadow: 0 0 4px #22c55e;
}

.settings-back-btn {
  margin-top: 30px;
  padding: 12px 32px;
  border-radius: 30px;
  border: none;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(5px);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  animation: fadeSlideUp 0.5s ease-out 0.2s forwards;
  opacity: 0;
}

.settings-back-btn:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
}

.settings-back-btn:active {
  transform: scale(0.95);
}

/* ===== STATISTICS MODAL ===== */
.statistics-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.statistics-modal.visible {
  opacity: 1;
  visibility: visible;
}

.statistics-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.statistics-content {
  position: relative;
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: scale(0.8) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.statistics-modal.visible .statistics-content {
  transform: scale(1) translateY(0);
}

.statistics-close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 3px 0 #b91c1c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.1s;
}

.statistics-close-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #b91c1c;
}

.statistics-close-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #b91c1c;
}

.statistics-close-btn svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.statistics-title {
  /* Visually hidden but accessible to screen readers */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.statistics-table {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.statistics-table-header {
  display: grid;
  grid-template-columns: 1fr 70px 70px;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 4px;
}

.stat-label-col {
  /* Empty column header */
}

.stat-value-col {
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  text-transform: lowercase;
}

.statistics-section {
  padding: 4px 0;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px;
  gap: 8px;
  padding: 7px 0;
}

.stat-label {
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-transform: lowercase;
}

.stat-value {
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.stat-value.highlight {
  color: #fbbf24;
  font-size: 20px;
}

.statistics-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  margin: 4px 0;
}

.statistics-back-btn {
  margin-top: 20px;
  padding: 14px 32px;
  border-radius: 30px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  text-transform: lowercase;
}

.statistics-back-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

.statistics-back-btn:active {
  transform: scale(0.95);
}

.statistics-btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.statistics-btn-row .statistics-back-btn {
  margin-top: 0;
}

.statistics-share-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 30px;
  border: none;
  background: linear-gradient(135deg, #f0a020 0%, #e8940d 100%);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: lowercase;
  box-shadow: 0 4px 0 #c67f00;
}

.statistics-share-btn svg {
  width: 20px;
  height: 20px;
}

.statistics-share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #c67f00;
}

.statistics-share-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c67f00;
}

/* ===== RULES MODAL ===== */
.rules-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.rules-modal.visible {
  opacity: 1;
  visibility: visible;
}

.rules-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.rules-content {
  position: relative;
  width: 90%;
  max-width: 420px;
  max-height: 85vh;
  background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: scale(0.8) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.rules-modal.visible .rules-content {
  transform: scale(1) translateY(0);
}

.rules-close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 3px 0 #b91c1c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.1s;
}

.rules-close-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #b91c1c;
}

.rules-close-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #b91c1c;
}

.rules-close-btn svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.rules-title {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  text-transform: lowercase;
  margin: 0 0 16px 0;
  text-align: center;
}

/* Carousel container */
.rules-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  min-height: 0;
}

.rules-carousel::-webkit-scrollbar {
  display: none;
}

.rules-page {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  overflow-y: auto;
  padding-right: 8px;
  max-height: calc(85vh - 180px);
}

.rules-section {
  margin-bottom: 20px;
}

.rules-section h2 {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(16px, 4vw, 18px);
  font-weight: 800;
  color: #fbbf24;
  text-transform: lowercase;
  margin: 0 0 10px 0;
  letter-spacing: 0.5px;
}

.rules-section p {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(15px, 3.8vw, 17px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  margin: 0 0 10px 0;
}

.rules-scoring-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.rules-score-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.rules-score-item span:first-child {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 700;
  color: #fff;
  text-transform: lowercase;
}

.rules-score-item span:last-child {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(13px, 3.2vw, 15px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
}

.rules-bonus {
  margin-top: 28px;
  padding: 10px 12px;
  background: rgba(251, 191, 36, 0.15);
  border-radius: 8px;
  border-left: 3px solid #fbbf24;
}

.rules-bonus strong {
  color: #fbbf24;
}

/* Navigation */
.rules-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.rules-nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.15s;
}

.rules-nav-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.rules-nav-arrow:active {
  transform: scale(0.95);
}

.rules-nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.rules-nav-arrow:disabled:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: none;
}

.rules-nav-arrow svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.rules-nav-dots {
  display: flex;
  gap: 8px;
}

.rules-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.rules-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.rules-dot.active {
  background: #fbbf24;
  transform: scale(1.2);
}

.rules-back-btn {
  margin-top: 16px;
  padding: 14px 32px;
  border-radius: 30px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  text-transform: lowercase;
}

.rules-back-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

.rules-back-btn:active {
  transform: scale(0.95);
}

/* Learn more link */
.rules-learn-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}

.rules-learn-more:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.02);
}

.rules-learn-more:active {
  transform: scale(0.98);
}

.rules-learn-more span {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 700;
  color: #fbbf24;
  text-transform: lowercase;
}

.rules-learn-more svg {
  width: 18px;
  height: 18px;
  fill: #fbbf24;
}

/* ===== INSTALL PROMPT (Bottom Sheet) ===== */
.install-prompt {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #1e3a5f 0%, #0f2744 100%);
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  transition: transform 0.3s ease-out;
  z-index: 5000;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

.install-prompt.visible {
  transform: translateX(-50%) translateY(0);
}

.install-prompt-content {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.install-prompt-icon {
  font-size: 48px;
  line-height: 1;
}

.install-prompt-text {
  flex: 1;
}

.install-prompt-title {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: 800;
  color: #fff;
  text-transform: lowercase;
  margin-bottom: 4px;
}

.install-prompt-subtitle {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.install-prompt-buttons {
  display: flex;
  gap: 12px;
}

.install-prompt-later {
  flex: 1;
  padding: 14px 20px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.install-prompt-later:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.install-prompt-install {
  flex: 1;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  font-family: 'Nunito', sans-serif;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 #15803d;
  transition: transform 0.1s, box-shadow 0.1s;
}

.install-prompt-install:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #15803d;
}

.install-prompt-install:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #15803d;
}

/* ===== CHALLENGE CELEBRATION ANIMATIONS ===== */

/* Lightning bolt animation for challenge win */
.challenge-bolt-anim {
  position: absolute;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%) rotate(var(--bolt-angle)) translateY(0);
  opacity: 0;
  pointer-events: none;
}

.challenge-bolt-anim svg {
  width: 100%;
  height: 100%;
  fill: #f59e0b;
  filter: drop-shadow(0 0 10px #fbbf24) drop-shadow(0 0 20px #f59e0b);
}

.challenge-bolt-anim.animating {
  animation: boltShoot 0.8s ease-out forwards;
}

@keyframes boltShoot {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--bolt-angle)) translateY(0) scale(0.3);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--bolt-angle)) translateY(-80px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--bolt-angle)) translateY(-200px) scale(0.5);
  }
}

/* Central glow for challenge win */
.challenge-win-glow {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251,191,36,0.8) 0%, rgba(245,158,11,0.4) 40%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
}

.challenge-win-glow.animating {
  animation: glowPulse 0.6s ease-out forwards;
}

@keyframes glowPulse {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(5);
    opacity: 0;
  }
}

/* Sparkle particles for challenge win */
.challenge-sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fbbf24;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 6px #fbbf24, 0 0 12px #f59e0b;
}

.challenge-sparkle.animating {
  animation: sparkleFloat 0.8s ease-out forwards;
}

@keyframes sparkleFloat {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--sparkle-x)), calc(-50% + var(--sparkle-y))) scale(0);
  }
}


