:root {
  --bg-dark: #14111f;
  --bg-panel: #221d33;
  --wood-light: #d9a066;
  --wood-dark: #9c632d;
  --bamboo-bg: #e9c46a;
  --bamboo-line: #c9a24b;
  --accent-red: #e63946;
  --accent-green: #06d6a0;
  --accent-gold: #ffd166;
  --accent-blue: #38bdf8;
  --text-light: #f8f9fa;
  --text-muted: #c4c0d4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100dvh;
  background-color: #0b0912;
  color: var(--text-light);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
  touch-action: manipulation;
}

#game-wrapper {
  width: 100%;
  max-width: 520px;
  height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(180deg, #1b172a 0%, #201a31 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.75);
}

@media (max-width: 540px) {
  #game-wrapper {
    max-width: 100%;
    border: none;
  }
}

/* =========================================================
   1. HUD SUPERIOR EN 2 FILAS CLARAS Y LEGIBLES EN CELULAR
   ========================================================= */
.hud-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px;
  background: rgba(12, 10, 20, 0.98);
  border-bottom: 2px solid var(--accent-red);
  flex-shrink: 0;
}

.hud-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.hud-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 1px solid #352d50;
  padding: 4px 4px;
  border-radius: 9px;
}

.hud-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.hud-value {
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hud-value.coins {
  color: var(--accent-gold);
}

.hud-value.combo {
  color: var(--accent-green);
}

.hud-actions-row {
  display: flex;
  gap: 5px;
}

.btn-hud-action {
  flex: 1;
  min-height: 34px;
  border: none;
  border-radius: 9px;
  padding: 5px 6px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s;
}

.btn-hud-action:active {
  transform: scale(0.96);
}

.btn-hud-action.hidden {
  display: none !important;
}

.btn-hud-action span {
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.btn-hud-action .hud-btn-icon {
  font-size: 0.92rem;
}

.btn-hud-action.pause {
  background: #1e293b;
  color: #f8fafc;
  border: 1.5px solid #475569;
}

.btn-hud-action.pause.is-paused {
  background: var(--accent-green);
  color: #0b2922;
  border-color: #ffffff;
}

.btn-hud-action.prestige {
  background: linear-gradient(180deg, #3c1f5e 0%, #24123b 100%);
  color: var(--accent-gold);
  border: 1.5px solid #8b5cf6;
}

.btn-hud-action.lobby {
  background: #312a4d;
  color: #38bdf8;
  border: 1.5px solid #4c4275;
}

.btn-hud-action.shop {
  background: linear-gradient(180deg, #ffd166 0%, #f4a261 100%);
  color: #1f1b2e;
  border: 1.5px solid #fde68a;
}

/* 1B. Barra de Prestigio y Certificación en Vivo */
.prestige-hud-strip {
  background: linear-gradient(90deg, #1b1332 0%, #2a1b4e 50%, #1b1332 100%);
  border-bottom: 1.5px solid #6d28d9;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
  cursor: pointer;
}

.prestige-hud-strip.hidden {
  display: none !important;
}

.prestige-strip-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
}

.prestige-strip-badge {
  font-weight: 900;
  color: var(--accent-gold);
}

.prestige-strip-metrics {
  font-weight: 800;
  color: #e2e8f0;
}

.prestige-progress-track {
  position: relative;
  height: 15px;
  background: rgba(12, 10, 22, 0.88);
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-radius: 99px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prestige-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #06d6a0 0%, #ffd166 100%);
  transition: width 0.25s ease;
}

.prestige-progress-text {
  position: relative;
  z-index: 1;
  font-size: 0.62rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}

/* =========================================================
   2. SELECTOR DE PUESTOS (MODO MULTIJUGADOR)
   ========================================================= */
.roles-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 5px 6px;
  background: #141122;
  border-bottom: 2px solid #2e2746;
  flex-shrink: 0;
}

.roles-bar.hidden,
.tables-mini-grid.hidden {
  display: none !important;
}

.role-tab {
  position: relative;
  background: #221d35;
  border: 1.5px solid #383056;
  border-radius: 10px;
  padding: 5px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  cursor: pointer;
}

.role-tab.active {
  background: #382e5c;
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.25);
}

.role-tab-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.role-tab-name {
  font-size: 0.68rem;
  font-weight: 800;
}

.role-tab-players {
  font-size: 0.6rem;
  color: #38bdf8;
  font-weight: 700;
}

.role-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--accent-red);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 900;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-badge.zero {
  display: none;
}

/* =========================================================
   3. ESTACIÓN DE TRABAJO PRINCIPAL (OCUPA TODO EL ESPACIO)
   ========================================================= */
.workstation-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1a162b;
  min-height: 0;
}

.role-station {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.role-station.hidden {
  display: none !important;
}

.station-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: linear-gradient(90deg, #26203d 0%, #1f1a33 100%);
  border-bottom: 1px solid #3a3158;
  gap: 8px;
  flex-shrink: 0;
}

.station-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.station-header h3 {
  font-size: 0.86rem;
  font-weight: 900;
  color: var(--accent-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-sub {
  display: none;
}

.station-badge-info {
  background: #2f2848;
  border: 1px solid #4a3f70;
  color: var(--accent-green);
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.btn-rice {
  background: #2f2848;
  border: 1.5px solid var(--accent-gold);
  color: #ffffff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-rice:active {
  transform: scale(0.96);
}

/* TARJETAS DE LAS 4 MESAS (KDS / ÓRDENES) */
.kds-section {
  background: radial-gradient(circle at 50% 0%, #2a2145 0%, #151125 100%);
  border-bottom: 2px solid #3c2f5e;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* En Cocina ocultamos la tira redundante de recetas porque los ingredientes ya se ven en cada mesa y en la guía */
#recipes-strip {
  display: none;
}

.recipes-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 5px 8px;
  background: #181427;
  border-bottom: 1px solid #2b2442;
  scrollbar-width: none;
}

.recipes-strip::-webkit-scrollbar {
  display: none;
}

.recipe-chip {
  flex: 0 0 auto;
  background: #252038;
  border: 1.5px solid #483f68;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.recipe-chip strong {
  color: var(--accent-gold);
}

.recipe-chip.queue-chip {
  cursor: pointer;
}

.recipe-chip.queue-chip.active {
  border-color: #38bdf8;
  background: #1e293b;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

.kds-orders-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px 8px;
  min-height: 112px;
  align-items: stretch;
}

.kds-empty-seat {
  background: rgba(255, 255, 255, 0.04);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.kds-empty-seat.selected-target {
  border-style: solid;
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.empty-seat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.empty-seat-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
}

.empty-seat-text strong {
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 900;
}

.kds-ticket {
  background: linear-gradient(180deg, #2b2344 0%, #1f1933 100%);
  border: 2px solid #5a4c85;
  border-radius: 12px;
  padding: 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.kds-ticket.selected-target {
  border: 2.5px solid #38bdf8;
  background: linear-gradient(180deg, #2b3558 0%, #1c223b 100%);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
}

.kds-ticket.selected-target .ticket-seat-tag {
  background: #38bdf8;
  color: #082032;
  border-color: #ffffff;
}

.kds-ticket.ready-match {
  background: linear-gradient(180deg, #13443b 0%, #0d2f29 100%);
  border-color: var(--accent-green);
  box-shadow: 0 0 14px rgba(6, 214, 160, 0.6);
}

.ticket-bubble-col {
  width: 100%;
  background: #ffffff;
  color: #1d1829;
  border-radius: 9px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.kds-ticket-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
  line-height: 1;
}

.ticket-dish-title {
  font-size: 1.25rem;
  line-height: 1;
}

.ticket-price-pill {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-size: 0.66rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 5px;
}

.kds-ticket-ings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding-top: 3px;
  border-top: 1px dashed #cbd5e1;
}

.step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1.5px solid #94a3b8;
  border-radius: 6px;
  min-width: 24px;
  height: 24px;
  padding: 1px 2px;
  font-size: 1.02rem;
  line-height: 1;
}

.step-chip.done {
  background: #a7f3d0;
  border: 2px solid #059669;
  transform: scale(1.05);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.65);
}

.ticket-avatar-col {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

.ticket-avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a3d70 0%, #261f3d 100%);
  border: 1.5px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  flex-shrink: 0;
}

.ticket-seat-tag {
  background: #141122;
  border: 1px solid #574a80;
  color: #f8f9fa;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
}

.ticket-vip-crown {
  font-size: 0.74rem;
  line-height: 1;
}

.ticket-patience-row {
  width: 100%;
  display: flex;
  align-items: center;
}

.kds-patience-bg {
  width: 100%;
  height: 5px;
  background: #151124;
  border-radius: 99px;
  overflow: hidden;
}

.kds-patience-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 99px;
  transition: width 0.2s linear;
}

/* =========================================================
   MESA DE PREPARACIÓN / CHAROLA / TERMINAL POS
   ========================================================= */
.prep-station {
  padding: 7px 10px;
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood-dark) 100%);
  border-bottom: 3px solid #6f4518;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.prep-station.host-theme {
  background: linear-gradient(180deg, #98c1d9 0%, #3d5a80 100%);
  border-bottom-color: #293241;
}

.prep-station.waiter-theme {
  background: linear-gradient(180deg, #b5838d 0%, #6d597a 100%);
  border-bottom-color: #352b42;
}

.prep-station.runner-theme {
  background: linear-gradient(180deg, #81b29a 0%, #3d8568 100%);
  border-bottom-color: #264653;
}

.prep-station.cashier-theme {
  background: linear-gradient(180deg, #e9c46a 0%, #b5832b 100%);
  border-bottom-color: #6f4e18;
}

.prep-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 900;
  color: #1e130a;
}

.prep-station.host-theme .prep-header,
.prep-station.waiter-theme .prep-header,
.prep-station.runner-theme .prep-header {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.dish-preview {
  background: rgba(255, 255, 255, 0.96);
  color: #1f1b2e;
  padding: 3px 9px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 0.74rem;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 68%;
}

/* Ocultamos la barra redundante de botones de mesa porque las 4 tarjetas superiores ya seleccionan la mesa con más claridad */
.table-target-bar {
  display: none;
}

.bamboo-mat {
  min-height: 54px;
  background: repeating-linear-gradient(
    90deg,
    var(--bamboo-bg),
    var(--bamboo-bg) 10px,
    var(--bamboo-line) 10px,
    var(--bamboo-line) 12px
  );
  border: 2.5px solid #6b4423;
  border-radius: 11px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 8px;
}

.mat-placeholder {
  color: #2b1b0e;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.3;
}

.guide-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid #7f5539;
  color: #1e1b2e;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 99px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.mat-ingredient {
  background: #ffffff;
  border: 2px solid #7f5539;
  border-radius: 9px;
  padding: 3px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.35rem;
  line-height: 1.05;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.mat-ingredient span {
  font-size: 0.64rem;
  color: #1f1b2e;
  font-weight: 800;
}

.prep-actions {
  display: grid;
  grid-template-columns: 1fr 2.2fr;
  gap: 7px;
}

.btn {
  border: none;
  border-radius: 10px;
  min-height: 44px;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform 0.08s, opacity 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-trash {
  background: #4a4e69;
  color: #ffffff;
}

.btn-serve {
  background: #06d6a0;
  color: #06281e;
  box-shadow: 0 3px 10px rgba(6, 214, 160, 0.35);
}

.btn-serve:not(:disabled) {
  animation: pulseReadyBtn 1.2s infinite alternate;
}

@keyframes pulseReadyBtn {
  from {
    box-shadow: 0 0 6px rgba(6, 214, 160, 0.4);
  }
  to {
    box-shadow: 0 0 16px rgba(6, 214, 160, 0.85);
  }
}

.btn-primary {
  background: var(--accent-red);
  color: #ffffff;
  width: 100%;
  font-size: 0.96rem;
  min-height: 46px;
  padding: 11px 14px;
}

.btn-shop-modal {
  background: var(--accent-gold);
  color: #1f1b2e;
  width: 100%;
  font-size: 0.86rem;
  min-height: 42px;
  padding: 9px 10px;
}

/* =========================================================
   ZONA DE BOTONES / INGREDIENTES (APROVECHA EL 100% DEL ALTO)
   ========================================================= */
.ingredients-zone {
  padding: 7px 8px;
  background: #1a1628;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ingredients-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 800;
  flex-shrink: 0;
}

.upgrades-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.upgrade-badge {
  background: #2b2540;
  border: 1px solid #4d4370;
  color: var(--accent-gold);
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 800;
}

.ingredients-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ingredients-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.ingredient-btn {
  position: relative;
  background: linear-gradient(180deg, #2f2847 0%, #241e38 100%);
  border: 2px solid #473d68;
  border-radius: 12px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-light);
  cursor: pointer;
  min-height: 58px;
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
}

.ingredient-btn:active {
  transform: scale(0.95);
  background: #3d345b;
  border-color: var(--accent-gold);
}

.ingredient-btn.needed-ing {
  border-color: var(--accent-green);
  background: linear-gradient(180deg, #1b433d 0%, #162e36 100%);
  box-shadow: inset 0 0 10px rgba(6, 214, 160, 0.25), 0 0 8px rgba(6, 214, 160, 0.3);
}

.ingredient-btn.needed-ing::after {
  content: "PEDIDO";
  position: absolute;
  top: 3px;
  right: 4px;
  background: var(--accent-green);
  color: #052e22;
  font-size: 0.52rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.ingredient-emoji {
  font-size: 1.75rem;
  line-height: 1.05;
}

.ingredient-name {
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.1;
}

/* =========================================================
   4. BARRA DE ESTADO INFERIOR COMPACTA
   ========================================================= */
.secondary-monitor {
  background: #110e1c;
  border-top: 2px solid #2f2846;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.monitor-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
}

.monitor-metrics {
  display: flex;
  gap: 6px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 700;
}

.monitor-metrics strong {
  color: var(--accent-gold);
}

.status-ticker {
  flex: 1;
  text-align: center;
  background: #1b172c;
  border: 1px solid #322a4d;
  color: #38bdf8;
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-pill-footer {
  background: #231e38;
  color: var(--accent-gold);
  border: 1px solid #483e6b;
  border-radius: 7px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.tables-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.table-slot {
  background: #1c182c;
  border: 1px solid #322b4b;
  border-radius: 8px;
  padding: 4px 5px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.table-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.table-mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
}

.stage-pill {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-SEATED { background: #3b82f6; color: #fff; }
.stage-ORDERED { background: #f59e0b; color: #1f1b2e; }
.stage-READY_PASS { background: #10b981; color: #06281e; }
.stage-EATING { background: #8b5cf6; color: #fff; }
.stage-BILL_READY { background: #ffd166; color: #1f1b2e; }
.stage-DIRTY { background: #64748b; color: #fff; }

.patience-bar-bg {
  width: 100%;
  height: 4px;
  background: #2d2744;
  border-radius: 2px;
  overflow: hidden;
}

.patience-bar-fill {
  height: 100%;
  width: 100%;
  background: #2a9d8f;
  transition: width 0.2s linear;
}

.empty-table-msg {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  margin: auto 0;
}

/* =========================================================
   5. PANTALLAS MODALES A PANTALLA COMPLETA EN MÓVIL
   ========================================================= */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 18, 0.94);
  backdrop-filter: blur(6px);
  display: none;
  justify-content: center;
  align-items: stretch;
  padding: 0;
  z-index: 25;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: linear-gradient(180deg, #252038 0%, #1c182c 100%);
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  gap: 10px;
}

.modal-icon {
  font-size: 2.3rem;
  line-height: 1.1;
}

.modal-card h1 {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--accent-gold);
  margin-bottom: 2px;
}

.modal-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.38;
  margin-bottom: 6px;
}

.lobby-step {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 8px;
}

.section-mini-label {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

/* Tarjetas de Selección de Modo */
.mode-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  text-align: left;
}

.mode-card {
  background: #1a1628;
  border: 2px solid #3a3257;
  border-radius: 13px;
  padding: 11px 10px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, background-color 0.15s, transform 0.08s;
}

.mode-card.active {
  background: #2d2447;
  border-color: var(--accent-green);
  box-shadow: 0 0 14px rgba(6, 214, 160, 0.28);
}

.mode-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--accent-gold);
}

.mode-emoji {
  font-size: 1.35rem;
}

.mode-desc {
  font-size: 0.76rem !important;
  color: var(--text-muted) !important;
  line-height: 1.35 !important;
  margin-bottom: 0 !important;
}

.player-setup-box {
  background: #1a1628;
  border: 1.5px solid #3a3257;
  border-radius: 13px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
}

.setup-row label {
  color: #e2e8f0;
  font-weight: 800;
}

.setup-row input {
  background: #252038;
  border: 1.5px solid #524775;
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
}

/* Selector de las 5 estaciones en Paso 3: tarjetas amplias con descripción */
.initial-role-Selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.init-role-btn {
  background: #252038;
  border: 2px solid #3f365c;
  border-radius: 11px;
  padding: 9px 10px;
  color: var(--text-light);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.init-role-btn:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.init-role-btn.active {
  border-color: var(--accent-gold);
  background: #382e59;
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.25);
}

.init-role-icon {
  font-size: 1.65rem;
  line-height: 1;
  flex-shrink: 0;
}

.init-role-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.init-role-texts strong {
  font-size: 0.86rem;
  color: var(--accent-gold);
}

.init-role-texts small {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.online-roster {
  font-size: 0.78rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 9px;
  padding: 8px 10px;
  line-height: 1.35;
}

.online-roster.hidden {
  display: none;
}

.modal-stats {
  background: #1a1628;
  border: 1px solid #3a3257;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-stats.hidden {
  display: none;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.modal-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-prestige-modal {
  background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 100%);
  color: #ffffff;
  border: 1px solid #a78bfa;
}

/* Prestigio y Tienda a pantalla completa con lista flexible */
.shop-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #3c3459;
  padding-bottom: 8px;
  flex-shrink: 0;
}

.shop-header h2 {
  font-size: 1.15rem;
  color: var(--accent-gold);
}

.shop-subtitle {
  font-size: 0.76rem !important;
  color: var(--accent-green) !important;
  font-weight: 800;
  margin-bottom: 0 !important;
}

.shop-balance {
  background: #1a1628;
  border: 1.5px solid #483e6b;
  border-radius: 10px;
  padding: 5px 10px;
  text-align: right;
  flex-shrink: 0;
}

.shop-balance span {
  display: block;
  font-size: 0.64rem;
  color: var(--text-muted);
}

.shop-balance strong {
  font-size: 0.98rem;
  color: var(--accent-gold);
}

.prestige-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.prestige-kpi-box {
  background: #1a1628;
  border: 1px solid #3c3459;
  border-radius: 9px;
  padding: 6px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prestige-kpi-box .kpi-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.prestige-kpi-box strong {
  font-size: 0.84rem;
  color: var(--accent-gold);
}

.prestige-rules-banner {
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #e2e8f0;
  flex-shrink: 0;
}

.shop-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.shop-tab {
  background: #1a1628;
  color: var(--text-muted);
  border: 1.5px solid #3c3459;
  border-radius: 9px;
  padding: 9px 4px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.shop-tab.active {
  background: #382f57;
  color: #ffffff;
  border-color: var(--accent-gold);
}

.shop-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 2px;
}

.shop-item {
  background: #1a1628;
  border: 1.5px solid #3a3257;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.shop-item.owned {
  border-color: #2a9d8f;
  background: rgba(42, 157, 143, 0.14);
}

.shop-item.current-cert {
  border: 2px solid var(--accent-gold);
  background: rgba(255, 209, 102, 0.14);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.25);
}

.shop-item.supreme-cert {
  border: 2px solid #f472b6;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22) 0%, rgba(244, 114, 182, 0.18) 100%);
}

.shop-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.shop-item-emoji {
  font-size: 1.65rem;
  background: #252038;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shop-item-text h3 {
  font-size: 0.86rem;
  color: #ffffff;
  margin-bottom: 3px;
}

.shop-item-text p {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.3;
}

.benefit-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-green);
  background: rgba(6, 214, 160, 0.14);
  padding: 2px 6px;
  border-radius: 6px;
}

.btn-buy {
  background: var(--accent-green);
  color: #0b2922;
  border: none;
  border-radius: 9px;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-buy:disabled {
  background: #3a3550;
  color: #8e8a9e;
  cursor: not-allowed;
}

.cert-status-pill {
  font-size: 0.7rem;
  font-weight: 900;
  padding: 6px 8px;
  border-radius: 8px;
  white-space: nowrap;
  text-align: center;
  flex-shrink: 0;
}

.cert-status-pill.unlocked {
  background: rgba(6, 214, 160, 0.2);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

.cert-status-pill.active-now {
  background: var(--accent-gold);
  color: #1f1b2e;
}

.cert-status-pill.locked {
  background: #2b2540;
  color: #94a3b8;
  border: 1px solid #3f375c;
}

.shop-footer {
  flex-shrink: 0;
  padding-top: 4px;
}

/* Pantallas del Asistente de Lobby (Pasos 1, 2 y 3) */
.lobby-step.hidden,
.mp-subpanel.hidden,
.join-password-box.hidden,
.setup-row.hidden,
.form-error-msg.hidden {
  display: none !important;
}

.mp-action-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mp-tab-btn {
  background: #1a1628;
  border: 2px solid #3a3257;
  border-radius: 10px;
  padding: 10px 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.mp-tab-btn.active {
  background: #332758;
  border-color: var(--accent-gold);
  color: #ffffff;
}

.mp-subpanel {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-height: 0;
}

.mp-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  text-align: left;
}

.mp-room-item {
  background: #1a1628;
  border: 1.5px solid #3c3459;
  border-radius: 11px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mp-room-item.selected-room {
  border-color: var(--accent-gold);
  background: rgba(255, 209, 102, 0.12);
}

.mp-room-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mp-room-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-room-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.room-badge-privacy {
  font-size: 0.66rem;
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 800;
}

.room-badge-privacy.public {
  background: rgba(6, 214, 160, 0.16);
  color: var(--accent-green);
}

.room-badge-privacy.private {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
}

.privacy-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.privacy-card {
  background: #252038;
  border: 2px solid #3f365c;
  border-radius: 10px;
  padding: 10px 8px;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.84rem;
  cursor: pointer;
}

.privacy-card small {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.privacy-card.active {
  border-color: var(--accent-green);
  background: #2d254c;
  box-shadow: 0 0 10px rgba(6, 214, 160, 0.22);
}

.join-password-box {
  background: #1a1628;
  border: 1.5px solid var(--accent-gold);
  border-radius: 11px;
  padding: 10px;
  text-align: left;
}

.password-inline-row {
  display: flex;
  gap: 6px;
}

.password-inline-row input {
  flex: 1;
}

.btn-sm-inline {
  padding: 8px 12px !important;
  font-size: 0.82rem !important;
  white-space: nowrap;
}

.admin-hint-note {
  font-size: 0.72rem;
  color: var(--accent-gold);
  line-height: 1.3;
}

.form-error-msg {
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
  color: #f87171;
  margin-top: 3px;
}

.step3-context-banner {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 11px;
  padding: 9px 11px;
  text-align: left;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #e2e8f0;
}
