:root {
  --color-primary: #0C2456;
  --color-secondary: #B62D58;
  --color-text: #232323;
  --color-accent: rgba(42, 47, 43, 0.23);
  --color-pink-light: #E89CB4;
  --color-dark-blue: #091C42;
  --color-gray: #A9A9A9;
  --color-white: #ffffff;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--color-text);
  background: var(--color-dark-blue);
  min-height: 100vh;
}

/* Layout */
.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 40px 20px;
}

.container--narrow {
  max-width: 400px;
  text-align: center;
}

/* Typography */
h1, h2, h3 {
  color: var(--color-white);
}

h1 { font-size: 1.75rem; margin-bottom: 8px; }
h2 { font-size: 1.35rem; margin-bottom: 12px; }
h3 { font-size: 1.1rem; margin-bottom: 8px; }

p { line-height: 1.5; }

/* Cards */
.card {
  background: var(--color-white);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.card--primary {
  background: var(--color-primary);
  color: var(--color-white);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.card--highlight {
  background: var(--color-secondary);
  color: var(--color-white);
}

.card--pink {
  background: var(--color-pink-light);
  color: var(--color-dark-blue);
}

.card--dark {
  background: var(--color-dark-blue);
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert--error {
  background: rgba(182, 45, 88, 0.15);
  color: var(--color-secondary);
  border: 1px solid rgba(182, 45, 88, 0.3);
}

.alert--info {
  background: rgba(12, 36, 86, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(12, 36, 86, 0.2);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
}

.card .form-label {
  color: var(--color-text);
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: var(--color-white);
  color: var(--color-text);
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-secondary);
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-white);
}

.btn--success {
  background: var(--color-secondary);
  color: var(--color-white);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.badge--primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.badge--pink {
  background: var(--color-pink-light);
  color: var(--color-dark-blue);
}

.badge--gray {
  background: rgba(169, 169, 169, 0.2);
  color: var(--color-gray);
}

/* Player list */
.player-list {
  list-style: none;
  padding: 0;
}

.player-item {
  padding: 10px 14px;
  margin-bottom: 6px;
  border-radius: 8px;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-item--active {
  background: rgba(12, 36, 86, 0.06);
  color: var(--color-text);
}

.player-item--eliminated {
  background: rgba(182, 45, 88, 0.08);
  color: var(--color-gray);
  text-decoration: line-through;
}

/* Invite box */
.invite-box {
  background: rgba(12, 36, 86, 0.06);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.invite-box code {
  display: block;
  margin-top: 6px;
  padding: 8px;
  background: var(--color-white);
  border-radius: 6px;
  font-size: 13px;
  word-break: break-all;
  border: 1px solid #e2e8f0;
}

/* Share buttons */
.share-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.btn--small {
  display: inline-block;
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
  flex: 1;
}

.btn--whatsapp {
  background: #25D366;
  color: var(--color-white);
}

/* Question card */
.question-box {
  background: var(--color-primary);
  color: var(--color-white);
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.question-box h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.5;
}

/* Answer options */
.option-label {
  display: block;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--color-white);
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  color: var(--color-text);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.option-label:hover {
  border-color: var(--color-secondary);
  background: rgba(232, 156, 180, 0.12);
  color: var(--color-text);
}

.option-label input[type="radio"] {
  margin-right: 10px;
  accent-color: var(--color-secondary);
}

/* Timer */
.timer {
  text-align: center;
  margin-bottom: 16px;
  font-size: 28px;
  font-weight: 800;
  color: var(--color-white);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), font-size 0.3s, color 0.3s;
  animation: timerAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes timerAppear {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: scale(1); }
}

.timer--urgent {
  font-size: 36px;
}

.timer--expired {
  color: var(--color-secondary);
  animation: timerPulse 0.6s ease-in-out 3;
}

/* Waiting / Loading */
.waiting-box {
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  color: var(--color-white);
}

.waiting-box p {
  color: var(--color-white);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-pink-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.card .spinner {
  border-color: rgba(12, 36, 86, 0.15);
  border-top-color: var(--color-secondary);
}

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

/* Results */
.result-box {
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  text-align: center;
}

.result-box--correct {
  background: rgba(12, 36, 86, 0.08);
  color: var(--color-primary);
  animation: resultReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes resultReveal {
  0%   { opacity: 0; transform: scale(0.8) translateY(10px); }
  60%  { transform: scale(1.04) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.result-box--answer {
  background: var(--color-white);
  color: var(--color-text);
}

/* Elimination banner */
.elimination-box {
  padding: 16px;
  background: rgba(182, 45, 88, 0.15);
  border: 1px solid rgba(182, 45, 88, 0.3);
  border-radius: 10px;
  text-align: center;
  margin-bottom: 16px;
  color: var(--color-white);
}

/* Table */
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: var(--color-white);
  border-radius: 12px;
  overflow: hidden;
}

.score-table thead tr {
  background: var(--color-primary);
  color: var(--color-white);
}

.score-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-table th:nth-child(3),
.score-table th:nth-child(4) {
  text-align: center;
}

.score-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.score-table td:nth-child(3) {
  text-align: center;
  font-weight: 700;
}

.score-table td:nth-child(4) {
  text-align: center;
  color: var(--color-gray);
  font-size: 13px;
}

.score-table tr.row--first td {
  background: rgba(12, 36, 86, 0.05);
}

.score-table tr.row--eliminated td {
  background: rgba(182, 45, 88, 0.06);
  color: var(--color-gray);
}

/* Winner card */
.winner-card {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
  color: var(--color-white);
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  margin-bottom: 24px;
}

.winner-card h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

/* Meta bar */
.meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.meta-info {
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

/* Countdown text */
.countdown-text {
  font-size: 14px;
  color: var(--color-gray);
  margin-bottom: 10px;
}

.countdown-text strong {
  display: inline-block;
  font-size: 18px;
  color: var(--color-pink-light);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 20px;
}

/* Header area */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* Eliminated notice */
.eliminated-notice {
  padding: 16px;
  background: rgba(182, 45, 88, 0.1);
  border-radius: 10px;
  text-align: center;
  margin-bottom: 16px;
  color: var(--color-pink-light);
}

/* ===================== */
/* ANIMATIONS            */
/* ===================== */

/* Page entrance */
.container {
  animation: fadeSlideUp 0.5s ease-out both;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Cards pop in */
.card {
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Question box entrance */
.question-box {
  animation: slideDown 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Option labels stagger in */
.option-label {
  animation: fadeSlideRight 0.35s ease-out both;
}

.option-label:nth-child(1) { animation-delay: 0.05s; }
.option-label:nth-child(2) { animation-delay: 0.1s; }
.option-label:nth-child(3) { animation-delay: 0.15s; }
.option-label:nth-child(4) { animation-delay: 0.2s; }

@keyframes fadeSlideRight {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Option select bounce */
.option-label:has(input:checked),
.option-label--selected {
  border-color: var(--color-secondary);
  background: rgba(232, 156, 180, 0.15);
  color: var(--color-text);
  animation: selectBounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-weight: 600;
}

@keyframes selectBounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Timer pulse when urgent */
.timer--urgent {
  animation: timerPulse 0.6s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.8; }
}

/* Player list items slide in */
.player-item {
  animation: fadeSlideRight 0.35s ease-out both;
}

.player-item:nth-child(1) { animation-delay: 0.03s; }
.player-item:nth-child(2) { animation-delay: 0.06s; }
.player-item:nth-child(3) { animation-delay: 0.09s; }
.player-item:nth-child(4) { animation-delay: 0.12s; }
.player-item:nth-child(5) { animation-delay: 0.15s; }
.player-item:nth-child(6) { animation-delay: 0.18s; }
.player-item:nth-child(7) { animation-delay: 0.21s; }
.player-item:nth-child(8) { animation-delay: 0.24s; }
.player-item:nth-child(9) { animation-delay: 0.27s; }
.player-item:nth-child(10) { animation-delay: 0.30s; }

/* Score table rows stagger */
.score-table tbody tr {
  animation: fadeSlideUp 0.4s ease-out both;
}

.score-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.score-table tbody tr:nth-child(2) { animation-delay: 0.18s; }
.score-table tbody tr:nth-child(3) { animation-delay: 0.26s; }
.score-table tbody tr:nth-child(4) { animation-delay: 0.34s; }
.score-table tbody tr:nth-child(5) { animation-delay: 0.42s; }
.score-table tbody tr:nth-child(6) { animation-delay: 0.50s; }
.score-table tbody tr:nth-child(7) { animation-delay: 0.58s; }
.score-table tbody tr:nth-child(8) { animation-delay: 0.66s; }
.score-table tbody tr:nth-child(9) { animation-delay: 0.74s; }
.score-table tbody tr:nth-child(10) { animation-delay: 0.82s; }

/* Winner card grand entrance */
.winner-card {
  animation: winnerEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes winnerEntrance {
  0%   { opacity: 0; transform: scale(0.5) rotate(-5deg); }
  60%  { opacity: 1; transform: scale(1.08) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Winner card shimmer */
.winner-card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 2.5s ease-in-out infinite;
}

.winner-card {
  position: relative;
  overflow: hidden;
}

@keyframes shimmer {
  0%   { left: -100%; }
  100% { left: 100%; }
}

/* Elimination box shake */
.elimination-box {
  animation: shakeIn 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeIn {
  0%        { opacity: 0; transform: translateX(0); }
  10%       { opacity: 1; transform: translateX(-8px); }
  20%       { transform: translateX(7px); }
  30%       { transform: translateX(-6px); }
  40%       { transform: translateX(5px); }
  50%       { transform: translateX(-3px); }
  60%       { transform: translateX(2px); }
  70%, 100% { transform: translateX(0); }
}

/* Buttons hover lift */
.btn {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, opacity 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  opacity: 1;
}

.btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Badge bounce in */
.badge {
  animation: badgeBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.2s;
}

@keyframes badgeBounce {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* Result box fade in */
.result-box {
  animation: fadeSlideUp 0.5s ease-out both;
}

/* Alert slide down */
.alert {
  animation: alertSlide 0.4s ease-out both;
}

@keyframes alertSlide {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Invite box code highlight */
.invite-box code {
  transition: background 0.2s;
}

.invite-box code:hover {
  background: rgba(232, 156, 180, 0.15);
}

/* Spinner glow */
.spinner {
  box-shadow: 0 0 12px rgba(232, 156, 180, 0.3);
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Waiting dots animation */
.waiting-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%  { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}
