*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f14;
  --surface: #1a1a24;
  --surface-2: #242433;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f0f5;
  --text-muted: #9898aa;
  --primary: #7c5cff;
  --primary-glow: rgba(124, 92, 255, 0.35);
  --success: #2dd4a8;
  --danger: #ff5c7a;
  --warning: #ffb347;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

html {
  font-size: 16px;
}

body {
  font-family: "Outfit", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: var(--primary-glow);
  top: -150px;
  right: -100px;
}

.bg-glow-2 {
  width: 400px;
  height: 400px;
  background: rgba(45, 212, 168, 0.15);
  bottom: -100px;
  left: -100px;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.screen {
  display: none;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(124, 92, 255, 0.15);
  border: 1px solid rgba(124, 92, 255, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(2.2rem, 8vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 10px;
  font-size: 1.05rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.setup-card {
  margin-bottom: 20px;
}

.player-inputs {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}

.input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.vs {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-bottom: 14px;
}

.rules h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.rules ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rules li {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding-left: 20px;
  position: relative;
}

.rules li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.rules strong {
  color: var(--success);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-lg {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.05rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5a3fd4);
  color: #fff;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 32px var(--primary-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #1fa882);
  color: #0a1a14;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #d43f5c);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.hidden {
  display: none !important;
}

.screen-header {
  text-align: center;
  margin-bottom: 32px;
}

.screen-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

.screen-header p {
  color: var(--text-muted);
  margin-top: 8px;
}

/* Moeda */
.coin-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.coin {
  width: 140px;
  height: 140px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.1s;
}

.coin.flipping {
  animation: coinFlip 1.8s ease-in-out forwards;
}

.coin.show-heads {
  transform: rotateY(0deg);
}

.coin.show-tails {
  transform: rotateY(180deg);
}

@keyframes coinFlip {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(1800deg); }
}

.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  backface-visibility: hidden;
  border: 4px solid rgba(255, 255, 255, 0.2);
}

.coin-front {
  background: linear-gradient(145deg, #ffd700, #ffb347);
  color: #5a3a00;
}

.coin-back {
  background: linear-gradient(145deg, #c0c0c0, #888);
  color: #222;
  transform: rotateY(180deg);
}

.coin-result {
  font-size: 1.2rem;
  font-weight: 600;
  min-height: 1.5em;
  text-align: center;
}

.coin-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coin-order-list,
.coin-ready-list {
  list-style: none;
  margin-bottom: 16px;
}

.coin-order-list li,
.coin-ready-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.coin-order-list li:last-child,
.coin-ready-list li:last-child {
  border-bottom: none;
}

.coin-order-pos {
  min-width: 2.2rem;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 800;
}

.coin-order-seat {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 4.5rem;
}

.coin-order-flip {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--primary);
}

.coin-order-name {
  flex: 1;
}

.coin-ready-list li.is-me {
  color: var(--primary);
}

.coin-ready-badge {
  margin-left: auto;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.coin-ready-badge.is-ready {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

#btn-coin-ready.is-done {
  opacity: 0.7;
  pointer-events: none;
}

/* Scoreboard */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.score-card.active-turn {
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
}

.score-name {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-value {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.score-value.negative {
  color: var(--danger);
}

.turn-indicator {
  text-align: center;
  padding: 0 8px;
}

.turn-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.turn-name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pergunta */
.game-card {
  text-align: center;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}

.difficulty-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.difficulty-flavor {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.9;
}

.difficulty-flavor.diff-muito-facil { color: var(--success); }
.difficulty-flavor.diff-facil { color: #6dd4a8; }
.difficulty-flavor.diff-media { color: var(--warning); }
.difficulty-flavor.diff-media-dificil { color: #ff8c47; }
.difficulty-flavor.diff-dificil { color: var(--danger); }
.difficulty-flavor.diff-hardcore { color: #c47cff; }

.difficulty-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.diff-muito-facil { background: rgba(45, 212, 168, 0.2); color: var(--success); }
.diff-facil { background: rgba(100, 200, 150, 0.2); color: #6dd4a8; }
.diff-media { background: rgba(255, 179, 71, 0.2); color: var(--warning); }
.diff-media-dificil { background: rgba(255, 140, 71, 0.2); color: #ff8c47; }
.diff-dificil { background: rgba(255, 92, 122, 0.2); color: var(--danger); }
.diff-hardcore { background: rgba(180, 60, 255, 0.25); color: #c47cff; }

.question-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.question-text {
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 600;
  line-height: 1.45;
  min-height: 4.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

/* Timer */
.timer-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 28px;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 6;
}

.timer-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  transition: stroke 0.3s;
}

.timer-progress.warning {
  stroke: var(--warning);
}

.timer-progress.danger {
  stroke: var(--danger);
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.answer-prompt {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.options-grid.disabled {
  pointer-events: none;
  opacity: 1;
}

.option-btn {
  min-height: 56px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.option-btn:disabled {
  cursor: default;
}

.option-letter {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.option-text {
  flex: 1;
}

.option-btn.is-selected {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.option-btn.is-correct {
  border-color: var(--success);
  background: rgba(45, 212, 168, 0.18);
  color: var(--success);
  box-shadow: 0 0 0 3px rgba(45, 212, 168, 0.14);
}

.option-btn.is-correct .option-letter {
  background: var(--success);
  color: #07130f;
}

.option-btn.is-wrong {
  border-color: var(--danger);
  background: rgba(255, 92, 122, 0.18);
  color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.14);
}

.option-btn.is-wrong .option-letter {
  background: var(--danger);
  color: #fff;
}

.answer-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  text-align: center;
  border: 1px solid var(--border);
}

.answer-status.is-correct {
  color: var(--success);
  background: rgba(45, 212, 168, 0.12);
  border-color: rgba(45, 212, 168, 0.35);
}

.answer-status.is-wrong {
  color: var(--danger);
  background: rgba(255, 92, 122, 0.12);
  border-color: rgba(255, 92, 122, 0.35);
}

.time-up-msg {
  animation: fadeIn 0.3s ease;
}

.time-up-msg p {
  color: var(--danger);
  font-weight: 600;
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.game-footer {
  margin-top: 20px;
  text-align: center;
}

/* Fila de turnos (2–4 jogadores) */
.turn-queue {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.turn-chip {
  flex: 1;
  min-width: 72px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
  position: relative;
}

.turn-chip.is-me {
  border-color: rgba(124, 92, 255, 0.35);
}

.turn-chip.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
  transform: scale(1.04);
}

.turn-chip.is-next {
  border-color: var(--warning);
  animation: pulseNext 1.2s ease-in-out infinite;
}

.turn-chip.is-me.is-next {
  border-color: var(--success);
  box-shadow: 0 0 24px rgba(45, 212, 168, 0.35);
}

@keyframes pulseNext {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.92; }
}

.turn-chip-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.turn-chip-score {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.turn-chip-score.negative {
  color: var(--danger);
}

.turn-chip-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
  color: var(--text-muted);
}

.turn-chip.is-active .turn-chip-label {
  color: var(--primary);
  font-weight: 700;
}

.turn-chip.is-next .turn-chip-label {
  color: var(--warning);
  font-weight: 700;
}

.turn-chip.is-me.is-next .turn-chip-label {
  color: var(--success);
}

.you-next-banner {
  text-align: center;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(45, 212, 168, 0.2), rgba(124, 92, 255, 0.15));
  border: 1px solid rgba(45, 212, 168, 0.45);
  color: var(--success);
  font-weight: 700;
  animation: pulseNext 1.2s ease-in-out infinite;
}

/* Toast de evento (errou!) */
.event-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface);
  border: 2px solid var(--warning);
  border-radius: 999px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: calc(100% - 32px);
}

.event-toast.show {
  transform: translateX(-50%) translateY(0);
}

.event-toast-emoji {
  font-size: 2rem;
  line-height: 1;
}

.event-toast-text {
  font-weight: 700;
  font-size: 1.05rem;
}

/* Reações na mesa */
.reaction-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(15, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}

.reaction-bar-label {
  display: block;
  text-align: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.reaction-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 520px;
  margin: 0 auto;
}

.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.reaction-btn-emoji {
  font-size: 1.3rem;
  line-height: 1;
}

.reaction-btn-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reaction-btn:active {
  transform: scale(1.08);
}

.reaction-btn:hover {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.2);
}

.reaction-float-area {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 850;
  overflow: hidden;
}

.reaction-bubble {
  position: absolute;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%) scale(0.5);
  opacity: 0;
  text-align: center;
  animation: reactionPop 2.4s ease forwards;
}

.reaction-bubble-emoji {
  display: block;
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

.reaction-bubble-label {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.reaction-bubble-name {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.8;
}

.reaction-bubble.is-me .reaction-bubble-label {
  color: var(--primary);
}

.reaction-bubble.is-me .reaction-bubble-name {
  color: var(--primary);
  opacity: 1;
}

@keyframes reactionPop {
  0% {
    transform: translateX(-50%) scale(0.4) translateY(20px);
    opacity: 0;
  }
  15% {
    transform: translateX(-50%) scale(1.15) translateY(0);
    opacity: 1;
  }
  30% {
    transform: translateX(-50%) scale(1) translateY(-10px);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(0.9) translateY(-80px);
    opacity: 0;
  }
}

.app.in-room {
  padding-bottom: 84px;
}

/* Lobby multi */
.lobby-players {
  list-style: none;
  margin-bottom: 16px;
}

.lobby-players li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.lobby-players li:last-child {
  border-bottom: none;
}

.lobby-players .host-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(124, 92, 255, 0.15);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Resultado */
.winner-text {
  font-size: 1.3rem;
  font-weight: 600;
}

.final-scores {
  margin-bottom: 24px;
}

.final-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.final-row:last-child {
  border-bottom: none;
}

.final-row.winner {
  color: var(--success);
}

.final-row .name {
  font-weight: 600;
}

.final-row .pts {
  font-size: 1.5rem;
  font-weight: 800;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.hero.compact {
  margin-bottom: 16px;
}

.hero.compact h1 {
  font-size: 2rem;
}

.welcome-text {
  color: var(--text-muted);
  margin-top: 8px;
}

.user-wins {
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
}

.ranking-card {
  margin-bottom: 8px;
}

.ranking-card h2 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.ranking-list li.ranking-me {
  border: 1px solid var(--primary);
  background: rgba(124, 92, 255, 0.1);
}

.ranking-empty {
  color: var(--text-muted);
  background: transparent !important;
  justify-content: center;
}

.rank-pos {
  font-weight: 800;
  color: var(--primary);
  min-width: 28px;
}

.rank-name {
  flex: 1;
  font-weight: 600;
}

.rank-wins {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 800;
  text-align: center;
  font-size: 1.5rem !important;
}

.room-code-display {
  text-align: center;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--primary);
  margin-bottom: 16px;
  padding: 28px !important;
}

.lobby-status {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.wait-msg,
.wait-turn-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 12px;
}

.wait-turn-msg p {
  font-weight: 600;
}

.score-target {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.stats-content {
  margin-bottom: 24px;
  text-align: left;
}

.stat-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.stat-block:last-child {
  border-bottom: none;
}

.stat-block h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-big {
  font-size: 1.5rem;
  font-weight: 800;
}

.stat-win .stat-big {
  color: var(--success);
}

.stat-loss .stat-big {
  color: var(--danger);
}

.stat-score {
  margin-top: 8px;
  color: var(--text-muted);
}

.stat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

.stat-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.stat-block strong {
  color: var(--text);
}

@media (max-width: 520px) {
  html {
    font-size: 15px;
  }

  .app {
    padding: 8px 8px 18px;
  }

  .app.in-room {
    padding-bottom: 52px;
  }

  .card {
    padding: 12px;
    border-radius: 12px;
  }

  .player-inputs {
    flex-direction: column;
    align-items: stretch;
  }

  .vs {
    text-align: center;
    padding: 0;
  }

  .scoreboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .turn-indicator {
    order: -1;
  }

  #screen-game {
    display: none;
  }

  #screen-game.active {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: calc(100dvh - 60px);
  }

  .you-next-banner {
    padding: 7px 10px;
    margin-bottom: 4px;
    font-size: 0.85rem;
  }

  .turn-queue {
    flex-wrap: nowrap;
    gap: 5px;
    margin-bottom: 4px;
    padding-bottom: 0;
  }

  .turn-chip {
    min-width: 58px;
    padding: 5px 4px;
    border-width: 1px;
  }

  .turn-chip.is-active {
    transform: none;
    box-shadow: 0 0 12px var(--primary-glow);
  }

  .turn-chip-name {
    font-size: 0.62rem;
    margin-bottom: 1px;
  }

  .turn-chip-score {
    font-size: 1rem;
  }

  .turn-chip-label {
    font-size: 0.5rem;
    margin-top: 1px;
  }

  .turn-indicator {
    padding: 0;
  }

  .turn-label {
    font-size: 0.58rem;
  }

  .turn-name {
    font-size: 0.82rem;
    max-width: none;
  }

  .game-card {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .question-meta {
    margin-bottom: 6px;
    gap: 4px;
  }

  .difficulty-wrap {
    gap: 2px;
  }

  .difficulty-badge {
    padding: 3px 8px;
    font-size: 0.58rem;
  }

  .difficulty-flavor {
    display: none;
  }

  .question-counter {
    font-size: 0.68rem;
  }

  .question-text {
    font-size: clamp(0.98rem, 4.7vw, 1.14rem);
    line-height: 1.22;
    min-height: 3.1em;
    margin-bottom: 8px;
  }

  .timer-wrap {
    width: 58px;
    height: 58px;
    margin: 0 auto 8px;
  }

  .timer-bg,
  .timer-progress {
    stroke-width: 8;
  }

  .timer-display {
    font-size: 1.35rem;
  }

  .answer-prompt {
    margin-bottom: 7px;
    font-size: 0.78rem;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .option-btn {
    min-height: 42px;
    padding: 8px 9px;
    font-size: 0.86rem;
    border-width: 1px;
    gap: 8px;
  }

  .option-letter {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }

  .answer-status {
    margin-top: 7px;
    padding: 7px 9px;
    font-size: 0.82rem;
  }

  .wait-turn-msg {
    padding: 6px;
    font-size: 0.8rem;
  }

  .event-toast {
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  .reaction-bar {
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
  }

  .reaction-bar-label {
    display: none;
  }

  .reaction-buttons {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 5px;
    max-width: none;
    scrollbar-width: none;
  }

  .reaction-buttons::-webkit-scrollbar {
    display: none;
  }

  .reaction-btn {
    flex: 0 0 auto;
    min-width: 48px;
    padding: 4px 6px;
    border-radius: 9px;
  }

  .reaction-btn-emoji {
    font-size: 1.1rem;
  }

  .reaction-btn-label {
    font-size: 0.55rem;
    max-width: 52px;
  }

  .reaction-bubble {
    bottom: 58px;
  }

  .reaction-bubble-emoji {
    font-size: 2.8rem;
  }

  .turn-prep-overlay .prep-name {
    font-size: 1.6rem;
  }

  .turn-prep-overlay .prep-msg {
    font-size: 1.1rem;
  }
}

/* ─── AUTH TABS ─────────────────────────────────────── */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  background: rgba(255, 92, 122, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 92, 122, 0.3);
}

/* ─── AVATAR & MEDALS ──────────────────────────────── */
.menu-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  border: 3px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.avatar-letter {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
}

.avatar-wrap.medal-none {
  border-color: var(--border);
}

.avatar-wrap.medal-beginner {
  border-color: #4ade80;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.3);
}

.avatar-wrap.medal-bronze {
  border-color: #cd7f32;
  box-shadow: 0 0 14px rgba(205, 127, 50, 0.35);
}

.avatar-wrap.medal-silver {
  border-color: #c0c0c0;
  box-shadow: 0 0 16px rgba(192, 192, 192, 0.4);
  animation: shimmer 2.5s ease-in-out infinite;
}

.avatar-wrap.medal-gold {
  border-color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.45);
  animation: pulse-gold 2s ease-in-out infinite;
}

.avatar-wrap.medal-platinum {
  border-color: #e5e4e2;
  box-shadow: 0 0 24px rgba(229, 228, 226, 0.5), 0 0 8px rgba(124, 92, 255, 0.3);
  animation: shimmer 2s ease-in-out infinite;
}

.avatar-wrap.medal-diamond {
  border-color: #b9f2ff;
  box-shadow: 0 0 28px rgba(185, 242, 255, 0.5), 0 0 12px rgba(124, 92, 255, 0.4);
  animation: pulse-diamond 1.8s ease-in-out infinite;
}

.avatar-wrap.medal-master {
  border-color: #ff6b35;
  box-shadow: 0 0 30px rgba(255, 107, 53, 0.5), 0 0 60px rgba(255, 107, 53, 0.2);
  animation: pulse-master 1.5s ease-in-out infinite;
}

.avatar-wrap.medal-legendary {
  border-width: 4px;
  border-image: linear-gradient(135deg, #ffd700, #ff6b35, #c47cff, #00d4ff) 1;
  border-radius: 50%;
  border-style: solid;
  border-color: #ffd700;
  box-shadow: 0 0 32px rgba(255, 215, 0, 0.5), 0 0 64px rgba(196, 124, 255, 0.3);
  animation: aura-legendary 2s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.45); }
  50% { box-shadow: 0 0 32px rgba(255, 215, 0, 0.7); }
}

@keyframes pulse-diamond {
  0%, 100% { box-shadow: 0 0 28px rgba(185, 242, 255, 0.5), 0 0 12px rgba(124, 92, 255, 0.4); }
  50% { box-shadow: 0 0 40px rgba(185, 242, 255, 0.7), 0 0 20px rgba(124, 92, 255, 0.6); }
}

@keyframes pulse-master {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 107, 53, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 44px rgba(255, 107, 53, 0.7); transform: scale(1.03); }
}

@keyframes aura-legendary {
  0%, 100% { box-shadow: 0 0 32px rgba(255, 215, 0, 0.5), 0 0 64px rgba(196, 124, 255, 0.3); transform: scale(1); }
  50% { box-shadow: 0 0 48px rgba(255, 215, 0, 0.7), 0 0 80px rgba(196, 124, 255, 0.5); transform: scale(1.04); }
}

.user-medal-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--warning);
  min-height: 1.2em;
}

/* ─── MEDAL MODAL ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.modal-content {
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-avatar {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
}

.modal-avatar .avatar-letter {
  font-size: 2.2rem;
}

.modal-medal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--warning);
  margin-bottom: 6px;
}

.modal-medal-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.medal-progress-wrap {
  margin-bottom: 24px;
}

.medal-progress-bar {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.medal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.medal-progress-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.modal-medals-header {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: left;
  margin-bottom: 12px;
}

.medal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.medal-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  opacity: 0.5;
}

.medal-list-item.unlocked {
  opacity: 1;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.medal-list-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.medal-list-icon.medal-beginner { border-color: #4ade80; }
.medal-list-icon.medal-bronze { border-color: #cd7f32; }
.medal-list-icon.medal-silver { border-color: #c0c0c0; }
.medal-list-icon.medal-gold { border-color: #ffd700; }
.medal-list-icon.medal-platinum { border-color: #e5e4e2; }
.medal-list-icon.medal-diamond { border-color: #b9f2ff; }
.medal-list-icon.medal-master { border-color: #ff6b35; }
.medal-list-icon.medal-legendary { border-color: #ffd700; }

.medal-list-info {
  font-size: 0.85rem;
  line-height: 1.4;
}

.medal-list-info strong {
  color: var(--text);
  font-size: 0.88rem;
}

/* ─── STREAK INDICATORS ────────────────────────────── */
.streak-indicator {
  position: absolute;
  top: -6px;
  right: -4px;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 999px;
  line-height: 1;
}

.streak-hot {
  background: rgba(255, 92, 0, 0.9);
  color: #fff;
}

.streak-cold {
  background: rgba(100, 180, 255, 0.9);
  color: #fff;
}

.streak-toast {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-align: center;
  font-size: 0.9rem;
  animation: fadeIn 0.3s ease;
}

.streak-toast.streak-bonus {
  background: rgba(255, 179, 71, 0.15);
  border: 1px solid rgba(255, 179, 71, 0.5);
  color: var(--warning);
}

.streak-toast.streak-penalty {
  background: rgba(255, 92, 122, 0.15);
  border: 1px solid rgba(255, 92, 122, 0.5);
  color: var(--danger);
}

/* ─── TURN PREP OVERLAY ────────────────────────────── */
.turn-prep-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 15, 20, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.prep-content {
  text-align: center;
  animation: prepPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes prepPop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.prep-label {
  font-size: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.prep-name {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.turn-prep-overlay.is-mine .prep-name {
  color: var(--success);
}

.prep-msg {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.turn-prep-overlay:not(.is-mine) .prep-msg::after {
  content: " (aguarde...)";
  font-size: 0.9rem;
  color: var(--text-muted);
}

.prep-countdown {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border: 3px solid var(--primary);
  border-radius: 50%;
  animation: prepShrink 2.8s linear forwards;
}

@keyframes prepShrink {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}
