/* Modo jogo. Mobile primeiro: painel de perguntas na parte de baixo, botoes grandes.
   Usa as variaveis de cor do index.html (--panel, --border, --accent...). */

#toolbar .btn-game { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* no jogo some tudo que e do modo estudo (lista, painel de info, alfinetes, creditos de rodape) */
body.mode-jogo #sidebar,
body.mode-jogo #sidebar-toggle,
body.mode-jogo #sidebar-backdrop,
body.mode-jogo #toolbar,
body.mode-jogo #pin-hint,
body.mode-jogo #info-panel,
body.mode-jogo #credits { display: none !important; }

#game-root { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#game-root > * { pointer-events: auto; }
#game-root [hidden] { display: none !important; }

.game-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-size: 14px; cursor: pointer; line-height: 1.2;
}
.game-btn:hover:not(:disabled) { background: var(--border); }
.game-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.game-btn.primary { background: var(--accent); border-color: var(--accent); color: #07131f; font-weight: 700; }
.game-btn.primary:hover:not(:disabled) { background: #7cc4ff; }
.game-btn.ghost { background: transparent; }
.game-btn.danger { border-color: #ff5d5d; color: #ff8f8f; }
.game-btn.big { padding: 14px 18px; font-size: 15px; min-height: 48px; }
.game-btn.small { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.game-btn.on { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------- menu de fases */
.game-menu {
  position: absolute; inset: 0; overflow-y: auto;
  background: rgba(18, 22, 28, 0.97);
  padding: 16px;
}
.game-menu-inner { max-width: 820px; margin: 0 auto; padding-bottom: 24px; }
.game-menu-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.game-menu h2 { margin: 0; font-size: 22px; }
.game-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.game-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.game-actions.col { flex-direction: column; align-items: stretch; }
.game-hint { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin: 0 0 14px; }
.game-note { font-size: 11.5px; color: var(--accent-2); line-height: 1.5; margin: 18px 0 0; }
.game-phases { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.phase-card {
  position: relative; text-align: left; background: var(--panel); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 12px 12px 12px 46px; cursor: pointer; min-height: 96px;
}
.phase-card:hover:not(:disabled) { border-color: var(--accent); }
.phase-card.locked { opacity: 0.55; cursor: not-allowed; }
.phase-order {
  position: absolute; left: 10px; top: 12px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel-2); color: var(--accent); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.phase-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.phase-meta { font-size: 11.5px; color: var(--text-dim); }
.phase-stars { font-size: 18px; color: #ffd24d; letter-spacing: 2px; margin: 4px 0 2px; }
.phase-best { font-size: 11.5px; color: var(--text-dim); }

/* ------------------------------------------------------------------- HUD */
.game-hud {
  position: absolute; left: 8px; right: 8px; top: 8px;
  background: rgba(26, 32, 41, 0.94); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px 8px; display: flex; flex-direction: column; gap: 6px;
}
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-title { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-title span { color: var(--text-dim); }
.hud-score { display: flex; gap: 10px; font-size: 14px; font-weight: 600; }
.hud-row.tools { flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------- painel de pergunta */
.game-panel {
  position: absolute; left: 8px; right: 8px; bottom: 8px; max-height: 56vh; overflow-y: auto;
  background: rgba(26, 32, 41, 0.97); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
.q-type { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 6px; }
.q-prompt { font-size: 17px; line-height: 1.35; margin-bottom: 10px; }
.q-latin { font-size: 12.5px; color: var(--text-dim); font-style: italic; margin: -6px 0 8px; }
.q-help { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; margin-bottom: 12px; }
.q-options { display: grid; gap: 8px; margin-bottom: 10px; }
.q-option {
  display: flex; align-items: flex-start; gap: 10px; text-align: left; width: 100%;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 14px; line-height: 1.35; cursor: pointer; min-height: 48px;
}
.q-option:hover:not(:disabled) { border-color: var(--accent); }
.q-option:disabled { cursor: default; }
.q-option .q-letter {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--panel);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--accent);
}
.q-option.certo { border-color: #3ddc84; background: rgba(61, 220, 132, 0.14); }
.q-option.errado { border-color: #ff5d5d; background: rgba(255, 93, 93, 0.14); }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.q-actions .game-btn { flex: 1 1 140px; }
.q-feedback { margin-top: 10px; border-radius: 10px; padding: 12px; border: 1px solid var(--border); }
.q-feedback.certo { border-color: #3ddc84; background: rgba(61, 220, 132, 0.08); }
.q-feedback.errado { border-color: #ff5d5d; background: rgba(255, 93, 93, 0.08); }
.fb-title { font-weight: 700; margin-bottom: 6px; }
.fb-text { font-size: 13.5px; line-height: 1.5; margin-bottom: 6px; }
.fb-3d { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.q-feedback .game-btn { width: 100%; margin-top: 4px; }

/* ----------------------------------------------------------------- resumo */
.summary { text-align: center; padding: 6px 4px; }
.summary-stars { font-size: 42px; color: #ffd24d; letter-spacing: 6px; }
.summary h3 { margin: 4px 0 6px; font-size: 20px; }
.summary-line { color: var(--text-dim); font-size: 14px; margin-bottom: 8px; }
.summary-record { color: var(--accent-2); font-size: 14px; margin-bottom: 6px; }
.summary .q-actions { margin-top: 12px; }

/* ------------------------------------------------------------------ modal */
.game-modal { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 5; }
.game-modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column; }
.game-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.game-modal-head h3 { margin: 0; font-size: 16px; }
.game-x { background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; padding: 4px 8px; }
.game-modal-body { padding: 14px; overflow-y: auto; font-size: 13px; line-height: 1.55; }
.game-modal-body p { margin: 0 0 10px; }
.game-list { margin: 0 0 14px; padding-left: 18px; }
.game-check { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 2px; }

.game-loading {
  position: absolute; left: 50%; top: 72px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; color: var(--accent-2); z-index: 6;
}

/* ------------------------------------------------------- modos, jogador, ranking */
.game-subtop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.game-subtop .game-stats { margin-bottom: 0; }
.game-section { font-size: 14px; margin: 10px 0 8px; color: var(--text-dim); font-weight: 600; }
.player-chip {
  display: inline-flex; align-items: baseline; gap: 8px; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.player-chip:hover { border-color: var(--accent); }
.player-chip-sub { font-size: 10.5px; color: var(--accent); }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mode-card {
  text-align: left; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 14px; padding: 14px; cursor: pointer; min-height: 130px;
}
.mode-card:hover { border-color: var(--accent); }
.mode-icon { font-size: 26px; margin-bottom: 4px; }
.mode-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.mode-desc { font-size: 12.5px; line-height: 1.45; color: var(--text-dim); }
.mode-extra { font-size: 12px; margin-top: 8px; color: #ffd24d; }
.game-input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 15px; margin: 4px 0 12px;
}
.game-input:focus { outline: 1px solid var(--accent); }
.player-list { display: grid; gap: 6px; margin-bottom: 12px; }
.player-row { display: flex; align-items: center; gap: 4px; }
.player-pick {
  flex: 1; display: flex; justify-content: space-between; gap: 10px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; cursor: pointer;
}
.player-row.atual .player-pick { border-color: var(--accent); }
.player-pts { color: var(--text-dim); font-size: 12px; }
.player-add { display: flex; gap: 8px; align-items: center; }
.player-add .game-input { margin: 0; }
.rank-wrap { overflow-x: auto; margin-bottom: 12px; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.rank-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.rank-table td.num, .rank-table th:nth-child(n+3) { text-align: right; }
.rank-table tr.voce { background: rgba(79, 176, 255, 0.12); }
.rank-table tr.top td:first-child { font-size: 18px; }
.r-nome { font-weight: 600; }
.tag { margin-left: 6px; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 999px; background: var(--accent); color: #07131f; vertical-align: middle; }
.tag.imp { background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border); }
.card-text { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; user-select: all; }
.fb-more { margin: 4px 0 8px; font-size: 13px; line-height: 1.5; }
.fb-more summary { cursor: pointer; color: var(--accent); margin-bottom: 4px; }
.fb-more p { margin: 6px 0; }
.fb-fono { font-size: 12.5px; line-height: 1.45; color: var(--accent-2); margin-bottom: 6px; }

/* ------------------------------------------------------------- telas largas */
@media (min-width: 900px) {
  .game-hud { left: 12px; right: auto; max-width: 560px; top: 12px; }
  .game-panel { left: 12px; right: auto; width: 520px; bottom: 12px; max-height: 62vh; }
  .game-menu { padding: 28px; }
}
