* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.15);
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
:root {
  --bg: #07060a;
  --surface: rgba(22, 21, 29, 0.72);
  --surface2: #1a1a1a;
  --accent: #f7c948;
  --text: #eee;
  --text2: #777;
  --radius: 14px;
  --card-radius: 10px;
}
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); display: flex; flex-direction: column; position: relative;
}

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.28;
  animation: floatAmbient 14s ease-in-out infinite alternate;
  will-change: transform;
}
.glow-blob.gold {
  top: -10%;
  left: 10%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #f7c948 0%, #ff8c00 100%);
}
.glow-blob.crimson {
  bottom: -10%;
  right: 10%;
  width: 440px;
  height: 440px;
  background: radial-gradient(circle, #ff4757 0%, #a55eea 100%);
}
.glow-blob.emerald {
  top: 45%;
  left: 55%;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, #2ed573 0%, #00d2d3 100%);
  opacity: 0.18;
}

@keyframes floatAmbient {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(35px, 25px) scale(1.12); }
}

.header { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; background: rgba(17,17,17,0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; position: relative; z-index: 50; }
.header-left { display: flex; align-items: center; gap: 10px; }
.header h1 { font-size: 16px; font-weight: 900; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
@media (min-width: 360px) { .header h1 { font-size: 18px; gap: 6px; } }

.round-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(247, 201, 72, 0.08), rgba(255, 75, 75, 0.05));
  border: 1px solid rgba(247, 201, 72, 0.2);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  text-align: center;
  flex-shrink: 0;
}

.round-title {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #f7c948, #ff9800);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  will-change: transform, opacity;
}

@keyframes roundChangeAnim {
  0% {
    transform: scale(0.7) translateY(-6px);
    opacity: 0.2;
  }
  50% {
    transform: scale(1.18) translateY(0);
    filter: drop-shadow(0 0 12px rgba(247, 201, 72, 0.8));
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.round-animating {
  animation: roundChangeAnim 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.title-flip7 {
  background: linear-gradient(135deg, #f7c948, #ff9800, #ff6b6b);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s ease-in-out infinite;
  letter-spacing: 1px;
}

.title-dash {
  color: rgba(255, 255, 255, 0.25);
  font-weight: 600;
  margin: 0 1px;
}

.title-vengeance {
  font-weight: 900;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #ff1a1a, #ff5500, #ff0055, #d32f2f, #ff2a2a);
  background-size: 250% 250%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: vengeance-flame 3s ease-in-out infinite, vengeance-aura 2.2s ease-in-out infinite alternate;
  display: inline-block;
  text-transform: uppercase;
}

@keyframes vengeance-flame {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes vengeance-aura {
  0% {
    filter: drop-shadow(0 0 3px rgba(255, 30, 30, 0.6)) drop-shadow(0 0 6px rgba(255, 0, 0, 0.3));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(255, 60, 0, 0.9)) drop-shadow(0 0 15px rgba(255, 0, 80, 0.7));
    transform: scale(1.03) rotate(-0.5deg);
  }
  100% {
    filter: drop-shadow(0 0 12px rgba(255, 0, 40, 1)) drop-shadow(0 0 20px rgba(255, 100, 0, 0.8));
    transform: scale(1.02) rotate(0.5deg);
  }
}

@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.round-label { font-size: 14px; font-weight: 700; color: var(--text2); white-space: nowrap; }
.header-btns { display: flex; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--surface2); color: var(--text); font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .1s; border: 1px solid rgba(255,255,255,.08); }
.icon-btn:active { transform: scale(.9); }

.main { flex: 1; overflow-y: auto; padding: 12px 12px 100px; -webkit-overflow-scrolling: touch; }
.players { display: flex; flex-direction: column; gap: 10px; }
.player-row { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1.5px solid rgba(255,255,255,.06); transition: border-color 0.25s, box-shadow 0.25s, background 0.25s; }

/* Unscored Card Highlight */
.player-row.unscored-row {
  border: 2px solid #f7c948 !important;
  background: linear-gradient(135deg, rgba(247, 201, 72, 0.12), #141414) !important;
  animation: unscoredGlow 1.8s ease-in-out infinite alternate !important;
}

@keyframes unscoredGlow {
  0% {
    border-color: rgba(247, 201, 72, 0.4);
    box-shadow: 0 0 6px rgba(247, 201, 72, 0.15);
  }
  100% {
    border-color: #f7c948;
    box-shadow: 0 0 18px rgba(247, 201, 72, 0.45);
  }
}

.needs-score-badge {
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: 1px;
  color: #000 !important;
  background: #f7c948 !important;
  border: none !important;
  padding: 4px 10px !important;
  border-radius: 20px !important;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(247, 201, 72, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.row-content { border-radius: var(--radius); padding: 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: transform .1s, box-shadow .15s; position: relative; z-index: 1; background: transparent; }
.player-row:active .row-content { transform: scale(.98); }

.avatar { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; color: #fff; flex-shrink: 0; text-shadow: 0 1px 3px rgba(0,0,0,.5); box-shadow: 0 2px 8px rgba(0,0,0,.3); background-size: 150% 150%; background-position: center; text-transform: uppercase; }

.player-info { flex: 1; min-width: 0; }
.player-name { font-weight: 700; font-size: 14px; text-transform: uppercase; }
.player-total { font-size: 12px; color: var(--text2); }

.score-area { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.medal { font-size: 16px; }
.scores { display: flex; flex-direction: column; align-items: flex-end; }
.round-score { font-size: 20px; font-weight: 800; line-height: 1.1; color: #4ecdc4; }
.total-score { font-size: 12px; font-weight: 700; color: var(--text2); line-height: 1.1; }

/* Progress bar */
.progress-container { position: absolute; bottom: 0; left: 0; right: 0; height: 5px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; background: rgba(255,255,255,0.05); z-index: 2; }
.progress-bar { height: 100%; transition: width 0.9s cubic-bezier(0.4,0,0.2,1); position: relative; overflow: hidden; border-radius: 0 3px 3px 0; }
.progress-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.55) 50%, transparent 100%); animation: progress-flow 1.8s infinite linear; }
@keyframes progress-flow { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }

.add-player-btn { background: var(--surface); border: 2px dashed rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px; text-align: center; color: var(--text2); font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .15s; margin-top: 10px; }
.add-player-btn:hover { border-color: rgba(255,255,255,.3); }

.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg), var(--bg) 70%, transparent); display: flex; gap: 10px; z-index: 10; }
.btn { flex: 1; padding: 14px; border-radius: var(--radius); border: none; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .1s; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, #c9961a, #c94040); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid rgba(255,255,255,.08); }
.btn-newgame { background: linear-gradient(135deg, #4ecdc4, #a855f7); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.overlay.active { opacity: 1; pointer-events: auto; }

.sheet { position: fixed; bottom: 0; left: 0; right: 0; background: #111; border-radius: 20px 20px 0 0; z-index: 51; transform: translateY(100%); transition: transform .3s cubic-bezier(.4, 0, .2, 1); max-height: 94vh; display: flex; flex-direction: column; border-top: 1px solid rgba(255,255,255,.1); max-width: 520px; margin: 0 auto; overflow: hidden; }
.sheet.active { transform: translateY(0); }
.sheet.keyboard-up { border-radius: 20px 20px 0 0; transition: bottom .25s ease-out, max-height .25s ease-out; }
.sheet-handle { width: 36px; height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; margin: 8px auto 4px; flex-shrink: 0; }
.sheet-header { padding: 0 16px 6px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.sheet-header h2 { font-size: 17px; font-weight: 700; }
.sheet-body { padding: 0 14px 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; justify-content: space-between; flex: 1; }

.card-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text2); margin: 6px 0 3px; letter-spacing: 1px; }
.card-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.card-btn { height: clamp(32px, 5.5vh, 44px); border-radius: var(--card-radius); border: 1.5px solid rgba(255,255,255,.08); background: #0a0a0a; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all .15s; position: relative; overflow: hidden; }
.card-btn .card-value { font-size: 15px; font-weight: 800; line-height: 1; pointer-events: none;}
.card-btn.active { border-color: var(--accent); background: rgba(247,201,72,.15); box-shadow: 0 0 12px rgba(247,201,72,.2); }
.card-btn.active .card-value { color: var(--accent); }
.card-btn.disabled { opacity: .3; pointer-events: none; }
.card-btn.bonus { background: rgba(255,152,0,.08); border-color: rgba(255,152,0,.2); }
.card-btn.bonus.active { border-color: #ff9800; background: rgba(255,152,0,.2); box-shadow: 0 0 12px rgba(255,152,0,.2); }
.card-btn.bonus.active .card-value { color: #ff9800; }
.card-btn.x2 { background: rgba(233,30,99,.08); border-color: rgba(233,30,99,.2); }
.card-btn.x2.active { border-color: #e91e63; background: rgba(233,30,99,.2); box-shadow: 0 0 12px rgba(233,30,99,.2); }
.card-btn.x2.active .card-value { color: #e91e63; }
.card-btn.freeze { background: rgba(162,219,250,.08); border-color: rgba(162,219,250,.2); }
.card-btn.freeze.active { border-color: #a2dbfa; background: rgba(162,219,250,.2); box-shadow: 0 0 12px rgba(162,219,250,.2); }
.card-btn.freeze.active .card-value, .card-btn.freeze.active div { color: #a2dbfa !important; }

.card-btn.special { background: rgba(247,201,72,.08); border-color: rgba(247,201,72,.2); }
.card-btn.special.active { border-color: #f7c948; background: rgba(247,201,72,.25); box-shadow: 0 0 12px rgba(247,201,72,.3); }
.card-btn.special.active .card-value { color: #f7c948 !important; }

.card-btn.special.unlucky { background: rgba(255,75,75,.08); border-color: rgba(255,75,75,.2); }
.card-btn.special.unlucky.active { border-color: #ff4b4b; background: rgba(255,75,75,.25); box-shadow: 0 0 12px rgba(255,75,75,.3); }
.card-btn.special.unlucky.active .card-value { color: #ff4b4b !important; }

.card-btn.special.lucky { background: rgba(76,217,100,.08); border-color: rgba(76,217,100,.2); }
.card-btn.special.lucky.active { border-color: #4cd964; background: rgba(76,217,100,.25); box-shadow: 0 0 12px rgba(76,217,100,.3); }
.card-btn.special.lucky.active .card-value { color: #4cd964 !important; }

.card-btn.action-veng { background: rgba(171,71,188,.08); border-color: rgba(171,71,188,.2); }
.card-btn.action-veng.active { border-color: #ab47bc; background: rgba(171,71,188,.25); box-shadow: 0 0 12px rgba(171,71,188,.3); }
.card-btn.action-veng.active .card-value { color: #ab47bc !important; }

.seven-bonus { text-align: center; padding: 4px; color: #4ecdc4; font-weight: 700; font-size: 12px; display: none; }
.seven-bonus.show { display: block; }

.card-count { text-align: center; font-size: 11px; color: var(--text2); margin-top: 3px; }
.card-count.full { color: #ff6b6b; font-weight: 700; }

.score-summary { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); margin-top: 4px; }
.score-summary .calc { font-size: 12px; color: var(--text2); flex: 1; margin-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-summary .total { font-size: 24px; font-weight: 800; color: var(--accent); }

.card-footer-actions { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.card-footer-actions .busted-btn { flex: 1; padding: 10px 4px; border-radius: var(--card-radius); border: 1.5px solid rgba(255,75,75,.3); background: rgba(255,75,75,.1); color: #ff4b4b; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; margin-top: 0; }
.card-footer-actions input { flex: 1; padding: 10px 8px; border-radius: var(--card-radius); border: 1px solid rgba(255,255,255,.12); background: var(--bg); color: var(--text); font-size: 13px; font-weight: 600; outline: none; min-width: 0; text-align: center; }
.card-footer-actions .btn-primary { flex: 1.2; padding: 10px 8px; border-radius: var(--card-radius); font-size: 13px; font-weight: 700; white-space: nowrap; }

.sheet.locked .card-footer-actions { display: none; }
.sheet.locked .card-btn { cursor: default; }
.locked-empty { grid-column: 1 / -1; text-align: center; padding: 16px; color: #ff4b4b; font-weight: 800; font-size: 16px; letter-spacing: 2px; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.form-group input { width: 100%; padding: 10px 12px; border-radius: var(--card-radius); border: 1px solid rgba(255,255,255,.12); background: #0a0a0a; color: var(--text); font-size: 15px; font-weight: 600; outline: none; }
.form-group input:focus { border-color: var(--accent); }
#playerInitials { text-transform: uppercase; }

/* Start / Configure New Game Sheet Styling */
.target-preset-row { display: flex; gap: 8px; margin-top: 6px; margin-bottom: 6px; }
.preset-btn { flex: 1; padding: 10px 4px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: var(--surface2); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.preset-btn.active, .preset-btn:active { border-color: var(--accent); background: rgba(247,201,72,.15); color: var(--accent); }

/* Hide up/down spinner arrows on number inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.brutal-mode-card {
  margin-top: 16px;
  background: rgba(255,42,42,.08);
  border: 1px solid rgba(255,42,42,.25);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.brutal-mode-card.active { background: rgba(255,42,42,.15); border-color: rgba(255,42,42,.6); box-shadow: 0 0 16px rgba(255,42,42,.2); }
.brutal-text { flex: 1; min-width: 0; }
.brutal-label { font-size: 15px; font-weight: 800; color: #ff4b4b; display: flex; align-items: center; gap: 6px; }
.brutal-checkbox { width: 24px; height: 24px; accent-color: #ff4b4b; cursor: pointer; flex-shrink: 0; margin: 0; align-self: center; }
.brutal-desc { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 4px; line-height: 1.4; }

.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.color-opt { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: transform .1s; background-size: 150% 150%; background-position: center; }
.color-opt.active { border-color: #fff; transform: scale(1.15); }
.color-opt.taken { opacity: .15; pointer-events: none; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.form-actions .btn { padding: 12px; }

.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.setting-row label { font-size: 14px; font-weight: 600; }
.setting-row input { width: 80px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: var(--bg); color: var(--text); font-size: 16px; font-weight: 600; text-align: center; outline: none; }
.danger-btn { width: 100%; padding: 12px; border-radius: var(--card-radius); border: 2px solid rgba(255,75,75,.3); background: rgba(255,75,75,.1); color: #ff4b4b; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 16px; }



.results-grid { margin-top: 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: stretch; display: none; }
.results-grid.show { display: grid; animation: slideUpFade 0.6s ease-out forwards; }
@keyframes slideUpFade { 0% { opacity: 0; transform: translateY(30px); } 100% { opacity: 1; transform: translateY(0); } }
@media (min-width: 760px) { .results-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.results-section, .stats-section { display: flex; flex-direction: column; }
.results-section h3, .stats-section h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; color: var(--text2); letter-spacing: 1px; margin-bottom: 10px; }
.chart-wrap { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center; background: rgba(17,17,17,0.75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 12px; overflow: hidden; }
.chart-wrap canvas { width: 100%; height: 200px; display: block; flex-shrink: 0; cursor: crosshair; }
.chart-tooltip {
  position: absolute;
  top: 10px;
  background: rgba(14, 13, 20, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 10px;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  font-size: 11px;
  color: #fff;
  min-width: 150px;
  max-width: 220px;
  animation: fadeInFast 0.15s ease-out;
}
@keyframes fadeInFast { 0% { opacity: 0; transform: scale(0.96); } 100% { opacity: 1; transform: scale(1); } }
.chart-tooltip-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #f7c948;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chart-tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}
.chart-tooltip-player {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}
.chart-tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.chart-tooltip-score {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.chart-tooltip-sub {
  font-size: 10px;
  color: var(--text2);
  margin-left: 4px;
}
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin-top: 10px; }
.chart-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.stats-card { flex: 1; display: flex; flex-direction: column; justify-content: center; background: rgba(17,17,17,0.75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 14px; container-type: inline-size; }
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@container (min-width: 320px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
.stat-box { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; min-height: 80px; }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text2); letter-spacing: 1px; }
.stat-value { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.stat-sub { font-size: 11px; color: var(--text2); }
.flip7-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.player-chip { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.player-chip .mini-avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 9px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); background-size: 150% 150%; background-position: center; flex-shrink: 0; }

.snow-flake {
  position: absolute;
  top: -20px;
  pointer-events: none;
  z-index: 3;
  color: rgba(162,219,250,0.85);
  animation: snowFall linear forwards;
  will-change: transform, opacity;
}
@keyframes snowFall {
  0%   { transform: translateY(0)     rotate(0deg);  opacity: 0; }
  8%   { opacity: 1; }
  88%  { opacity: 0.9; }
  100% { transform: translateY(130px) rotate(var(--spin,45deg)); opacity: 0; }
}

.falling-seven {
  position: absolute;
  top: -24px;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  pointer-events: none;
  user-select: none;
  z-index: 4;
  animation: fallSeven linear forwards;
  will-change: transform, opacity;
}
@keyframes fallSeven {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  85%  { opacity: 0.95; }
  100% { transform: translateY(130px) rotate(var(--spin, 45deg)); opacity: 0; }
}

@keyframes avatarShiver {
  0%   { transform: translateX(0)    rotate(0deg); }
  10%  { transform: translateX(-6px) rotate(-1deg); }
  25%  { transform: translateX(6px)  rotate(1deg); }
  40%  { transform: translateX(-5px) rotate(-0.5deg); }
  55%  { transform: translateX(5px)  rotate(0.5deg); }
  70%  { transform: translateX(-4px) rotate(-0.5deg); }
  85%  { transform: translateX(3px)  rotate(0.5deg); }
  100% { transform: translateX(0)    rotate(0deg); }
}
.avatar.shivering { animation: avatarShiver 0.38s ease-in-out; }


@keyframes shake { 0%, 100% { transform: translateX(0); } 10%, 50%, 90% { transform: translateX(-4px); } 30%, 70% { transform: translateX(4px); } }
.shake { animation: shake .4s ease-in-out; }
@keyframes pop { 0% { transform: scale(.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.player-row.new-row { animation: pop .2s ease-out; }

.avatar-wrap { position: relative; cursor: pointer; }
.avatar-wrap .edit-badge { position: absolute; bottom: -2px; right: -2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #000; opacity: 0; transition: opacity .15s; }
.avatar-wrap:hover .edit-badge, .avatar-wrap:active .edit-badge { opacity: 1; }

.fireworks-overlay { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.firework { position: absolute; width: 6px; height: 6px; border-radius: 50%; animation: firework-burst .8s ease-out forwards; }
@keyframes firework-burst { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx),var(--dy)) scale(0); opacity: 0; } }

.card-fireworks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; border-radius: var(--radius); }
.winner-row-firework { position: absolute; width: 4px; height: 4px; border-radius: 50%; animation: firework-burst 1.2s ease-out forwards; }

/* Player stats drawer (results page — lives inside .player-row) */
.stats-drawer { height: 0; overflow: hidden; }
.stats-drawer-inner {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px 12px;
}
.psd-stat { display: flex; flex-direction: column; gap: 2px; }
.psd-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text2); }
.psd-value { font-size: 18px; font-weight: 800; color: var(--text); display: flex; align-items: baseline; gap: 5px; }
.psd-sub { font-size: 11px; font-weight: 600; color: var(--text2); }

/* Helper to hide things */
[hidden], .hidden { display: none !important; }
