﻿/* ========================================================
   MENTES BRILHANTES — FOLHA DE ESTILOS MODERNA (Mobile First)
   ======================================================== */

:root {
  --bg-dark: #0f111a;
  --bg-card: rgba(26, 29, 45, 0.88);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --secondary: #334155;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --whatsapp-green: #25D366;
  --whatsapp-hover: #20ba59;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow-x: hidden;
  position: relative;
  padding: 12px;
}

/* Fundo Dinâmico com Brilho Suave */
.background-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(139, 92, 246, 0.12) 40%, transparent 75%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  width: 100%;
  max-width: 580px;
  position: relative;
  z-index: 1;
  margin: 0 auto;
}

/* ================= HEADER ================= */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 16px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 12px var(--primary-glow));
  animation: floatBrain 3.5s ease-in-out infinite;
}

@keyframes floatBrain {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

.brand-text h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  font-size: 1.1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

/* ================= CARTÕES E ECRÃS ================= */
.game-screen {
  display: none;
  width: 100%;
}

.game-screen.active {
  display: block;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

/* ================= FORMULÁRIOS E INPUTS ================= */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 8px;
}

input[type="text"], select {
  width: 100%;
  padding: 13px 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  transition: var(--transition);
}

input[type="text"]:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ================= AVATARES ================= */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.avatar-option {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.avatar-option:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.avatar-option.selected {
  background: rgba(99, 102, 241, 0.22);
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow);
}

.avatar-emoji {
  font-size: 1.9rem;
}

.avatar-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #cbd5e1;
}

/* ================= BOTÕES ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  width: 100%;
}

.btn-large {
  padding: 15px 22px;
  font-size: 1.05rem;
  flex-direction: column;
  gap: 3px;
}

.btn-large small {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.85;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border: 1px solid var(--bg-card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  font-size: 0.84rem;
}

.btn-ghost:hover {
  color: #fff;
  border-color: #fff;
}

.btn-sm {
  width: auto;
  padding: 7px 14px;
  font-size: 0.82rem;
}

/* ================= BOTÃO WHATSAPP ================= */
.whatsapp-invite-container {
  margin: 16px 0 20px 0;
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #1ea952 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  flex-direction: row;
  justify-content: center;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

.btn-whatsapp:hover {
  background: linear-gradient(135deg, #22bf5b 0%, #178a42 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 211, 102, 0.48);
}

.wa-icon {
  font-size: 1.6rem;
}

.wa-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.wa-text strong {
  font-size: 1.02rem;
  letter-spacing: -0.2px;
}

.wa-text small {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.9;
}

/* ================= DIVIDER & JOIN ================= */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 22px 0 16px 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.8px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.divider span {
  padding: 0 12px;
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
  text-transform: uppercase;
}

.input-with-btn .btn {
  width: auto;
  min-width: 100px;
}

/* ================= LOBBY ================= */
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.room-code-badge {
  display: flex;
  flex-direction: column;
}

.code-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.code-val {
  font-size: 1.45rem;
  font-weight: 900;
  color: #a5b4fc;
  letter-spacing: 1.5px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 800;
  color: #e2e8f0;
  margin-bottom: 12px;
}

.badge-status {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-gold);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  max-height: 220px;
  overflow-y: auto;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 9px 14px;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-avatar {
  font-size: 1.4rem;
}

.player-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.host-tag {
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
}

/* ================= SELETOR DE TEMAS ================= */
.themes-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.theme-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.theme-chip input {
  display: none;
}

.theme-chip.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.settings-row {
  display: flex;
  gap: 12px;
}

.settings-group.half {
  flex: 1;
}

.guest-waiting-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin: 14px 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ================= CONTAGEM DECRESCENTE ================= */
.countdown-modal {
  text-align: center;
  padding: 40px 20px;
}

.countdown-label {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.countdown-number {
  font-size: 6.5rem;
  font-weight: 900;
  color: #fff;
  margin: 15px 0;
  text-shadow: 0 0 35px var(--primary-glow);
  animation: pulseNumber 1s ease-in-out infinite;
}

@keyframes pulseNumber {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.countdown-tip {
  font-size: 0.88rem;
  color: #cbd5e1;
}

/* ================= ECRÃ DE PERGUNTA (IN-GAME) ================= */
.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 14px;
}

.round-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: #a5b4fc;
}

.theme-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.74rem;
  font-weight: 700;
}

.difficulty-badge {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-gold);
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 800;
}

/* BARRA DO TEMPORIZADOR */
.timer-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.timer-bar-outer {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.timer-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 70%, #ef4444 100%);
  border-radius: 10px;
  transition: width 1s linear;
}

.timer-seconds {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  min-width: 28px;
  text-align: right;
}

.timer-seconds.urgent {
  color: var(--accent-red);
  animation: pulseText 0.5s infinite;
}

@keyframes pulseText {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.question-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  margin-bottom: 20px;
  text-align: center;
}

.question-box h2 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.45;
  color: #fff;
}

/* GRELHA DAS OPÇÕES */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.option-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.option-btn .opt-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 900;
  font-size: 0.9rem;
  color: #a5b4fc;
}

.option-btn.selected {
  background: rgba(99, 102, 241, 0.35);
  border-color: #a5b4fc;
  box-shadow: 0 0 12px var(--primary-glow);
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.35) !important;
  border-color: var(--accent-green) !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5) !important;
}

.option-btn.incorrect {
  background: rgba(239, 68, 68, 0.35) !important;
  border-color: var(--accent-red) !important;
  opacity: 0.8;
}

.option-btn:disabled {
  cursor: default;
}

.question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  min-height: 24px;
}

.answer-status-badge {
  color: var(--accent-green);
  font-weight: 700;
}

/* ================= REVELAÇÃO DA RONDA ================= */
.reveal-result-banner {
  text-align: center;
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.reveal-result-banner.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-green);
}

.reveal-result-banner.fail {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
}

.result-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 6px;
}

.correct-answer-card {
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 20px;
}

.correct-answer-card .card-caption {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.correct-answer-card h4 {
  font-size: 1.25rem;
  color: var(--accent-green);
  margin-top: 4px;
  font-weight: 800;
}

.mini-leaderboard-section h4 {
  font-size: 0.86rem;
  font-weight: 800;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.mini-leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.mini-leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
}

.next-round-timer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ================= PÓDIO FINAL ================= */
.gameover-header {
  text-align: center;
  margin-bottom: 24px;
}

.trophy-hero {
  font-size: 3.5rem;
  display: block;
  filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.5));
}

.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 10px 0;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.podium-crown {
  font-size: 1.5rem;
  margin-bottom: -6px;
  animation: bounceCrown 2s infinite;
}

@keyframes bounceCrown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.podium-avatar {
  font-size: 2.2rem;
}

.podium-name {
  font-weight: 800;
  font-size: 0.88rem;
  margin-top: 4px;
  text-align: center;
}

.podium-score {
  font-size: 0.78rem;
  color: var(--accent-gold);
  font-weight: 800;
  margin-bottom: 6px;
}

.podium-bar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  color: #fff;
}

.step-1 .podium-bar {
  height: 120px;
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
}

.step-2 .podium-bar {
  height: 85px;
  background: linear-gradient(180deg, #94a3b8 0%, #475569 100%);
}

.step-3 .podium-bar {
  height: 60px;
  background: linear-gradient(180deg, #d97706 0%, #78350f 100%);
}

.full-ranking-section h4 {
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: #cbd5e1;
}

.ranking-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.ranking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ================= TOAST NOTIFICATION ================= */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 999;
  transition: var(--transition);
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
}

/* ================= FOOTER ================= */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ================= UTILITÁRIOS ================= */
.hidden {
  display: none !important;
}

/* RESPONSIVO PARA ECRÃS GRANDES */
@media (min-width: 640px) {
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
}


/* Botao Regressar ao Arcade Hub */
.btn-hub {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  transition: var(--transition);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.btn-hub:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.btn-hub-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: var(--transition);
}

.btn-hub-action:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  transform: translateY(-2px);
}

/* Ajustes Mobile e Safe Area para opcoes */
@media (max-width: 639px) {
  .options-grid {
    gap: 10px;
    margin-bottom: 20px;
  }
  .option-btn {
    padding: 12px 14px;
    font-size: 0.92rem;
    min-height: 48px;
  }
  .card-question {
    padding-bottom: 24px;
  }
}
