:root {
  --online-bg: #f4f6f8;
  --online-panel: rgba(255, 255, 255, 0.85);
  --online-panel-solid: #ffffff;
  --online-panel-border: rgba(0, 0, 0, 0.1);
  --online-text: #111111;
  --online-muted: #5f6672;
  --online-dim: rgba(0, 0, 0, 0.04);
}

html, body {
  background: var(--online-bg);
  color: var(--online-text);
  font-family: var(--font-primary);
  overflow: hidden;
  height: 100vh;
  margin: 0;
}

body.online-body { padding: 0; }
.hidden { display: none !important; }

.online-bg {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
    url('../assets/city.webp') center/cover no-repeat;
  z-index: 0;
}

.online-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--online-panel-border);
  z-index: 50;
}
.online-header .brand-logo-text {
  color: var(--online-text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 20px;
}
.online-header .back-link {
  color: var(--online-muted);
  text-decoration: none;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.2s;
}
.online-header .back-link:hover { color: var(--online-text); }
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ========== AUDIO BUTTON + MENU ========== */
#audio-wrap {
  position: relative;
  outline: none;
}
.audio-btn {
  background: var(--online-dim);
  border: 1px solid var(--online-panel-border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  color: var(--online-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
.audio-btn:hover { background: #fff; transform: translateY(-1px); }
.audio-btn.muted::before {
  content: '✕';
  position: absolute;
  font-size: 10px;
  color: var(--color-erotico);
  top: 2px;
  right: 4px;
  font-weight: 700;
}

.audio-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: none;
  flex-direction: column;
  gap: 10px;
  min-width: 240px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid var(--online-panel-border);
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
  z-index: 60;
}
#audio-wrap:hover .audio-menu,
#audio-wrap:focus-within .audio-menu { display: flex; }

.audio-menu-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--online-muted);
  text-align: center;
}
.audio-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.audio-row-label {
  flex: 0 0 55px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--online-text);
}
.audio-row input[type="range"] {
  flex: 1;
  accent-color: var(--color-economico-dark);
}
.audio-mute-btn {
  background: var(--online-dim);
  border: 1px solid var(--online-panel-border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  color: var(--online-text);
  transition: background 0.15s;
}
.audio-mute-btn:hover { background: #fff; }
.audio-mute-btn.muted { opacity: 0.35; }

.audio-master-btn {
  background: transparent;
  color: var(--online-text);
  border: 2px solid var(--online-panel-border);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  margin-top: 2px;
}
.audio-master-btn:hover { border-color: var(--online-text); }
.audio-master-btn.muted { background: var(--color-erotico); color: #fff; border-color: var(--color-erotico); }

/* ========== WELCOME ========== */
#welcome {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 20px;
  z-index: 20;
  overflow: auto;
}
.welcome-card {
  max-width: 720px;
  width: 100%;
  background: var(--online-panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--online-panel-border);
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}
.welcome-card h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.welcome-card h1 .sub {
  display: block;
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 4px;
  color: var(--color-economico-contrast);
  text-transform: uppercase;
  margin-top: 6px;
}
.welcome-card .desc {
  color: var(--online-muted);
  margin: 16px 0 28px;
  font-weight: 300;
  line-height: 1.5;
}
.ficha-pick-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--online-muted);
  margin-bottom: 12px;
}
.ficha-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
@media (max-width: 520px) {
  .ficha-grid { grid-template-columns: repeat(3, 1fr); }
}
.ficha-option {
  background: #fff;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 0;
  color: var(--online-text);
  font-family: inherit;
  cursor: pointer;
  display: block;
  overflow: hidden;
  transition: all 0.2s;
}
.ficha-option:hover {
  border-color: #000;
  box-shadow: 0 0 10px 2px rgba(135, 206, 235, 0.55);
}
.ficha-option.selected {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.45), 0 0 16px 4px rgba(135, 206, 235, 0.6);
}
.ficha-dot {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btn-primary-game, .btn-secondary-game {
  padding: 16px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary-game {
  background: var(--color-economico);
  color: #000;
}
.btn-primary-game:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255, 210, 28, 0.35); }
.btn-secondary-game {
  background: transparent;
  color: var(--online-text);
  border: 2px solid var(--online-panel-border);
}
.btn-secondary-game:hover { border-color: var(--online-text); }
.btn-secondary-game:disabled { opacity: 0.5; cursor: default; }
.welcome-note {
  font-size: 12px;
  color: var(--online-muted);
  margin-top: 16px;
  font-weight: 300;
}

/* ========== GAME UI ========== */
#game-ui {
  position: fixed;
  inset: 0;
  padding: 56px 10px 10px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 260px;
  grid-template-rows: 1fr;
  grid-template-areas: "left board right";
  gap: 10px;
  z-index: 10;
}
.side-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
  min-height: 0;
}
.side-left { grid-area: left; }
.side-right { grid-area: right; position: relative; z-index: 5; }

@media (max-width: 980px) {
  #game-ui {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "left"
      "board"
      "right";
  }
  .side-column {
    flex-direction: row;
    overflow: visible;
  }
  .side-column > * { min-width: 220px; flex: 0 0 auto; }
}

/* ========== PLAYER PANELS ========== */
.player-slot {
  background: var(--online-panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--online-panel-border);
  border-radius: 14px;
  padding: 12px;
  transition: box-shadow 0.3s, transform 0.3s;
}
.player-slot.active {
  animation: slot-glow 1.4s ease-in-out infinite;
  transform: translateY(-1px);
}
@keyframes slot-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.55), 0 4px 14px rgba(0, 0, 0, 0.08); }
  50%      { box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.8), 0 6px 20px rgba(34, 211, 238, 0.35); }
}

.player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.player-avatar {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--online-dim);
  border: 2px solid rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.player-info {
  flex: 1;
  min-width: 0;
}
.player-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--online-muted);
}
.player-badge-turn {
  background: var(--color-economico);
  color: #000;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: none;
}
.player-slot.active .player-badge-turn { display: inline-block; }

/* ========== CAPITAL ICONS (official rule: circle + colored border) ========== */
.capital-icon {
  width: 32px;
  height: 32px;
  background-color: #fff;
  background-size: 70%;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 50%;
  border: 2px solid currentColor;
}
.capital-icon-lg { width: 44px; height: 44px; border-width: 3px; }
.capital-icon-er { color: var(--color-erotico); }
.capital-icon-so { color: var(--color-social); }
.capital-icon-cu { color: var(--color-cultural); }
.capital-icon-ec { color: var(--color-economico); }
.capital-icon-si { color: var(--color-simbolico); }

.capital-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.capital-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  border-radius: 10px;
  transition: transform 0.3s, background 0.3s;
}
.capital-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--online-text);
  line-height: 1;
}
.capital-chip.pulse-up { animation: pulseUp 0.65s; }
.capital-chip.pulse-down { animation: pulseDown 0.65s; }
@keyframes pulseUp {
  0%   { transform: scale(1); background: transparent; }
  50%  { transform: scale(1.2); background: rgba(0, 173, 90, 0.18); box-shadow: 0 0 12px rgba(0, 173, 90, 0.25); }
  100% { transform: scale(1); background: transparent; }
}
@keyframes pulseDown {
  0%   { transform: scale(1); background: transparent; }
  50%  { transform: scale(0.85); background: rgba(255, 49, 49, 0.18); }
  100% { transform: scale(1); background: transparent; }
}

.hand-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--online-dim);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--online-muted);
}

.seguros-row {
  display: flex;
  gap: 4px;
  margin: 6px 0;
  flex-wrap: wrap;
}
.seguro-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2px solid currentColor;
  color: var(--online-text);
}
.seguro-chip-er { color: var(--color-erotico); }
.seguro-chip-so { color: var(--color-social); }
.seguro-chip-cu { color: var(--color-cultural); }
.seguro-chip-ec { color: var(--color-economico); }
.seguro-chip-si { color: var(--color-simbolico); }

.player-badge-soc {
  display: inline-block;
  background: var(--color-cultural);
  color: #fff;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 4px;
}

.selector-mix {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 10px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
}
.selector-mix-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.selector-mix-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: var(--online-dim);
  cursor: pointer;
  font-weight: 700;
  color: var(--online-text);
}
.selector-mix-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ========== BOARD AREA (full-bleed, sin chrome) ========== */
#board-area {
  grid-area: board;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  position: relative;
  box-shadow: none;
}
#board-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* ===== STAGE LAYER ===== */
#stage-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}
#stage-banner {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-economico-contrast);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid rgba(255, 210, 28, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.17, 0.67, 0.21, 1.3);
  z-index: 6;
  white-space: nowrap;
}
#stage-banner.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== D12 ===== */
.d12 {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  background: #ffffff;
  border: 3px solid #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 700;
  color: #000;
  transform: scale(0.3) rotate(0deg);
  opacity: 0;
  animation: d12-enter 0.3s forwards;
}
@keyframes d12-enter {
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}
.d12-spinning { animation: d12-enter 0.3s forwards, d12-spin 0.4s linear 0.3s infinite; }
@keyframes d12-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}
.d12-settled { animation: d12-pulse 0.5s cubic-bezier(0.17, 0.67, 0.21, 1.3) forwards; }
.d12-held { animation: none; z-index: 60; }
@keyframes d12-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); box-shadow: 0 0 40px rgba(255, 210, 28, 0.6); }
  100% { transform: scale(1); }
}
.d12-leaving { animation: d12-leave 0.5s forwards; }
@keyframes d12-leave {
  to { opacity: 0; transform: scale(0.3) translateY(-80px); }
}

/* ===== 5 capital dice ===== */
.capital-dice-row {
  display: flex;
  gap: 14px;
  padding: 20px 30px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  animation: dice-row-enter 0.4s cubic-bezier(0.17, 0.67, 0.21, 1.3);
}
.capital-dice-row.leaving { animation: dice-row-leave 0.5s forwards; }
@keyframes dice-row-enter {
  from { transform: scale(0.6) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes dice-row-leave {
  to { transform: scale(0.8) translateY(-30px); opacity: 0; }
}
.capital-die {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  background: var(--die-color);
  color: #000;
  font-size: 34px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25), inset 0 0 10px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(0, 0, 0, 0.4);
}
.capital-die.spinning { animation: capital-die-spin 0.3s linear infinite; }
@keyframes capital-die-spin {
  0%   { transform: rotate(0deg); }
  50%  { transform: rotate(180deg) scale(0.95); }
  100% { transform: rotate(360deg); }
}
.capital-die.settled { animation: capital-die-settle 0.5s cubic-bezier(0.17, 0.67, 0.21, 1.3); }
@keyframes capital-die-settle {
  0%   { transform: scale(1.3) rotate(0deg); }
  50%  { transform: scale(1.1) rotate(0deg); box-shadow: 0 0 20px var(--die-color); }
  100% { transform: scale(1) rotate(0deg); }
}

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

/* ========== FONDO CHIP (top of board, hover expands) ========== */
#fondo-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--online-panel-border);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: box-shadow 0.2s;
  outline: none;
}
.fondo-chip-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: default;
  user-select: none;
}
.fondo-chip-pill {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--online-muted);
  font-weight: 600;
}
.fondo-chip-arrow {
  color: var(--online-muted);
  font-size: 12px;
  transition: transform 0.3s;
}
#fondo-chip:hover .fondo-chip-arrow,
#fondo-chip:focus-within .fondo-chip-arrow { transform: rotate(180deg); }

#fondo-detail {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 6px 14px 12px;
}
#fondo-chip:hover #fondo-detail,
#fondo-chip:focus-within #fondo-detail {
  display: flex;
}
#fondo-icons {
  display: flex;
  gap: 10px;
}
.fondo-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--online-dim);
  border-radius: 999px;
  padding: 4px 14px 4px 4px;
}
.fondo-chip-num {
  font-size: 15px;
  font-weight: 600;
}

/* ===== Selector overlays (CAMBIAR / COMPRAR) ===== */
.selector-overlay {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 4px;
}
.selector-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--online-muted);
  text-align: center;
}
.selector-sub {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--online-muted);
  margin: -8px 0 10px;
}
.selector-cards {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.selector-card-text {
  font-weight: 300;
  line-height: 1.35;
  font-size: 12px;
  color: var(--online-text);
  text-align: left;
}
.selector-card {
  flex: 0 0 auto;
  width: 180px;
  min-height: 80px;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--online-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.selector-card:hover { transform: translateY(-3px); }
.selector-card.chosen {
  border-color: var(--color-economico-dark);
  box-shadow: 0 0 0 3px rgba(255, 210, 28, 0.3);
  background: #fff8e0;
}
.selector-capitals {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.selector-capital-btn {
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 76px;
  font-family: inherit;
  color: var(--online-text);
  transition: transform 0.15s, border-color 0.15s;
}
.selector-capital-btn:not(:disabled):hover {
  transform: translateY(-3px);
  border-color: var(--color-economico-dark);
}
.selector-capital-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.selector-capital-count {
  font-size: 14px;
  font-weight: 600;
}
.selector-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ========== HAND DOCK (right column, under human panel) ========== */
#hand-dock {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--online-panel-border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.3s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
#hand-dock.hand-dock-locked {
  opacity: 0.5;
  pointer-events: none;
}
#hand-dock.hand-dock-active {
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(255, 210, 28, 0.5), 0 8px 25px rgba(0, 0, 0, 0.15);
}
.hand-dock-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--online-muted);
  text-align: center;
}
.hand-cards {
  display: flex;
  gap: 0;
  padding: 20px 10px 10px;
  justify-content: center;
  position: relative;
}
.hand-cards .hand-card + .hand-card {
  margin-left: -42px;
}
.hand-card {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 90px;
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 8px 6px;
  color: var(--online-text);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, opacity 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  align-items: center;
  justify-content: flex-start;
  overflow: visible;
}
.hand-card:hover {
  z-index: 20;
  transform: translateY(-10px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}
.hand-card.usable:hover { border-color: var(--color-economico-dark); }
.hand-card.locked {
  opacity: 0.55;
  background: rgba(0, 0, 0, 0.03);
}
.hand-card.locked:hover { opacity: 0.9; }
.hand-card.defensa-card { border-style: dashed; }
.hand-card-stamp {
  display: inline-block;
  padding: 3px 8px;
  color: #000;
  border-radius: 999px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}
.hand-card-icon {
  width: 36px;
  height: 36px;
  background: #fff;
  border-radius: 50%;
  background-size: 70%;
  background-repeat: no-repeat;
  background-position: center;
  border: 2px solid currentColor;
  flex-shrink: 0;
}
.hand-card-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  max-width: 90vw;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  font-weight: 300;
  line-height: 1.35;
  color: var(--online-text);
  text-align: left;
  font-size: 12px;
  z-index: 50;
  pointer-events: none;
}
.hand-card:hover .hand-card-text { display: block; }
.hand-card-lock {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 49, 49, 0.1);
  color: var(--color-erotico-dark);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 10px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}
.hand-card:hover .hand-card-lock { display: block; }

.player-slot.setup-focus {
  animation: slot-glow 0.8s ease-in-out infinite;
}

/* ========== ACTIONS TRIGGER (right column, under hand dock) ========== */
#actions-wrap {
  position: relative;
  outline: none;
}
.action-trigger-btn {
  width: 100%;
  background: #e5e7eb;
  color: #111111;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.action-trigger-btn:hover { transform: translateY(-2px); background: #d1d5db; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12); }
#action-panel.action-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--online-panel-border);
  border-radius: 14px;
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.18);
  z-index: 20;
}
#actions-wrap:hover #action-panel.action-menu,
#actions-wrap:focus-within #action-panel.action-menu {
  display: flex;
}
#action-panel.action-menu::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%) rotate(45deg);
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.95);
  border-right: 1px solid var(--online-panel-border);
  border-bottom: 1px solid var(--online-panel-border);
}

/* When selector overlays are open (compra/cambiar), take over the full menu */
#action-panel .selector-overlay {
  background: transparent;
  padding: 0;
}

.action-btn {
  background: #e5e7eb;
  color: #111111;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, background 0.15s;
}
.action-btn:hover:not(:disabled) { transform: translateY(-2px); background: #d1d5db; }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; background: var(--online-dim); color: var(--online-muted); }
.action-btn.action-end {
  background: transparent;
  color: var(--online-text);
  border: 2px solid var(--online-panel-border);
}

.action-hint {
  flex-basis: 100%;
  text-align: center;
  color: var(--online-muted);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.pick-card-title {
  width: 100%;
  text-align: center;
  color: var(--online-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

/* ========== ONBOARDING ========== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(6px);
  padding: 20px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.onboarding-overlay.visible { opacity: 1; }
.onboarding-card {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 30px 32px 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  color: var(--online-text);
  animation: obIn 0.3s cubic-bezier(0.17, 0.67, 0.21, 1.3);
}
@keyframes obIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ob-skip {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--online-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.ob-skip:hover { background: rgba(0, 0, 0, 0.05); color: var(--online-text); }

.ob-step-head { text-align: center; margin-bottom: 18px; }
.ob-eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--online-muted);
  margin-bottom: 10px;
}
.ob-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: 0.5px;
}
.ob-subtitle {
  font-size: 14px;
  color: var(--online-muted);
  margin: 0;
}

.ob-body {
  min-height: 220px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--online-text);
}
.ob-body p { margin: 0 0 12px; }
.ob-body strong { font-weight: 700; }
.ob-lead {
  font-style: italic;
  font-size: 16px;
  color: var(--online-muted);
  text-align: center;
  margin-bottom: 16px !important;
}
.ob-note {
  background: #eef0f3;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--online-text);
}

.ob-capitals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}
@media (max-width: 520px) {
  .ob-capitals { grid-template-columns: 1fr; }
}
.ob-capital {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ob-capital-txt { min-width: 0; }
.ob-capital-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.ob-capital-desc {
  font-size: 12.5px;
  color: var(--online-muted);
  line-height: 1.4;
}

.ob-actions, .ob-cells {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ob-actions li, .ob-cells li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: #f6f7f9;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.ob-ico {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.ob-tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  min-width: 90px;
  text-align: center;
}
.ob-tag-normal { background: #e5e7eb; color: #4b5563; }
.ob-tag-fondo  { background: #fef3c7; color: #92400e; }
.ob-tag-event  { background: #e0e7ff; color: #3730a3; }

.ob-layout {
  background: #f6f7f9;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--online-muted);
  font-weight: 600;
}
.ob-layout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
}
.ob-layout-chip {
  background: #eef0f3;
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--online-text);
  font-size: 10px;
}
.ob-layout-body {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: 8px;
}
.ob-layout-col { display: flex; flex-direction: column; gap: 6px; }
.ob-layout-slot {
  background: #ffffff;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  color: var(--online-text);
}
.ob-slot-you { border-color: rgba(34, 211, 238, 0.6); color: #0e7490; }
.ob-slot-hand { background: #fff8e0; border-color: rgba(255, 210, 28, 0.4); color: #92400e; }
.ob-slot-actions { background: #e5e7eb; color: #111827; }
.ob-layout-board {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  color: var(--online-text);
}
.ob-layout-board-label { font-size: 13px; letter-spacing: 2px; }
.ob-layout-board-sub {
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: none;
  color: var(--online-muted);
}
.ob-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  line-height: 1.45;
}
.ob-legend li { color: var(--online-text); }
.ob-legend em { font-style: normal; color: var(--online-muted); }

.ob-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 14px;
}
.ob-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.ob-dot:hover { background: rgba(0, 0, 0, 0.3); }
.ob-dot.active { background: var(--online-text); transform: scale(1.25); }

.ob-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ob-remember {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--online-muted);
  cursor: pointer;
}
.ob-remember input { accent-color: var(--online-text); }
.ob-nav { display: flex; gap: 8px; }
.ob-btn {
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
}
.ob-btn-primary {
  background: var(--online-text);
  color: #fff;
}
.ob-btn-primary:hover { transform: translateY(-1px); background: #000; }
.ob-btn-ghost {
  background: transparent;
  color: var(--online-text);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.ob-btn-ghost:hover:not(:disabled) { background: rgba(0, 0, 0, 0.04); }
.ob-btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== MODAL ========== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  padding: 20px;
}
.modal.visible { display: flex; animation: fadeIn 0.3s; }

.modal-content {
  background: var(--online-panel-solid);
  border: 1px solid var(--online-panel-border);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  animation: scaleIn 0.3s cubic-bezier(0.17, 0.67, 0.21, 1.3);
  color: var(--online-text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal-content-wide { max-width: 680px; }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content h2 { font-size: 24px; margin-bottom: 10px; letter-spacing: 1px; }
.modal-content h3 { font-size: 18px; margin: 8px 0; letter-spacing: 1px; }
.modal-content p { color: var(--online-muted); line-height: 1.5; margin: 10px 0 18px; font-weight: 300; }

.card-stamp {
  display: inline-block;
  padding: 6px 14px;
  color: #000;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.card-player-label {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--online-muted);
  margin-bottom: 8px;
}

.card-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

#btn-card-ok, .end-cta {
  background: var(--color-economico);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
}
#btn-card-ok:hover, .end-cta:hover { transform: translateY(-2px); }

.end-cta-whatsapp {
  display: inline-block;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 8px 4px;
  font-size: 14px;
}
.end-cta-secondary {
  background: transparent;
  color: var(--online-text);
  border: 2px solid var(--online-panel-border);
  margin: 8px 4px;
}
.end-link-close {
  display: block;
  margin-top: 14px;
  color: var(--online-muted);
  text-decoration: underline;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

#end-modal .modal-content {
  background: linear-gradient(135deg, #ffffff 0%, #fff8e0 100%);
  border: 1px solid rgba(255, 210, 28, 0.4);
}
