* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --felt-green: #0a6e3a;
  --felt-dark: #064d28;
  --wood-brown: #5c3a1e;
  --gold: #FFD700;
  --bg-dark: #0a1a0f;
  --neon-green: #00FF88;
  --chalk-blue: #4a9eff;
}

body {
  font-family: 'Press Start 2P', monospace;
  background: #000;
  color: white;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(135deg, #0a1a0f 0%, #0a2a15 50%, #0a1a1a 100%);
}

.scanlines {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 2px, transparent 2px, transparent 4px);
}

.felt-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
  background:
    radial-gradient(circle at 20% 30%, rgba(0,255,136,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,215,0,0.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(10,110,58,0.08) 0%, transparent 60%);
  animation: bgPulse 10s ease-in-out infinite alternate;
}

@keyframes bgPulse { 0%{opacity:0.5} 100%{opacity:0.8} }

.floating-balls {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

.float-ball {
  position: absolute; font-size: 2rem; opacity: 0.1;
  animation: floatBall 10s ease-in-out infinite;
}

@keyframes floatBall {
  0%,100%{transform:translateY(0) translateX(0) rotate(0deg)}
  25%{transform:translateY(-25px) translateX(15px) rotate(90deg)}
  50%{transform:translateY(-10px) translateX(-15px) rotate(180deg)}
  75%{transform:translateY(-30px) translateX(10px) rotate(270deg)}
}

.app {
  position: relative; z-index: 1; max-width: 1000px;
  margin: 0 auto; padding: 40px 20px;
  opacity: 0; transform: translateY(30px);
  transition: opacity 1s ease, transform 1s ease;
}
.app.loaded { opacity: 1; transform: translateY(0); }

header { text-align: center; margin-bottom: 60px; }

.title-container {
  display: flex; align-items: center; justify-content: center;
  gap: 25px; margin-bottom: 25px;
}

.title-ball { font-size: 3rem; filter: drop-shadow(0 0 20px rgba(255,255,255,0.4)); }

h1 {
  font-size: 3.5rem; letter-spacing: 8px;
  animation: titleGlow 3s ease-in-out infinite alternate;
}

.title-8 {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255,215,0,0.7), 0 0 20px rgba(255,215,0,0.4);
}
.title-dash { color: white; animation: dashBlink 1.2s step-end infinite; }
.title-ball-text {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(0,255,136,0.7), 0 0 20px rgba(0,255,136,0.4);
}

@keyframes titleGlow { 0%{filter:brightness(1)} 100%{filter:brightness(1.1)} }
@keyframes dashBlink { 0%,49%{opacity:1} 50%,100%{opacity:0.2} }

h2 {
  font-size: 0.95rem; color: var(--neon-green); letter-spacing: 5px;
  text-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green);
  animation: subtitlePulse 4s ease-in-out infinite;
}

@keyframes subtitlePulse { 0%,100%{opacity:1} 50%{opacity:0.8} }

.pool-dots {
  display: flex; justify-content: center; gap: 15px; margin-top: 25px; flex-wrap: wrap;
}
.pool-dot {
  width: 10px; height: 10px; border-radius: 50%;
  animation: dotPulse 2.5s ease-in-out infinite; opacity: 0.7;
  box-shadow: 0 0 10px currentColor;
}
@keyframes dotPulse { 0%,100%{transform:scale(1);opacity:0.7} 50%{transform:scale(1.4);opacity:1} }

.scoreboard { display: flex; flex-direction: column; gap: 25px; }

.score-row {
  display: grid; grid-template-columns: 220px 1fr 180px;
  align-items: center; gap: 20px; padding: 20px 25px;
  background: linear-gradient(135deg, rgba(10,60,30,0.7), rgba(6,40,20,0.7));
  border: 2px solid rgba(0,255,136,0.2);
  border-radius: 16px; opacity: 0;
  transform: translateX(-80px) scale(0.95);
  transition: all 0.7s cubic-bezier(0.16,1,0.3,1);
  position: relative; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.score-row::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  animation: shimmer 4s ease-in-out infinite;
}
@keyframes shimmer { 0%{left:-100%} 100%{left:200%} }

.score-row.visible { opacity: 1; transform: translateX(0) scale(1); }
.score-row:hover {
  transform: translateX(8px) scale(1.02);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 40px rgba(0,255,136,0.15);
}

.score-row.first-place {
  background: linear-gradient(135deg, rgba(50,50,10,0.8), rgba(40,40,5,0.8));
  border-color: rgba(255,215,0,0.4);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 60px rgba(255,215,0,0.15);
}

.player-info { display: flex; align-items: center; gap: 12px; }
.rank { font-size: 0.8rem; color: #888; min-width: 32px; }
.rank-emoji { font-size: 1.4rem; min-width: 28px; animation: rankBounce 2.5s ease-in-out infinite; }
@keyframes rankBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px) rotate(10deg)} }
.player-icon { font-size: 1.6rem; animation: iconWobble 3.5s ease-in-out infinite; }
@keyframes iconWobble { 0%,100%{transform:rotate(0) scale(1)} 25%{transform:rotate(8deg) scale(1.1)} 75%{transform:rotate(-8deg) scale(1.1)} }
.player-name {
  font-size: 1rem; color: var(--gold);
  text-shadow: 0 0 10px rgba(255,215,0,0.5); letter-spacing: 2px;
}

.bar-container {
  height: 40px;
  background: linear-gradient(135deg, #0a2a15, #0a3a1a);
  border-radius: 20px; position: relative; overflow: hidden;
  border: 2px solid #1a4a2e;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}
.bar {
  height: 100%; border-radius: 20px; width: 0%;
  transition: width 2.5s cubic-bezier(0.16,1,0.3,1);
  position: relative; overflow: hidden;
}
.bar-shine {
  position: absolute; top: 0; left: 0; width: 100%; height: 60%;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent);
  border-radius: 20px 20px 0 0;
}
.bar-particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.particle {
  position: absolute; bottom: 0; width: 4px; height: 4px;
  background: rgba(255,255,255,0.8); border-radius: 50%;
  animation: particleFloat 2.5s ease-in-out infinite;
}
@keyframes particleFloat { 0%{transform:translateY(0);opacity:1} 50%{transform:translateY(-20px);opacity:0.5} 100%{transform:translateY(-35px);opacity:0} }
.bar-end-glow {
  position: absolute; right: -6px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%;
  animation: endGlow 2s ease-in-out infinite alternate; filter: blur(4px);
}
@keyframes endGlow { 0%{opacity:0.6;transform:translateY(-50%) scale(1)} 100%{opacity:1;transform:translateY(-50%) scale(1.8)} }

.score-value { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.score-number {
  font-size: 1.3rem; color: white;
  text-shadow: 0 0 15px rgba(255,255,255,0.7);
  font-variant-numeric: tabular-nums;
}
.score-pts { font-size: 0.55rem; color: #888; letter-spacing: 3px; margin-top: 4px; }

/* STATS */
.stats-section, .performance-section { margin-top: 80px; padding: 40px 20px; }
.section-title {
  font-size: 1.2rem; text-align: center; color: var(--gold);
  margin-bottom: 40px; letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255,215,0,0.6);
}
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 25px; max-width: 1000px; margin: 0 auto;
}
.stats-card {
  background: linear-gradient(135deg, rgba(10,60,30,0.8), rgba(6,40,20,0.8));
  border: 2px solid rgba(0,255,136,0.3); border-radius: 16px;
  padding: 30px 20px; text-align: center;
  transition: all 0.4s ease; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.stats-card:hover {
  transform: translateY(-10px) scale(1.05); border-color: var(--gold);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 40px rgba(255,215,0,0.2);
}
.stats-icon { font-size: 3rem; margin-bottom: 15px; animation: iconFloat 3s ease-in-out infinite; }
@keyframes iconFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.stats-value { font-size: 2rem; color: white; margin: 15px 0; text-shadow: 0 0 20px rgba(255,255,255,0.5); }
.stats-label { font-size: 0.6rem; color: #888; letter-spacing: 3px; }

.performance-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px; max-width: 800px; margin: 0 auto;
}
.performance-card {
  background: linear-gradient(135deg, rgba(10,60,30,0.8), rgba(6,40,20,0.8));
  border: 2px solid rgba(0,255,136,0.3); border-radius: 16px;
  padding: 30px 20px; text-align: center; transition: all 0.4s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.performance-card:hover {
  transform: translateY(-10px); border-color: var(--chalk-blue);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 40px rgba(74,158,255,0.2);
}
.perf-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; }
.perf-icon { font-size: 2rem; }
.perf-name { font-size: 0.9rem; color: var(--gold); letter-spacing: 2px; }
.perf-ring { margin: 20px 0; display: flex; justify-content: center; }
.progress-ring circle { transition: stroke-dashoffset 1.5s ease; }
.perf-score { font-size: 0.8rem; color: #888; letter-spacing: 2px; margin-top: 15px; }

/* FOOTER */
footer { text-align: center; margin-top: 80px; padding-bottom: 50px; }
.footer-dots { margin-bottom: 25px; }
.footer-dot {
  font-size: 2rem; color: var(--neon-green); display: inline-block; margin: 0 4px;
  animation: footerDotPulse 2.5s ease-in-out infinite;
}
@keyframes footerDotPulse { 0%,100%{opacity:0.4;transform:scale(0.8)} 50%{opacity:1;transform:scale(1.4)} }
.insert-coin {
  font-size: 0.75rem; color: #888; letter-spacing: 5px;
  animation: insertCoin 1.8s step-end infinite; cursor: default; user-select: none;
}
@keyframes insertCoin { 0%,49%{opacity:1} 50%,100%{opacity:0} }
.high-score-flash {
  margin-top: 25px; font-size: 0.85rem; color: var(--gold);
  text-shadow: 0 0 20px rgba(255,215,0,0.6);
  animation: highScoreFlash 2.5s ease-in-out infinite alternate; letter-spacing: 4px;
}
@keyframes highScoreFlash { 0%{opacity:0.8} 100%{opacity:1;text-shadow:0 0 30px var(--gold)} }
.final-footer {
  margin-top: 40px; padding: 40px 20px;
  background: linear-gradient(180deg, transparent, rgba(10,26,15,0.8));
  border-top: 2px solid rgba(0,255,136,0.15);
}
.copyright { font-size: 0.6rem; color: #666; letter-spacing: 2px; margin-bottom: 15px; }
.made-with { font-size: 0.65rem; color: #888; letter-spacing: 2px; }
.heart { color: #FF006E; animation: heartBeat 1.5s ease-in-out infinite; display: inline-block; }
@keyframes heartBeat { 0%,100%{transform:scale(1)} 25%{transform:scale(1.2)} }
.back-link {
  display: inline-block; margin-top: 20px; font-size: 0.55rem;
  color: var(--neon-green); text-decoration: none; letter-spacing: 3px;
  transition: all 0.3s ease; border: 1px solid rgba(0,255,136,0.3);
  padding: 8px 16px; border-radius: 8px;
}
.back-link:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }

/* ADMIN */
.admin-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(10px);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
}
.admin-overlay.open { opacity: 1; pointer-events: all; }
.admin-panel {
  background: linear-gradient(135deg, #0a3a1e, #062a14);
  border: 3px solid var(--gold); border-radius: 20px;
  padding: 35px; max-width: 560px; width: 90%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 0 60px rgba(255,215,0,0.2); position: relative;
  animation: adminPanelAppear 0.4s ease;
}
@keyframes adminPanelAppear { from{transform:scale(0.9);opacity:0} to{transform:scale(1);opacity:1} }
.admin-panel h3 {
  font-size: 0.95rem; color: var(--gold); text-align: center; margin-bottom: 25px;
}
.admin-close {
  position: absolute; top: 15px; right: 20px; background: none; border: none;
  color: #FF0000; font-size: 1.3rem; cursor: pointer; font-family: 'Press Start 2P', monospace;
  transition: all 0.3s ease;
}
.admin-close:hover { text-shadow: 0 0 20px #FF0000; transform: scale(1.2); }
.admin-form { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.admin-input {
  font-family: 'Press Start 2P', monospace; font-size: 0.7rem;
  padding: 12px 16px; background: #0a2a15; border: 2px solid #1a4a2e;
  border-radius: 10px; color: white; text-align: center; width: 100%; outline: none;
  transition: all 0.3s ease;
}
.admin-input:focus { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,215,0,0.3); }
.admin-btn {
  font-family: 'Press Start 2P', monospace; font-size: 0.6rem;
  padding: 12px 22px; background: linear-gradient(135deg, #1a4a2e, #0a3a1e);
  border: 2px solid #2a6a3e; border-radius: 10px; color: white; cursor: pointer;
  transition: all 0.3s ease;
}
.admin-btn:hover {
  background: linear-gradient(135deg, #2a6a3e, #1a4a2e);
  border-color: var(--gold); box-shadow: 0 0 25px rgba(255,215,0,0.3); transform: translateY(-2px);
}
.admin-btn.green { border-color: #00FF0066; }
.admin-btn.green:hover { border-color: #00FF00; box-shadow: 0 0 25px rgba(0,255,0,0.4); }
.admin-error { color: #FF0000; font-size: 0.55rem; text-shadow: 0 0 10px rgba(255,0,0,0.6); animation: shake 0.4s ease; }
.admin-success { color: #00FF00; font-size: 0.55rem; text-shadow: 0 0 10px rgba(0,255,0,0.6); text-align: center; margin-top: 10px; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }
.admin-players { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.admin-row {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  background: rgba(10,42,21,0.9); border: 2px solid #1a4a2e;
  border-radius: 10px; flex-wrap: wrap; transition: all 0.3s ease;
}
.admin-row:hover { border-color: #2a6a3e; transform: translateX(5px); }
.admin-row input {
  font-family: 'Press Start 2P', monospace; font-size: 0.6rem;
  padding: 8px 10px; background: #0a2a15; border: 2px solid #1a4a2e;
  border-radius: 8px; color: white; outline: none; transition: all 0.3s ease;
}
.admin-row input:focus { border-color: var(--gold); }
.admin-row .n { flex: 1; min-width: 90px; }
.admin-row .s { width: 100px; text-align: right; }
.admin-row .e { width: 50px; text-align: center; }
.admin-row .c { width: 40px; height: 32px; padding: 3px; cursor: pointer; border-radius: 8px; background: #0a2a15; border: 2px solid #1a4a2e; }
.admin-del { background: none; border: none; color: #FF000088; font-size: 1rem; cursor: pointer; padding: 4px 8px; transition: all 0.3s ease; }
.admin-del:hover { color: #FF0000; transform: scale(1.3); }
.admin-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 15px; }
.admin-divider { border: none; border-top: 2px solid #1a4a2e; margin: 22px 0; }
.admin-label { font-size: 0.6rem; color: var(--chalk-blue); margin-bottom: 8px; letter-spacing: 2px; }
.admin-pw-section input {
  font-family: 'Press Start 2P', monospace; font-size: 0.6rem;
  padding: 10px; background: #0a2a15; border: 2px solid #1a4a2e;
  border-radius: 8px; color: white; outline: none; width: 100%; margin-bottom: 8px;
  transition: all 0.3s ease;
}
.admin-pw-section input:focus { border-color: var(--gold); }

@media (max-width:768px) {
  h1{font-size:2.2rem;letter-spacing:4px}
  h2{font-size:0.7rem}
  .score-row{grid-template-columns:1fr;gap:12px;padding:16px 20px}
  .player-info{justify-content:center}
  .bar-container{height:32px}
  .score-value{align-items:center;flex-direction:row;justify-content:center;gap:10px}
  .score-number{font-size:1rem}
  .title-container{gap:15px}
  .app{padding:30px 15px}
  .stats-grid,.performance-grid{grid-template-columns:1fr;gap:20px}
  .section-title{font-size:0.9rem}
  .stats-value{font-size:1.5rem}
}

@media (max-width:480px) {
  h1{font-size:1.6rem;letter-spacing:2px}
  .app{padding:25px 12px}
  .player-name{font-size:0.8rem}
  .score-number{font-size:0.9rem}
  .admin-panel{padding:25px 20px}
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration:0.01ms!important; animation-iteration-count:1!important; transition-duration:0.01ms!important; }
}
