/* ── Game Layout ─────────────────────────────────────────────────────────── */

.game-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Lobby ──────────────────────────────────────────────────────────────── */
.lobby-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}
.lobby-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 60%, rgba(232,197,71,.05) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(82,168,224,.04) 0%, transparent 50%);
  pointer-events: none;
}
.lobby-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: min(560px, 100%);
  box-shadow: var(--shadow-lg);
  position: relative;
}
.lobby-header { text-align: center; margin-bottom: 2rem; }
.lobby-header .logo-icon {
  width: 60px; height: 60px;
  background: var(--accent-bg);
  border: 1px solid rgba(232,197,71,.25);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin: 0 auto 1rem;
}
.lobby-header h1 { font-size: 2rem; }
.lobby-header p  { font-size: .9rem; color: var(--text-3); margin-top: .3rem; }

.players-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: .75rem;
}
.player-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.player-row .player-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-3);
  flex-shrink: 0;
}
.player-row .input { flex: 1; }
.player-row .btn-icon { flex-shrink: 0; }

/* Game selector */
.game-option {
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.game-option:hover   { border-color: var(--border-2); }
.game-option.selected { border-color: var(--accent); background: var(--accent-bg); }
.game-option .go-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.game-option.selected .go-icon { background: rgba(232,197,71,.15); color: var(--accent); }
.game-option .go-info { flex: 1; min-width: 0; }
.game-option .go-name  { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-option .go-meta  { font-size: .76rem; color: var(--text-3); margin-top: .15rem; }

/* ── HUD (in-game header) ─────────────────────────────────────────────── */
.game-hud {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.hud-logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: .06em;
  color: var(--accent);
  white-space: nowrap;
}
.hud-round {
  font-size: .82rem;
  color: var(--text-3);
  white-space: nowrap;
}
.hud-round strong { color: var(--text); }

/* Progress bar */
.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
}

/* Timer */
.hud-timer {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.hud-timer.warning { color: var(--accent); }
.hud-timer.danger  { color: var(--red); animation: pulse 1s infinite; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ── Frame display ──────────────────────────────────────────────────────── */
.game-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  min-height: 0;
}
.frame-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #050507;
  position: relative;
  min-height: calc(100vh - 60px);
}

.frame-display {
  position: relative;
  max-width: 800px;
  width: 100%;
}
.frame-display img {
  width: 100%;
  border-radius: var(--radius-lg);
  display: block;
  box-shadow: 0 16px 64px rgba(0,0,0,.8);
  user-select: none;
  -webkit-user-drag: none;
}
.frame-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  border: 1px solid var(--border);
}
.frame-timecode {
  position: absolute;
  bottom: 10px;
  right: 14px;
  z-index: 10;
  background: rgba(0,0,0,.75);
  border-radius: 4px;
  padding: .2rem .5rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: rgba(255,255,255,.6);
  backdrop-filter: blur(4px);
}

.frame-genre {
  position: absolute;
  bottom: 10px;
  left: 14px;
  z-index: 10;
  background: rgba(0,0,0,.75);
  border-radius: 4px;
  padding: .2rem .5rem;
  font-family: var(--font-body);
  font-size: .75rem;
  color: rgba(255,255,255,.8);
  backdrop-filter: blur(4px);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Hint toast no frame */
.hint-bubble {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: .5rem 1rem;
  font-size: .85rem;
  color: var(--accent);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .5rem;
  box-shadow: var(--glow);
  animation: hintPopDown 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  z-index: 200;
}

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
}
.fullscreen-overlay img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  background: #000;
  box-shadow: 0 18px 70px rgba(0,0,0,.8);
}
.fs-timer {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .75rem;
  border-radius: 100px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.85);
  font-family: var(--font-mono);
  font-size: .85rem;
  backdrop-filter: blur(8px);
}
.fs-hint {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  padding: .4rem .8rem;
  border-radius: 100px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  backdrop-filter: blur(8px);
}

@keyframes hintPopDown {
  0% {
    top: 50%;
    transform: translate(-50%, -50%) scale(2.5);
    box-shadow: 0 0 50px rgba(232,197,71, 0.5);
    background: var(--bg-1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  40% {
    top: 50%;
    transform: translate(-50%, -50%) scale(2.5);
    box-shadow: 0 0 50px rgba(232,197,71, 0.5);
    background: var(--bg-1);
    opacity: 1;
  }
  100% {
    top: -50px;
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

/* ── Answer panel ───────────────────────────────────────────────────────── */
.answer-panel {
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  gap: 1.5rem;
  overflow-y: auto;
}
.answer-panel h3 {
  font-size: 1rem;
  color: var(--text-2);
  font-family: var(--font-body);
  font-weight: 500;
}

/* Múltipla escolha */
.choices-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.choice-btn {
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .9rem;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.choice-btn:hover:not(:disabled) { border-color: var(--border-2); background: var(--bg-3); }
.choice-btn:disabled { cursor: default; }
.choice-btn.correct  { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.choice-btn.wrong    { border-color: var(--red);   background: var(--red-bg);   color: var(--red); }
.choice-btn.chosen { border-color: rgba(232,197,71,.55); background: rgba(232,197,71,.08); }
.choice-btn.chosen .choice-letter { background: rgba(232,197,71,.15); color: var(--accent); }
.choice-letter {
  width: 24px; height: 24px;
  border-radius: 4px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Resposta livre */
.free-answer-wrap {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.free-answer-wrap .input { font-size: 1rem; padding: .85rem 1rem; }

/* Jogadores scores sidebar */
.players-scores {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: auto;
}
.player-score-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--border);
  transition: all .3s;
}
.player-score-row.active-player { border-color: var(--accent); background: var(--accent-bg); }
.player-score-row .psr-name { flex: 1; font-size: .88rem; font-weight: 500; }
.player-score-row .psr-score {
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--accent);
}
.player-score-row .psr-delta {
  font-size: .75rem;
  font-family: var(--font-mono);
  animation: scorePop .5s ease;
}
.player-score-row .psr-delta.pos { color: var(--green); }
.player-score-row .psr-delta.neg { color: var(--red); }

@keyframes scorePop {
  0%   { transform: scale(1.5); opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

/* ── Reveal overlay ─────────────────────────────────────────────────────── */
.reveal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn .3s ease;
}
.reveal-card {
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: min(480px, 90vw);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}
.reveal-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  animation: iconPop .4s cubic-bezier(.17,.67,.49,1.5);
}
.reveal-icon.correct { background: var(--green-bg); color: var(--green); border: 2px solid var(--green); }
.reveal-icon.wrong   { background: var(--red-bg);   color: var(--red);   border: 2px solid var(--red); }
.reveal-icon.timeout { background: var(--accent-bg); color: var(--accent); border: 2px solid var(--accent); }

@keyframes iconPop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.reveal-movie  { font-family: var(--font-display); font-size: 2rem; letter-spacing: .04em; margin: .5rem 0; }
.reveal-points {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  margin: .5rem 0;
}
.reveal-points.pos { color: var(--green); }
.reveal-points.neg { color: var(--red); }

/* ── Master screen ──────────────────────────────────────────────────────── */
.master-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: calc(100vh - 60px);
}
.master-frame-panel {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: #050507;
}
.master-control-panel {
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}
.answer-reveal-box {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 1rem;
}
.answer-reveal-box .label { font-size: .72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .3rem; }
.answer-reveal-box .value { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: .04em; }

.judge-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.btn-judge-correct {
  background: var(--green-bg);
  border: 2px solid var(--green);
  color: var(--green);
  border-radius: var(--radius);
  padding: .85rem;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  transition: all .15s;
}
.btn-judge-correct:hover { background: var(--green); color: #0a1c12; }
.btn-judge-wrong {
  background: var(--red-bg);
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: var(--radius);
  padding: .85rem;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  transition: all .15s;
}
.btn-judge-wrong:hover { background: var(--red); color: #1c0a0a; }

/* ── Resultado ──────────────────────────────────────────────────────────── */
.resultado-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}
.resultado-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(232,197,71,.08) 0%, transparent 60%);
  pointer-events: none;
}

/* Confetti */
.confetti-piece {
  position: absolute;
  width: 8px;
  height: 12px;
  top: -20px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* Tabs & History */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; padding: .25rem; }
.tab-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem; border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text-2);
  font-family: var(--font-body); font-size: .82rem; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.tab-btn:hover { border-color: var(--border-2); color: var(--text); }
.tab-btn.active { background: var(--bg-3); border-color: var(--border-2); color: var(--text); }

.history-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.history-table th {
  padding: .5rem .75rem; text-align: left; font-size: .7rem; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
.history-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.history-table tr:last-child td { border-bottom: none; }

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.year-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .35rem;
}
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}
.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
.podium-bar {
  width: 100px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: .75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-bottom: none;
}
.podium-bar.p1 { height: 160px; background: linear-gradient(180deg, rgba(232,197,71,.2) 0%, rgba(232,197,71,.05) 100%); border-color: var(--accent); }
.podium-bar.p2 { height: 110px; }
.podium-bar.p3 { height: 80px; }
.podium-rank {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--text-3);
}
.podium-rank.p1 { color: var(--accent); }
.podium-name  { font-weight: 600; font-size: .9rem; text-align: center; max-width: 100px; }
.podium-score { font-family: var(--font-mono); font-size: .85rem; color: var(--text-2); }

.score-table {
  width: min(480px, 100%);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.score-row {
  display: grid;
  grid-template-columns: 2rem auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.score-row:last-child { border-bottom: none; }
.score-row.winner { background: var(--accent-bg); }
.score-rank { font-family: var(--font-mono); font-size: .85rem; color: var(--text-3); }
.score-rank.gold { color: var(--accent); font-weight: 700; }

.score-body { flex: 1; min-width: 0; }
.score-bar-wrap { height: 4px; background: var(--bg-3); border-radius: 2px; margin-top: .4rem; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 2px; transition: width .6s cubic-bezier(0.2, 0.8, 0.2, 1); }

.score-name  { font-weight: 500; }
.score-pts   { font-family: var(--font-mono); font-size: .95rem; color: var(--accent); }

@media (max-width: 768px) {
  .game-body { grid-template-columns: 1fr; }
  .answer-panel { border-left: none; border-top: 1px solid var(--border); min-height: auto; }
  .master-layout { grid-template-columns: 1fr; }
  .master-control-panel { border-left: none; border-top: 1px solid var(--border); }
}

/* ── Local Game Setup ───────────────────────────────────────────────────── */
.local-card { width: min(420px, 92vw); margin: 0 auto; }
.logo-local { font-family: var(--font-display); font-size: 2rem; letter-spacing: .08em; color: var(--accent); margin-bottom: .25rem; }
.subtitle-local { color: var(--text-3); font-size: .85rem; margin-bottom: 1.75rem; }

.game-pill {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-2);
  cursor: pointer; transition: border-color .15s; margin-bottom: .4rem;
}
.game-pill:hover { border-color: var(--border-2); }
.game-pill.selected { border-color: var(--accent); background: var(--accent-bg); }
.game-pill-name { flex: 1; font-size: .88rem; font-weight: 500; }
.game-pill-meta { font-size: .74rem; color: var(--text-3); font-family: var(--font-mono); }

.player-row-local { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
