:root {
  --bg-iron: #0d0907;
  --surface-iron: rgba(24, 18, 14, 0.96);
  --surface-raised: #291f18;
  --surface-recessed: #140f0b;
  --border-hairline: rgba(245, 236, 225, 0.22);
  --border-strong: rgba(229, 169, 60, 0.55);
  --terracotta: #d9531e;
  --terracotta-hover: #eb6028;
  --ochre: #f2b641;
  --gold-bright: #ffe047;
  --green-good: #22c55e;
  --green-dark: #15803d;
  --linen: #ffffff;
  --ash: #d4c5b4;
  --danger: #ef4444;
  --urchin-olive: #84cc16;

  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;

  --topbar-h: 56px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

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

html {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-iron);
  color: var(--linen);
  font-family: var(--font-sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100dvh;
  background-color: var(--bg-iron);
  color: var(--linen);
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

/* Durante os 30s de jogo, bloqueia o scroll para toques rápidos no assador */
body.is-playing {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   CAMADA 3D E 2D DO ASSADOR (FUNDO E TABULEIRO DE JOGO)
   ========================================================================== */

#canvas-3d-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  touch-action: none;
  pointer-events: none;
}

body.is-playing #canvas-3d-container {
  pointer-events: auto;
}

#canvas-3d-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: pointer;
  touch-action: none;
}

/* Etiquetas grandes flutuantes sobre os buracos 3D (visíveis apenas durante o jogo) */
.slot-badges-3d-layer {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  display: none;
}

body.is-playing .slot-badges-3d-layer {
  display: block;
}

.slot-3d-badge {
  position: absolute;
  transform: translate(-50%, 18px);
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(0.82rem, 2.5vw, 1rem);
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.85);
}

.badge-state-raw {
  background: rgba(45, 26, 14, 0.95);
  color: #fbd38d;
  border: 2px solid #d97706;
}

.badge-state-roasted {
  background: #16a34a;
  color: #ffffff;
  border: 2px solid #bbf7d0;
  font-size: clamp(0.92rem, 2.8vw, 1.12rem);
  animation: pulseBadge 0.55s ease-in-out infinite alternate;
}

.badge-state-golden {
  background: #f59e0b;
  color: #111827;
  border: 2px solid #fef08a;
  font-size: clamp(0.92rem, 2.8vw, 1.12rem);
  animation: pulseBadge 0.45s ease-in-out infinite alternate;
}

.badge-state-urchin {
  background: #dc2626;
  color: #ffffff;
  border: 2px solid #fecaca;
}

.badge-state-burned {
  background: #27272a;
  color: #d4d4d8;
  border: 2px solid #52525b;
}

@keyframes pulseBadge {
  from { transform: translate(-50%, 18px) scale(1); }
  to { transform: translate(-50%, 15px) scale(1.1); }
}

#grid-2d-wrapper {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--topbar-h) + 104px) 10px calc(58px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.assador-grid-2d {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: clamp(10px, 2.5vw, 16px);
  width: min(92vw, 56dvh, 440px);
  height: min(92vw, 56dvh, 440px);
  aspect-ratio: 1 / 1;
  padding: clamp(14px, 3.8vw, 24px);
  border-radius: 50%;
  background: radial-gradient(circle, #2e1509 0%, #150c08 75%, #1f1814 100%);
  border: clamp(5px, 1.2vw, 7px) solid #4a3b31;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.9),
    inset 0 0 42px rgba(217, 83, 30, 0.32);
  pointer-events: none;
  touch-action: none;
}

body.is-playing .assador-grid-2d {
  pointer-events: auto;
}

.assador-grid-2d.active-2d {
  display: grid;
}

/* Base 2D 100% imóvel ao tocar (sem transform/scale no :active) */
.slot-2d {
  position: relative;
  border-radius: 50%;
  border: 3px solid #45362c;
  background: radial-gradient(circle, #381205 0%, #120804 85%);
  color: var(--linen);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.slot-2d .slot-svg-wrap {
  width: clamp(42px, 10vw, 58px);
  height: clamp(42px, 10vw, 58px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.slot-2d .slot-svg-wrap svg {
  width: 100%;
  height: 100%;
}

.slot-2d .slot-caption {
  font-family: var(--font-sans);
  font-size: clamp(0.72rem, 2.2vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--linen);
  margin-top: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  pointer-events: none;
}

.slot-2d.state-empty .slot-caption {
  display: none;
}

.slot-2d .slot-key {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.slot-2d.state-raw {
  border-color: #b45309;
}

.slot-2d.state-raw .slot-caption {
  background: rgba(45, 26, 14, 0.95);
  color: #fde68a;
}

.slot-2d.state-roasted {
  border-color: #4ade80;
  background: radial-gradient(circle, #166534 0%, #142918 90%);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.75);
}

.slot-2d.state-roasted .slot-caption {
  background: #16a34a;
  color: #ffffff;
}

.slot-2d.state-golden {
  border-color: #fef08a;
  background: radial-gradient(circle, #b45309 0%, #3b2000 90%);
  box-shadow: 0 0 28px rgba(255, 224, 71, 0.9);
}

.slot-2d.state-golden .slot-caption {
  background: #f59e0b;
  color: #111827;
}

.slot-2d.state-urchin {
  border-color: #ef4444;
  background: radial-gradient(circle, #450a0a 0%, #1c0808 90%);
}

.slot-2d.state-urchin .slot-caption {
  background: #dc2626;
  color: #ffffff;
}

.slot-2d.state-burned .slot-caption {
  background: #27272a;
  color: #d4d4d8;
}

/* Popups grandes e legíveis no local do toque */
.hit-popups-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.hit-popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(1.05rem, 3.2vw, 1.3rem);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(12, 9, 7, 0.96);
  border: 2px solid currentColor;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  animation: popupRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popupRise {
  0% {
    opacity: 1;
    transform: translate(-50%, -25%) scale(0.95);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -175%) scale(1);
  }
}

/* ==========================================================================
   BARRA DE TOPO FIXA (BOTÕES GRANDES E LEGÍVEIS)
   ========================================================================== */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 clamp(10px, 3vw, 24px);
  background: rgba(12, 9, 7, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-hairline);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--terracotta);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  font-weight: 800;
  color: var(--linen);
  white-space: nowrap;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-hairline);
  background: var(--surface-raised);
  color: var(--linen);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.ctrl-btn:hover {
  border-color: var(--ochre);
}

.ctrl-key {
  color: var(--ash);
}

.ctrl-val {
  color: var(--gold-bright);
  font-weight: 800;
}

.ctrl-btn-danger {
  border-color: rgba(239, 68, 68, 0.45);
}

.ctrl-btn-danger .ctrl-val {
  color: #fca5a5;
}

/* ==========================================================================
   HUD DE JOGO ATIVO (NUMERAÇÃO GRANDE E ALTO CONTRASTE)
   ========================================================================== */

.hud-layer {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--topbar-h) + 8px) clamp(8px, 2.5vw, 24px) max(8px, env(safe-area-inset-bottom, 8px));
}

.hud-top-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.hud-telemetry {
  width: 100%;
  max-width: 680px;
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.95fr;
  background: rgba(14, 10, 7, 0.95);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.telemetry-cell {
  padding: clamp(8px, 1.8vw, 12px) clamp(10px, 2vw, 16px);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.telemetry-cell:last-child {
  border-right: none;
}

.telemetry-cell-center {
  align-items: center;
  text-align: center;
}

.telemetry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.telemetry-label {
  font-family: var(--font-sans);
  font-size: clamp(0.74rem, 2vw, 0.86rem);
  font-weight: 800;
  color: var(--ash);
  text-transform: uppercase;
  white-space: nowrap;
}

.telemetry-phase {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ochre);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-value {
  font-size: clamp(1.55rem, 5vw, 2.1rem);
  font-weight: 800;
  color: var(--linen);
  line-height: 1.1;
}

.telemetry-score {
  color: var(--gold-bright);
}

.meter-track {
  margin-top: 5px;
  height: 7px;
  width: 100%;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, var(--gold-bright));
  transition: width 0.1s linear;
}

.hud-combo-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.combo-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--ochre);
  white-space: nowrap;
}

.combo-hot {
  background: rgba(34, 197, 94, 0.18);
}

.hud-banner-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.hud-banner {
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(14, 10, 7, 0.96);
  border: 2px solid var(--border-strong);
  font-family: var(--font-sans);
  font-size: clamp(0.88rem, 2.8vw, 1.08rem);
  font-weight: 800;
  color: var(--gold-bright);
  text-align: center;
  max-width: 96vw;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.75);
}

.hud-footer-bar {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(14, 10, 7, 0.95);
  border: 1.5px solid var(--border-hairline);
}

.legend-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  font-size: clamp(0.8rem, 2.3vw, 0.94rem);
  width: 100%;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--linen);
}

.legend-pill-good strong {
  color: #4ade80;
}

.legend-pill-bad strong {
  color: #fca5a5;
}

/* ==========================================================================
   CONTENTORES DE ECRÃS (LOGIN, MENU, COMO JOGAR, FIM DE JOGO)
   ========================================================================== */

.app-screen {
  position: relative;
  z-index: 25;
  min-height: 100dvh;
  width: 100%;
  padding: calc(var(--topbar-h) + clamp(12px, 3vw, 28px)) clamp(10px, 3vw, 24px) max(28px, env(safe-area-inset-bottom, 28px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 20%, rgba(18, 12, 9, 0.82) 0%, rgba(10, 7, 5, 0.94) 100%);
}

.screen-container {
  width: 100%;
  margin: auto;
}

.container-narrow {
  max-width: 490px;
}

.container-medium {
  max-width: 720px;
}

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

.card-surface {
  background: var(--surface-iron);
  border: 2px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.88);
  overflow: hidden;
}

.eyebrow-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ochre);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ==========================================================================
   ECRÃ 1: LOGIN SIMPLIFICADO (CAMPOS GRANDES E BOTÃO MOSTRAR SENHA)
   ========================================================================== */

.login-card {
  padding: clamp(22px, 5vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 5.5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--linen);
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ash);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-block label {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--linen);
}

.field-block input,
.field-block select,
.dept-change-row select {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-hairline);
  background: var(--surface-recessed);
  color: var(--linen);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  outline: none;
}

.field-block input::placeholder {
  color: rgba(212, 197, 180, 0.55);
}

.field-block input:focus,
.field-block select:focus,
.dept-change-row select:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(255, 224, 71, 0.22);
}

.password-input-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.password-input-wrap input {
  flex: 1;
}

.toggle-pass-btn {
  padding: 0 16px;
  min-height: 56px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-hairline);
  background: var(--surface-raised);
  color: var(--gold-bright);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.alert-box {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--danger);
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

/* Botões Principais Grandes e Fáceis de Tocar */
.action-btn {
  width: 100%;
  min-height: 58px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 240, 180, 0.45);
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.38);
}

.action-btn:hover {
  filter: brightness(1.08);
}

.action-btn-large {
  min-height: 62px;
  font-size: 1.18rem;
}

.action-btn-xl {
  min-height: 66px;
  font-size: clamp(1.12rem, 3.5vw, 1.3rem);
}

.btn-arrow {
  font-size: 1.4rem;
  line-height: 1;
}

.ghost-btn {
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-hairline);
  background: var(--surface-raised);
  color: var(--linen);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}

/* ==========================================================================
   ECRÃ 2: MENU PRINCIPAL & CLASSIFICAÇÃO
   ========================================================================== */

.lobby-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

@media (min-width: 920px) {
  .lobby-layout {
    grid-template-columns: 390px 1fr;
    gap: 22px;
  }
}

.player-panel,
.board-panel {
  padding: clamp(18px, 4vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dossier-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-monogram {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 2px solid var(--border-strong);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  flex-shrink: 0;
}

.dossier-id {
  min-width: 0;
  flex: 1;
}

.dossier-kicker {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ochre);
  text-transform: uppercase;
}

.dossier-id h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 3.8vw, 1.55rem);
  font-weight: 800;
  color: var(--linen);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dept-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.dept-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(242, 182, 65, 0.16);
  border: 1.5px solid rgba(242, 182, 65, 0.45);
  color: var(--gold-bright);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
}

.text-action-btn {
  border: none;
  background: none;
  color: var(--ash);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

.dept-change-row {
  display: flex;
  gap: 8px;
}

.mini-action-btn {
  padding: 0 18px;
  min-height: 56px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gold-bright);
  background: var(--surface-raised);
  color: var(--gold-bright);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.lobby-cta-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--surface-recessed);
  overflow: hidden;
}

.metric-cell {
  padding: 12px 8px;
  border-right: 1px solid var(--border-hairline);
  text-align: center;
}

.metric-cell:last-child {
  border-right: none;
}

.metric-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ash);
  margin-bottom: 4px;
}

.metric-cell strong {
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  color: var(--gold-bright);
}

.manual-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-recessed);
  border: 1px solid var(--border-hairline);
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ash);
}

/* Quadro de Classificação */
.board-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.board-heading {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 3.8vw, 1.65rem);
  font-weight: 800;
  color: var(--linen);
}

.board-sub {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ash);
  margin-top: 2px;
}

.board-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-recessed);
  overflow: hidden;
}

.board-tab {
  min-height: 52px;
  padding: 12px 10px;
  border: none;
  border-right: 1px solid var(--border-hairline);
  background: transparent;
  color: var(--ash);
  font-family: var(--font-sans);
  font-size: clamp(0.88rem, 2.4vw, 1.02rem);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.board-tab:last-child {
  border-right: none;
}

.board-tab.active {
  background: var(--surface-raised);
  color: var(--gold-bright);
  box-shadow: inset 0 -3px 0 #22c55e;
}

.table-container {
  border: 2px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-recessed);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.92rem, 2.5vw, 1.02rem);
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #16100c;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ash);
  white-space: nowrap;
}

.data-table .col-rank {
  width: 66px;
  text-align: center;
}

.data-table .col-num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rank-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 800;
  border: 1px solid var(--border-hairline);
  color: var(--linen);
}

.rank-plate.rank-1 {
  border-color: #f5b932;
  background: rgba(245, 185, 50, 0.22);
  color: #ffe047;
}

.rank-plate.rank-2 {
  border-color: #d4d4d8;
  background: rgba(212, 212, 216, 0.18);
  color: #ffffff;
}

.rank-plate.rank-3 {
  border-color: #fb923c;
  background: rgba(251, 146, 60, 0.2);
  color: #fed7aa;
}

.data-table tr.me-row {
  background: rgba(34, 197, 94, 0.18);
}

.data-table tr.me-row td {
  color: #ffffff;
  font-weight: 700;
}

/* ==========================================================================
   ECRÃ 2.5: COMO JOGAR (SEMÁFORO VERDE / VERMELHO SUPER CLARO)
   ========================================================================== */

.howto-card {
  padding: clamp(20px, 4.5vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.howto-title {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  font-weight: 800;
  color: var(--linen);
  margin-bottom: 6px;
}

.howto-subtitle {
  font-size: clamp(1rem, 2.8vw, 1.12rem);
  line-height: 1.5;
  color: var(--ash);
}

.howto-subtitle strong {
  color: var(--gold-bright);
}

.howto-section-box {
  padding: clamp(14px, 3vw, 18px);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.howto-box-positive {
  background: rgba(22, 163, 74, 0.12);
  border: 2px solid rgba(74, 222, 128, 0.45);
}

.howto-box-negative {
  background: rgba(220, 38, 38, 0.1);
  border: 2px solid rgba(248, 113, 113, 0.4);
}

.howto-section-title {
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 2.6vw, 1.08rem);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.good-title {
  color: #4ade80;
}

.bad-title {
  color: #fca5a5;
}

.howto-grid {
  display: grid;
  gap: 12px;
}

.howto-grid-positive {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.howto-grid-negative {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.howto-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(14, 10, 7, 0.92);
  border: 1.5px solid var(--border-hairline);
}

.howto-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, #381205 0%, #120804 88%);
  border: 2px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-box-good {
  border-color: #4ade80;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.45);
}

.icon-box-gold {
  border-color: #ffe047;
  box-shadow: 0 0 18px rgba(255, 224, 71, 0.55);
}

.howto-info {
  flex: 1;
  min-width: 0;
}

.howto-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.howto-item-head strong {
  font-size: 1.02rem;
  color: var(--linen);
}

.howto-info p {
  font-size: 0.94rem;
  line-height: 1.42;
  color: var(--ash);
}

.badge-pts {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-good {
  background: #16a34a;
  color: #ffffff;
}

.badge-gold {
  background: #f59e0b;
  color: #111827;
}

.badge-wait {
  background: #78350f;
  color: #fde68a;
}

.badge-bad {
  background: #dc2626;
  color: #ffffff;
}

.howto-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

/* ==========================================================================
   ECRÃ 3: FIM DE JOGO (RELATÓRIO DE 30s)
   ========================================================================== */

.gameover-card {
  padding: clamp(22px, 5vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gameover-heading {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4.8vw, 2.1rem);
  font-weight: 800;
  color: var(--linen);
}

.score-plaque {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-recessed);
  border: 2px solid var(--border-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.plaque-label {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ash);
}

.plaque-value {
  font-size: clamp(2rem, 6.5vw, 2.6rem);
  font-weight: 800;
  color: var(--gold-bright);
}

.gameover-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--surface-recessed);
  overflow: hidden;
}

.gameover-metrics .metric-cell:nth-child(1),
.gameover-metrics .metric-cell:nth-child(2) {
  border-bottom: 1px solid var(--border-hairline);
}

.gameover-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   ADAPTAÇÕES TELEMÓVEL E DISPOSITIVOS DE TOQUE
   ========================================================================== */

@media (pointer: coarse) {
  .slot-2d .slot-key {
    display: none !important;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-h: 52px;
  }

  .ctrl-key {
    display: none;
  }

  .app-screen {
    justify-content: flex-start;
  }

  .data-table .col-extra {
    display: none;
  }

  .data-table th,
  .data-table td {
    padding: 11px 8px;
  }

  .data-table td:nth-child(2),
  .data-table td.col-dept {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .howto-grid-negative {
    grid-template-columns: 1fr;
  }
}
