:root {
  --bg: #0f1115;
  --bg-card: #1a1d24;
  --bg-card-2: #21252f;
  --text: #f2f2f2;
  --muted: #9aa0ab;
  --red: #e63946;
  --orange: #f4a261;
  --green: #2a9d8f;
  --yellow: #ffd166;
  --purple: #8338ec;
  --border: #2c303a;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.container.wide {
  max-width: 1100px;
}

h1, h2, h3 {
  margin: 0 0 8px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 14px;
}

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  color: var(--text);
  font-size: 1rem;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--green);
  transition: transform 0.05s ease;
}

button:active { transform: scale(0.97); }

button.secondary {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text);
}

button.danger { background: var(--red); }
button.warn { background: var(--orange); color: #241a00; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-row button { flex: 1; min-width: 120px; }

.full-width { width: 100%; margin-top: 16px; }

/* --- Barra de progresso (combustivel / pneu) --- */
.bar-track {
  width: 100%;
  height: 22px;
  background: var(--bg-card-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease, background 0.3s ease;
}
.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.bar-value { color: var(--text); font-weight: 700; }

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.stat-icon { font-size: 1.4rem; width: 30px; text-align: center; }

.warning-banner {
  background: #3a1f00;
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  margin: 10px 0;
  text-align: center;
}

.danger-banner {
  background: #3a0d12;
  border: 1px solid var(--red);
  color: #ff8790;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  margin: 10px 0;
  text-align: center;
}

.dice-btn {
  width: 100%;
  padding: 26px;
  font-size: 1.4rem;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--green), #1c7268);
  margin-top: 10px;
}

.dice-result {
  text-align: center;
  font-size: 3.5rem;
  font-weight: 800;
  margin: 10px 0;
}

@keyframes dicePop {
  0% { transform: scale(0.4) rotate(-8deg); opacity: 0.3; }
  55% { transform: scale(1.25) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.dice-pop {
  animation: dicePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.opponents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opponent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

.opponent-row .name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.opponent-row .roll-value {
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 2ch;
  text-align: center;
}

.opponent-row .roll-value.empty {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
}

.tag-dice {
  background: var(--purple);
  color: white;
}

.card-mine {
  border: 2px solid var(--green);
  box-shadow: 0 0 0 1px var(--green) inset;
}

.dice-result-mini {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.color-dot {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
}

.fines-list {
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--muted);
}
.fines-list div { padding: 4px 0; border-bottom: 1px solid var(--border); }

.fine-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fine-row button { padding: 2px 10px; font-size: 0.8rem; flex-shrink: 0; }

.game-code {
  font-family: monospace;
  font-size: 1.6rem;
  letter-spacing: 2px;
  background: var(--bg-card-2);
  padding: 10px 16px;
  border-radius: 10px;
  display: inline-block;
  border: 1px dashed var(--border);
}

.center { text-align: center; }
.mt-24 { margin-top: 24px; }
.small { font-size: 0.8rem; color: var(--muted); }

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.status-lobby { background: #2c2f3a; color: var(--muted); }
.status-playing { background: #0d3a2a; color: var(--green); }
.status-finished { background: #3a0d12; color: #ff8790; }

/* --- Cartas da sorte --- */
.card-luck {
  border-color: var(--purple);
  background: linear-gradient(160deg, #241a3d, var(--bg-card));
}

.luck-log-list {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--muted);
}
.luck-log-list div { padding: 4px 0; border-bottom: 1px solid var(--border); }
.luck-log-list strong { color: var(--text); }

/* --- Efeitos continuos (ex: Pneu Remold, Kit Gas) --- */
.tag-effect {
  background: var(--red);
  color: white;
}

.active-effects-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.effect-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.effect-row select { width: auto; flex: 1; min-width: 140px; }
.effect-row button { padding: 8px 12px; font-size: 0.85rem; }

/* --- Painel do piloto: carrossel lateral (voce + adversarios) --- */
.panel-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 16px 0 10px;
  scrollbar-width: none;
}
.panel-tabs::-webkit-scrollbar { display: none; }

.panel-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 999px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.panel-tab.active { color: var(--text); border-color: var(--green); }
.panel-tab .roll-value { font-weight: 800; color: var(--text); }
.panel-tab .roll-value.empty { color: var(--muted); font-weight: 400; }
.panel-tab .color-dot { width: 10px; height: 10px; }

.panel-slider {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.panel-slider::-webkit-scrollbar { display: none; }

.panel-slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
}

.opp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.opp-header h3 { margin: 0; flex: 1; }

/* --- Mostradores lado a lado --- */
.gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: start;
}
.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.gauge-title { font-size: 0.8rem; font-weight: 700; }
.gauge-caption { font-size: 0.72rem; color: var(--muted); text-align: center; line-height: 1.3; }

/* Gasolina: relogio estilo painel de carro (E -> F), porcentagem e dados restantes embaixo */
.fuel-dial { width: 100%; max-width: 120px; height: auto; display: block; }
.dial-letter { font-size: 11px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; }
.dial-icon { font-size: 12px; text-anchor: middle; dominant-baseline: middle; }
.fuel-percent { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.dial-needle {
  transform-box: view-box;
  transform-origin: 50px 56px;
  transition: transform 1.2s cubic-bezier(0.34, 1.25, 0.64, 1); /* leve balanco no fim, tipo ponteiro */
}

/* Pneu: desenho do pneu com o anel de 10 barrinhas (nivel) em volta */
.tire-svg { width: 100%; max-width: 120px; height: auto; display: block; }

/* Turbo: conta-giros (reaproveita .fuel-dial e .dial-needle) */
.dial-number { font-size: 8px; font-weight: 700; fill: #111; text-anchor: middle; dominant-baseline: middle; }
.dial-dice { font-size: 13px; font-weight: 800; fill: #111; text-anchor: middle; dominant-baseline: middle; }

.dash-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.dash-stat strong { font-size: 1.2rem; color: var(--text); }

/* Mestre: painel do piloto a esquerda, controles a direita (empilha no celular) */
.master-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 800px) {
  .master-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.master-layout .dash-card { margin: 12px 0 0; background: var(--bg-card-2); }
.gauges { max-width: 480px; margin: 0 auto; }
