/* ═══════════════════════════════════════════════════════════════
   0. DESIGN TOKENS — Plataforma de Jogos Legeo
   ═══════════════════════════════════════════════════════════════ */
:root {
  /* Brand */
  --brand:        #4f46e5;
  --brand-dark:   #3730a3;
  --brand-light:  #818cf8;
  --brand-muted:  color-mix(in srgb, var(--brand) 12%, transparent);

  /* Boss / All-in */
  --boss:         #7c3aed;
  --boss-dark:    #5b21b6;
  --boss-muted:   color-mix(in srgb, #7c3aed 15%, transparent);
  --allin:        #9b59b6;

  /* Type scale */
  --fs-xs:   0.72rem;
  --fs-sm:   0.85rem;
  --fs-base: 1rem;
  --fs-md:   1.15rem;
  --fs-lg:   1.6rem;
  --fs-xl:   2.2rem;

  /* Surface — Light */
  --bg:           #f5f5ff;
  --surface:      #ffffff;
  --surface-alt:  #f1f0fe;
  --border:       #e4e4f0;
  --text:         #0f0e1a;
  --text-muted:   #6b6a80;
  --text-subtle:  #a09fc0;

  /* Semantic */
  --success:      #22c55e;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #3b82f6;

  /* Game theme (sobrescrito pelo módulo do jogo via JS) */
  --game-primary: var(--brand);
  --game-dark:    var(--brand-dark);

  /* Sizing */
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-xl:    28px;
  --radius-full:  9999px;

  /* Shadows */
  --shadow-xs:    0 1px 3px rgba(15,14,26,.06);
  --shadow-sm:    0 2px 8px rgba(15,14,26,.08);
  --shadow:       0 4px 20px rgba(15,14,26,.1);
  --shadow-lg:    0 12px 40px rgba(15,14,26,.14);
  --shadow-brand: 0 8px 24px color-mix(in srgb, var(--brand) 35%, transparent);

  /* Motion */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:  cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --duration-fast:  150ms;
  --duration-base:  250ms;
  --duration-slow:  400ms;
}

[data-theme="dark"] {
  --bg:           #080810;
  --surface:      #111120;
  --surface-alt:  #181830;
  --border:       #252540;
  --text:         #eeeef8;
  --text-muted:   #9090b8;
  --text-subtle:  #505078;
  --shadow-xs:    0 1px 3px rgba(0,0,0,.3);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.35);
  --shadow:       0 4px 20px rgba(0,0,0,.4);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.5);
}

/* ═══════════════════════════════════════════════════════════════
   1. RESET & BASE
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: -webkit-fill-available;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background-color var(--duration-base),
    color var(--duration-base);
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* previne zoom automático no iOS */
}

/* ═══════════════════════════════════════════════════════════════
   2. UTILITÁRIOS
   ═══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  border-radius: var(--radius);
  padding: 14px 28px;
  font-size: 1rem;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast), background var(--duration-fast);
  touch-action: manipulation;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 0 var(--brand-dark), var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-dark); }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-alt); border-radius: var(--radius-sm); }

.btn-full { width: 100%; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 0 #b91c1c;
}
.btn-danger:active { transform: translateY(3px); box-shadow: 0 1px 0 #b91c1c; }

/* ═══════════════════════════════════════════════════════════════
   3. HEADER / HUD
   ═══════════════════════════════════════════════════════════════ */
.shell-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.shell-header .logo {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.shell-header .logo-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--brand-muted);
  color: var(--brand);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hud {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  font-weight: 700;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
}

.hud-item .value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hud-power {
  display: flex;
  align-items: center;
  gap: 6px;
}

.power-track {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.power-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #f97316, #ef4444);
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-out);
  width: 0%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  transition: background var(--duration-fast);
}
.btn-theme-toggle:hover { background: var(--border); }

/* ═══════════════════════════════════════════════════════════════
   4. TELA DE LOGIN (PIN + INFO)
   ═══════════════════════════════════════════════════════════════ */
.screen-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  min-height: 100dvh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

/* Logomarca tipográfica — "L" em brand, resto em text */
.login-brand {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 8px;
}
.brand-l    { color: var(--brand); }
.brand-rest { color: var(--text); }

.login-tagline {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

/* PIN step e Auth step */
.pin-step, .info-step, .auth-step {
  animation: fadeIn var(--duration-base) var(--ease-out) both;
}

.auth-error {
  font-size: 0.825rem;
  color: var(--danger);
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 4px;
  text-align: center;
}

.btn-esqueci-senha {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-subtle);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-top: 4px;
  transition: color var(--duration-fast);
}
.btn-esqueci-senha:hover { color: var(--brand); }

/* Overlay de primeiro acesso do aluno */
.student-fa-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px 20px;
  animation: fadeIn var(--duration-base) var(--ease-out) both;
}

.student-fa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: slideUp var(--duration-slow) var(--ease-spring) both;
}

.student-fa-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.student-fa-card h2 {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.4px;
  margin-bottom: 8px;
}

.student-fa-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: left;
}

.pin-label {
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.pin-input-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}

.pin-digit {
  width: 64px;
  height: 72px;
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  border: 2.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  outline: none;
  caret-color: transparent;
  transition:
    border-color var(--duration-fast),
    background var(--duration-fast),
    transform var(--duration-fast),
    box-shadow var(--duration-fast);
  -moz-appearance: textfield;
}
.pin-digit::-webkit-inner-spin-button,
.pin-digit::-webkit-outer-spin-button { -webkit-appearance: none; }

.pin-digit:focus {
  border-color: var(--brand);
  background: var(--surface);
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 0 0 4px var(--brand-muted);
}

.pin-digit.filled {
  border-color: var(--brand);
  background: var(--brand-muted);
  color: var(--brand);
}

.pin-digit.error {
  border-color: var(--danger);
  animation: shake var(--duration-slow) var(--ease-out);
}

.pin-error-msg {
  text-align: center;
  font-size: 0.825rem;
  color: var(--danger);
  font-weight: 600;
  min-height: 20px;
  margin-bottom: 8px;
}

/* Unlocked game preview (shown after PIN validated) */
.pin-unlock-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--success) 30%, transparent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  animation: popIn var(--duration-base) var(--ease-spring);
}

.pin-unlock-badge .badge-emoji { font-size: 1.8rem; }

.pin-unlock-badge .badge-info { flex: 1; }
.pin-unlock-badge .badge-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.pin-unlock-badge .badge-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.pin-unlock-badge .badge-check { color: var(--success); font-size: 1.2rem; }

/* Player info form */
.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  outline: none;
}
.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-muted);
}
.form-input option { background: var(--surface); }

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-subtle);
  font-size: 0.8rem;
  margin: 20px 0;
}
.login-divider::before,
.login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.btn-admin-link {
  display: block;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-top: 8px;
  opacity: 0.45;
  transition: opacity var(--duration-fast);
  letter-spacing: 0.01em;
}
.btn-admin-link:hover { opacity: 1; }

.login-footer-credit {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 14px;
}

/* Seletores lado a lado — mesma largura total do input de nome */
.form-row-double {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-row-double .form-field { margin-bottom: 0; }

/* ═══════════════════════════════════════════════════════════════
   5. HUB DE JOGOS
   ═══════════════════════════════════════════════════════════════ */
.screen-hub {
  flex: 1;
  padding: 32px 20px 40px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.hub-header {
  margin-bottom: 28px;
}

.hub-greeting {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hub-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-top: 4px;
}

.hub-turma-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 10px;
}

.hub-section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 12px;
}

.game-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 32px;
}

.game-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base),
    border-color var(--duration-base);
  position: relative;
  overflow: hidden;
}

.game-card.active {
  border-color: var(--game-primary);
  box-shadow: 0 0 0 1px var(--game-primary), var(--shadow);
  cursor: pointer;
}
.game-card.active:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--game-primary), var(--shadow-lg); }
.game-card.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--game-primary) 6%, transparent), transparent);
  pointer-events: none;
}

.game-card.inactive { opacity: 0.55; cursor: default; }

.game-card-emoji {
  font-size: 2.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.game-card-body { flex: 1; min-width: 0; }
.game-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 3px;
}
.game-card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.game-card-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.badge-active {
  background: color-mix(in srgb, var(--game-primary) 15%, transparent);
  color: var(--game-primary);
}
.badge-soon {
  background: var(--surface-alt);
  color: var(--text-subtle);
}

.hub-cta {
  margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════════════
   6. LOBBY SÍNCRONO
   ═══════════════════════════════════════════════════════════════ */
.screen-lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  min-height: 100dvh;
  animation: fadeIn var(--duration-slow) var(--ease-out) both;
}

.lobby-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 36px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.lobby-pulse-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--game-primary);
  opacity: 0;
  animation: lobbyPulse 2.4s var(--ease-out) infinite;
}
.lobby-ring:nth-child(2) { animation-delay: 0.8s; }
.lobby-ring:nth-child(3) { animation-delay: 1.6s; }

.lobby-emoji-main {
  font-size: 3rem;
  animation: lobbyFloat 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.lobby-status {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.lobby-dots::after {
  content: '';
  animation: lobbyDots 1.4s infinite;
}

.lobby-game-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--game-primary);
  margin-bottom: 6px;
}

.lobby-player-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 20px;
}

.lobby-footer {
  margin-top: 28px;
}

/* ═══════════════════════════════════════════════════════════════
   7. TELA DE RESULTADO
   ═══════════════════════════════════════════════════════════════ */
.screen-result {
  flex: 1;
  padding: 28px 20px 40px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.result-hero {
  text-align: center;
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.result-hero .hero-emoji { font-size: 3.5rem; display: block; margin-bottom: 8px; }
.result-hero h2 { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.3px; }
.result-hero .result-score {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--game-primary);
  margin-top: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.stat-card.highlight .stat-value { color: var(--game-primary); }

.ranking-section h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.ranking-table th {
  background: var(--surface-alt);
  padding: 10px 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  font-weight: 700;
}
.ranking-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.ranking-table tr.current-player td { background: var(--brand-muted); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   8. GAME CONTAINER (o módulo renderiza aqui)
   ═══════════════════════════════════════════════════════════════ */
.screen-game {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════
   9. COMPONENTES GLOBAIS
   ═══════════════════════════════════════════════════════════════ */

/* Toast */
#toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  pointer-events: auto;
  animation: toastIn var(--duration-base) var(--ease-spring) both;
}
.toast.removing { animation: toastOut var(--duration-base) var(--ease-out) both; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-msg { line-height: 1.4; }
.toast.success { border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.toast.error   { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.toast.info    { border-color: color-mix(in srgb, var(--brand) 40%, transparent); }

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: fadeIn var(--duration-fast) both;
}
.loading-overlay p {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   10. ANIMAÇÕES
   ═══════════════════════════════════════════════════════════════ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes lobbyPulse {
  0%   { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes lobbyFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes lobbyDots {
  0%   { content: ''; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '...'; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px) scale(0.95); }
}

/* ═══════════════════════════════════════════════════════════════
   11. RESPONSIVIDADE MOBILE-FIRST
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .login-card { padding: 28px 20px; }
  .pin-digit  { width: 54px; height: 62px; font-size: 1.7rem; }
  .lobby-card { padding: 36px 24px; }
}

/* PC — reduz espaçamento vertical e ajusta grids */
@media (min-width: 640px) {
  .screen-login { padding: 16px 20px; }
  .login-card   { padding: 28px 32px; }
  .login-logo   { margin-bottom: 18px; }
  .login-logo .logo-mark { width: 48px; height: 48px; font-size: 1.5rem; margin-bottom: 8px; }
  .login-logo h1 { font-size: 1.3rem; }
  .form-field { margin-bottom: 10px; }
  .login-divider { margin: 14px 0; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .game-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   12. CELEBRAÇÃO — Confetti + Contador Animado
   ═══════════════════════════════════════════════════════════════ */
.confetti-particle {
  position: fixed;
  top: -12px;
  z-index: 999;
  pointer-events: none;
  animation: confetti-fall linear forwards;
  will-change: transform, opacity;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  75%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(600deg) scale(0.5); opacity: 0; }
}

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