/* ===================================================
   BrazGuesser – Dark Theme Stylesheet
   =================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface2:  #334155;
  --primary:   #22c55e;
  --primary-d: #16a34a;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --text:      #f1f5f9;
  --muted:     #94a3b8;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-glow: 0 0 0 3px rgba(34,197,94,.12);
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Screen system ───────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: 24px;
  overflow-y: auto;
}
.screen.active { display: flex; animation: screenFadeIn .25s ease both; }

/* ── Card ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.06);
}
.card::-webkit-scrollbar { width: 6px; }
.card::-webkit-scrollbar-track { background: transparent; }
.card::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.card::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

.card h2 {
  font-size: 1.4rem;
  margin-bottom: 20px;
  color: var(--primary);
}

/* ── Logo / Home ─────────────────────────────────── */
#home { gap: 24px; }
.logo {
  text-align: center;
  line-height: 1.1;
}
.logo h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #86efac);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo p { color: var(--muted); margin-top: 6px; }

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  text-align: center;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary); color: #000; box-shadow: 0 2px 12px rgba(34,197,94,.2); }
.btn-primary:hover  { filter: brightness(1.1); box-shadow: 0 4px 20px rgba(34,197,94,.35); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-secondary:hover { filter: brightness(1.2); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { filter: brightness(1.1); }
.btn-sm { padding: 7px 14px; font-size: .875rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ── Form elements ───────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid #475569;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34,197,94,.1); }

/* ── Radio tabs ──────────────────────────────────── */
/* ── Preset chips + custom number input ─────────── */
.preset-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chip {
  flex: 1;
  min-width: 44px;
  padding: 8px 4px;
  background: var(--surface2);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.chip.active {
  border-color: var(--primary);
  background: rgba(34,197,94,.12);
  color: var(--primary);
}
.custom-num-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface2);
  border: 2px solid var(--surface2);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s;
  box-sizing: border-box;
}
.custom-num-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Lobby ───────────────────────────────────────── */
#lobby { gap: 16px; }
.lobby-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 540px;
}
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.room-code {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--primary);
}
.player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
}
.player-list li .crown { color: var(--warning); }
.ready-badge {
  margin-left: auto;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(34,197,94,.15);
  color: var(--primary);
}
.not-ready-badge {
  margin-left: auto;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
}

/* ── Game screen ─────────────────────────────────── */
#game {
  display: none;
  position: absolute;
  inset: 0;
  padding: 0;
}
#game.active { display: block; }

#sv-container {
  position: absolute;
  inset: 0;
}

/* HUD */
.hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 20;
  pointer-events: none;
}
.hud-pill {
  background: rgba(15,23,42,.85);
  backdrop-filter: blur(6px);
  border-radius: 99px;
  padding: 6px 16px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid rgba(255,255,255,.08);
}
.hud-pill.timer-warning { color: var(--danger); }

/* Map panel */
.map-panel {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 20;
  width: 280px;
  background: rgba(15,23,42,.9);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.1);
  overflow: hidden;
  transition: width .25s, height .25s;
}
.map-panel.expanded { width: 420px; }

.map-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}
.map-panel-header span { font-size: .8rem; font-weight: 600; color: var(--muted); }
#guess-map-container {
  width: 100%;
  height: 220px;
  transition: height .25s;
}
.map-panel.expanded #guess-map-container { height: 340px; }
.map-panel.collapsed #guess-map-container { height: 0; }
.map-panel.collapsed .map-panel-header span::after { content: ' (clique para abrir)'; }

.map-panel-footer {
  padding: 8px 12px;
  display: flex;
  gap: 8px;
}
.map-panel-footer .btn { flex: 1; }
.btn.confirmed, .btn.confirmed:disabled {
  background: #166534;
  color: #86efac;
  opacity: 1;
  cursor: default;
  border: 2px solid #22c55e;
}

/* ── Result screen ───────────────────────────────── */
#result { padding: 16px; }
.result-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 32px);
}
@media (max-width: 640px) {
  .result-layout { grid-template-columns: 1fr; }
}
#result-map-container {
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 260px;
}
.result-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.score-big {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.score-sub { color: var(--muted); font-size: .9rem; }
.breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border-radius: 8px;
  padding: 12px 16px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
}
.breakdown-row span:last-child { font-weight: 600; color: var(--primary); }

/* MP scoreboard inside result */
.mp-scoreboard {
  background: var(--surface);
  border-radius: 8px;
  padding: 12px;
  overflow-y: auto;
  max-height: 280px;
}
.mp-scoreboard h4 { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.mp-scoreboard h4.mt-10 { margin-top: 10px; }
.mp-score-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: .9rem;
  border-bottom: 1px solid var(--surface2);
}
.mp-score-row:last-child { border-bottom: none; }
.mp-podium-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  font-size: .88rem;
  border-bottom: 1px solid var(--surface2);
}
.mp-podium-row:last-child { border-bottom: none; }
.mp-podium-rank { font-size: .95rem; text-align: center; }
.mp-podium-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-podium-pts { color: #4ade80; font-weight: 700; white-space: nowrap; }

/* ── Gameover ────────────────────────────────────── */
#gameover { gap: 16px; }
.final-score-banner {
  text-align: center;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
}
.final-score-banner .label { color: var(--muted); font-size: .9rem; }
.final-score-banner .pts {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

/* ── Leaderboard ─────────────────────────────────── */
#leaderboard { gap: 16px; }
.lb-table-wrap {
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: .8rem;
  color: var(--muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface2);
}
tbody td { padding: 10px 10px; font-size: .9rem; }
tbody tr { border-bottom: 1px solid var(--surface2); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.03); }
.rank-1 td:first-child { color: var(--warning); font-weight: 700; }
.rank-2 td:first-child { color: #94a3b8; font-weight: 700; }
.rank-3 td:first-child { color: #cd7f32; font-weight: 700; }
.mode-badge {
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--muted);
}
.lb-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 600px;
}
.lb-filter-btn {
  padding: 6px 14px;
  border-radius: 99px;
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lb-filter-btn.active { background: var(--primary); color: #000; font-weight: 600; }

/* ── Toast ───────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 99px;
  font-size: .9rem;
  font-weight: 500;
  animation: toastIn .25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.toast.success { background: var(--primary); color: #000; }
.toast.error   { background: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading overlay ─────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.85);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 1.1rem;
  color: var(--muted);
}
#loading-overlay.hidden { display: none; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--surface2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Confetti canvas ─────────────────────────────── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 998;
}

/* ── Error / API key screen ──────────────────────── */
#api-error {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}
#api-error.hidden { display: none; }
#api-error h2 { color: var(--danger); font-size: 1.6rem; }
#api-error p  { color: var(--muted); max-width: 480px; line-height: 1.6; }
#api-error code {
  background: var(--surface);
  padding: 12px 20px;
  border-radius: 8px;
  display: block;
  font-size: .9rem;
  color: var(--primary);
  word-break: break-all;
}

/* ── Daily badge ─────────────────────────────────── */
.daily-badge {
  background: rgba(245,158,11,.15);
  border: 1px solid var(--warning);
  color: var(--warning);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 600;
}

/* ── MP players in HUD ───────────────────────────── */
.mp-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mp-hud-player {
  background: rgba(15,23,42,.85);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: .8rem;
  border: 1px solid rgba(255,255,255,.08);
}
.mp-hud-player.guessed { border-color: var(--primary); color: var(--primary); }

/* ── Misc utilities ──────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
hr.divider { border: none; border-top: 1px solid var(--surface2); margin: 16px 0; }

/* ── Winner message ──────────────────────────────── */
.winner-msg {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  padding: 10px 24px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24, #fde68a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: winnerPop .5s cubic-bezier(.175,.885,.32,1.275) both;
  width: 100%;
  max-width: 480px;
}
@keyframes winnerPop {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Game Mode Selector ───────────────────────────── */
.mode-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.mode-card {
  position: relative;
  background: var(--surface2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px 8px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, background .2s, transform .1s;
  font-size: .85rem;
}
.mode-card:hover { border-color: rgba(34,197,94,.35); transform: translateY(-1px); }
.mode-card.active { border-color: var(--primary); background: rgba(34,197,94,.15); }
.mode-card .mode-icon { font-size: 1.4rem; display: block; margin-bottom: 4px; }
#mp-mode-desc {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 8px;
  min-height: 20px;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  cursor: pointer;
  margin-bottom: 6px;
}
.toggle-label input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; }

/* ── Lobby extras ─────────────────────────────────── */
.lobby-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 16px 0 8px;
}
.lobby-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.07);
}
#lobby-mode-badge {
  display: inline-block;
  background: var(--surface2);
  color: var(--primary);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.team-card {
  background: var(--surface2);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 4px;
  font-size: .85rem;
}
.role-buttons { display: flex; gap: 8px; margin-top: 4px; }
.role-buttons button { flex: 1; }
.active-role { border: 2px solid var(--primary) !important; background: rgba(34,197,94,.2) !important; }
.role-badge-sm, .team-badge-sm {
  display: inline-block;
  background: var(--surface2);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: .72rem;
  margin-left: 5px;
  vertical-align: middle;
}

/* ── Dark Souls overlay ───────────────────────────── */
#darksouls-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
#darksouls-overlay.blackout { opacity: 1; pointer-events: auto; }

#darksouls-countdown {
  font-size: 8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px rgba(255,255,255,.5);
  line-height: 1;
  user-select: none;
}

/* ── C&M: Cego fullscreen map ─────────────────────── */
.map-panel.cego-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 100 !important;
  border-radius: 0 !important;
}
.map-panel.hidden { display: none !important; }

/* ── BR spectator HUD ─────────────────────────────── */
#br-spectator-hud {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239,68,68,.9);
  color: #fff;
  border-radius: 20px;
  padding: 4px 16px;
  font-size: .85rem;
  font-weight: 600;
  z-index: 20;
}

/* ── C&M role badge (in-game) ─────────────────────── */
#hud-cm-role {
  background: rgba(34,197,94,.2);
  color: var(--primary);
  border-radius: 20px;
  padding: 2px 12px;
  font-size: .8rem;
  font-weight: 600;
}

/* ── BR elimination notice ────────────────────────── */
.br-elimination-notice {
  background: rgba(239,68,68,.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-top: 8px;
  color: var(--danger);
  font-size: .88rem;
  font-weight: 600;
  text-align: center;
}
.eliminated-row { opacity: .5; text-decoration: line-through; }

/* ── MP team results ──────────────────────────────── */
#mp-team-results h4 { margin-bottom: 6px; }
#mp-team-results { margin-bottom: 10px; }

.mt-10 { margin-top: 10px; }

/* ══════════════════════════════════════════════════════
   UI/UX Enhancements – Polish layer
   ══════════════════════════════════════════════════════ */

/* ── Screen fade-in ──────────────────────────────── */
@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Home: radial glow backdrop ──────────────────── */
#home { position: relative; }
#home::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 75% 55% at 50% 38%, rgba(34,197,94,.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
#home > * { position: relative; z-index: 1; }

/* ── Logo entrance animation ─────────────────────── */
@keyframes logoReveal {
  from { opacity: 0; transform: scale(.94) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.logo { animation: logoReveal .4s cubic-bezier(.22,1,.36,1) both; }

/* ── Home button stagger entrance ────────────────── */
@keyframes btnSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.home-buttons .btn { animation: btnSlideIn .3s ease both; }
.home-buttons .btn:nth-child(1) { animation-delay: .10s; }
.home-buttons .btn:nth-child(2) { animation-delay: .16s; }
.home-buttons .btn:nth-child(3) { animation-delay: .22s; }
.home-buttons .btn:nth-child(4) { animation-delay: .28s; }
.home-buttons .btn:nth-child(5) { animation-delay: .34s; }
.home-buttons .btn:nth-child(6) { animation-delay: .40s; }

/* ── Home button group divider ───────────────────── */
.btn-group-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  border: none;
  margin: 4px 0;
  width: 100%;
}

/* ── Mode card enhancements ──────────────────────── */
.mode-card.active::after {
  content: '✓';
  position: absolute;
  top: 5px; right: 6px;
  width: 16px; height: 16px;
  background: var(--primary);
  color: #000;
  border-radius: 50%;
  font-size: .6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 16px;
}
.mode-card .mode-desc-card {
  font-size: .68rem;
  color: var(--muted);
  line-height: 1.3;
  margin-top: 3px;
}

/* ── Form section divider ────────────────────────── */
.form-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
}
.form-section-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  white-space: nowrap;
}
.form-section-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.07);
}

/* ── Custom toggle switch ────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0; width: 0; height: 0;
  position: absolute;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border-radius: 99px;
  border: 2px solid rgba(255,255,255,.1);
  transition: background .2s, border-color .2s;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s cubic-bezier(.22,1,.36,1), background .2s;
}
.toggle-switch input:checked + .toggle-track {
  background: rgba(34,197,94,.18);
  border-color: var(--primary);
}
.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--primary);
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .875rem;
  cursor: pointer;
  user-select: none;
  margin-bottom: 6px;
}

/* ── Room code hero (join screen) ────────────────── */
.room-code-hero input {
  font-size: 1.8rem !important;
  font-weight: 800 !important;
  letter-spacing: .28em !important;
  text-align: center !important;
  font-family: 'Courier New', monospace !important;
  padding: 16px 12px !important;
}

/* ── Lobby upgrades ──────────────────────────────── */
.lobby-card { border: 1px solid rgba(255,255,255,.06); }

.room-code-row { display: flex; align-items: center; gap: 8px; }

.copy-code-btn {
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
  padding: 4px 9px;
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.copy-code-btn:hover { background: var(--surface); color: var(--text); }
.copy-code-btn.copied { color: var(--primary); border-color: var(--primary); }

/* ── Player avatar circle ────────────────────────── */
.player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
}

/* ── Player list: animation + hover ─────────────── */
.player-list li {
  border: 1px solid transparent;
  transition: border-color .2s;
}
.player-list li:hover { border-color: rgba(255,255,255,.06); }
@keyframes playerSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Ready badge pop ─────────────────────────────── */
@keyframes readyPop {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}
.ready-badge { animation: readyPop .3s ease; }

/* ── Start button pulse when all ready ───────────── */
@keyframes startGlow {
  0%, 100% { box-shadow: 0 2px 12px rgba(34,197,94,.2); }
  50%       { box-shadow: 0 0 24px rgba(34,197,94,.6); }
}
#btn-lobby-start.all-ready { animation: startGlow 1.5s ease infinite; }

/* ── Lobby status row ────────────────────────────── */
.lobby-status-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .8rem;
  color: var(--muted);
  margin-top: 12px;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background .3s;
}
.status-dot.active {
  background: var(--primary);
  animation: statusPulse 1.5s ease infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

/* ── Ghost button ────────────────────────────────── */
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.1);
}
.btn-ghost:hover { filter: none; background: rgba(255,255,255,.05); color: var(--text); }

/* ══════════════════════════════════════════════════════
   "Quem não ajuda, atrapalha" – Sabotagem Module
   ══════════════════════════════════════════════════════ */

/* ── Lootbox Modal ───────────────────────────────────── */
#sabotagem-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: screenFadeIn .2s ease both;
}
#sabotagem-modal.hidden { display: none; }

.sabotagem-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  padding: 28px 24px 20px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  animation: winnerPop .35s cubic-bezier(.175,.885,.32,1.275) both;
}

.sabotagem-lootbox-icon {
  font-size: 4rem;
  line-height: 1;
  display: block;
  margin-bottom: 12px;
  transition: transform .3s cubic-bezier(.175,.885,.32,1.275);
}
.sabotagem-lootbox-icon.sabotagem-lootbox-open {
  transform: scale(1.4) rotate(-10deg);
}

.sabotagem-ability-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--warning);
  min-height: 32px;
  margin-bottom: 4px;
}

.sabotagem-ability-desc {
  font-size: .85rem;
  color: var(--muted);
  min-height: 20px;
  margin-bottom: 16px;
}

.sabotagem-target-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 8px;
}

.sabotagem-target-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.sabotagem-target-btn {
  font-size: .9rem;
  padding: 9px 14px;
  text-align: center;
  transition: background .15s, border-color .15s, transform .1s;
  border: 2px solid transparent;
}
.sabotagem-target-btn:hover {
  border-color: var(--warning);
  background: rgba(245,158,11,.12);
  color: var(--warning);
}

/* ── Effect overlay base ─────────────────────────────── */
.sabotagem-effect-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ── Celular de véia: big font ───────────────────────── */
.sabotagem-celular-veia .hud-pill  { font-size: 1.6rem !important; padding: 10px 20px !important; }
.sabotagem-celular-veia .map-panel-header span { font-size: 1.4rem !important; }
.sabotagem-celular-veia #btn-guess { font-size: 1.3rem !important; padding: 14px !important; }
.sabotagem-celular-veia .mp-hud-player { font-size: 1.2rem !important; }

/* ── Microondas: spinning map ────────────────────────── */
@keyframes microondasRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.sabotagem-microondas-map {
  animation: microondasRotate 6s linear infinite !important;
  transform-origin: center center;
}

/* ── Dever de Casa overlay ───────────────────────────── */
.sabotagem-math-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.97);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: screenFadeIn .2s ease both;
}

.sabotagem-math-card {
  text-align: center;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.sabotagem-math-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.sabotagem-math-sub {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.sabotagem-math-eq {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .08em;
  margin-bottom: 20px;
  font-family: 'Courier New', monospace;
}

.sabotagem-math-input {
  width: 130px;
  font-size: 1.6rem;
  text-align: center;
  padding: 10px;
  background: var(--surface2);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.sabotagem-math-input:focus { border-color: var(--primary); }

.sabotagem-math-err {
  color: var(--danger);
  font-size: .85rem;
  min-height: 20px;
  margin-top: 8px;
}

/* ── TMFE effects HUD banner ─────────────────────── */
.tmfe-effects-hud {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  background: rgba(239,68,68,.88);
  backdrop-filter: blur(6px);
  border-radius: 99px;
  padding: 5px 18px;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(255,255,255,.15);
  pointer-events: none;
  animation: tmfeHudIn .35s cubic-bezier(.175,.885,.32,1.275) both;
}
@keyframes tmfeHudIn {
  from { opacity: 0; transform: translateX(-50%) scale(.85); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ── Ender-Pearl Mode ────────────────────────────────── */
/* Full-screen blackout over SV after tour ends */
.ep-blackout {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 20;
  pointer-events: none;
}

/* Hides Street View + map while sabotagem lootbox is pending */
.sabotagem-sv-blackout {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 50;
  pointer-events: none;
}

/* Counter pill "1 / 5" shown during each teleport */
.ep-counter {
  position: absolute;
  top: 52px;
  right: 18px;
  z-index: 26;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  border-radius: 99px;
  padding: 5px 16px;
  font-size: .9rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .2);
  pointer-events: none;
  letter-spacing: .04em;
  animation: epCounterIn .2s ease both;
}
@keyframes epCounterIn {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* Big reveal banner after all 5 locations are shown */
.ep-reveal-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: rgba(16, 185, 129, .92);
  color: #fff;
  border-radius: 18px;
  padding: 22px 40px;
  font-size: 1.45rem;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, .25);
  box-shadow: 0 8px 40px rgba(0, 0, 0, .45);
  animation: epRevealIn .4s cubic-bezier(.175, .885, .32, 1.275) both;
  white-space: nowrap;
}
@keyframes epRevealIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.65); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── Sabotagem active-effect corner HUD ─────────── */
.sabotagem-active-hud {
  position: absolute;
  top: 90px;
  left: 12px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
.sabotagem-hud-tag {
  background: rgba(239, 68, 68, .82);
  backdrop-filter: blur(4px);
  color: #fff;
  border-radius: 99px;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .15);
}

/* ═══════════════════════════════════════════════════════
   PROFILE PILL + DROPDOWN MENU
═══════════════════════════════════════════════════════ */
.profile-pill {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  border: 1px solid rgba(34,197,94,.25);
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s;
}
.profile-pill:hover { border-color: var(--primary); }
.profile-pill.hidden { display: none; }
.profile-pill-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}
.profile-pill-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown */
@keyframes menuSlideIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)     scale(1);    }
}
@keyframes menuSlideOut {
  from { opacity: 1; transform: translateY(0)     scale(1);    }
  to   { opacity: 0; transform: translateY(-10px) scale(0.96); }
}
.profile-menu {
  position: fixed;
  top: 48px;
  right: 10px;
  z-index: 200;
  width: 260px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  padding: 0;
  overflow: hidden;
  transform-origin: top right;
  animation: menuSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.profile-menu.hidden { display: none; }
.profile-menu.closing {
  animation: menuSlideOut 0.14s ease forwards;
  pointer-events: none;
}
.profile-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
}
.profile-menu-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}
.profile-menu-name { font-weight: 700; font-size: .95rem; color: var(--text); }
.profile-menu-subtitle { font-size: .7rem; color: var(--muted); }
.profile-menu-divider { border: none; border-top: 1px solid rgba(255,255,255,.06); margin: 0; }
.profile-menu-section { padding: 10px 16px; }
.profile-menu-label { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; display: block; }
.profile-menu-input {
  flex: 1; min-width: 0;
  background: var(--surface2); border: 1px solid rgba(255,255,255,.1);
  color: var(--text); padding: 5px 8px; border-radius: var(--radius-sm);
  font-size: .82rem;
}
.profile-menu-hint { font-size: .68rem; color: var(--muted); margin-top: 4px; }
.profile-menu-item {
  display: block; width: 100%;
  padding: 10px 16px;
  background: none; border: none;
  color: var(--text); font-size: .85rem;
  text-align: left; cursor: pointer;
  transition: background .1s;
}
.profile-menu-item:hover { background: rgba(255,255,255,.05); }
.profile-menu-danger { color: var(--danger); }
.profile-menu-danger:hover { background: rgba(239,68,68,.1); }

/* Hide name inputs when user is logged in */
body.logged-in .guest-name-group { display: none; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.1);
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255,255,255,.05);
}

/* ═══════════════════════════════════════════════════════
   BROWSE ROOMS SCREEN
═══════════════════════════════════════════════════════ */
#browse-rooms {
  justify-content: flex-start;
  padding-top: 32px;
  gap: 14px;
}
.browse-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 640px;
  flex-wrap: wrap;
}
.rooms-list {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  padding-bottom: 16px;
}
.rooms-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: .95rem;
}
.rooms-error { color: var(--danger); }

.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,.06);
  gap: 12px;
  transition: border-color .15s;
}
.room-card:hover { border-color: rgba(34,197,94,.25); }
.room-card-left  { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.room-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.room-card-host  { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.room-card-count  { font-size: .8rem; color: var(--muted); }
.room-card-count.full { color: var(--danger); }
.mode-badge-room {
  font-size: .7rem;
  background: rgba(255,255,255,.07);
  border-radius: 99px;
  padding: 2px 8px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.08);
}

/* ═══════════════════════════════════════════════════════
   MULTIPLAYER SECTION — Guest lock state
═══════════════════════════════════════════════════════ */
.mp-section {
  margin-top: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mp-section.mp-locked .mp-btn {
  opacity: 0.4;
  pointer-events: none;
}
.mp-lock-notice {
  text-align: center;
  font-size: .78rem;
  color: var(--warning);
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════════
   MODAL OVERLAY (password prompt & ad modal)
═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 380px;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}

/* ═══════════════════════════════════════════════════════
   AD GATE MODAL (rewarded ad before room join)
═══════════════════════════════════════════════════════ */
.ad-gate-card {
  max-width: 380px;
  text-align: center;
}
.ad-gate-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}
.ad-gate-icon {
  font-size: 2.4rem;
  line-height: 1;
}
.ad-gate-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.ad-gate-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.ad-gate-status {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}
.ad-gate-countdown {
  font-size: .8rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0;
}
.ad-gate-progress {
  width: 100%;
}
.ad-progress-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}
.ad-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 2px;
}
.ad-gate-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
