/* === CSS Variables === */
:root {
  --bg-deep: #8B0D15;
  --bg-mid: #A6111D;
  --surface: rgba(247, 233, 208, 0.85);
  --surface-strong: rgba(247, 233, 208, 0.95);
  --border: rgba(139, 69, 19, 0.2);
  --text: #1A1A2E;
  --text-muted: #6B4C3B;
  --text-dim: #9E8577;
  --danger: #C91A29;
  --success: #24B04B;
  --accent: #FFC526;
  --accent-dark: #E6A800;
  --cream: #F7E9D0;
  --royal-blue: #2A62C4;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-soft: 0 4px 20px rgba(100, 20, 20, 0.25);
  --shadow-glow: 0 0 24px rgba(255, 197, 38, 0.45);
  --shadow-lifted: 0 12px 40px rgba(60, 10, 10, 0.4);
}

/* === Reset & Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at top, #C91A29 0%, #8B0D15 60%);
  color: var(--text);
  font-family: 'Fredoka', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
input { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 69, 19, 0.3); border-radius: 999px; }

/* === Animations === */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--hue-soft, rgba(255, 197, 38, 0.6)); }
  50% { box-shadow: 0 0 20px 4px var(--hue-soft, rgba(255, 197, 38, 0.6)); }
}
@keyframes floatUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spinIn {
  from { opacity: 0; transform: scale(0.8) rotate(-4deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes shimmer {
  to { background-position: 200% center; }
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px) rotate(-2deg); }
  40% { transform: translateX(3px) rotate(2deg); }
  60% { transform: translateX(-2px) rotate(-1deg); }
  80% { transform: translateX(2px) rotate(1deg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === UI Components === */
.btn-primary {
  background: linear-gradient(180deg, #FFDF43 0%, #FF9E00 100%);
  color: #3D2200;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  border: none;
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 150ms;
  box-shadow: 0 4px 0 #B8860B, 0 6px 20px rgba(255, 158, 0, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #B8860B, 0 10px 30px rgba(255, 158, 0, 0.4);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #B8860B, 0 2px 8px rgba(255, 158, 0, 0.2);
}
.btn-ghost {
  background: rgba(247, 233, 208, 0.15);
  color: #FFF8E7;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 16px;
  border: 1px solid rgba(247, 233, 208, 0.3);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 150ms, transform 150ms, border-color 150ms;
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(247, 233, 208, 0.25);
  border-color: rgba(247, 233, 208, 0.5);
  transform: translateY(-1px);
}
.btn-danger {
  background: rgba(201, 26, 41, 0.2);
  color: #FFB3B3;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid rgba(201, 26, 41, 0.4);
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(201, 26, 41, 0.35);
  border-color: rgba(201, 26, 41, 0.6);
}
.glass-card {
  background: #F7E9D0;
  border: 1px solid rgba(139, 69, 19, 0.15);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(100, 20, 20, 0.12);
  color: #1A1A2E;
}
.input {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  color: #1A1A2E;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.input::placeholder { color: #9E8577; }
.input:focus { border-color: #FFC526; box-shadow: 0 0 0 3px rgba(255, 197, 38, 0.25); }
.title-gradient {
  background: linear-gradient(135deg, #FFC526 0%, #FF9E00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 48px;
}
.error-msg {
  color: #FFB3B3;
  font-size: 14px;
  padding: 8px 14px;
  background: rgba(201, 26, 41, 0.15);
  border-radius: 10px;
  border: 1px solid rgba(201, 26, 41, 0.3);
}

/* === Start Screen === */
.hero {
  text-align: center;
  margin-bottom: 40px;
  animation: floatUp 500ms cubic-bezier(0.16, 1, 0.3, 1);
}
.dice-emoji {
  font-size: 64px;
  margin-bottom: 8px;
  animation: spinIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.start-title {
  font-size: clamp(56px, 14vw, 96px);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  margin: 0;
}
.subtitle {
  color: #FFD6D6;
  font-size: 18px;
  margin-top: 8px;
  font-weight: 400;
}
.welcome {
  color: #FFD6D6;
  font-size: 18px;
  margin-bottom: 24px;
}
.welcome strong { color: #FFF8E7; }
.name-row {
  padding: 8px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 320px;
  animation: floatUp 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.start-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.secondary-actions {
  display: flex;
  gap: 12px;
}

/* === Lobby === */
.lobby-title {
  font-size: clamp(36px, 8vw, 56px);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 720px;
  margin-bottom: 24px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px;
  cursor: pointer;
  text-align: center;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), background 150ms;
  animation: floatUp 350ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.mode-card:nth-child(1) { animation-delay: 0ms; }
.mode-card:nth-child(2) { animation-delay: 60ms; }
.mode-card:nth-child(3) { animation-delay: 120ms; }
.mode-card:hover { transform: translateY(-4px); background: #FFF3D6; }
.mode-icon { font-size: 36px; }
.mode-title { font-size: 17px; font-weight: 600; color: #1A1A2E; }
.mode-desc { font-size: 13px; color: #9E8577; }
.join-card {
  padding: 20px 24px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: floatUp 400ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: 180ms;
}
.join-title { font-size: 14px; color: #6B4C3B; font-weight: 500; }
.join-row { display: flex; gap: 12px; }
.join-row .input { flex: 1; text-align: center; letter-spacing: 4px; font-weight: 600; }

/* === Waiting Room === */
.code-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 40px;
  margin-bottom: 20px;
  animation: floatUp 350ms cubic-bezier(0.16, 1, 0.3, 1);
}
.code-label { font-size: 13px; color: #7C7799; text-transform: uppercase; letter-spacing: 1px; }
.code {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #FFC526 0%, #FF9E00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.code-hint { font-size: 13px; color: #9E8577; margin-top: 4px; }
.players-card {
  padding: 24px 28px;
  width: 100%;
  max-width: 480px;
  margin-bottom: 20px;
  animation: floatUp 400ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: 80ms;
}
.section-title { font-size: 18px; font-weight: 600; color: #1A1A2E; margin-bottom: 16px; }
.player-count { color: #9E8577; font-weight: 400; font-size: 15px; }
.player-list { display: flex; flex-direction: column; gap: 10px; }
.player-row { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}
.player-name { font-size: 16px; color: #1A1A2E; font-weight: 500; }
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139, 69, 19, 0.12);
  color: #6B4C3B;
}
.badge-you {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(36, 176, 75, 0.15);
  color: #1A8A3A;
}
.lobby-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.waiting-text { color: #9E8577; font-size: 15px; }

/* === Game Screen === */
.game-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  position: relative;
  z-index: 30;
  gap: 12px;
}
.top-bar-left { display: flex; gap: 24px; align-items: center; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 11px; color: #FFD6D6; text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 18px; font-weight: 700; color: #FFF8E7; }
.stat-max { font-size: 13px; color: #E8A0A0; font-weight: 400; }
.roll-dots { display: flex; gap: 5px; align-items: center; padding-top: 2px; }
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(247, 233, 208, 0.25);
  transition: background 200ms, transform 200ms;
}
.dot-active {
  background: linear-gradient(135deg, #FFC526 0%, #FF9E00 100%);
  transform: scale(1.1);
}
.top-bar-right { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(247, 233, 208, 0.12);
  border: 1px solid rgba(247, 233, 208, 0.2);
  color: #FFD6D6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, color 150ms, transform 150ms;
}
.icon-btn:hover {
  background: rgba(247, 233, 208, 0.25);
  color: #FFF8E7;
  transform: rotate(30deg);
}

/* === Player Tabs === */
.player-tabs {
  padding: 0 12px 12px;
  position: relative;
  z-index: 20;
}
.tabs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 4px 8px;
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 16px;
  background: rgba(247, 233, 208, 0.12);
  border: 1px solid rgba(247, 233, 208, 0.15);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 200ms, border-color 200ms, transform 150ms;
  position: relative;
}
.tab:hover { background: rgba(247, 233, 208, 0.22); transform: translateY(-1px); }
.tab-active {
  background: rgba(247, 233, 208, 0.3);
  border-color: rgba(247, 233, 208, 0.45);
}
.tab-turn {
  border-color: var(--hue);
  animation: pulseGlow 2s ease-in-out infinite;
}
.tab-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
}
.turn-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #24B04B;
  border: 2px solid #A6111D;
  animation: pulseGlow 1.5s ease-in-out infinite;
}
.tab-info { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.tab-name { font-size: 13px; font-weight: 600; color: #FFF8E7; display: flex; align-items: center; gap: 6px; }
.you-tag {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(36, 176, 75, 0.2);
  color: #24B04B;
  font-weight: 600;
}
.tab-score { font-size: 11px; color: #E8A0A0; }

/* === Scorecard === */
.scorecard-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 220px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.active-card {
  padding: 18px;
  animation: floatUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.active-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.active-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 15px;
}
.active-info { display: flex; flex-direction: column; }
.active-name { font-size: 16px; font-weight: 600; color: #1A1A2E; }
.active-total { font-size: 12px; color: #9E8577; }
.scorecard-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 520px) {
  .scorecard-sections { grid-template-columns: 1fr; gap: 12px; }
}
.section-col { display: flex; flex-direction: column; gap: 6px; }
.section { display: flex; flex-direction: column; gap: 4px; }
.section-label {
  font-size: 10px;
  color: #9E8577;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-bottom: 2px;
}
.cat-list { display: flex; flex-direction: column; gap: 3px; }
.cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid transparent;
  cursor: default;
  transition: background 150ms, border-color 150ms, transform 100ms;
  text-align: left;
  width: 100%;
}
.cat-label { font-size: 13px; color: #6B4C3B; font-weight: 500; }
.cat-value { font-size: 13px; font-weight: 700; color: #9E8577; min-width: 26px; text-align: right; }
.cat-scored { background: rgba(255, 255, 255, 0.6); }
.cat-scored .cat-value { color: #1A1A2E; }
.cat-scored .cat-label { color: #1A1A2E; }
.cat-interactive {
  cursor: pointer;
  background: rgba(255, 197, 38, 0.15);
  border-color: rgba(255, 197, 38, 0.4);
}
.cat-interactive:hover {
  background: rgba(255, 197, 38, 0.25);
  border-color: rgba(255, 197, 38, 0.6);
  transform: translateX(2px);
}
.cat-preview-good .cat-value { color: #24B04B; }
.cat-preview-zero .cat-value { color: #9E8577; }
.subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-top: 1px solid rgba(139, 69, 19, 0.12);
  font-size: 13px;
  font-weight: 700;
  color: #1A1A2E;
  margin-top: 2px;
}
.bonus-hint {
  font-size: 11px;
  color: #9E8577;
  padding: 0 10px;
  text-align: center;
}
.bonus-earned { color: #24B04B; font-weight: 600; }
.opponents { display: flex; flex-direction: column; gap: 8px; }
.opp-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  animation: floatUp 300ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.opp-card:nth-child(1) { animation-delay: 50ms; }
.opp-card:nth-child(2) { animation-delay: 100ms; }
.opp-card:nth-child(3) { animation-delay: 150ms; }
.opp-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}
.opp-info { display: flex; flex-direction: column; flex: 1; gap: 5px; }
.opp-top { display: flex; align-items: center; justify-content: space-between; }
.opp-name { font-size: 13px; font-weight: 500; color: #1A1A2E; }
.opp-score { font-size: 16px; font-weight: 700; }
.opp-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(139, 69, 19, 0.1);
  overflow: hidden;
}
.opp-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* === Dice Stage === */
.dice-stage {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(139, 13, 21, 0.98) 60%, rgba(139, 13, 21, 0.7) 85%, transparent);
  z-index: 25;
}
.dice-canvas-container {
  width: 100%;
  height: 130px;
  max-width: 500px;
}
.dice-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.roll-btn {
  min-width: 180px;
  font-size: 17px !important;
  padding: 14px 32px !important;
}

/* === Turn Banner === */
.turn-banner {
  position: fixed;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: rgba(247, 233, 208, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 69, 19, 0.15);
  color: #1A1A2E;
  font-size: 14px;
  font-weight: 500;
  z-index: 15;
  animation: floatUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.turn-avatar-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 12px;
}

/* === Error Floating === */
.error-floating {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  animation: floatUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* === Game Over Overlay === */
.game-over-overlay {
  position: fixed;
  inset: 0;
  background: rgba(139, 13, 21, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: floatUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.game-over-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 40px;
  max-width: 420px;
  width: 100%;
}
.game-over-emoji { font-size: 56px; animation: spinIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.game-over-title { font-size: 36px; font-weight: 700; letter-spacing: -1px; }
.game-over-winner { color: #6B4C3B; font-size: 16px; }
.game-over-rankings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 8px 0 16px;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(247, 233, 208, 0.5);
}
.rank-num {
  font-size: 16px;
  font-weight: 700;
  color: #9E8577;
  min-width: 20px;
}
.rank-name { flex: 1; font-size: 15px; color: #1A1A2E; font-weight: 500; }
.rank-score { font-size: 18px; font-weight: 700; color: #E6A800; }

/* === Connection Badge === */
.connection-badge {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(201, 26, 41, 0.2);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(201, 26, 41, 0.4);
  z-index: 400;
  animation: floatUp 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #C91A29;
  animation: pulseDot 1s ease-in-out infinite;
}
.connection-text {
  font-size: 13px;
  font-weight: 500;
  color: #FFB3B3;
}

/* === Celebration Overlay === */
.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 13, 21, 0.85);
  backdrop-filter: blur(4px);
  cursor: pointer;
  overflow: hidden;
}
.celebration-text-layer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  pointer-events: none;
}
.yatzy-text {
  font-size: clamp(56px, 16vw, 120px);
  font-weight: 700;
  letter-spacing: -3px;
  margin: 0;
  line-height: 1;
  background: linear-gradient(90deg, #FF0040 0%, #FF6B00 16%, #FFD500 33%, #7CFC00 50%, #00E5FF 66%, #7C4DFF 83%, #E040FB 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.15);
  animation: shimmer 2s linear infinite;
}
.celebration-player-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 8px 8px;
  border-radius: 999px;
  background: rgba(247, 233, 208, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 69, 19, 0.15);
}
.celebration-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}
.celebration-scored-by { font-size: 16px; color: #1A1A2E; }
.celebration-scored-by strong { font-weight: 700; }

/* === About / Rules === */
.about-title, .rules-title {
  font-size: clamp(36px, 8vw, 56px);
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -1px;
}
.about-card, .rules-card {
  padding: 24px 28px;
  width: 100%;
  max-width: 560px;
  margin-bottom: 16px;
  animation: floatUp 350ms cubic-bezier(0.16, 1, 0.3, 1);
}
.rules-card:nth-child(2) { animation-delay: 50ms; animation-fill-mode: backwards; }
.rules-card:nth-child(3) { animation-delay: 100ms; animation-fill-mode: backwards; }
.rules-card:nth-child(4) { animation-delay: 150ms; animation-fill-mode: backwards; }
.about-text {
  color: #6B4C3B;
  line-height: 1.7;
  font-size: 15px;
  margin-bottom: 16px;
}
.about-text:last-child { margin-bottom: 0; }
.about-text strong { color: #1A1A2E; }
.rules-section-title {
  font-size: 20px;
  font-weight: 600;
  color: #1A1A2E;
  margin-bottom: 12px;
}
.rules-list {
  list-style-position: inside;
  color: #6B4C3B;
  line-height: 1.8;
  font-size: 15px;
}
.rules-list li { margin-bottom: 4px; }
.rules-list strong { color: #1A1A2E; }

/* === Settings Popover === */
.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.settings-popover {
  position: absolute;
  top: 52px;
  right: 16px;
  width: 280px;
  z-index: 50;
  padding: 0;
  animation: floatUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(139, 69, 19, 0.12);
}
.settings-title { font-weight: 600; font-size: 15px; color: #1A1A2E; }
.settings-close {
  background: rgba(139, 69, 19, 0.1);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #6B4C3B;
  font-size: 12px;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-close:hover { background: rgba(139, 69, 19, 0.2); }
.settings-body { padding: 8px 0; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  cursor: pointer;
  transition: background 100ms;
}
.settings-row:hover { background: rgba(139, 69, 19, 0.05); }
.settings-row-text { display: flex; flex-direction: column; gap: 2px; }
.settings-row-label { font-size: 14px; color: #1A1A2E; font-weight: 500; }
.settings-row-desc { font-size: 12px; color: #9E8577; }
.settings-switch {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(139, 69, 19, 0.2);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 200ms;
  flex-shrink: 0;
}
.settings-switch-on {
  background: linear-gradient(135deg, #FFC526 0%, #FF9E00 100%);
}
.settings-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.settings-switch-on .settings-knob { transform: translateX(18px); }

/* === Confetti Layer === */
.confetti-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* === Responsive === */
@media (max-width: 480px) {
  .scorecard-area { padding: 0 12px 210px; }
  .active-card { padding: 14px; }
  .cat-row { padding: 7px 10px; }
  .cat-label { font-size: 13px; }
}
@media (max-width: 400px) {
  .top-bar { padding: 10px 12px; gap: 8px; }
  .top-bar-left { gap: 16px; }
}
