/* ========== DESIGN TOKENS v20 (Bloco 5) ========== */
:root {
  color-scheme: dark;

  /* Paleta — gold (brand primary) */
  --gold-1: #fce58c;        /* light highlight */
  --gold-2: #d4a84a;        /* primary gold */
  --gold-3: #b08030;        /* deep gold */
  --gold-text: #f0d080;
  --gold-soft: rgba(212, 168, 74, 0.5);
  --gold-border: rgba(212, 168, 74, 0.45);
  --gold-glow: rgba(212, 168, 74, 0.25);

  /* Paleta — noir backgrounds */
  --noir-1: #1a0f15;        /* card top */
  --noir-2: #0a0508;        /* card bottom */
  --noir-3: #050308;        /* page background */
  --noir-overlay: rgba(5, 3, 8, 0.85);

  /* Accents */
  --pink-accent: #ff7090;
  --green-correct: #6aff8a;
  --red-wrong: #ff6a6a;

  /* Tier colors (Bloco 4) */
  --tier-bronze: #c48246;
  --tier-prata:  #c8ccdc;
  --tier-ouro:   #ffd180;
  --tier-diamante: #a6e0ff;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 14px;
  --space-4: 20px;
  --space-5: 32px;
  --space-6: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-card:  0 12px 36px rgba(0, 0, 0, 0.65);
  --shadow-modal: 0 18px 60px rgba(0, 0, 0, 0.85);
  --shadow-glow-gold: 0 0 22px rgba(212, 168, 74, 0.25);

  /* Tipografia — Inter (sans) pra UI, Georgia (serif) pra narrativa */
  --font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  --font-narrative: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Consolas', 'Courier New', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ========== ACESSIBILIDADE WCAG (v7) ========== */
/* Conteúdo só pra screen reader — invisível mas acessível */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
/* Skip-link: aparece quando recebe foco (Tab) */
.skip-link {
  position: absolute;
  top: -100px; left: 0;
  background: #d4a84a;
  color: #1a0a08;
  padding: 10px 16px;
  z-index: 1000;
  font-weight: bold;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  transition: top 0.2s ease-out;
}
.skip-link:focus { top: 0; }
/* Foco visível pra navegação por teclado em todos os interativos.
   :focus-visible só dispara em foco por teclado, não em clique de mouse.
   v12 R4: usando :is() pra compactar (era 8 selectors repetidos). */
:is(.btn, .option-btn, .casino-card, .stage-card, button, a, input[type="text"], input[type="radio"], input[type="checkbox"]):focus-visible {
  outline: 3px solid #ffd180;
  outline-offset: 2px;
  box-shadow: 0 0 14px rgba(255,209,128,0.55);
}
/* Casino/stage cards: indicar que são clicáveis pra screen readers via tabindex no HTML
   (o :focus-visible acima cobre o estilo) */
.casino-card[tabindex],
.stage-card[tabindex] { outline-offset: 4px; }

/* Reduced motion — respeita preferência do usuário (M4 do REVIEW) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Para animações de fundo decorativas — desligar de vez */
  #start-screen::before { animation: none !important; }
  #game-screen::after { animation: none !important; }
}
/* ========== /ACESSIBILIDADE ========== */

body {
  /* v20 (Bloco 5): Inter sans no body; Georgia serif só pra elementos narrativos (títulos, .q-text, score) */
  font-family: var(--font-ui);
  background: #0a0a0a;
  color: #e8d8b0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  /* Font smoothing pra renderizar Inter limpo em macOS / Windows */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.screen {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0;
  transition: opacity 0.4s ease-out;
}
.screen.active {
  display: flex;
  opacity: 1;
  animation: screenFadeIn 0.4s ease-out;
}
@keyframes screenFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ========== TELA INICIAL ========== */
#start-screen {
  flex-direction: column;
  align-items: center;
  /* v16: overflow-y auto + flex-start pra não cortar conteúdo em laptops 13" / mobile landscape */
  justify-content: flex-start;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(212, 168, 74, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 80%, rgba(255, 64, 128, 0.05) 0%, transparent 40%),
    radial-gradient(ellipse at top, #1a0f1a 0%, #0a0505 60%),
    #000;
  padding: max(40px, 5vh) 20px 20px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}
/* Padrão sutil de feltro/diamante no fundo */
#start-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg,
      rgba(212, 168, 74, 0.02) 0px,
      rgba(212, 168, 74, 0.02) 1px,
      transparent 1px,
      transparent 14px),
    repeating-linear-gradient(-45deg,
      rgba(212, 168, 74, 0.02) 0px,
      rgba(212, 168, 74, 0.02) 1px,
      transparent 1px,
      transparent 14px);
  pointer-events: none;
  z-index: 0;
  animation: bgDrift 90s linear infinite;
}
@keyframes bgDrift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 200px 200px, -200px 200px; }
}
#start-screen > * { position: relative; z-index: 1; }
#start-screen h1 {
  font-family: var(--font-narrative);
  font-size: clamp(40px, 7vw, 84px);
  color: #f5d678;
  -webkit-text-stroke: 1px #6a4818;
  text-shadow:
    0 1px 0 #5a3812,
    0 2px 0 #4a2812,
    0 3px 4px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(212, 168, 74, 0.7),
    0 0 40px rgba(212, 168, 74, 0.5),
    0 0 60px rgba(255, 200, 100, 0.3);
  letter-spacing: 6px;
  margin-bottom: 10px;
  font-weight: bold;
  animation: neonPulse 3s ease-in-out infinite;
  background: linear-gradient(180deg, #fce58c 0%, #d4a84a 50%, #b08030 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
#start-screen h1 .brand-dot {
  color: #ff7090;
  -webkit-text-stroke: 1px #6a1820;
  background: linear-gradient(180deg, #ffb0c8 0%, #ff4080 60%, #aa1860 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow:
    0 0 14px rgba(255, 64, 128, 0.9),
    0 0 28px rgba(255, 64, 128, 0.6),
    0 0 50px rgba(255, 100, 160, 0.4);
}
@keyframes neonPulse {
  0%, 100% { text-shadow: 0 0 20px rgba(212, 168, 74, 0.8), 0 0 40px rgba(212, 168, 74, 0.4); }
  50% { text-shadow: 0 0 30px rgba(212, 168, 74, 1), 0 0 60px rgba(212, 168, 74, 0.6); }
}
#start-screen .subtitle {
  font-family: var(--font-narrative);
  font-size: clamp(14px, 2vw, 18px);
  color: #a08060;
  margin-bottom: 40px;
  font-style: italic;
}
.npcs-row {
  display: flex;
  gap: 15px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  justify-content: center;
}
.npc-card {
  width: 110px;
  text-align: center;
  cursor: default;
}
.npc-card svg {
  width: 100%;
  height: 140px;
  transition: transform 0.3s;
}
.npc-card:hover svg { transform: translateY(-5px); }
.npc-name {
  font-size: 13px;
  color: #d4a84a;
  margin-top: 5px;
  font-weight: bold;
}
.npc-role {
  font-size: 10px;
  color: #888;
  font-style: italic;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(20, 10, 10, 0.6);
  border: 1px solid #6a5030;
  border-radius: 6px;
  padding: 12px 18px;
  font-size: 14px;
  color: #e8d8b0;
}
.mode-toggle label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mode-toggle small { color: #888; font-size: 11px; }
.mode-toggle input[type="radio"] { accent-color: #d4a84a; }
input[type="text"] {
  padding: 14px 20px;
  font-size: 18px;
  background: rgba(20, 15, 10, 0.8);
  border: 2px solid #8a6a3a;
  border-radius: 4px;
  color: #e8d8b0;
  min-width: 260px;
  text-align: center;
  outline: none;
  font-family: inherit;
}
input[type="text"]:focus { border-color: #d4a84a; box-shadow: 0 0 15px rgba(212, 168, 74, 0.3); }
.btn {
  padding: 14px 36px;
  font-size: 18px;
  background: linear-gradient(180deg, #8a1515 0%, #5a0808 100%);
  color: #f0e4c0;
  border: 2px solid #d4a84a;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 2px;
  transition: all 0.2s;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
.btn:hover {
  background: linear-gradient(180deg, #a31818 0%, #700a0a 100%);
  box-shadow: 0 0 20px rgba(212, 168, 74, 0.5);
  transform: translateY(-2px);
}
.btn:active { transform: translateY(0) scale(0.97); }
.btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255, 220, 140, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
}
.btn.ripple::after {
  animation: btnRipple 0.6s ease-out;
}
@keyframes btnRipple {
  0%   { width: 0; height: 0; opacity: 0.7; }
  100% { width: 360px; height: 360px; opacity: 0; }
}
.btn-ghost {
  background: transparent;
  border-color: #6a5030;
  color: #a08060;
}
.btn-ghost:hover { background: rgba(212, 168, 74, 0.1); box-shadow: none; }

/* ========== TELA DE SELEÇÃO DE CASSINO ========== */
#casino-screen {
  flex-direction: column;
  align-items: center;
  /* v16: overflow-y auto + flex-start pra não cortar grade em telas baixas */
  justify-content: flex-start;
  background: radial-gradient(ellipse at center, #0f0a15 0%, #050305 70%);
  padding: max(40px, 5vh) 20px 20px;
  overflow-y: auto;
}
#casino-screen h2 {
  font-family: var(--font-narrative);
  font-size: clamp(32px, 5vw, 48px);
  color: var(--gold-2);
  margin-bottom: 10px;
  letter-spacing: 4px;
}
#casino-screen .subtitle { color: #a08060; margin-bottom: 40px; font-style: italic; }
/* Curriculum (trilha de aprendizado) */
#curriculum-panel {
  background: rgba(20, 10, 10, 0.7);
  border: 1px solid #6a5030;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  max-width: 700px;
  width: 100%;
}
.curriculum-list { display: flex; flex-direction: column; gap: 8px; }
.stage-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 20, 15, 0.7);
  border: 1px solid #4a3a20;
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.stage-card:hover { border-color: #d4a84a; transform: translateX(3px); box-shadow: 0 0 12px rgba(212,168,74,0.3); }
.stage-card.locked { opacity: 0.5; cursor: not-allowed; }
.stage-card.locked:hover { transform: none; box-shadow: none; }
.stage-icon { font-size: 24px; min-width: 30px; text-align: center; }
.stage-body { flex: 1; }
.stage-name { color: #f0e4c0; font-weight: bold; font-size: 14px; margin-bottom: 2px; }
.stage-desc { color: #a08060; font-size: 12px; margin-bottom: 6px; font-style: italic; }
.stage-bar { background: #1a1010; border: 1px solid #3a2a1a; height: 8px; border-radius: 3px; overflow: hidden; }
.stage-fill { height: 100%; transition: width 0.4s ease-out; }
.stage-meta { color: #888; font-size: 10px; margin-top: 4px; letter-spacing: 0.5px; }
.stage-go { color: #d4a84a; font-size: 22px; font-weight: bold; }

.tier-filter {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(20, 10, 10, 0.6);
  border: 1px solid #6a5030;
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #a08060;
}
.tier-filter small { color: #888; margin-right: 6px; font-size: 10px; }
.tier-filter label { cursor: pointer; padding: 3px 8px; border-radius: 4px; }
.tier-filter label:hover { background: rgba(212, 168, 74, 0.1); }
.tier-filter input[type="radio"] { accent-color: #d4a84a; vertical-align: middle; margin-right: 4px; }
.position-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(20, 10, 10, 0.6);
  border: 1px solid #6a5030;
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  color: #a08060;
}
.position-filter small { color: #a08060; margin-right: 6px; }
.position-filter label { cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.position-filter label:hover { background: rgba(212, 168, 74, 0.1); }
.position-filter input[type="radio"] { accent-color: #d4a84a; vertical-align: middle; margin-right: 3px; }
.casino-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  max-width: 1000px;
  width: 100%;
  margin-bottom: 30px;
}
.casino-card {
  background: linear-gradient(135deg, #1a0f15 0%, #0a0508 100%);
  border: 2px solid #6a5030;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.casino-card:hover {
  border-color: #d4a84a;
  box-shadow: 0 0 30px rgba(212, 168, 74, 0.4);
  transform: translateY(-4px);
}
.casino-card .icon { font-size: 48px; margin-bottom: 10px; }
.casino-card .name {
  font-size: 24px;
  color: #d4a84a;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.casino-card .desc { font-size: 13px; color: #888; font-style: italic; }
.casino-card .count {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 12px;
  color: #6a5030;
  background: rgba(0,0,0,0.5);
  padding: 3px 8px;
  border-radius: 10px;
}
.casino-card.empty { opacity: 0.5; cursor: not-allowed; }
.casino-card.empty:hover { border-color: #6a5030; box-shadow: none; transform: none; }

/* ========== ELEMENTOS FLUTUANTES (v11) — antes inline em JS via style.cssText ========== */
/* Movidos de game.js / kart.js / street.js / ui.js / multiplayer.js pra cá.
   Critério: posição absoluta + tema dark/gold. Ficaram inline só os que têm
   props dinâmicas (cor por estado, animation-delay, etc). */

/* Hints de interação (bottom center) */
.float-hint {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 5, 5, 0.9);
  border: 1px solid #d4a84a;
  color: #d4a84a;
  padding: 10px 20px;
  border-radius: 4px;
  z-index: 15;
  font-size: 15px;
}
.float-hint.large {
  padding: 14px 26px;
  border-radius: 6px;
  font-size: 17px;
  font-weight: bold;
  letter-spacing: 1px;
  box-shadow: 0 0 20px rgba(212, 168, 74, 0.5);
}

/* Streak badge (v20: top center fora do jogo / inline chip do HUD durante o jogo) */
.float-streak-badge {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(255, 106, 48, 0.18), rgba(255, 64, 128, 0.18));
  border: 1px solid rgba(255, 170, 48, 0.55);
  color: #ffb088;
  padding: 6px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  z-index: 30;
  box-shadow: 0 0 18px rgba(255, 140, 40, 0.18);
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 1px;
  backdrop-filter: blur(10px);
  text-shadow: 0 0 8px rgba(255, 140, 40, 0.5);
}
/* v20: quando o HUD do jogo está visível, integra o streak como sub-chip à esquerda dele */
#game-screen:not(:has(#hud[style*="display: none"])) ~ #streak-badge,
body:has(#hud:not([style*="display: none"])) #streak-badge {
  top: 14px;
  left: 14px;
  right: auto;
  transform: none;
  /* compõe ao lado/acima do HUD principal */
  margin-top: 50px;
}

/* Multiplayer: badge online + painel "online aqui" */
.float-online-badge {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 5, 5, 0.85);
  border: 1px solid #6a5030;
  color: #a08060;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 1px;
  z-index: 12;
  font-family: Georgia, serif;
}
.float-online-panel {
  position: fixed;
  left: 15px;
  bottom: 15px;
  background: rgba(10, 5, 5, 0.85);
  border: 1px solid #3a7a4a;
  color: #6aff8a;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: Georgia, serif;
  z-index: 11;
  max-width: 220px;
  line-height: 1.5;
}

/* Kart: minimap, HUD, countdown, finish screen, picker */
.float-kart-minimap {
  position: fixed;
  top: 60px;
  right: 15px;
  background: rgba(10, 5, 5, 0.85);
  border: 1px solid #d4a84a;
  border-radius: 6px;
  z-index: 11;
  display: none;
}
.float-kart-hud {
  position: fixed;
  top: 15px;
  left: 15px;
  background: rgba(10, 5, 5, 0.85);
  border: 1px solid #d4a84a;
  border-radius: 6px;
  padding: 10px 14px;
  color: #d4a84a;
  font-family: Georgia, serif;
  z-index: 11;
  display: flex;
  gap: 18px;
  font-size: 14px;
}
.float-kart-countdown {
  position: fixed;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 140px;
  font-weight: bold;
  font-family: Georgia, serif;
  color: #ffd080;
  text-shadow: 0 0 40px rgba(255, 200, 80, 0.9), 0 0 80px rgba(255, 140, 40, 0.6);
  z-index: 55;
  pointer-events: none;
  letter-spacing: 8px;
  transition: transform 0.25s ease-out;
}
.float-kart-finish {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 5, 5, 0.95);
  border: 3px solid #d4a84a;
  border-radius: 12px;
  padding: 32px 48px;
  color: #e8d8b0;
  text-align: center;
  z-index: 60;
  box-shadow: 0 0 40px rgba(212, 168, 74, 0.5);
  min-width: 340px;
  font-family: Georgia, serif;
}
.float-kart-picker {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 8, 0.92);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ktp-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 16px;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  background: linear-gradient(135deg, #1a0f15, #0a0508);
  border: 2px solid #4a3a20;
  color: #e8d8b0;
  cursor: pointer;
}
.ktp-card.current { border-color: #d4a84a; }

/* Confetti wrapper (overlay) */
.float-confetti-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}

/* Gold-flash overlay (combo party) */
.float-gold-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: radial-gradient(ellipse at center, rgba(255, 215, 80, 0.4) 0%, rgba(255, 200, 80, 0) 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

/* History chart canvas */
.float-history-canvas {
  display: block;
  margin: 0 auto;
  background: #0f0a0a;
  border: 1px solid #3a2a1a;
  border-radius: 6px;
}

/* ========== CONFIRM MODAL (v10) — substitui confirm() nativo ========== */
.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 8, 0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: confirmFadeIn 0.18s ease-out;
}
@keyframes confirmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.confirm-modal-box {
  background: linear-gradient(135deg, #1a0f15, #0a0508);
  border: 2px solid #d4a84a;
  border-radius: 10px;
  padding: 24px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 40px rgba(212, 168, 74, 0.35);
  font-family: Georgia, serif;
  animation: confirmZoomIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes confirmZoomIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.confirm-modal-box h3 {
  color: #d4a84a;
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.confirm-modal-box p {
  color: #e8d8b0;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 22px;
  font-style: italic;
}
.confirm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.confirm-modal-actions .btn { padding: 10px 22px; font-size: 14px; }
/* Variante destrutiva: confirm em vermelho mais forte */
.confirm-modal .btn.confirm-destructive {
  background: linear-gradient(180deg, #aa1818 0%, #6a0808 100%);
  border-color: #ff8a6a;
}
.confirm-modal .btn.confirm-destructive:hover {
  background: linear-gradient(180deg, #c81a1a 0%, #800a0a 100%);
  box-shadow: 0 0 18px rgba(255, 100, 80, 0.5);
}

/* ========== RANKING MODAL (v20) — substitui alert() do botão "🏆 Ranking" ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 8, 0.86);
  z-index: 220;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: max(40px, 6vh) 20px 20px;
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.modal-overlay.show { display: flex; animation: confirmFadeIn 0.22s ease-out; }

.ranking-modal-box {
  background:
    radial-gradient(ellipse at top, rgba(212, 168, 74, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #1a0f15 0%, #08050a 100%);
  border: 1px solid rgba(212, 168, 74, 0.5);
  border-radius: 14px;
  padding: 28px 28px 22px;
  max-width: 560px;
  width: 100%;
  position: relative;
  box-shadow:
    0 0 1px rgba(212, 168, 74, 0.6),
    0 18px 60px rgba(0, 0, 0, 0.85),
    0 0 80px rgba(212, 168, 74, 0.1);
  font-family: Georgia, serif;
  animation: confirmZoomIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ranking-modal-box h3 {
  color: #f0d080;
  font-size: 22px;
  letter-spacing: 4px;
  margin: 0 0 4px;
  text-align: center;
  text-shadow: 0 0 18px rgba(212, 168, 74, 0.4);
}
.ranking-modal-subtitle {
  color: #8a7a5a;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 22px;
  font-style: italic;
}
.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid rgba(212, 168, 74, 0.3);
  border-radius: 6px;
  color: #a08060;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.18s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.modal-close-btn:hover {
  background: rgba(212, 168, 74, 0.12);
  border-color: #d4a84a;
  color: #f0d080;
}
.ranking-modal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.ranking-modal-list::-webkit-scrollbar { width: 6px; }
.ranking-modal-list::-webkit-scrollbar-thumb { background: rgba(212, 168, 74, 0.25); border-radius: 3px; }
.rank-card {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(20, 12, 12, 0.75);
  border: 1px solid rgba(106, 80, 48, 0.45);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.18s ease-out, transform 0.18s ease-out;
}
.rank-card:hover { border-color: rgba(212, 168, 74, 0.55); transform: translateX(2px); }
.rank-card .rank-pos {
  font-weight: bold;
  color: #d4a84a;
  font-size: 18px;
  text-align: center;
  font-family: 'Georgia', serif;
  letter-spacing: 0;
}
.rank-card .rank-name {
  color: #e8d8b0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-card .rank-casino {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(212, 168, 74, 0.14);
  border: 1px solid rgba(212, 168, 74, 0.35);
  color: #c89a3a;
  margin-left: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
}
.rank-card .rank-score {
  color: #d4a84a;
  font-weight: bold;
  font-size: 16px;
  text-align: right;
}
.rank-card .rank-hits {
  color: #8aff8a;
  font-size: 12px;
  text-align: right;
  letter-spacing: 0.5px;
}
/* Top 3 com hierarquia visual */
.rank-card.rank-top1 {
  background: linear-gradient(135deg, rgba(212, 168, 74, 0.22), rgba(212, 168, 74, 0.06));
  border-color: rgba(255, 209, 128, 0.7);
  box-shadow: 0 0 24px rgba(212, 168, 74, 0.22), inset 0 1px 0 rgba(255, 220, 140, 0.25);
}
.rank-card.rank-top1 .rank-pos { color: #ffd180; font-size: 22px; text-shadow: 0 0 14px rgba(255, 209, 128, 0.7); }
.rank-card.rank-top2 {
  background: linear-gradient(135deg, rgba(200, 200, 220, 0.1), rgba(160, 160, 180, 0.03));
  border-color: rgba(190, 195, 210, 0.5);
}
.rank-card.rank-top2 .rank-pos { color: #c8ccdc; font-size: 20px; }
.rank-card.rank-top3 {
  background: linear-gradient(135deg, rgba(196, 130, 70, 0.14), rgba(150, 90, 50, 0.04));
  border-color: rgba(196, 130, 70, 0.55);
}
.rank-card.rank-top3 .rank-pos { color: #d8a070; font-size: 20px; }
.ranking-modal-empty {
  text-align: center;
  padding: 36px 16px;
  color: #8a7a5a;
}
.ranking-modal-empty .empty-icon { font-size: 42px; margin-bottom: 12px; opacity: 0.7; }
.ranking-modal-empty .empty-text { font-style: italic; font-size: 14px; }
.ranking-modal-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(212, 168, 74, 0.12);
  text-align: center;
}
.ranking-modal-hint {
  color: #6a5840;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: 'Inter', system-ui, sans-serif;
}
.ranking-modal-hint kbd {
  display: inline-block;
  background: #2a1f15;
  border: 1px solid #6a5030;
  border-radius: 3px;
  padding: 1px 6px;
  font-family: monospace;
  color: #d4a84a;
  font-size: 10px;
  margin: 0 2px;
}
@media (max-width: 480px) {
  .ranking-modal-box { padding: 22px 18px 18px; border-radius: 10px; }
  .ranking-modal-box h3 { font-size: 18px; letter-spacing: 3px; }
  .rank-card { grid-template-columns: 28px 1fr auto auto; gap: 10px; padding: 8px 10px; font-size: 13px; }
  .rank-card .rank-casino { font-size: 9px; padding: 1px 6px; margin-left: 4px; }
}

/* ========== DISCOVERY TIP (v20) — substitui o popup com cssText inline em showDiscoveryPopup ========== */
.discovery-tip {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 25;
  max-width: 320px;
  padding: 16px 20px 14px;
  background:
    radial-gradient(ellipse at top right, rgba(212, 168, 74, 0.14) 0%, transparent 60%),
    linear-gradient(135deg, rgba(26, 15, 21, 0.96), rgba(10, 6, 14, 0.96));
  border: 1px solid rgba(212, 168, 74, 0.55);
  border-radius: 12px;
  color: #e8d8b0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 1px rgba(212, 168, 74, 0.6),
    0 12px 36px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(212, 168, 74, 0.12);
  animation: discoveryTipIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}
@keyframes discoveryTipIn {
  from { opacity: 0; transform: translateY(20px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.discovery-tip.dismissing {
  animation: discoveryTipOut 0.3s ease-out forwards;
}
@keyframes discoveryTipOut {
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}
.discovery-tip-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1px solid rgba(212, 168, 74, 0.2);
  border-radius: 5px;
  color: #8a7a5a;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease-out;
  font-family: inherit;
}
.discovery-tip-close:hover {
  background: rgba(212, 168, 74, 0.12);
  border-color: #d4a84a;
  color: #f0d080;
}
.discovery-tip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding-right: 24px;
}
.discovery-tip-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(212, 168, 74, 0.4));
}
.discovery-tip-label {
  color: #d4a84a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.discovery-tip-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #d4cfb8;
  font-family: Georgia, serif;
}
.discovery-tip-text b { color: #d4a84a; font-weight: 600; }
@media (max-width: 480px) {
  .discovery-tip {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    padding: 14px 16px 12px;
  }
}

/* ========== ENGAGEMENT NUDGE (v12 G6) ========== */
#engagement-nudge {
  margin: 14px auto;
  max-width: 540px;
  background: linear-gradient(135deg, rgba(64, 192, 255, 0.08), rgba(212, 168, 74, 0.08));
  border: 1px solid #4a7aaa;
  border-radius: 8px;
  padding: 10px 16px;
  color: #d4e8ff;
  font-size: 13px;
  font-style: italic;
  text-align: center;
  line-height: 1.5;
}

/* ========== WEAK SPOT CALLOUT (v8) ========== */
.weak-spot-callout {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(255, 100, 100, 0.08), rgba(255, 64, 128, 0.08));
  border: 1px solid #aa4040;
  border-radius: 8px;
  padding: 14px 16px;
  text-align: left;
}
.weak-spot-callout h4 {
  color: #ff8a6a;
  font-size: 14px;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  font-weight: bold;
}
.weak-spot-callout ul {
  list-style: none;
  padding: 0;
  margin-bottom: 8px;
}
.weak-spot-callout li {
  font-size: 13px;
  color: #e8d8b0;
  padding: 4px 0;
  line-height: 1.5;
}
.weak-spot-callout small {
  display: block;
  color: #a08060;
  font-style: italic;
  font-size: 11px;
  margin-top: 4px;
}
.weak-spot-callout.strong {
  background: linear-gradient(135deg, rgba(106, 255, 138, 0.08), rgba(64, 192, 255, 0.08));
  border-color: #4a8a4a;
}
.weak-spot-callout.strong h4 { color: #6aff8a; margin-bottom: 0; }
.weak-spot-roadmap {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #6a5030;
}
.weak-spot-roadmap h4 { color: #d4a84a; margin-bottom: 6px; font-size: 13px; }
.weak-spot-roadmap ol {
  list-style: decimal;
  padding-left: 24px;
  margin: 0;
}
.weak-spot-roadmap li {
  font-size: 12px;
  color: #e8d8b0;
  padding: 3px 0;
  line-height: 1.5;
}
.weak-spot-roadmap b { color: #ffd180; }

/* ========== TELA DE CONQUISTAS (v7) ========== */
#achievements-screen {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: radial-gradient(ellipse at top, #1a0f1a 0%, #0a0505 60%);
  padding: 40px 20px 20px;
  overflow-y: auto;
}
#achievements-screen h2 {
  font-family: var(--font-narrative);
  font-size: clamp(28px, 4.5vw, 42px);
  color: var(--gold-2);
  margin-bottom: 8px;
  letter-spacing: 4px;
}
#achievements-screen .subtitle { color: #a08060; margin-bottom: 24px; font-style: italic; text-align: center; }
/* ========== ACHIEVEMENTS v20: tier system (bronze/prata/ouro/diamante) ========== */
#achievements-summary {
  background:
    radial-gradient(ellipse at top, rgba(212, 168, 74, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 12, 12, 0.85) 0%, rgba(8, 5, 8, 0.92) 100%);
  border: 1px solid rgba(212, 168, 74, 0.45);
  border-radius: 14px;
  padding: 18px 24px;
  margin-bottom: 28px;
  width: 100%;
  max-width: 760px;
  text-align: center;
  box-shadow: 0 0 1px rgba(212, 168, 74, 0.4), 0 12px 28px rgba(0, 0, 0, 0.55);
}
.ach-summary-text {
  font-size: 14px;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
  font-family: 'Inter', system-ui, sans-serif;
}
.ach-summary-label {
  color: #8a7a5a;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 700;
}
.ach-summary-count { color: #e8d8b0; font-size: 15px; }
.ach-summary-count b {
  font-size: 26px;
  color: #ffd180;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fce58c 0%, #d4a84a 60%, #b08030 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ach-summary-pct {
  color: #c89a3a;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}
.ach-summary-bar {
  background: rgba(26, 16, 16, 0.85);
  border: 1px solid rgba(58, 42, 26, 0.85);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
}
.ach-summary-fill {
  height: 100%;
  background: linear-gradient(90deg, #6aff8a 0%, #d4a84a 50%, #ff7090 100%);
  box-shadow: 0 0 12px rgba(212, 168, 74, 0.4);
  transition: width 0.6s ease-out;
}
#achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  max-width: 960px;
  width: 100%;
  margin-bottom: 24px;
}
.ach-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 14px;
  border-radius: 12px;
  border: 1px solid rgba(106, 80, 48, 0.55);
  background:
    radial-gradient(ellipse at top, rgba(212, 168, 74, 0.04) 0%, transparent 70%),
    linear-gradient(180deg, rgba(22, 12, 14, 0.85) 0%, rgba(10, 5, 8, 0.92) 100%);
  transition: transform 0.25s ease-out, border-color 0.25s ease-out, box-shadow 0.25s ease-out;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
}
.ach-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
/* Tier visual: cor de glow + border. Locked desaturada mas mantém indicação de tier. */
.ach-card.unlocked.ach-tier-bronze   { border-color: rgba(196, 130, 70, 0.8); box-shadow: 0 0 22px rgba(196, 130, 70, 0.18); }
.ach-card.unlocked.ach-tier-bronze::before { background: radial-gradient(ellipse at top right, rgba(196, 130, 70, 0.16) 0%, transparent 60%); opacity: 1; }
.ach-card.unlocked.ach-tier-prata    { border-color: rgba(200, 204, 220, 0.65); box-shadow: 0 0 22px rgba(180, 190, 210, 0.18); }
.ach-card.unlocked.ach-tier-prata::before { background: radial-gradient(ellipse at top right, rgba(200, 204, 220, 0.12) 0%, transparent 60%); opacity: 1; }
.ach-card.unlocked.ach-tier-ouro     { border-color: rgba(255, 209, 128, 0.85); box-shadow: 0 0 26px rgba(212, 168, 74, 0.28); }
.ach-card.unlocked.ach-tier-ouro::before { background: radial-gradient(ellipse at top right, rgba(255, 209, 128, 0.18) 0%, transparent 60%); opacity: 1; }
.ach-card.unlocked.ach-tier-diamante { border-color: rgba(166, 224, 255, 0.85); box-shadow: 0 0 32px rgba(120, 200, 255, 0.35), inset 0 0 18px rgba(120, 200, 255, 0.08); animation: diamondShine 4s ease-in-out infinite; }
.ach-card.unlocked.ach-tier-diamante::before { background: radial-gradient(ellipse at top right, rgba(166, 224, 255, 0.2) 0%, transparent 60%); opacity: 1; }
@keyframes diamondShine {
  0%, 100% { box-shadow: 0 0 32px rgba(120, 200, 255, 0.35), inset 0 0 18px rgba(120, 200, 255, 0.08); }
  50%      { box-shadow: 0 0 46px rgba(166, 224, 255, 0.55), inset 0 0 24px rgba(166, 224, 255, 0.16); }
}
.ach-card.unlocked:hover { transform: translateY(-2px); }
.ach-card.unlocked.ach-tier-bronze:hover   { box-shadow: 0 0 30px rgba(196, 130, 70, 0.4); }
.ach-card.unlocked.ach-tier-prata:hover    { box-shadow: 0 0 30px rgba(200, 204, 220, 0.4); }
.ach-card.unlocked.ach-tier-ouro:hover     { box-shadow: 0 0 36px rgba(255, 209, 128, 0.55); }
.ach-card.unlocked.ach-tier-diamante:hover { box-shadow: 0 0 48px rgba(166, 224, 255, 0.7), inset 0 0 30px rgba(166, 224, 255, 0.2); }

/* Locked: mantém tier color sutil mas dim */
.ach-card.locked { opacity: 0.5; }
.ach-card.locked .ach-icon { background: rgba(20, 14, 14, 0.7); }
.ach-card.locked.ach-tier-bronze   { border-color: rgba(196, 130, 70, 0.3); }
.ach-card.locked.ach-tier-prata    { border-color: rgba(200, 204, 220, 0.25); }
.ach-card.locked.ach-tier-ouro     { border-color: rgba(255, 209, 128, 0.3); }
.ach-card.locked.ach-tier-diamante { border-color: rgba(166, 224, 255, 0.3); }

/* Tier pill (canto direito) */
.ach-tier-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: 'Inter', system-ui, sans-serif;
}
.ach-tier-bronze   .ach-tier-pill { color: #d8a070; border-color: rgba(196, 130, 70, 0.5); }
.ach-tier-prata    .ach-tier-pill { color: #c8ccdc; border-color: rgba(200, 204, 220, 0.45); }
.ach-tier-ouro     .ach-tier-pill { color: #ffd180; border-color: rgba(255, 209, 128, 0.55); }
.ach-tier-diamante .ach-tier-pill { color: #a6e0ff; border-color: rgba(166, 224, 255, 0.55); text-shadow: 0 0 6px rgba(166, 224, 255, 0.5); }
.ach-card.locked .ach-tier-pill { opacity: 0.6; }

.ach-icon {
  font-size: 32px;
  min-width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 20, 15, 0.7);
  border-radius: 12px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5));
  position: relative;
  z-index: 1;
}
.ach-card.unlocked.ach-tier-bronze   .ach-icon { background: linear-gradient(135deg, rgba(196, 130, 70, 0.2), rgba(120, 70, 40, 0.1)); }
.ach-card.unlocked.ach-tier-prata    .ach-icon { background: linear-gradient(135deg, rgba(200, 204, 220, 0.18), rgba(150, 155, 175, 0.06)); }
.ach-card.unlocked.ach-tier-ouro     .ach-icon { background: linear-gradient(135deg, rgba(255, 209, 128, 0.22), rgba(180, 130, 50, 0.08)); }
.ach-card.unlocked.ach-tier-diamante .ach-icon { background: linear-gradient(135deg, rgba(166, 224, 255, 0.22), rgba(100, 160, 220, 0.08)); }
.ach-info { flex: 1; min-width: 0; position: relative; z-index: 1; padding-right: 50px; }
.ach-name {
  color: #f0e4c0;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  font-family: 'Inter', system-ui, sans-serif;
}
.ach-card.locked .ach-name { color: #8a7a5a; }
.ach-desc {
  color: #b0a070;
  font-size: 12px;
  line-height: 1.4;
  font-family: 'Inter', system-ui, sans-serif;
}
.ach-card.locked .ach-desc { color: #807060; }

/* ========== TELA DE JOGO ========== */
#game-screen { background: #000; position:relative; }
#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  /* v17: color grading reforçado — tom warmer, contraste maior pra combinar com bloom */
  filter: contrast(1.12) saturate(1.22) brightness(1.04);
}
/* Vinheta cinematográfica */
#game-screen::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0) 40%,
    rgba(0,0,0,0.35) 70%,
    rgba(0,0,0,0.7) 100%);
}
/* Grão de filme animado */
#game-screen::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 1.8s steps(6) infinite;
  mix-blend-mode: overlay;
}
@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  16%  { transform: translate(-2%, 1%); }
  33%  { transform: translate(1%, -2%); }
  50%  { transform: translate(-1%, 2%); }
  66%  { transform: translate(2%, -1%); }
  83%  { transform: translate(-2%, -1%); }
  100% { transform: translate(0, 0); }
}
/* Brilho suave (fake bloom) — desativado pra não criar mancha forte no centro */
#game-screen .bloom-overlay {
  display: none;
}

/* ========== HUD v20: row horizontal de chips (era tabela vertical key:value) ========== */
#hud.hud-row {
  position: fixed;
  top: 14px;
  left: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 10;
  padding: 6px;
  background: rgba(10, 5, 5, 0.72);
  border: 1px solid rgba(106, 80, 48, 0.55);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 220, 140, 0.06);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  max-width: calc(100vw - 100px);
}
#hud .hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px 6px 10px;
  background: rgba(28, 18, 14, 0.6);
  border: 1px solid rgba(106, 80, 48, 0.5);
  border-radius: 8px;
  font-size: 13px;
  color: #e8d8b0;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 0.18s ease-out, background 0.18s ease-out;
}
#hud .hud-chip:hover { border-color: rgba(212, 168, 74, 0.5); background: rgba(38, 24, 18, 0.7); }
#hud .hud-icon {
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}
#hud .hud-value {
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #f0e4c0;
  font-family: 'Inter', system-ui, sans-serif;
}
#hud .hud-chip-casino .hud-value { color: #d4a84a; }
#hud .hud-chip-chips  .hud-value {
  color: #ffd180;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
#hud .hud-chip-progress .hud-value {
  color: #c89a7a;
  font-variant-numeric: tabular-nums;
}
/* Combo chip — só aparece quando combo >= 2 */
#hud .hud-chip-combo {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(255, 64, 128, 0.18), rgba(212, 168, 74, 0.18));
  border: 1px solid rgba(255, 106, 154, 0.5);
  border-radius: 8px;
  font-size: 13px;
  font-weight: bold;
  color: #ff8aaa;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.5px;
}
#hud .hud-chip-combo[data-active="1"] { display: inline-flex; }
#hud .hud-chip-combo.hot {
  animation: comboFlash 0.55s ease-in-out infinite;
  transform-origin: center;
  /* v13: will-change reduz jank em mobile */
  will-change: transform, color, text-shadow, box-shadow;
}
@keyframes comboFlash {
  0%, 100% {
    text-shadow: 0 0 10px #ff6a9a;
    box-shadow: 0 0 12px rgba(255, 106, 154, 0.3);
    transform: scale(1);
  }
  50% {
    text-shadow: 0 0 22px #ffd700, 0 0 40px rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.55);
    color: #ffd700;
    transform: scale(1.06);
  }
}

/* ========== CONTROLS TOGGLE + HINT (v20) — substitui painel fixo de 11 keys ========== */
.controls-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  background: rgba(10, 5, 5, 0.72);
  border: 1px solid rgba(106, 80, 48, 0.55);
  border-radius: 10px;
  color: #d4a84a;
  font-size: 18px;
  cursor: pointer;
  z-index: 11;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-out;
  font-family: inherit;
}
.controls-toggle:hover {
  background: rgba(28, 18, 14, 0.85);
  border-color: #d4a84a;
  color: #ffd180;
  box-shadow: 0 0 16px rgba(212, 168, 74, 0.3);
}
.controls-toggle[aria-expanded="true"] {
  background: rgba(212, 168, 74, 0.12);
  border-color: #d4a84a;
  color: #ffd180;
}

#controls-hint {
  position: fixed;
  top: 62px;
  right: 14px;
  background:
    radial-gradient(ellipse at top right, rgba(212, 168, 74, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 12, 12, 0.96) 0%, rgba(8, 4, 6, 0.96) 100%);
  border: 1px solid rgba(212, 168, 74, 0.45);
  border-radius: 12px;
  padding: 14px 16px 12px;
  font-size: 12px;
  color: #c8b890;
  z-index: 10;
  max-width: 280px;
  width: 280px;
  line-height: 1.5;
  backdrop-filter: blur(10px);
  display: none;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow:
    0 0 1px rgba(212, 168, 74, 0.5),
    0 12px 36px rgba(0, 0, 0, 0.75),
    0 0 30px rgba(212, 168, 74, 0.1);
  animation: controlsHintIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#controls-hint.show { display: block; }
@keyframes controlsHintIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); transform-origin: top right; }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.controls-hint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(212, 168, 74, 0.15);
}
.controls-hint-header strong {
  color: #d4a84a;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
}
.controls-hint-close {
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1px solid rgba(212, 168, 74, 0.2);
  border-radius: 5px;
  color: #8a7a5a;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease-out;
  font-family: inherit;
}
.controls-hint-close:hover { border-color: #d4a84a; color: #f0d080; background: rgba(212, 168, 74, 0.1); }
.controls-hint-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
}
.controls-hint-list dt {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-wrap: wrap;
}
.controls-hint-list dd {
  margin: 0;
  color: #b0a070;
  font-size: 12px;
  align-self: center;
}
#controls-hint .key {
  display: inline-block;
  background: #2a1f15;
  border: 1px solid #6a5030;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: #d4a84a;
  font-size: 10px;
  letter-spacing: 0.5px;
  line-height: 1.4;
  font-weight: 600;
}
.controls-hint-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 168, 74, 0.15);
  cursor: pointer;
  color: #d4a84a;
  font-size: 12px;
  font-weight: 600;
}
.controls-hint-toggle input[type="checkbox"] {
  accent-color: #d4a84a;
  cursor: pointer;
}

#question-panel {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 95vw);
  /* v19: gradient mais sofisticado + glow dourado discreto */
  background:
    radial-gradient(ellipse at top, rgba(60, 30, 20, 0.55) 0%, transparent 50%),
    linear-gradient(180deg, rgba(22, 12, 12, 0.97) 0%, rgba(8, 4, 4, 0.97) 100%);
  border: 1px solid rgba(212, 168, 74, 0.35);
  border-radius: 14px;
  padding: 22px 24px 20px;
  z-index: 10;
  display: none;
  backdrop-filter: blur(12px);
  box-shadow:
    0 0 1px rgba(212, 168, 74, 0.6),
    0 12px 40px rgba(0, 0, 0, 0.85),
    0 0 60px rgba(212, 168, 74, 0.08);
}
#question-panel.show { display: block; animation: slideUp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes slideUp {
  0%   { transform: translate(-50%, 100%) scale(0.96); opacity: 0; }
  60%  { transform: translate(-50%, -4%) scale(1.01); opacity: 1; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}
#question-panel .q-header {
  font-size: 11px;
  color: #c89a3a;
  letter-spacing: 3px;
  margin-bottom: 10px;
  text-transform: uppercase;
  font-weight: 600;
  /* Linha sutil dourada abaixo */
  border-bottom: 1px solid rgba(212, 168, 74, 0.15);
  padding-bottom: 8px;
}
#question-panel .q-text {
  font-size: 19px;
  color: #f5e8c8;
  margin-bottom: 18px;
  line-height: 1.5;
  font-family: Georgia, serif;
}
#question-panel .q-hand {
  display: inline-block;
  padding: 3px 14px;
  /* v19: pill dourada com glow sutil + texture sutil */
  background: linear-gradient(180deg, rgba(212, 168, 74, 0.22) 0%, rgba(170, 130, 60, 0.16) 100%);
  border: 1px solid rgba(212, 168, 74, 0.6);
  border-radius: 6px;
  color: #f0d080;
  font-weight: bold;
  font-size: 24px;
  font-family: Georgia, serif;
  letter-spacing: 0.5px;
  margin: 0 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 140, 0.25),
    0 0 12px rgba(212, 168, 74, 0.18);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.hand-badge {
  display: inline-block;
  font-size: 18px;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
  animation: badgePop 0.5s ease-out;
}
.hand-badge.tier-premium { filter: drop-shadow(0 0 6px #ffd700); }
.hand-badge.tier-strong { filter: drop-shadow(0 0 5px #6aff8a); }
.hand-badge.tier-fronteira { filter: drop-shadow(0 0 5px #ffa040); }
.hand-badge.tier-fora { filter: drop-shadow(0 0 4px #ff4060); }
@keyframes badgePop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
#question-panel .bluff {
  font-style: italic;
  color: #e8a0b8;
  background: rgba(60, 20, 40, 0.6);
  border-left: 3px solid #e8a0b8;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 4px;
  font-size: 14px;
}
#question-panel .bluff::before { content: '🎭 Laura: '; color: #d4a84a; font-weight: bold; font-style: normal; }

/* Mesa visual contextual (Fase 2 — Quiz Poker.Mtts) */
.poker-table-wrap {
  margin: 6px 0 14px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(212, 168, 74, 0.4);
  background: #050308;
  box-shadow:
    0 0 18px rgba(0, 0, 0, 0.6) inset,
    0 0 30px rgba(212, 168, 74, 0.25),
    0 6px 20px rgba(0, 0, 0, 0.5);
  animation: tableWrapIn 0.4s ease-out;
}
@keyframes tableWrapIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.poker-table-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
}
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.options-grid.yesno { grid-template-columns: 1fr 1fr; }
.option-btn {
  padding: 14px;
  background: rgba(30, 20, 15, 0.8);
  border: 2px solid #6a5030;
  border-radius: 6px;
  color: #e8d8b0;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  transition: all 0.2s;
}
.option-btn:hover:not(:disabled) {
  background: rgba(60, 40, 30, 0.9);
  border-color: #d4a84a;
  transform: translateX(4px);
}
.option-btn .letter {
  display: inline-block;
  width: 26px;
  height: 26px;
  line-height: 24px;
  text-align: center;
  background: #2a1f15;
  border: 1px solid #d4a84a;
  border-radius: 50%;
  color: #d4a84a;
  font-weight: bold;
  margin-right: 10px;
}
.option-btn.correct {
  background: rgba(40, 100, 40, 0.6);
  border-color: #6aff6a;
  animation: correctPulse 0.6s ease-out;
  box-shadow: 0 0 20px rgba(106, 255, 106, 0.5);
}
.option-btn.wrong {
  background: rgba(100, 40, 40, 0.6);
  border-color: #ff6a6a;
  animation: wrongShake 0.5s ease-out;
}
@keyframes correctPulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06); box-shadow: 0 0 28px rgba(106, 255, 106, 0.8); }
  70%  { transform: scale(0.98); }
  100% { transform: scale(1); box-shadow: 0 0 20px rgba(106, 255, 106, 0.5); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.option-btn:disabled { cursor: default; }

/* Tela final */
#end-screen {
  flex-direction: column;
  align-items: center;
  /* v16: overflow-y auto + flex-start pra não cortar conteúdo (h2+score+stats+chart+ranking+4 botões = ~950px) */
  justify-content: flex-start;
  background: radial-gradient(ellipse at center, #15080a 0%, #050205 70%);
  padding: max(40px, 5vh) 20px 30px;
  overflow-y: auto;
}
#end-screen h2 {
  font-size: clamp(36px, 6vw, 64px);
  color: #d4a84a;
  margin-bottom: 20px;
  letter-spacing: 4px;
}
/* v20: end-screen title sem emojis, com ornamento gold sutil + brand wordmark */
#end-screen h2.end-title {
  font-family: var(--font-narrative);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  letter-spacing: 5px;
  text-transform: uppercase;
  font-weight: 700;
  font-size: clamp(28px, 4.4vw, 46px);
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 60%, var(--gold-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  position: relative;
  padding: 14px 0 6px;
}
#end-screen h2.end-title::before,
#end-screen h2.end-title::after {
  content: '';
  display: block;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(212, 168, 74, 0.6) 50%, transparent 100%);
}
#end-screen h2.end-title::before { margin-bottom: 8px; }
#end-screen h2.end-title::after  { margin-top: 8px; }
#end-screen h2.end-title .end-brand {
  font-size: 0.5em;
  letter-spacing: 6px;
  color: #c89a3a;
  background: none;
  -webkit-text-fill-color: #c89a3a;
  font-weight: 600;
  opacity: 0.85;
  font-family: 'Inter', system-ui, sans-serif;
  text-transform: lowercase;
}
#end-screen h2.end-title .end-brand .brand-dot {
  color: #ff7090;
  -webkit-text-fill-color: #ff7090;
  text-shadow: 0 0 8px rgba(255, 112, 144, 0.4);
}
/* v20: end-grid layout 2-col em desktop, stack em mobile */
.end-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto 24px;
}
.end-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0; /* permite filhos com max-width 100% */
}
.end-col > * { margin-bottom: 0; min-width: 0; max-width: 100%; }
.end-actions { max-width: 1080px; width: 100%; margin: 0 auto; }
@media (min-width: 900px) {
  .end-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}

/* v20: score-box refinado — número 80px tabular, hierarquia clara, ornamento gold */
.score-box {
  background:
    radial-gradient(ellipse at top, rgba(212, 168, 74, 0.1) 0%, transparent 60%),
    linear-gradient(180deg, rgba(22, 12, 12, 0.92) 0%, rgba(10, 6, 8, 0.95) 100%);
  border: 1px solid rgba(212, 168, 74, 0.45);
  border-radius: 14px;
  padding: 30px 36px 26px;
  margin-bottom: 0;
  text-align: center;
  min-width: 0;
  width: 100%;
  box-shadow:
    0 0 1px rgba(212, 168, 74, 0.5),
    0 12px 36px rgba(0, 0, 0, 0.75),
    0 0 60px rgba(212, 168, 74, 0.1);
  position: relative;
}
.score-box .label {
  color: #c89a3a;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 3.5px;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  margin-bottom: 6px;
  opacity: 0.9;
}
.score-box .big {
  font-size: clamp(56px, 7vw, 80px);
  color: #ffd180;
  font-weight: 700;
  margin: 4px 0 16px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  background: linear-gradient(180deg, #fce58c 0%, #d4a84a 60%, #b08030 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 32px rgba(212, 168, 74, 0.35);
  font-family: 'Georgia', serif;
}
.score-box .score-meta {
  display: flex;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid rgba(212, 168, 74, 0.18);
}
.score-box .meta-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.score-box .meta-label {
  color: #8a7a5a;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
}
.score-box .meta-value {
  color: #e8d8b0;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.score-box .meta-value.gold { color: #d4a84a; letter-spacing: 1px; }

/* v20: sub-elementos do end-grid ocupam largura total da coluna */
.end-col #stats-breakdown,
.end-col #ranking-panel,
.end-col #engagement-nudge,
.end-col #replay-errors,
.end-col #history-chart {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  margin: 0;
}
/* Refinar o look dos cards secundários do end-screen */
.end-col #stats-breakdown,
.end-col #ranking-panel,
.end-col #replay-errors {
  background:
    radial-gradient(ellipse at top, rgba(212, 168, 74, 0.05) 0%, transparent 60%),
    linear-gradient(180deg, rgba(22, 12, 12, 0.85) 0%, rgba(10, 6, 8, 0.9) 100%);
  border: 1px solid rgba(106, 80, 48, 0.55);
  border-radius: 12px;
  padding: 18px 22px;
  box-shadow:
    0 0 1px rgba(212, 168, 74, 0.25),
    0 8px 24px rgba(0, 0, 0, 0.55);
}
.end-col #stats-breakdown h3,
.end-col #ranking-panel h3 {
  color: #f0d080;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 168, 74, 0.15);
}
.end-col #history-chart {
  background: linear-gradient(180deg, rgba(22, 12, 12, 0.7) 0%, rgba(10, 6, 8, 0.85) 100%);
  border: 1px solid rgba(106, 80, 48, 0.4);
  border-radius: 12px;
  padding: 14px 18px;
}

/* Replay perguntas erradas (tela final) */
#replay-errors {
  background: rgba(60, 20, 20, 0.65);
  border: 1px solid #6a3030;
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 360px;
  max-width: 500px;
  margin-bottom: 18px;
}
.replay-list { max-height: 200px; overflow-y: auto; }
.replay-item {
  padding: 8px 10px;
  border-left: 3px solid #ff8a6a;
  margin-bottom: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  font-size: 13px;
}
.replay-item small { color: #c0a890; display: block; margin-top: 4px; font-size: 11px; line-height: 1.4; }

/* Estatísticas por posição (tela final) */
#stats-breakdown {
  background: rgba(20, 10, 10, 0.85);
  border: 1px solid #8a6a3a;
  border-radius: 8px;
  padding: 18px 22px;
  min-width: 360px;
  max-width: 500px;
  margin-bottom: 18px;
  display: none;
}
#stats-breakdown h3 {
  color: #d4a84a;
  margin-bottom: 14px;
  letter-spacing: 2px;
  font-size: 16px;
}
.stat-row {
  display: grid;
  grid-template-columns: 50px 1fr 60px 50px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.stat-pos {
  text-align: center;
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 1px;
  border: 1px solid;
  border-radius: 4px;
  padding: 2px 0;
}
.stat-bar {
  background: #1a1010;
  border: 1px solid #3a2a1a;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  transition: width 0.4s ease-out;
}
.stat-num {
  font-size: 12px;
  color: #888;
  text-align: right;
}
.stat-pct {
  font-size: 13px;
  font-weight: bold;
  text-align: right;
}

/* Ranking */
#ranking-panel {
  background: rgba(20, 10, 10, 0.85);
  border: 1px solid #8a6a3a;
  border-radius: 8px;
  padding: 20px;
  min-width: 320px;
  max-width: 500px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
}
#ranking-panel h3 { color: #d4a84a; margin-bottom: 12px; letter-spacing: 2px; }
.rank-row {
  display: grid;
  grid-template-columns: 30px 1fr 60px 60px;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #3a2a1a;
  font-size: 14px;
  align-items: center;
}
.rank-row.header { color: #888; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.rank-row .pos { color: #d4a84a; font-weight: bold; text-align: center; }
.rank-row .score { text-align: right; color: #d4a84a; font-weight: bold; }
.rank-row .hits { text-align: right; color: #6aff6a; }

.button-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Toast */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 5, 5, 0.95);
  border: 2px solid #d4a84a;
  color: #d4a84a;
  padding: 14px 24px;
  border-radius: 6px;
  z-index: 999;
  font-size: 15px;
  display: none;
  box-shadow: 0 0 20px rgba(212, 168, 74, 0.5);
}
#toast.show { display: block; animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes toastIn {
  0%   { opacity: 0; transform: translate(-50%, -20px) scale(0.85) rotate(-2deg); }
  60%  { opacity: 1; transform: translate(-50%, 4px) scale(1.04) rotate(1deg); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(0); }
}

/* Minigame modal */
#minigame-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
#minigame-modal.show { display: flex; animation: minigameFadeIn 0.3s ease-out; }
#minigame-modal.show .modal-content {
  animation: minigameSlideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes minigameFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes minigameSlideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.85); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-content {
  background: linear-gradient(180deg, #1a0f15 0%, #0a0508 100%);
  border: 2px solid #d4a84a;
  border-radius: 10px;
  padding: 30px;
  min-width: 320px;
  max-width: 500px;
  text-align: center;
}
.modal-content h3 { color: #d4a84a; margin-bottom: 15px; letter-spacing: 3px; }
.slot-display {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}
.slot-reel {
  width: 80px;
  height: 100px;
  background: #2a1f15;
  border: 2px solid #d4a84a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

/* HUD da pista de kart */
#kart-hud .kart-stat {
  font-size: 13px;
  letter-spacing: 1px;
}
#kart-hud .kart-stat b {
  color: #ffd080;
  font-size: 18px;
  display: block;
}

/* Painel de explicação no modo Treino */
.training-explanation {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  border-left: 4px solid;
  background: rgba(20, 10, 10, 0.7);
  animation: trainingFadeIn 0.3s ease-out;
}
.training-explanation.training-correct {
  border-color: #6aff8a;
  background: rgba(20, 60, 30, 0.5);
}
.training-explanation.training-wrong {
  border-color: #ff8a6a;
  background: rgba(60, 20, 20, 0.5);
}
.training-header {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #f0e4c0;
  letter-spacing: 1px;
}
.training-text {
  font-size: 14px;
  color: #d4cfb8;
  line-height: 1.5;
  margin-bottom: 12px;
}
.training-text b { color: #d4a84a; }
.training-next {
  width: 100%;
  font-size: 15px;
  padding: 10px;
}
@keyframes trainingFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Onboarding 5 slides (primeira vez) */
#onboarding-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  backdrop-filter: blur(10px);
  padding: 20px;
}
#onboarding-modal.show { display: flex; animation: howtoFadeIn 0.5s ease-out; }
.onboarding-content {
  background: linear-gradient(180deg, #1a0f15 0%, #0a0508 100%);
  border: 2px solid #d4a84a;
  border-radius: 12px;
  padding: 32px 36px;
  max-width: 600px;
  width: 100%;
  text-align: center;
  color: #e8d8b0;
  box-shadow: 0 0 40px rgba(212, 168, 74, 0.4);
  position: relative;
  animation: howtoSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.onboarding-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 22px;
}
.onb-dot {
  width: 30px;
  height: 4px;
  background: #3a2820;
  border-radius: 2px;
  transition: background 0.3s;
}
.onb-dot.active { background: #d4a84a; box-shadow: 0 0 8px rgba(212, 168, 74, 0.6); }
.onb-icon { font-size: 64px; margin-bottom: 16px; }
.onboarding-content h2 {
  color: #f0e4c0;
  font-size: 26px;
  margin-bottom: 18px;
  letter-spacing: 1px;
}
.onboarding-content p {
  color: #d4cfb8;
  line-height: 1.6;
  margin-bottom: 14px;
  font-size: 15px;
}
.onboarding-content ul li {
  padding: 6px 0 6px 12px;
  border-left: 2px solid rgba(212, 168, 74, 0.3);
  margin-bottom: 4px;
  font-size: 14px;
}
.onboarding-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* Streak badge override pra ficar abaixo do onboarding */
#onboarding-modal.show ~ #streak-badge { display: none; }

/* Modal "Como Jogar" (overlay sobre tela inicial) */
#howto-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(8px);
  padding: 20px;
}
#howto-modal.show { display: flex; animation: howtoFadeIn 0.35s ease-out; }
#howto-modal.show .howto-content { animation: howtoSlideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes howtoFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes howtoSlideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.howto-content {
  background: linear-gradient(180deg, #1a0f15 0%, #0a0508 100%);
  border: 2px solid #d4a84a;
  border-radius: 12px;
  padding: 32px;
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  color: #e8d8b0;
  box-shadow: 0 0 40px rgba(212, 168, 74, 0.3);
}
.howto-content h2 {
  font-family: var(--font-narrative);
  color: var(--gold-2);
  letter-spacing: 3px;
  margin-bottom: 14px;
  font-size: clamp(22px, 3vw, 32px);
}
.howto-intro {
  color: #a08060;
  font-style: italic;
  margin-bottom: 22px;
  font-size: 15px;
}
.howto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
}
.howto-content h3 {
  color: #d4a84a;
  margin-bottom: 8px;
  font-size: 16px;
  letter-spacing: 1px;
}
.howto-content ul {
  list-style: none;
  padding: 0;
}
.howto-content li {
  padding: 5px 0 5px 16px;
  border-left: 2px solid rgba(212, 168, 74, 0.3);
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.5;
}
.howto-content b { color: #d4a84a; }
@media (max-width: 700px) {
  .howto-grid { grid-template-columns: 1fr; }
  .howto-content { padding: 20px; }
}

/* v20: pulse no controls-toggle (botão) nos primeiros segundos da 1ª partida */
.controls-toggle.pulse {
  animation: hintPulse 1.4s ease-in-out 3;
}
@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(212, 168, 74, 0); border-color: rgba(106, 80, 48, 0.55); }
  50%      { box-shadow: 0 0 22px rgba(212, 168, 74, 0.7); border-color: #d4a84a; }
}

/* Botão de mute */
#mute-btn {
  position: fixed;
  bottom: 15px;
  right: 15px;
  background: rgba(10, 5, 5, 0.85);
  border: 1px solid #6a5030;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  color: #d4a84a;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
}

/* Botão de sair (sempre visível durante o jogo) — v16: posição fluida pra evitar overlap com #controls-hint */
#exit-btn {
  position: fixed;
  top: 15px;
  /* Reserva 240px (max-width do controls-hint) + 15px gap + 15px right margin */
  right: max(15px, 270px);
  background: rgba(60, 10, 15, 0.9);
  border: 1px solid #aa2030;
  border-radius: 4px;
  padding: 8px 14px;
  color: #ffaab0;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  z-index: 11;
  letter-spacing: 1px;
  font-family: inherit;
  transition: all 0.2s;
}
@media (max-width: 1100px) {
  /* Em telas menores, controls-hint pode estar oculto ou contraído — fica no canto direito mesmo */
  #exit-btn { right: 15px; }
}
#exit-btn:hover {
  background: rgba(120, 20, 30, 0.95);
  color: #fff;
  border-color: #ff4040;
  box-shadow: 0 0 12px rgba(255, 64, 64, 0.4);
}
@media (max-width: 700px) {
  #exit-btn { right: 70px; top: 15px; }
}

@media (max-width: 600px) {
  .options-grid { grid-template-columns: 1fr; }
  #question-panel { bottom: 10px; padding: 14px; }
  #controls-hint { display: none; }
}

/* ============================================================
   MOBILE — Joystick virtual + botões de ação
   ============================================================ */
#mobile-stick {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(20, 10, 10, 0.55);
  border: 2px solid rgba(212, 168, 74, 0.55);
  z-index: 50;
  touch-action: none;
  box-shadow: 0 0 18px rgba(0,0,0,0.6);
}
#mobile-stick .stick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4d680, #8a6a30 70%, #3a2810);
  border: 2px solid #d4a84a;
  box-shadow: 0 0 14px rgba(212,168,74,0.5);
  transition: transform 0.05s linear;
}
#mobile-actions {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: grid;
  grid-template-columns: repeat(3, 60px);
  gap: 8px;
  z-index: 50;
}
#mobile-actions .ma-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6a1010 0%, #3a0808 100%);
  color: #ffd080;
  border: 2px solid #d4a84a;
  font-family: inherit;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(212,168,74,0.4);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#mobile-actions .ma-btn:active,
#mobile-actions .ma-btn.active {
  background: linear-gradient(180deg, #8a1818 0%, #5a0a0a 100%);
  transform: scale(0.95);
  box-shadow: 0 0 22px rgba(255,140,40,0.7);
}
#mobile-actions .ma-btn-turbo {
  background: linear-gradient(180deg, #aa6010 0%, #6a3a05 100%);
  border-color: #ffaa30;
  font-size: 24px;
}
#mobile-actions .ma-btn-turbo.active {
  background: linear-gradient(180deg, #ff8030 0%, #aa4010 100%);
  box-shadow: 0 0 26px rgba(255, 160, 60, 0.9);
}

/* Em telas pequenas, ajusta o painel da pergunta pra não cobrir os botões */
@media (max-width: 800px) and (pointer: coarse) {
  #question-panel {
    bottom: 110px;
    /* v13: scroll interno se altura passar do disponível, evita corte do topo */
    max-height: calc(100vh - 130px);
    overflow-y: auto;
  }
  #controls-hint, .controls-toggle { display: none; }
  /* v13: mute-btn movido pra topo-centro pra não colidir com mobile-actions (bottom 30-158) */
  #mute-btn {
    bottom: auto;
    top: 15px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }
  #exit-btn { right: 15px; top: 15px; }
  /* v20: HUD chips compacto em mobile */
  #hud.hud-row {
    padding: 4px;
    gap: 4px;
    max-width: calc(100vw - 60px);
    flex-wrap: wrap;
  }
  #hud .hud-chip {
    padding: 4px 8px 4px 6px;
    font-size: 11px;
    gap: 4px;
  }
  #hud .hud-icon { font-size: 11px; }
  #hud .hud-chip-chips .hud-value { font-size: 12px; }
  /* Streak badge desce um pouco pra não colidir com HUD em viewport estreito */
  #streak-badge { top: 70px !important; left: 14px !important; right: auto !important; transform: none !important; }
  /* Touch targets maiores (U7 do REVIEW2_AGENTES, v8) — facilita pra alunos em iPad/Android */
  .option-btn {
    min-height: 56px;
    padding: 16px 14px;
    font-size: 16px;
  }
  .option-btn .letter {
    width: 32px;
    height: 32px;
    line-height: 30px;
    font-size: 16px;
  }
  .btn { min-height: 48px; padding: 14px 28px; }
  .ach-card { min-height: 88px; }
  .casino-card { min-height: 140px; }
  .stage-card { min-height: 76px; }
}
