:root {
  --primary-color: #6366f1;
  --secondary-color: #8b5cf6;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --border-color: rgba(255,255,255,0.1);
  --text-color: #f1f5f9;
  --text-muted: #94a3b8;
  --success-color: #10b981;
  --danger-color: #ef4444;
}

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

body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: block; }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
  text-align: center;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0f172a;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
}

.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.role-badge {
  display: inline-block;
  background: rgba(99,102,241,0.2);
  color: var(--primary-color);
  border: 1px solid rgba(99,102,241,0.4);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.game-code-big {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--primary-color);
  text-align: center;
  margin: 12px 0;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.number-btn {
  aspect-ratio: 1;
  font-size: 1.3rem;
  font-weight: 700;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s;
}

.number-btn:hover {
  border-color: var(--primary-color);
  background: rgba(99,102,241,0.1);
}

.number-btn.selected {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-color: var(--primary-color);
}

.number-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.result-display {
  text-align: center;
  padding: 20px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 12px;
  margin: 16px 0;
}

.result-text-big {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-detail {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.score-row {
  display: flex;
  justify-content: space-around;
  margin: 16px 0;
}

.score-box {
  text-align: center;
  padding: 16px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  flex: 1;
  margin: 0 6px;
}

.score-box.winner-box {
  border-color: var(--primary-color);
  background: rgba(99,102,241,0.15);
}

.score-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.score-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-color);
}

.waiting-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  margin: 20px 0;
}

.winner-announcement {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.2));
  border: 2px solid var(--primary-color);
  border-radius: 16px;
  margin: 20px 0;
}

.winner-name {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.confirmed-waiting {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* === REACTIONS === */
.reaction-bar {
  margin-top: 20px;
  padding: 12px 10px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
}

.reaction-bar-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
}

.reaction-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.reaction-btn {
  font-size: 1.6rem;
  line-height: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

.reaction-btn:hover { background: rgba(255,255,255,0.14); transform: scale(1.18); }
.reaction-btn:active { transform: scale(0.88); }

.reaction-feedback {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 18px;
  margin-top: 6px;
}

/* Floating animation */
.reaction-float {
  position: fixed;
  top: -90px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  z-index: 9999;
  animation: reactionFall 3.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.reaction-float-emoji {
  font-size: 2.8rem;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.6));
}

.reaction-float-text {
  background: rgba(15,23,42,0.88);
  color: #f1f5f9;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.15);
}

@keyframes reactionFall {
  0%   { top: -90px; opacity: 0; }
  8%   { opacity: 1; }
  75%  { opacity: 1; }
  100% { top: 90vh; opacity: 0; }
}

/* === CONFETTI === */
.confetti-piece {
  position: fixed;
  top: -20px;
  pointer-events: none;
  z-index: 9998;
  opacity: 1;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(105vh) translateX(var(--drift)) rotate(var(--rotate)); opacity: 0; }
}
