/* =========================================================
   TORACLES MESA DE COMMANDER — ESTILOS DEL PROTOTIPO
   Tokens heredados de TORACLES Observatory (styles.css)
   ========================================================= */

:root {
  --bg-canvas: #101615;
  --bg-surface: #161f1e;
  --bg-surface-elevated: #1c2726;
  --bg-surface-hover: #233432;
  --bg-input: #0c1211;
  --bg-chip: #192523;

  --border-subtle: #243532;
  --border-muted: #344844;
  --border-copper: #cd9b66;
  --border-copper-subtle: rgba(205, 155, 102, 0.28);
  --copper-glow: rgba(205, 155, 102, 0.16);

  --ink-text-primary: #eee8d8;
  --ink-text-secondary: #c5beae;
  --ink-text-muted: #9eafa0;
  --copper-base: #cd9b66;
  --copper-hover: #deb382;
  --copper-deep: #9d6f3e;

  --ok: #52a384;
  --ok-bg: rgba(82, 163, 132, 0.14);
  --warn: #e09f3e;
  --warn-bg: rgba(224, 159, 62, 0.14);
  --danger: #c85647;
  --danger-bg: rgba(200, 86, 71, 0.16);

  --font-heading: 'Cinzel', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.toracles-app {
  background: var(--bg-canvas);
  color: var(--ink-text-primary);
  font-family: var(--font-body);
  line-height: 1.45;
  min-height: 100vh;
}

.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

/* ---------- Botones y utilidades ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--copper-base), var(--copper-deep));
  color: #101615;
  border: 1px solid var(--copper-hover);
  font-weight: 700;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  transition: 0.18s ease;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-lg { padding: 13px 26px; font-size: 1rem; width: 100%; }

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--ink-text-primary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--font-body);
  cursor: pointer;
}
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: var(--border-copper); }

.btn-ghost-copper {
  background: transparent;
  color: var(--copper-base);
  border: 1px solid var(--border-copper-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-body);
  cursor: pointer;
}
.btn-ghost-copper:hover { background: var(--copper-glow); }

.btn-sm { padding: 6px 11px; font-size: 0.85rem; }
.btn-xs { padding: 4px 9px; font-size: 0.78rem; }

.pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
}
.pill-copper { background: var(--copper-glow); color: var(--copper-hover); border: 1px solid var(--border-copper-subtle); }
.pill-sage { background: rgba(158, 175, 160, 0.12); color: var(--ink-text-muted); border: 1px solid var(--border-subtle); }

/* =========================================================
   LOBBY
   ========================================================= */
.toracles-masthead {
  background: rgba(10, 10, 12, 0.96);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}
html[data-theme="light"] .toracles-masthead {
  background: rgba(245, 240, 232, 0.96);
  border-bottom-color: var(--border-subtle);
}
.masthead-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.brand-container { display: flex; align-items: center; }
.brand-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink-text-primary);
}
.brand-sigil {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--copper-base);
  filter: none;
  transition: transform 0.2s ease;
}
.brand-link:hover .brand-sigil {
  transform: scale(1.04);
}
.sigil-icon,
.thassa-sigil {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
}
.brand-titles { display: flex; flex-direction: column; }
.brand-name {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--ivory, #f6efe0);
  line-height: 1.1;
  background: none;
  -webkit-text-fill-color: currentColor;
}
html[data-theme="light"] .brand-name {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--ink-text-primary);
}
.brand-sub {
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-text-muted);
  margin-top: 2px;
}
.nav-shelf {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: 0;
  flex-wrap: wrap;
}
.nav-tab {
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--ink-text-muted);
  padding: 0.7rem 0.15rem;
  border-radius: 0;
  text-decoration: none;
  font-family: 'Source Serif 4', var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
}
.tab-shortcut {
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-text-muted);
  border: 0;
  background: transparent;
  padding: 1px 4px;
}
.nav-tab.active .tab-shortcut {
  color: var(--copper-base);
}
.nav-tab:hover,
.nav-tab.active {
  color: var(--ink-text-primary);
  background: transparent;
  border-bottom-color: var(--copper-base);
  box-shadow: none;
}
.nav-tab.active .tab-label {
  color: var(--copper-hover);
  font-weight: 600;
}
.masthead-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lobby-container { max-width: 1320px; margin: 0 auto; padding: 28px 24px 48px; }
.lobby-hero { margin-bottom: 24px; }
.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--copper-base);
  margin-bottom: 6px;
}
.lobby-hero h1 { font-family: var(--font-heading); font-size: 2rem; margin-bottom: 6px; }
.hero-lead { color: var(--ink-text-secondary); max-width: 720px; }

.lobby-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 980px) { .lobby-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-header h2 { font-family: var(--font-heading); font-size: 1.15rem; }

.field-group { margin-bottom: 16px; }
.field-label { display: flex; justify-content: space-between; font-size: 0.86rem; color: var(--ink-text-secondary); margin-bottom: 7px; font-weight: 500; }
.field-hint { color: var(--copper-base); font-size: 0.8rem; }

.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-muted);
  color: var(--ink-text-primary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font-body);
}
.input:focus { outline: none; border-color: var(--border-copper); }
.two-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--bg-input); padding: 4px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
.seg-btn {
  background: transparent; border: none; color: var(--ink-text-muted); padding: 8px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-size: 0.86rem;
}
.seg-btn.active { background: var(--bg-surface-elevated); color: var(--copper-hover); border: 1px solid var(--border-copper-subtle); font-weight: 600; }

/* Selector de asientos 1..8 */
.seat-selector { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
@media (max-width: 640px) { .seat-selector { grid-template-columns: repeat(4, 1fr); } }
.seat-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--ink-text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-mono); font-size: 1rem; font-weight: 700;
}
.seat-btn span { font-family: var(--font-body); font-size: 0.68rem; font-weight: 400; color: var(--ink-text-muted); margin-top: 2px; }
.seat-btn.active { border-color: var(--copper-base); background: var(--copper-glow); color: var(--copper-hover); }
.seat-btn.seat-madness.active { border-color: var(--warn); background: var(--warn-bg); color: #ffd180; }

.referee-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ref-card {
  text-align: left; background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
  color: var(--ink-text-primary); padding: 10px; border-radius: var(--radius-md); cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
}
.ref-card strong { font-size: 0.88rem; }
.ref-card span { font-size: 0.76rem; color: var(--ink-text-muted); }
.ref-card.active { border-color: var(--copper-base); background: var(--copper-glow); }

.rule0-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-check {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem;
  background: var(--bg-chip); border: 1px solid var(--border-subtle); padding: 5px 10px; border-radius: 999px; cursor: pointer;
}

/* Selector de Fundas / Reverso de cartas */
.sleeve-selector { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 640px) { .sleeve-selector { grid-template-columns: repeat(3, 1fr); } }
.sleeve-btn {
  background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: 8px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--ink-text-primary); transition: 0.15s ease;
}
.sleeve-btn:hover { border-color: var(--border-copper); }
.sleeve-btn.active { border-color: var(--copper-base); background: var(--copper-glow); }
.sleeve-swatch {
  width: 34px; height: 48px; border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}
.sleeve-name { font-size: 0.74rem; font-weight: 600; }
.sleeve-tier { font-size: 0.65rem; font-family: var(--font-mono); padding: 1px 6px; border-radius: 999px; }
.sleeve-tier.free { color: var(--ok); background: var(--ok-bg); }
.sleeve-tier.pro { color: var(--copper-hover); background: var(--copper-glow); }

/* Temas de fundas (compartidos entre Lobby, Biblioteca y Mano rival) */
.sleeve-toracles { background: linear-gradient(145deg, #162220, #0c1211); color: #cd9b66; border-color: #cd9b66 !important; }
.sleeve-copper { background: linear-gradient(145deg, #9d6f3e, #4a3016); color: #eee8d8; border-color: #deb382 !important; }
.sleeve-crimson { background: linear-gradient(145deg, #6e2222, #2b0c0c); color: #f4b860; border-color: #c85647 !important; }
.sleeve-emerald { background: linear-gradient(145deg, #1b4d3e, #0c241d); color: #a7e3c6; border-color: #52a384 !important; }
.sleeve-arcane { background: linear-gradient(145deg, #2d2654, #120f26); color: #d6c8ff; border-color: #937de8 !important; }

.deck-preview-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-surface-elevated); border: 1px solid var(--border-copper-subtle);
  border-radius: var(--radius-md); padding: 12px; margin-bottom: 16px;
}
.deck-preview-art {
  width: 48px; height: 66px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(145deg, #2d5a4c, #cd9b66); border: 1px solid var(--copper-base);
}
.deck-preview-info { flex: 1; }
.deck-preview-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.deck-tag { font-size: 0.72rem; color: var(--ink-text-muted); text-transform: uppercase; }
.legality-badge.legal { font-size: 0.74rem; color: var(--ok); background: var(--ok-bg); padding: 2px 8px; border-radius: 999px; }
.deck-preview-info h3 { font-size: 0.96rem; margin-bottom: 2px; }
.deck-meta { font-size: 0.78rem; color: var(--ink-text-muted); }

/* Mesas abiertas */
.join-code-box { display: flex; gap: 8px; margin-bottom: 14px; }
.room-list { display: flex; flex-direction: column; gap: 10px; }
.room-item {
  background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.room-item.room-madness { border-color: rgba(224, 159, 62, 0.35); }
.room-item-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.room-seats { font-family: var(--font-mono); color: var(--copper-hover); font-size: 0.85rem; }
.room-item-meta { display: flex; gap: 10px; font-size: 0.76rem; color: var(--ink-text-muted); }
.lang-tag { margin-left: auto; font-family: var(--font-mono); color: var(--ink-text-primary); }

/* =========================================================
   MESA VISUAL (1 a 8 JUGADORES)
   ========================================================= */
#table-view.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.table-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.room-badge { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; }

.live-seat-switcher { display: flex; align-items: center; gap: 4px; background: var(--bg-input); padding: 3px 6px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }
.switcher-label { font-size: 0.74rem; color: var(--ink-text-muted); margin-right: 3px; }
.mini-seat {
  width: 24px; height: 24px; border: 1px solid var(--border-subtle); background: var(--bg-surface-elevated);
  color: var(--ink-text-secondary); border-radius: 4px; cursor: pointer; font-family: var(--font-mono); font-size: 0.76rem;
}
.mini-seat.active { background: var(--copper-base); color: #101615; border-color: var(--copper-hover); font-weight: 700; }
.mini-seat.madness.active { background: var(--warn); color: #101615; }

.phase-ribbon { display: flex; gap: 3px; background: var(--bg-input); padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }
.phase-step {
  background: transparent; border: none; color: var(--ink-text-muted); padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 0.76rem; font-family: var(--font-body);
}
.phase-step.active { background: var(--bg-surface-hover); color: var(--copper-hover); border: 1px solid var(--border-copper-subtle); font-weight: 600; }

.btn-respond {
  background: rgba(200, 86, 71, 0.22); color: #ffb3a7; border: 1px solid var(--danger);
  border-radius: var(--radius-sm); padding: 6px 12px; font-weight: 700; font-size: 0.84rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-respond:hover { background: rgba(200, 86, 71, 0.36); }
.stack-count { background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 6px; font-size: 0.72rem; font-family: var(--font-mono); }

.table-workspace { display: flex; flex: 1; min-height: 0; }
.playmat-area { flex: 1; display: flex; flex-direction: column; padding: 10px; gap: 10px; min-width: 0; overflow-y: auto; }

/* ---------- Grid adaptativo de rivales según data-players ---------- */
.opponents-grid { display: grid; gap: 8px; }
.playmat-area[data-players="1"] .opponents-grid { display: none; }
.playmat-area[data-players="2"] .opponents-grid { grid-template-columns: 1fr; }
.playmat-area[data-players="3"] .opponents-grid { grid-template-columns: repeat(2, 1fr); }
.playmat-area[data-players="4"] .opponents-grid { grid-template-columns: repeat(3, 1fr); }
.playmat-area[data-players="5"] .opponents-grid { grid-template-columns: repeat(4, 1fr); }
.playmat-area[data-players="6"] .opponents-grid,
.playmat-area[data-players="7"] .opponents-grid,
.playmat-area[data-players="8"] .opponents-grid {
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
}

.opp-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: 0.15s ease;
}
.opp-card:hover { border-color: var(--copper-base); background: var(--bg-surface-elevated); }
.opp-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; }
.opp-life { font-family: var(--font-mono); font-weight: 700; color: var(--copper-hover); font-size: 0.95rem; }
.opp-cmdr { font-size: 0.75rem; color: var(--ink-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-mini-bf { display: flex; flex-wrap: wrap; gap: 4px; }
.opp-mini-perm {
  font-size: 0.68rem; background: var(--bg-chip); border: 1px solid var(--border-subtle);
  padding: 2px 6px; border-radius: 4px; color: var(--ink-text-secondary);
}
.opp-mini-perm.tapped { opacity: 0.65; border-style: dashed; }
.opp-foot { display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; color: var(--ink-text-muted); font-family: var(--font-mono); }
.opp-hand-pips { display: inline-flex; align-items: center; gap: 2px; }
.mini-sleeve-pip {
  display: inline-block; width: 9px; height: 13px; border-radius: 2px; border: 1px solid rgba(255,255,255,0.25);
}

/* Enfoque de rival (útil en 4-8 jugadores) */
.opponent-focus-drawer {
  background: var(--bg-surface-elevated); border: 1px solid var(--copper-base);
  border-radius: var(--radius-md); padding: 10px;
}
.focus-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.86rem; color: var(--copper-hover); }
.focus-board { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Tablero Local ---------- */
.local-board {
  flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 10px 12px;
}
.local-board-layout { display: grid; grid-template-columns: 270px 1fr; gap: 12px; flex: 1; min-height: 0; }
@media (max-width: 1100px) { .local-board-layout { grid-template-columns: 1fr; } }

.local-left-col { display: flex; flex-direction: column; gap: 10px; }
.player-hud {
  background: var(--bg-surface-elevated); border: 1px solid var(--border-copper-subtle);
  border-radius: var(--radius-md); padding: 9px 10px; display: flex; flex-direction: column; gap: 8px;
}
.hud-identity { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; }
.turn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.hud-colors { display: block; font-size: 0.72rem; color: var(--ink-text-muted); font-family: var(--font-mono); }

.life-control { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.life-btn {
  background: var(--bg-input); border: 1px solid var(--border-subtle); color: var(--ink-text-secondary);
  border-radius: 4px; padding: 3px 7px; cursor: pointer; font-family: var(--font-mono); font-size: 0.76rem;
}
.life-btn:hover { border-color: var(--copper-base); color: var(--ink-text-primary); }
.life-value { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 700; color: var(--copper-hover); }

.hud-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-badge { font-size: 0.7rem; background: var(--bg-chip); border: 1px solid var(--border-subtle); padding: 2px 7px; border-radius: 999px; color: var(--ink-text-muted); }
.mini-badge.gold { color: var(--copper-hover); border-color: var(--border-copper-subtle); }

.zones-rack { display: grid; grid-template-columns: 1fr 100px; gap: 8px; }
.zone-box {
  background: var(--bg-input); border: 1px dashed var(--border-muted); border-radius: var(--radius-md);
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.zone-title { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-text-muted); }
.piles-stack { display: flex; flex-direction: column; gap: 6px; }
.pile-btn {
  flex: 1; background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  color: var(--ink-text-primary); padding: 5px 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.pile-library { padding: 4px 8px; }
.library-back {
  width: 22px; height: 30px; border-radius: 3px; border: 1px solid var(--copper-base);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; flex-shrink: 0;
}
.pile-info { display: flex; flex: 1; justify-content: space-between; align-items: center; }
.pile-btn:hover { border-color: var(--copper-base); }
.pile-label { font-size: 0.72rem; color: var(--ink-text-muted); }
.pile-count { font-family: var(--font-mono); font-size: 0.85rem; }

/* Campo de Batalla */
.local-battlefield { display: flex; flex-direction: column; gap: 8px; }
.bf-row {
  background: rgba(12, 18, 17, 0.55); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 8px 10px; min-height: 92px;
}
.row-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-text-muted); margin-bottom: 6px; }
.card-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.card-tile {
  width: 94px; aspect-ratio: 3 / 4; background: var(--bg-surface-elevated); border: 1px solid var(--border-muted);
  border-radius: 7px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between;
  transition: transform 0.16s ease, border-color 0.16s ease; user-select: none;
}
.card-tile:hover { border-color: var(--copper-base); }
.card-tile.tapped { transform: rotate(90deg); opacity: 0.88; border-color: var(--copper-deep); margin: 0 28px; }
.card-tile.land { background: #17231e; }
.card-tile.commander-card { width: 100%; max-width: 112px; aspect-ratio: 3 / 4; border-color: var(--copper-base); background: linear-gradient(155deg, #1f2e2b, #151e1d); margin: 0 auto; }
.card-tile.token-card { border-style: dashed; border-color: var(--copper-base); }
.token-tag { font-size: 0.62rem; color: var(--copper-hover); font-family: var(--font-mono); }
.card-cost { font-size: 0.68rem; color: var(--copper-base); font-family: var(--font-mono); }
.card-name { font-size: 0.78rem; font-weight: 600; line-height: 1.2; }
.card-stats { font-size: 0.68rem; color: var(--ink-text-muted); font-family: var(--font-mono); }

/* Mano + Barra rápida */
.local-hand-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-top: 1px solid var(--border-subtle); padding: 10px 0 8px; flex-wrap: wrap;
}
.hand-cards { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.hand-card {
  background: var(--bg-surface-elevated); border: 1px solid var(--border-muted); border-radius: 7px;
  padding: 7px 10px; min-width: 118px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.hand-card:hover { transform: translateY(-4px); border-color: var(--copper-base); }
.hand-card strong { font-size: 0.78rem; }

.quick-toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.tool-btn {
  background: var(--bg-chip); border: 1px solid var(--border-subtle); color: var(--ink-text-primary);
  border-radius: var(--radius-sm); padding: 7px 10px; font-size: 0.78rem; cursor: pointer; font-family: var(--font-body);
}
.tool-btn:hover { border-color: var(--copper-base); color: var(--copper-hover); }

/* ---------- Sidebar: Inspector + Árbitro + Log ---------- */
.table-sidebar {
  width: 310px; background: var(--bg-surface); border-left: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 12px; padding: 12px; overflow-y: auto;
}
@media (max-width: 900px) { .table-sidebar { display: none; } .table-sidebar.force-open { display: flex; position: fixed; right: 0; top: 52px; bottom: 0; z-index: 40; } }
.sidebar-section { background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 10px; }
.sidebar-title { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-text-muted); margin-bottom: 8px; }

.insp-name { display: block; font-family: var(--font-heading); font-size: 0.96rem; color: var(--copper-hover); }
.insp-type { display: block; font-size: 0.75rem; color: var(--ink-text-muted); margin-bottom: 6px; }
.insp-text { font-size: 0.8rem; color: var(--ink-text-secondary); }

.referee-alert {
  background: var(--warn-bg); border: 1px solid rgba(224, 159, 62, 0.45);
  border-radius: var(--radius-sm); padding: 9px; font-size: 0.8rem;
}
.ref-alert-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: #ffd180; }
.amber-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.ref-alert-actions { display: flex; gap: 6px; margin-top: 8px; }

.action-log { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--ink-text-secondary); }
.log-t { font-family: var(--font-mono); font-size: 0.68rem; color: var(--copper-base); margin-right: 4px; }

/* ---------- Modal La Pila ---------- */
.stack-overlay {
  position: fixed; inset: 0; background: rgba(8, 12, 11, 0.72); display: flex; align-items: center; justify-content: center; z-index: 60;
}
.stack-modal {
  width: 440px; max-width: 92vw; background: var(--bg-surface); border: 1px solid var(--copper-base);
  border-radius: var(--radius-lg); padding: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}
.stack-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stack-header h3 { font-family: var(--font-heading); font-size: 1.05rem; }
.stack-sub { font-size: 0.76rem; color: var(--ink-text-muted); }
.stack-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.stack-item {
  display: flex; gap: 10px; background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 9px; font-size: 0.82rem;
}
.stack-item.top { border-color: var(--copper-base); }
.stack-pos { font-family: var(--font-mono); font-size: 0.72rem; color: var(--copper-hover); white-space: nowrap; }
.stack-ctrl { color: var(--ink-text-muted); font-size: 0.76rem; }
.stack-footer { display: flex; justify-content: flex-end; gap: 8px; }


/* =========================================================
   PROCESO 4: DRAG & DROP, CONTADORES Y MODALES DE ZONA
   ========================================================= */
.drop-zone.drop-active {
  outline: 2px dashed var(--copper-base);
  outline-offset: -3px;
  background: rgba(205, 155, 102, 0.08) !important;
}

.card-tile[draggable="true"], .hand-card[draggable="true"] {
  cursor: grab;
}
.card-tile.dragging, .hand-card.dragging {
  opacity: 0.45;
  transform: scale(0.96);
}

.card-counters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 3px;
}
.counter-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--ink-text-secondary);
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}
.counter-btn:hover { border-color: var(--copper-base); color: var(--copper-hover); }
.counter-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--copper-hover);
  background: var(--copper-glow);
  padding: 1px 5px;
  border-radius: 999px;
}

.zone-modal-box { width: 560px; max-width: 94vw; }
.zone-modal-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.zone-card-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zone-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.82rem;
}
.zone-card-row-actions { display: flex; gap: 5px; flex-shrink: 0; }

.mulligan-hand {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.mulligan-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mulligan-card.to-bottom {
  border-color: var(--danger);
  background: var(--danger-bg);
  opacity: 0.72;
}

.token-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.referee-alerts-list { display: flex; flex-direction: column; gap: 8px; }
.ref-empty-msg { font-size: 0.78rem; color: var(--ink-text-muted); }
.referee-alert.info { background: var(--copper-glow); border-color: var(--border-copper-subtle); }
.referee-alert.info .ref-alert-head { color: var(--copper-hover); }
.referee-alert.info .amber-dot { background: var(--copper-base); }

/* =========================================================
   PROCESO 2 (MEJORA VISUAL): TAPETE, ARTE, MARCOS Y ESTADOS
   ========================================================= */
.playmat-area {
  background:
    radial-gradient(ellipse at 50% 62%, rgba(205, 155, 102, 0.07) 0%, rgba(22, 31, 30, 0) 65%),
    radial-gradient(circle at 20% 15%, rgba(82, 163, 132, 0.05) 0%, transparent 45%),
    var(--bg-canvas);
}

.mini-badge.interactive { cursor: pointer; transition: 0.15s ease; }
.mini-badge.interactive:hover { border-color: var(--copper-base); color: var(--ink-text-primary); }
.mini-badge.active-state {
  background: var(--copper-glow);
  border-color: var(--copper-base);
  color: var(--copper-hover);
  font-weight: 700;
}
.mini-badge.danger-state {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #ffb3a7;
  font-weight: 700;
}

/* Matriz compacta de Daño de Comandante */
.cmd-dmg-matrix {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.cmd-dmg-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--ink-text-secondary);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
}
.cmd-dmg-chip:hover { border-color: var(--copper-base); }
.cmd-dmg-chip.warn { border-color: var(--warn); color: #ffd180; background: var(--warn-bg); }
.cmd-dmg-chip.lethal { border-color: var(--danger); color: #ffb3a7; background: var(--danger-bg); font-weight: 700; }

/* Pips de Maná */
.mana-pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  margin-right: 2px;
  border: 1px solid rgba(0, 0, 0, 0.45);
  color: #101615;
}
.mana-W { background: #f3ecd2; }
.mana-U { background: #7fc8f8; }
.mana-B { background: #b298dc; }
.mana-R { background: #f28482; }
.mana-G { background: #81c784; }
.mana-C, .mana-num { background: #c5beae; }

/* Marcos por identidad de color en cartas */
.card-tile, .hand-card {
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.42);
}
.card-tile.frame-W, .hand-card.frame-W { border-top: 3px solid #e9dec0; }
.card-tile.frame-U, .hand-card.frame-U { border-top: 3px solid #5aa9e6; }
.card-tile.frame-B, .hand-card.frame-B { border-top: 3px solid #9d79d6; }
.card-tile.frame-R, .hand-card.frame-R { border-top: 3px solid #e06d53; }
.card-tile.frame-G, .hand-card.frame-G { border-top: 3px solid #52a384; }
.card-tile.frame-multi, .hand-card.frame-multi { border-top: 3px solid #d4af37; }
.card-tile.frame-land, .hand-card.frame-land { border-top: 3px solid #7d8f7e; }

.card-art-strip {
  width: 100%;
  height: 40px;
  border-radius: 4px;
  background-size: cover;
  background-position: center 25%;
  background-color: #121a19;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin: 3px 0;
}
.card-tile.land .card-art-strip { height: 26px; }
.hand-card .card-art-strip { height: 34px; }

/* Estados visuales de combate / objetivo */
.card-tile.attacking {
  border-color: var(--danger) !important;
  box-shadow: 0 0 14px rgba(200, 86, 71, 0.55);
}
.card-tile.blocking {
  border-color: #5aa9e6 !important;
  box-shadow: 0 0 14px rgba(90, 169, 230, 0.5);
}
.card-state-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.14s ease;
}
.card-tile:hover .card-state-actions { opacity: 1; }
.state-mini-btn {
  background: rgba(16, 22, 21, 0.88);
  border: 1px solid var(--border-muted);
  color: var(--ink-text-primary);
  border-radius: 4px;
  font-size: 0.62rem;
  padding: 1px 4px;
  cursor: pointer;
}
.state-mini-btn.on { border-color: var(--copper-base); color: var(--copper-hover); }

/* Inspector con arte */
.insp-art-wrap {
  position: relative;
  width: 100%;
  height: 126px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-copper-subtle);
  background: linear-gradient(145deg, #1b2a28, #0e1413);
  margin-bottom: 8px;
}
.insp-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
}
.insp-cost {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(16, 22, 21, 0.85);
  padding: 2px 5px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

/* =========================================================
   BIBLIOTECA CON REVERSO COMPLETO Y MANO EN ABANICO REAL
   ========================================================= */
.library-deck-card {
  position: relative;
  width: 100%;
  min-height: 92px;
  border-radius: 8px;
  border: 2px solid var(--copper-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  box-shadow:
    2px 2px 0 #1c2726,
    4px 4px 0 #0b100f,
    5px 5px 0 rgba(205, 155, 102, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
}
.library-deck-card:hover {
  transform: translateY(-2px);
}
.library-deck-emblem {
  font-size: 1.55rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}
.library-deck-label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
}
.library-deck-count {
  position: absolute;
  top: 4px;
  right: 5px;
  background: rgba(10, 14, 13, 0.86);
  color: var(--ink-text-primary);
  border: 1px solid var(--border-copper-subtle);
  border-radius: 999px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.side-piles-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.side-piles-row .pile-btn {
  padding: 5px 6px;
  flex-direction: column;
  gap: 1px;
}

/* Tu mano en abanico real */
.hand-cards {
  display: flex;
  align-items: flex-end;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-muted) transparent;
  padding: 20px 18px 20px 18px;
  gap: 0;
  min-height: 126px;
}
.hand-card {
  width: 118px;
  min-width: 118px;
  min-height: 84px;
  transform: rotate(var(--fan-angle, 0deg)) translateY(var(--fan-y, 0px));
  transform-origin: bottom center;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), z-index 0s;
  z-index: 1;
}
.hand-card + .hand-card {
  margin-left: -18px;
}
.hand-card:hover {
  transform: translateY(-16px) scale(1.06) rotate(0deg);
  z-index: 25;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.7);
}

/* Mini abanico de reversos en mano rival */
.opp-hand-pips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.opp-hand-fan {
  display: inline-flex;
  align-items: flex-end;
  padding: 2px 4px;
}
.mini-sleeve-pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 19px;
  font-size: 0.5rem;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  transform-origin: bottom center;
}
.mini-sleeve-pip + .mini-sleeve-pip {
  margin-left: -5px;
}

/* =========================================================
   PROPORCIÓN ORIGINAL MTG (63x88) Y BACK CLÁSICO DE MAGIC
   ========================================================= */
.library-deck-card {
  width: clamp(114px, min(7vw, 11.8vh), 166px);
  max-width: 100%;
  min-height: 0;
  aspect-ratio: 3 / 4;
  margin: 0 auto;
}

.hand-card {
  width: 96px;
  min-width: 96px;
  min-height: 0;
  aspect-ratio: 3 / 4;
  padding: 6px;
  justify-content: space-between;
}

.mini-sleeve-pip {
  width: 15px;
  height: auto;
  aspect-ratio: 3 / 4;
}

/* Reverso clásico de Magic (cuando el mazo no lleva fundas) */
.sleeve-classic {
  background:
    radial-gradient(ellipse at center, #254b7a 0%, #1c3356 42%, transparent 45%),
    radial-gradient(ellipse at center, rgba(212, 175, 55, 0.35) 45%, transparent 48%),
    linear-gradient(150deg, #6e472a 0%, #482c19 52%, #2c1a0e 100%);
  color: #e6c67c;
  border-color: #24140b !important;
  box-shadow: inset 0 0 0 2px #8a5c38, 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* =========================================================
   BLOQUE 1: MODO CLARO (PARIDAD OBSERVATORY), SVG Y TAPETE
   ========================================================= */
html[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #f5f0e8;
  --bg-surface: #fffdf8;
  --bg-surface-elevated: #ffffff;
  --bg-surface-hover: #e7ded1;
  --bg-input: #fffdf8;
  --bg-chip: #eee7dc;

  --border-subtle: rgba(71, 55, 38, 0.14);
  --border-muted: rgba(71, 55, 38, 0.32);
  --border-copper: #7a531f;
  --border-copper-subtle: rgba(71, 55, 38, 0.26);
  --copper-glow: rgba(122, 83, 31, 0.14);

  --ink-text-primary: #171513;
  --ink-text-secondary: #302d28;
  --ink-text-muted: #5c5349;
  --copper-base: #7a531f;
  --copper-hover: #5d3e17;
  --copper-deep: #47371f;

  --ok: #276c54;
  --ok-bg: rgba(39, 108, 84, 0.12);
  --warn: #b4690e;
  --warn-bg: rgba(180, 105, 14, 0.12);
  --danger: #a13c32;
  --danger-bg: rgba(161, 60, 50, 0.12);
}

html[data-theme="light"] body.toracles-app {
  color-scheme: light;
}
html[data-theme="light"] .bf-row,
html[data-theme="light"] .zone-box {
  background: rgba(238, 231, 220, 0.65);
}
html[data-theme="light"] .card-tile.land {
  background: #eae4d6;
}
html[data-theme="light"] .card-tile.commander-card {
  background: linear-gradient(155deg, #f7efe2, #eadbc4);
}
html[data-theme="light"] .btn-respond {
  background: rgba(161, 60, 50, 0.14);
  color: #8b261d;
}
html[data-theme="light"] .card-tile,
html[data-theme="light"] .hand-card,
html[data-theme="light"] .opp-card-tile {
  color: #171513;
}
html[data-theme="light"] .card-name,
html[data-theme="light"] .card-stats,
html[data-theme="light"] .opp-tile-name,
html[data-theme="light"] .opp-tile-stats {
  color: #171513;
}
html[data-theme="light"] .card-cost {
  color: #4a3519;
  font-weight: 700;
}
html[data-theme="light"] .card-pt-pill {
  background: #232a28;
  color: #f4e6cc;
  border-color: rgba(122, 83, 31, 0.55);
}
html[data-theme="light"] .local-board .row-label {
  color: #d8d1c5;
}
html[data-theme="light"] .command-zone .zone-title {
  color: #2f2a24;
  font-weight: 700;
}
html[data-theme="light"] .pile-card-btn {
  background: rgba(16, 22, 21, 0.88);
  color: #eee8d8;
  border-color: rgba(205, 155, 102, 0.42);
}
html[data-theme="light"] .pile-card-btn .pile-count {
  color: #ffe28a;
}

.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.15em;
}
.tor-svg { display: block; }

/* V1.3 Tapete con textura mineral sutil y divisiones limpias */
.playmat-area {
  background-image:
    radial-gradient(ellipse at 50% 62%, rgba(205, 155, 102, 0.08) 0%, transparent 66%),
    radial-gradient(rgba(158, 175, 160, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
}
html[data-theme="light"] .playmat-area {
  background-image:
    radial-gradient(ellipse at 50% 62%, rgba(122, 83, 31, 0.07) 0%, transparent 66%),
    radial-gradient(rgba(71, 55, 38, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
}

/* =========================================================
   REFINAMIENTO V1.3: CONTRASTE MESA vs. TAPETE (PLAYMAT)
   ========================================================= */
.playmat-area {
  background-color: #0b0f0e;
  background-image:
    radial-gradient(ellipse at 50% 50%, rgba(205, 155, 102, 0.06) 0%, transparent 70%);
}
html[data-theme="light"] .playmat-area {
  background-color: #e6ddd0;
}

.local-board {
  position: relative;
  border: 2px solid var(--border-copper-subtle);
  background-color: #141d1b;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(205, 155, 102, 0.11) 0%, rgba(16, 22, 21, 0) 68%),
    repeating-linear-gradient(
      45deg,
      rgba(205, 155, 102, 0.025) 0px,
      rgba(205, 155, 102, 0.025) 1px,
      transparent 1px,
      transparent 14px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(158, 175, 160, 0.025) 0px,
      rgba(158, 175, 160, 0.025) 1px,
      transparent 1px,
      transparent 14px
    );
  box-shadow:
    inset 0 0 48px rgba(0, 0, 0, 0.55),
    0 10px 28px rgba(0, 0, 0, 0.45);
}
html[data-theme="light"] .local-board {
  background-color: #fbf7ef;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(122, 83, 31, 0.09) 0%, transparent 68%),
    repeating-linear-gradient(
      45deg,
      rgba(122, 83, 31, 0.035) 0px,
      rgba(122, 83, 31, 0.035) 1px,
      transparent 1px,
      transparent 14px
    );
  box-shadow:
    inset 0 0 36px rgba(122, 83, 31, 0.08),
    0 8px 22px rgba(71, 55, 38, 0.12);
}

/* Marca de agua sutil del Oráculo en el centro del tapete */
.local-battlefield {
  position: relative;
}
.local-battlefield::before {
  content: "◈";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7.5rem;
  color: rgba(205, 155, 102, 0.045);
  pointer-events: none;
  z-index: 0;
}
.bf-row {
  position: relative;
  z-index: 1;
  background: rgba(12, 18, 17, 0.36);
  border-color: rgba(205, 155, 102, 0.18);
}
html[data-theme="light"] .bf-row {
  background: rgba(245, 240, 232, 0.24);
  border-color: rgba(122, 83, 31, 0.2);
}

/* =========================================================
   PLAYMATS PERSONALIZABLES (MONETIZACIÓN COSMÉTICA)
   ========================================================= */
.playmat-select {
  padding: 6px 8px;
}

.local-board[data-playmat="obsidian"] {
  background-color: #12101d;
  border-color: rgba(147, 125, 232, 0.45);
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(147, 125, 232, 0.16) 0%, transparent 68%),
    repeating-linear-gradient(60deg, rgba(147, 125, 232, 0.04) 0px, rgba(147, 125, 232, 0.04) 1px, transparent 1px, transparent 16px);
}
.local-board[data-playmat="obsidian"] .local-battlefield::before {
  content: "☽";
  color: rgba(147, 125, 232, 0.08);
}

.local-board[data-playmat="crimson"] {
  background-color: #1f1111;
  border-color: rgba(200, 86, 71, 0.48);
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(200, 86, 71, 0.18) 0%, transparent 68%),
    repeating-linear-gradient(-45deg, rgba(244, 184, 96, 0.035) 0px, rgba(244, 184, 96, 0.035) 1px, transparent 1px, transparent 14px);
}
.local-board[data-playmat="crimson"] .local-battlefield::before {
  content: "✦";
  color: rgba(200, 86, 71, 0.08);
}

.local-board[data-playmat="emerald"] {
  background-color: #0e1d17;
  border-color: rgba(82, 163, 132, 0.45);
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(82, 163, 132, 0.16) 0%, transparent 68%),
    repeating-linear-gradient(45deg, rgba(167, 227, 198, 0.03) 0px, rgba(167, 227, 198, 0.03) 1px, transparent 1px, transparent 15px);
}
.local-board[data-playmat="emerald"] .local-battlefield::before {
  content: "❦";
  color: rgba(82, 163, 132, 0.08);
}

.local-board[data-playmat="azure"] {
  background-color: #0f1a24;
  border-color: rgba(90, 169, 230, 0.45);
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(90, 169, 230, 0.16) 0%, transparent 68%),
    repeating-linear-gradient(0deg, rgba(90, 169, 230, 0.03) 0px, rgba(90, 169, 230, 0.03) 1px, transparent 1px, transparent 16px);
}
.local-board[data-playmat="azure"] .local-battlefield::before {
  content: "❖";
  color: rgba(90, 169, 230, 0.08);
}

/* Mantener visibles los playmats personalizados también en tema claro */
html[data-theme="light"] .local-board[data-playmat="obsidian"] {
  background-color: #211d36;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(147, 125, 232, 0.24) 0%, transparent 68%),
    repeating-linear-gradient(60deg, rgba(147, 125, 232, 0.06) 0px, rgba(147, 125, 232, 0.06) 1px, transparent 1px, transparent 16px);
}
html[data-theme="light"] .local-board[data-playmat="crimson"] {
  background-color: #361b1b;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(200, 86, 71, 0.26) 0%, transparent 68%),
    repeating-linear-gradient(-45deg, rgba(244, 184, 96, 0.05) 0px, rgba(244, 184, 96, 0.05) 1px, transparent 1px, transparent 14px);
}
html[data-theme="light"] .local-board[data-playmat="emerald"] {
  background-color: #183428;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(82, 163, 132, 0.26) 0%, transparent 68%),
    repeating-linear-gradient(45deg, rgba(167, 227, 198, 0.05) 0px, rgba(167, 227, 198, 0.05) 1px, transparent 1px, transparent 15px);
}
html[data-theme="light"] .local-board[data-playmat="azure"] {
  background-color: #172a3b;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(90, 169, 230, 0.26) 0%, transparent 68%),
    repeating-linear-gradient(0deg, rgba(90, 169, 230, 0.05) 0px, rgba(90, 169, 230, 0.05) 1px, transparent 1px, transparent 16px);
}
html[data-theme="light"] .local-board[data-playmat="obsidian"] .bf-row,
html[data-theme="light"] .local-board[data-playmat="crimson"] .bf-row,
html[data-theme="light"] .local-board[data-playmat="emerald"] .bf-row,
html[data-theme="light"] .local-board[data-playmat="azure"] .bf-row {
  background: rgba(12, 18, 17, 0.34);
  color: #eee8d8;
}

/* =========================================================
   MOTOR CINEMATOGRÁFICO 3D: ASTROLABIO, MONEDA, CUBO D6, D20 Y DUELOS
   ========================================================= */
.fx-stage {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: radial-gradient(circle at 50% 45%, rgba(20, 32, 30, 0.82), rgba(5, 8, 8, 0.94) 78%);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  perspective: 1200px;
  overflow: hidden;
  transition: opacity 0.28s ease;
}
.fx-stage.fx-fade-out { opacity: 0; }
.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* Camera Shake on Heavy Impact */
.fx-stage.fx-shake { animation: fxShake 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.fx-stage.fx-shake-heavy { animation: fxShakeHeavy 0.48s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes fxShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-5px, 4px, 0); }
  45% { transform: translate3d(5px, -4px, 0); }
  70% { transform: translate3d(-3px, 2px, 0); }
}
@keyframes fxShakeHeavy {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-10px, 7px, 0) scale(1.01); }
  35% { transform: translate3d(9px, -7px, 0); }
  55% { transform: translate3d(-6px, 4px, 0); }
  75% { transform: translate3d(4px, -3px, 0); }
}

/* Suelo Astrolabio 3D + Sombra Proyectada */
.fx-astrolabe-floor {
  position: absolute;
  top: 52%;
  left: 50%;
  width: 420px;
  height: 420px;
  transform: translate(-50%, -50%) rotateX(64deg);
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 1;
}
.fx-astro-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in srgb, var(--fx-accent, #cd9b66) 48%, transparent);
  box-shadow: 0 0 35px color-mix(in srgb, var(--fx-accent, #cd9b66) 20%, transparent);
}
.fx-astro-ring.outer { animation: fxRingSpin 16s linear infinite; }
.fx-astro-ring.inner {
  inset: 58px;
  border-style: solid;
  border-width: 1px;
  border-color: color-mix(in srgb, var(--fx-accent, #cd9b66) 35%, transparent);
  animation: fxRingSpinReverse 10s linear infinite;
}
@keyframes fxRingSpin { to { transform: rotate(360deg); } }
@keyframes fxRingSpinReverse { to { transform: rotate(-360deg); } }

.fx-cast-shadow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 130px;
  transform: translate(-50%, -50%) scale(0.35);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.85), transparent 72%);
  filter: blur(10px);
  opacity: 0.35;
  transition: transform 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
}
.fx-cast-shadow.landed {
  transform: translate(-50%, -50%) scale(1.05);
  opacity: 0.85;
  filter: blur(4px);
}

/* Rayos de luz volumétricos */
.fx-godrays {
  position: absolute;
  top: 46%;
  left: 50%;
  width: 580px;
  height: 580px;
  transform: translate(-50%, -50%) scale(0.4);
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 18deg,
    color-mix(in srgb, var(--fx-accent, #cd9b66) 24%, transparent) 24deg 36deg,
    transparent 42deg 76deg,
    color-mix(in srgb, var(--fx-accent, #cd9b66) 20%, transparent) 84deg 98deg,
    transparent 106deg 145deg,
    color-mix(in srgb, var(--fx-accent, #cd9b66) 26%, transparent) 152deg 170deg,
    transparent 180deg 220deg,
    color-mix(in srgb, var(--fx-accent, #cd9b66) 22%, transparent) 230deg 248deg,
    transparent 258deg 300deg,
    color-mix(in srgb, var(--fx-accent, #cd9b66) 24%, transparent) 312deg 330deg,
    transparent 340deg 360deg
  );
  -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,0.95) 10%, transparent 68%);
  mask-image: radial-gradient(circle, rgba(0,0,0,0.95) 10%, transparent 68%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.35s ease, transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.fx-godrays.active {
  opacity: 0.95;
  transform: translate(-50%, -50%) scale(1.15);
  animation: fxRaysSpin 18s linear infinite;
}
@keyframes fxRaysSpin {
  from { transform: translate(-50%, -50%) scale(1.15) rotate(0deg); }
  to { transform: translate(-50%, -50%) scale(1.15) rotate(360deg); }
}

/* Arenas centrales */
.fx-coin-arena, .fx-die-arena {
  position: relative;
  width: 190px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  z-index: 3;
}

/* =========================================================
   1. MONEDA 3D CON GROSOR REAL, CANTO Y BRILLO ESPECULAR
   ========================================================= */
.fx-coin-3d {
  width: 136px;
  height: 136px;
  position: relative;
  transform-style: preserve-3d;
  animation: fxCoinArc 1.05s cubic-bezier(0.22, 0.86, 0.3, 1) forwards;
}
@keyframes fxCoinArc {
  0%   { transform: translateY(190px) scale(0.42) rotateX(0deg) rotateY(0deg) rotateZ(-22deg); }
  42%  { transform: translateY(-165px) scale(1.42) rotateX(960deg) rotateY(190deg) rotateZ(18deg); }
  78%  { transform: translateY(12px) scale(0.94) rotateX(calc(var(--coin-rot, 1800deg) - 20deg)) rotateY(360deg) rotateZ(-4deg); }
  88%  { transform: translateY(-18px) scale(1.04) rotateX(var(--coin-rot, 1800deg)) rotateY(360deg) rotateZ(2deg); }
  100% { transform: translateY(0px) scale(1) rotateX(var(--coin-rot, 1800deg)) rotateY(360deg) rotateZ(0deg); }
}
.fx-coin-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #6e481f, #d9b06b 45%, #462b10);
  border: 2px solid #7d5627;
}
.fx-coin-rim.rim-1 { transform: translateZ(-4px); }
.fx-coin-rim.rim-2 { transform: translateZ(0px); }
.fx-coin-rim.rim-3 { transform: translateZ(4px); }

.fx-coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 5px solid #f0d08c;
  box-shadow:
    inset 0 0 26px rgba(0, 0, 0, 0.55),
    inset 0 2px 10px rgba(255, 255, 255, 0.45),
    0 18px 40px rgba(0, 0, 0, 0.78);
}
.fx-coin-face.front {
  transform: translateZ(5px);
  background: radial-gradient(circle at 30% 25%, #fff0c2, #d4a157 48%, #7a4f21 88%, #3c220a 100%);
  color: #1f1307;
}
.fx-coin-face.back {
  transform: rotateX(180deg) translateZ(5px);
  background: radial-gradient(circle at 30% 25%, #7866b8, #302659 55%, #120d26 95%);
  color: #efe9ff;
  border-color: #b19ff7;
}
.coin-sheen {
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: fxCoinSheen 1.4s ease-in-out 0.9s infinite;
  pointer-events: none;
}
@keyframes fxCoinSheen {
  0% { transform: translateX(-110%); }
  45%, 100% { transform: translateX(110%); }
}
.coin-sigil { font-size: 3.1rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35)); }
.fx-coin-face small { font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.14em; margin-top: 6px; }

/* =========================================================
   2. CUBO 3D REAL PARA D6 Y CRISTAL FACETADO D20
   ========================================================= */
.fx-die-rig {
  transform-style: preserve-3d;
  animation: fxDieRigArc 1s cubic-bezier(0.2, 0.85, 0.3, 1) forwards;
}
@keyframes fxDieRigArc {
  0%   { transform: translate(-220px, -160px) scale(0.45); }
  52%  { transform: translate(26px, 24px) scale(1.22); }
  74%  { transform: translate(-10px, -22px) scale(0.95); }
  88%  { transform: translate(4px, 6px) scale(1.03); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Cubo 3D D6 real */
.fx-d6-cube {
  --half: 56px;
  width: 112px;
  height: 112px;
  position: relative;
  transform-style: preserve-3d;
  animation: fxCubeTumble 1s cubic-bezier(0.18, 0.88, 0.3, 1) forwards;
}
@keyframes fxCubeTumble {
  0%   { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  100% { transform: rotateX(var(--rx, 720deg)) rotateY(var(--ry, 720deg)) rotateZ(360deg); }
}
.d6-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(145deg, #273835, #101716 70%, #090e0d);
  border: 2.5px solid #cd9b66;
  box-shadow: inset 0 0 22px rgba(205, 155, 102, 0.25), 0 0 18px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.d6-face.f1 { transform: translateZ(var(--half)); }
.d6-face.f2 { transform: rotateY(180deg) translateZ(var(--half)); }
.d6-face.f3 { transform: rotateY(90deg) translateZ(var(--half)); }
.d6-face.f4 { transform: rotateY(-90deg) translateZ(var(--half)); }
.d6-face.f5 { transform: rotateX(90deg) translateZ(var(--half)); }
.d6-face.f6 { transform: rotateX(-90deg) translateZ(var(--half)); }

.d6-pips {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
}
.d6-pips .pip {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  opacity: 0;
}
.d6-pips .pip.on {
  opacity: 1;
  background: radial-gradient(circle at 35% 35%, #fff2c6, #d4a157 65%, #7a501d);
  box-shadow: 0 0 10px rgba(222, 179, 130, 0.7), inset 0 1px 2px #fff;
}

/* D20 Icosaedro SVG Geométrico 3D */
.fx-d20-tumbler {
  transform-style: preserve-3d;
  animation: fxD20Tumble 1s cubic-bezier(0.18, 0.88, 0.3, 1) forwards;
}
@keyframes fxD20Tumble {
  0%   { transform: rotateX(240deg) rotateY(-400deg) rotateZ(-160deg) scale(0.75); }
  62%  { transform: rotateX(18deg) rotateY(24deg) rotateZ(12deg) scale(1.06); }
  100% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); }
}
.fx-d20-svg-wrap {
  position: relative;
  width: 164px;
  height: 164px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fx-d20-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.d20-num-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 12px;
  pointer-events: none;
}
.fx-die-num {
  display: block;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--d20-num-color, #fff4dc);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 18px rgba(222, 179, 130, 0.45);
  line-height: 1;
}
.fx-die-num.locked {
  animation: fxPop 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ondas expansivas dobles */
.fx-shockwave {
  position: absolute;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 2.5px solid var(--fx-accent, var(--copper-hover));
  box-shadow: 0 0 24px color-mix(in srgb, var(--fx-accent, #deb382) 55%, transparent);
  opacity: 0;
  pointer-events: none;
}
.fx-shockwave.active { animation: fxShock 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-shockwave.secondary.active { animation: fxShock 1.15s 0.08s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fxShock {
  0%   { transform: scale(0.65); opacity: 0.95; }
  100% { transform: scale(3.4); opacity: 0; }
}

/* Banner resultado — tipografía limpia y moderna */
.fx-banner {
  position: relative;
  z-index: 5;
  text-align: center;
  opacity: 0;
  transform: translateY(16px) scale(0.94);
  transition: opacity 0.32s ease, transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}
.fx-banner.visible { opacity: 1; transform: translateY(0) scale(1); }
.fx-kicker {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--copper-hover);
  margin-bottom: 4px;
}
.fx-title {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f7f1e3;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.9), 0 0 24px rgba(205, 155, 102, 0.3);
}
.fx-coin-face small {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-top: 6px;
}

/* =========================================================
   3. CEREMONIA DE SALIDA WOW (ARENA DE DUELOS + ORDEN DE TURNOS)
   ========================================================= */
.fx-duel-panel.wow {
  position: relative;
  z-index: 5;
  width: min(880px, 94vw);
  background: linear-gradient(165deg, rgba(22, 33, 31, 0.97), rgba(10, 15, 14, 0.99));
  border: 1.5px solid var(--copper-base);
  border-radius: 20px;
  padding: 24px 26px 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.92), inset 0 1px 0 rgba(255, 232, 185, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.fx-duel-header { text-align: center; }
.fx-duel-header h3 {
  font-family: var(--font-body);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f7f2e7;
}
.fx-duel-sub {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: #a9bbb0;
  margin-top: 4px;
}
.fx-duel-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}
.fx-duel-card {
  position: relative;
  background: linear-gradient(180deg, #192523, #0e1514);
  border: 1.5px solid #354c48;
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.35s ease;
}
.fx-duel-card.rolling .duel-mini-d20 {
  animation: fxOrbPulse 0.32s ease-in-out infinite alternate;
}
@keyframes fxOrbPulse {
  from { transform: scale(0.95) rotate(-5deg); }
  to { transform: scale(1.06) rotate(5deg); }
}
.fx-duel-card.runner-up {
  border-color: #46615c;
  background: linear-gradient(180deg, #172120, #0d1312);
}
.duel-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.duel-seat {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: #9bb0a4;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.duel-rank {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(205, 155, 102, 0.14);
  color: #deb382;
}
.duel-rank.done {
  background: rgba(82, 163, 132, 0.18);
  color: #8ad3b5;
}
.duel-crown {
  position: absolute;
  top: -18px;
  font-size: 1.7rem;
  color: #f2c94c;
  opacity: 0;
  transform: translateY(-16px) scale(0.5);
  text-shadow: 0 0 18px rgba(242, 201, 76, 0.9);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.fx-duel-card.winner {
  border-color: #f2c94c;
  background: linear-gradient(155deg, rgba(242, 201, 76, 0.22), #131b1a 75%);
  transform: scale(1.05) translateY(-4px);
  box-shadow: 0 0 36px rgba(242, 201, 76, 0.42), inset 0 0 18px rgba(242, 201, 76, 0.16);
  z-index: 2;
}
.fx-duel-card.winner .duel-crown {
  opacity: 1;
  transform: translateY(0) scale(1.1);
}
.fx-duel-card.winner .duel-rank {
  background: rgba(242, 201, 76, 0.25);
  color: #ffe382;
}
.duel-name {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 700;
  color: #f6f0e4;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.duel-mini-d20 .fx-d20-svg-wrap {
  width: 82px;
  height: 82px;
}
.duel-mini-d20 .d20-num-overlay {
  padding-top: 6px;
}
.duel-mini-d20 .fx-die-num {
  font-size: 1.3rem;
}
.fx-die-num.revealed {
  color: #ffe29a;
  animation: fxPop 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fxPop { 0% { transform: scale(1.65); } 100% { transform: scale(1); } }

.fx-turn-order {
  width: 100%;
  background: rgba(12, 18, 17, 0.85);
  border: 1px solid #2b3e3b;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.turn-order-label {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9bb0a4;
}
.turn-order-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.turn-chip {
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #1a2725;
  border: 1px solid #354a46;
  color: #d7dfd9;
}
.turn-chip.first {
  background: rgba(242, 201, 76, 0.16);
  border-color: #f2c94c;
  color: #ffe89e;
}
.turn-chip em {
  font-style: normal;
  color: #9bb0a4;
  font-size: 0.76rem;
}
.fx-close-pill {
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: #c5beae;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.fx-close-pill:hover {
  background: rgba(205, 155, 102, 0.2);
  color: #fff4dc;
}

/* =========================================================
   4. EVENTO DE MESA CINEMATOGRÁFICO (MONARCA, ETC.)
   ========================================================= */
.fx-event-burst.wow {
  position: relative;
  z-index: 5;
  width: 340px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.fx-event-crest {
  font-size: 3.6rem;
  color: #f2c94c;
  text-shadow: 0 0 34px rgba(242, 201, 76, 0.85), 0 6px 20px rgba(0, 0, 0, 0.8);
  animation: fxCrestDrop 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes fxCrestDrop {
  0%   { transform: translateY(-70px) scale(2); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}


/* =========================================================
   MODIFICADORES PERMANENTES Y EMBLEMAS EN HUD
   ========================================================= */
.table-modifiers-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.table-modifiers-bar.empty { display: none; }

.mod-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  background: rgba(205, 155, 102, 0.14);
  border: 1px solid rgba(205, 155, 102, 0.45);
  color: #f3e6cf;
  cursor: help;
}
.mod-pill strong { font-weight: 600; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-pill .mod-ico { font-size: 0.8rem; line-height: 1; }
.mod-pill.mod-companion { background: rgba(155, 134, 242, 0.16); border-color: rgba(155, 134, 242, 0.55); color: #e5ddff; }
.mod-pill.mod-background { background: rgba(82, 163, 132, 0.16); border-color: rgba(82, 163, 132, 0.55); color: #ccf2e2; }
.mod-pill.mod-eminence { background: rgba(224, 159, 62, 0.18); border-color: rgba(224, 159, 62, 0.6); color: #ffe2ad; }
.mod-pill.mod-citysBlessing { background: rgba(242, 201, 76, 0.18); border-color: rgba(242, 201, 76, 0.65); color: #fff1b8; }
.mod-pill.mod-emblem {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.24), rgba(157, 111, 62, 0.22));
  border-color: #d4af37;
  color: #fff3cc;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.22);
}
.mod-remove {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 2px;
  line-height: 1;
}
.mod-remove:hover { opacity: 1; color: #ff9c8f; }

.modifiers-modal { width: min(640px, 94vw); }
.mod-section-title {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--copper-hover);
  margin-bottom: 8px;
}
.mod-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}


/* =========================================================
   TAPETES REALES DE RIVALES (TODOS vs SOLO JUGADOR ACTIVO)
   ========================================================= */
.opp-view-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.opp-mode-btn {
  border: none;
  background: transparent;
  color: var(--ink-text-muted);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.opp-mode-btn.active {
  background: var(--copper-base);
  color: #14120e;
}

.opponents-grid.single-active-mode {
  grid-template-columns: 1fr !important;
  gap: 8px;
}
.active-opp-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.opp-roster-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  color: var(--ink-text-secondary);
  font-family: var(--font-body);
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.opp-roster-chip.active {
  border-color: var(--copper-base);
  background: rgba(205, 155, 102, 0.16);
  color: var(--ink-text-primary);
}
.opp-roster-chip em {
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--copper-base);
  color: #14120e;
}

/* Tapete de cada rival */
.opp-card.opp-playmat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border-muted);
  background: radial-gradient(circle at 50% 40%, rgba(28, 43, 40, 0.9), rgba(14, 21, 20, 0.96));
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.45);
}
.opp-card.opp-playmat.active-turn {
  border-color: var(--copper-base);
  box-shadow: 0 0 0 1px rgba(205, 155, 102, 0.35), inset 0 0 28px rgba(205, 155, 102, 0.12);
}
.opp-card.opp-playmat[data-playmat="arcane"] {
  background: radial-gradient(circle at 50% 35%, rgba(62, 42, 112, 0.85), rgba(17, 13, 34, 0.96));
  border-color: rgba(155, 134, 242, 0.45);
}
.opp-card.opp-playmat[data-playmat="crimson"] {
  background: radial-gradient(circle at 50% 35%, rgba(96, 30, 26, 0.85), rgba(26, 10, 10, 0.96));
  border-color: rgba(200, 86, 71, 0.45);
}
.opp-card.opp-playmat[data-playmat="forest"] {
  background: radial-gradient(circle at 50% 35%, rgba(28, 66, 44, 0.88), rgba(10, 24, 16, 0.96));
  border-color: rgba(82, 163, 132, 0.45);
}
.opp-card.opp-playmat[data-playmat="abyss"] {
  background: radial-gradient(circle at 50% 35%, rgba(22, 54, 78, 0.88), rgba(9, 20, 32, 0.96));
  border-color: rgba(102, 178, 224, 0.45);
}

.opp-head-left, .opp-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.opp-cmd-dmg {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-text-muted);
}
.opp-turn-pill {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--copper-base);
  color: #16110b;
}
.opp-set-turn-btn {
  font-size: 0.66rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink-text-muted);
  cursor: pointer;
}
.opp-set-turn-btn:hover { border-color: var(--copper-base); color: var(--copper-hover); }

.opp-playmat-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}
.opp-cmd-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px dashed rgba(205, 155, 102, 0.35);
}
.opp-zone-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--copper-hover);
}
.opp-bf-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.opp-bf-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
}
.opp-lands-row {
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Cartas 63:88 en tapetes rivales */
.opp-card-tile {
  width: 60px;
  aspect-ratio: 3 / 4;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-muted);
  border-radius: 5px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.opp-card.opp-playmat.expanded .opp-card-tile {
  width: 78px;
  padding: 5px;
}
.opp-card-tile:hover {
  border-color: var(--copper-hover);
  transform: translateY(-2px);
}
.opp-card-tile.land {
  width: 54px;
  background: #17231e;
}
.opp-card.opp-playmat.expanded .opp-card-tile.land {
  width: 68px;
}
.opp-card-tile.commander-card {
  border-color: var(--copper-base);
  background: linear-gradient(155deg, #243632, #141d1b);
}
.opp-card-tile.token-card {
  border-style: dashed;
  border-color: var(--copper-base);
}
.opp-card-tile.tapped {
  transform: rotate(90deg) scale(0.88);
  opacity: 0.84;
  border-color: var(--copper-deep);
  margin: 0 14px;
}
.opp-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  font-size: 0.54rem;
}
.opp-tile-cost { color: var(--copper-hover); }
.opp-tile-counter {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: #ffe382;
}
.opp-tile-name {
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink-text-primary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.opp-card.opp-playmat.expanded .opp-tile-name {
  font-size: 0.7rem;
}
.opp-tile-stats {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--ink-text-muted);
}

.opp-piles-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.opp-lib-pip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.opp-gy-pip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-text-muted);
}


/* =========================================================
   ESCALADO FLUIDO Y PANTALLAS ULTRAWIDE (2560px / 3440x1440)
   ========================================================= */
.opponents-grid,
.local-board {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.local-board-layout {
  grid-template-columns: clamp(270px, 18vw, 370px) 1fr;
  align-items: stretch;
}

.local-battlefield {
  height: 100%;
}
.bf-permanents {
  flex: 1.25;
  display: flex;
  flex-direction: column;
}
.bf-lands {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.bf-permanents .card-row,
.bf-lands .card-row {
  flex: 1;
  align-content: flex-start;
  justify-content: center;
}

/* Cartas propias escalan proporcionalmente en 63:88 */
.card-tile {
  width: clamp(94px, 5.6vw, 152px);
  padding: clamp(6px, 0.45vw, 10px);
}
.card-tile.land {
  width: clamp(94px, 5.6vw, 152px);
}
.card-tile.commander-card {
  max-width: clamp(112px, 6.8vw, 168px);
}
.card-tile.tapped {
  margin: 0 clamp(22px, 1.5vw, 36px);
}

.hand-card {
  width: clamp(116px, 6.6vw, 168px);
  min-width: clamp(116px, 6.6vw, 168px);
  min-height: clamp(86px, 5.8vw, 126px);
  padding: clamp(7px, 0.5vw, 11px) clamp(10px, 0.65vw, 14px);
}

/* Cartas de rivales escalan también en 63:88 */
.opp-card-tile {
  width: clamp(60px, 3.8vw, 106px);
}
.opp-card.opp-playmat.expanded .opp-card-tile {
  width: clamp(72px, 4.2vw, 116px);
}
.opp-card-tile.land {
  width: clamp(54px, 3.4vw, 94px);
}
.opp-card.opp-playmat.expanded .opp-card-tile.land {
  width: clamp(64px, 3.8vw, 102px);
}
.opp-card-tile.tapped {
  margin: 0 clamp(14px, 1vw, 24px);
}

@media (min-width: 2200px) {
  .playmat-area {
    padding: 16px 22px;
    gap: 14px;
  }
  .local-board {
    padding: 14px 18px;
    gap: 14px;
  }
  .card-name { font-size: 0.92rem; }
  .card-stats, .card-cost { font-size: 0.78rem; }
  .hand-card strong { font-size: 0.92rem; }
  .opp-tile-name { font-size: 0.74rem; }
  .opp-card.opp-playmat.expanded .opp-tile-name { font-size: 0.84rem; }
  .table-sidebar { width: 390px; }
}


/* =========================================================
   UI MINIMALISTA: TAPETE 100% ANCHO + DOCK INFERIOR + MENÚS DESPLEGABLES
   ========================================================= */
.local-player-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.local-player-shell > .local-board {
  flex: 1 0 auto;
}
.local-player-shell .local-board-layout {
  grid-template-columns: clamp(134px, 9.5vw, 178px) 1fr;
  flex: 1 0 auto;
  min-height: auto;
}
@media (max-width: 1100px) {
  .local-player-shell .local-board-layout {
    grid-template-columns: 1fr;
  }
}
.local-player-shell .zones-rack {
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
}
.local-player-shell .piles-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.local-player-shell .library-deck-card {
  width: clamp(114px, min(7vw, 11.8vh), 166px);
  max-width: 100%;
  margin: 0 auto;
}
.local-player-shell .bf-row {
  padding: 6px 10px;
  min-height: auto;
}
.local-player-shell .local-hand-bar {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  margin-top: 4px;
}

/* Barra inferior minimalista (fuera del tapete) */
.local-dock-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(16, 22, 21, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 10px;
}

.seat-pill-minimal {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.seat-name-mini {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-text-primary);
}
.life-control.compact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-copper-subtle);
  border-radius: 999px;
  padding: 2px 6px;
}
.life-control.compact .life-btn {
  border: none;
  background: transparent;
  padding: 2px 6px;
  font-size: 0.78rem;
}
.life-control.compact .life-value {
  font-size: 1.12rem;
  min-width: 30px;
  text-align: center;
}

.quick-toolbar.minimal {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Menús desplegables hacia arriba */
.ui-dropdown {
  position: relative;
}
.ui-dropdown > summary {
  list-style: none;
  user-select: none;
}
.ui-dropdown > summary::-webkit-details-marker {
  display: none;
}
.ui-dropdown[open] > summary {
  border-color: var(--copper-base);
  color: var(--copper-hover);
}
.dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 205px;
  background: rgba(18, 26, 25, 0.98);
  border: 1px solid var(--copper-base);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 60;
}
.ui-dropdown.right .dropdown-menu {
  left: auto;
  right: 0;
}
.dropdown-menu.seat-menu {
  min-width: 280px;
  gap: 8px;
}
.dropdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dropdown-label {
  font-size: 0.72rem;
  color: var(--ink-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dropdown-btn-group {
  display: flex;
  gap: 4px;
}
.dropdown-item {
  width: 100%;
  text-align: left;
  background: var(--bg-chip);
  border: 1px solid var(--border-subtle);
  color: var(--ink-text-primary);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  cursor: pointer;
}
.dropdown-item:hover {
  border-color: var(--copper-base);
  color: var(--copper-hover);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 2px 0;
}
.dropdown-menu .playmat-select {
  width: 100%;
}


/* =========================================================
   INVERSIÓN FLUIDA DE TAMAÑOS SEGÚN TURNO ACTIVO (0.38s)
   ========================================================= */
.turn-owner-btn {
  font-weight: 700;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.turn-owner-btn.is-local {
  border-color: rgba(82, 163, 132, 0.55);
  color: #9ce2c6;
  background: rgba(82, 163, 132, 0.12);
}
.turn-owner-btn.is-opp {
  border-color: var(--copper-base);
  color: #ffe3ad;
  background: rgba(205, 155, 102, 0.18);
}

/* Transiciones suaves sin saltos bruscos */
.opp-card.opp-playmat,
.opp-card-tile,
.opp-card-tile.land,
.local-board,
.local-board-layout,
.bf-row,
.card-tile,
.card-tile.land,
.card-tile.commander-card {
  transition:
    flex 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    max-width 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.32s ease,
    box-shadow 0.32s ease,
    opacity 0.28s ease;
}

/* En 2J..5J usamos flex en .opponents-grid para que flex-grow anime de forma fluida */
.playmat-area[data-players="2"] .opponents-grid:not(.single-active-mode),
.playmat-area[data-players="3"] .opponents-grid:not(.single-active-mode),
.playmat-area[data-players="4"] .opponents-grid:not(.single-active-mode),
.playmat-area[data-players="5"] .opponents-grid:not(.single-active-mode) {
  display: flex;
  gap: 10px;
}
.playmat-area[data-players="2"] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat,
.playmat-area[data-players="3"] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat,
.playmat-area[data-players="4"] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat,
.playmat-area[data-players="5"] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat {
  flex: 1 1 0;
  min-width: 0;
}

/* Cuando el turno es de un rival: su tapete se expande con fluidez y el tuyo se compacta */
.playmat-area[data-turn-owner="opponent"] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat.active-turn {
  flex: 1.8 1 0;
}
.playmat-area[data-turn-owner="opponent"] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat:not(.active-turn) {
  flex: 0.78 1 0;
  opacity: 0.84;
}

.playmat-area[data-turn-owner="opponent"] .opp-card.opp-playmat.active-turn {
  padding: 10px 13px;
  border-color: var(--copper-hover);
  box-shadow: 0 0 0 1px rgba(222, 179, 130, 0.45), 0 12px 30px rgba(0, 0, 0, 0.45);
}
.playmat-area[data-turn-owner="opponent"] .opp-card.opp-playmat.active-turn .opp-card-tile {
  width: clamp(70px, min(4.3vw, 7.6vh), 116px);
}
.playmat-area[data-turn-owner="opponent"] .opp-card.opp-playmat.active-turn .opp-card-tile.land {
  width: clamp(62px, min(3.8vw, 6.8vh), 102px);
}
.playmat-area[data-turn-owner="opponent"] .opp-card.opp-playmat.expanded.active-turn .opp-card-tile {
  width: clamp(76px, min(4.8vw, 8.2vh), 124px);
}
.playmat-area[data-turn-owner="opponent"] .opp-card.opp-playmat.expanded.active-turn .opp-card-tile.land {
  width: clamp(68px, min(4.2vw, 7.2vh), 108px);
}

/* Tu tablero se compacta suavemente en turno rival (sin encoger tu mano ni ¡Respondo!) */
.playmat-area[data-turn-owner="opponent"] .local-board {
  padding: 7px 10px;
  gap: 5px;
}
.playmat-area[data-turn-owner="opponent"] .bf-permanents {
  flex: 0.85;
}
.playmat-area[data-turn-owner="opponent"] .bf-lands {
  flex: 0.7;
}
.playmat-area[data-turn-owner="opponent"] .card-tile {
  width: clamp(64px, min(3.6vw, 6.6vh), 96px);
  padding: 4px;
}
.playmat-area[data-turn-owner="opponent"] .card-tile.land {
  width: clamp(58px, min(3.2vw, 6vh), 86px);
}
.playmat-area[data-turn-owner="opponent"] .card-tile.commander-card {
  max-width: clamp(76px, min(4.2vw, 7.6vh), 110px);
}
.playmat-area[data-turn-owner="opponent"] .card-tile.tapped {
  margin: 0 clamp(14px, 1vw, 22px);
}

/* Ajuste vertical estricto para evitar scroll vertical en ventanas sin pantalla completa */
.playmat-area {
  padding: 8px 12px;
  gap: 8px;
}
.hand-cards {
  min-height: clamp(92px, 10vh, 114px);
  padding: 14px 16px 14px 16px;
}
.hand-card {
  min-height: clamp(76px, 8.2vh, 112px);
}
.card-tile {
  width: clamp(82px, min(5.4vw, 9.2vh), 138px);
}
.card-tile.land {
  width: clamp(102px, min(6.4vw, 10.8vh), 158px);
}


/* =========================================================
   CARTAS MÁS GRANDES, ARTE DOMINANTE E ICONOS RÁPIDOS (63:88)
   ========================================================= */
.card-tile {
  position: relative;
  width: clamp(102px, min(6.4vw, 10.8vh), 158px);
  padding: 5px;
  gap: 3px;
}
.card-tile.land {
  width: clamp(102px, min(6.4vw, 10.8vh), 158px);
}
.card-tile.commander-card {
  max-width: clamp(114px, min(7vw, 11.8vh), 166px);
}

.hand-card {
  width: clamp(118px, min(7vw, 11.6vh), 170px);
  min-width: clamp(118px, min(7vw, 11.6vh), 170px);
  aspect-ratio: 3 / 4;
  height: auto;
  min-height: 0;
  padding: 5px;
  gap: 3px;
  justify-content: space-between;
}

.opp-card-tile {
  position: relative;
  width: clamp(68px, min(4.1vw, 7.2vh), 112px);
  padding: 4px;
  gap: 2px;
}
.opp-card-tile.land {
  width: clamp(58px, min(3.5vw, 6.2vh), 96px);
}

/* El arte ocupa la mayor parte de la carta */
.card-art-strip {
  position: relative;
  flex: 1 1 auto;
  min-height: 52%;
  height: auto !important;
  width: 100%;
  margin: 0;
  border-radius: 4px;
  background-size: cover;
  background-position: center 22%;
  background-color: #121b19;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px;
}
.card-art-strip.no-art {
  background: radial-gradient(circle at 40% 30%, #243733, #111918);
}

.card-type-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(10, 15, 14, 0.78);
  border: 1px solid rgba(205, 155, 102, 0.4);
  font-size: 0.68rem;
  line-height: 1;
  color: #f4e6cc;
  backdrop-filter: blur(2px);
}

.card-kw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: auto;
}
.card-kw-chip {
  font-family: var(--font-body);
  font-size: 0.56rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(9, 14, 13, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #efe7d6;
  white-space: nowrap;
}

.card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 15px;
}
.card-type-txt {
  font-size: 0.62rem;
  color: var(--ink-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card-bottom-bar,
.opp-tile-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
}
.card-bottom-bar .card-name {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-pt-pill {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(12, 18, 17, 0.9);
  border: 1px solid var(--border-muted);
  color: var(--copper-hover);
}
.opp-tile-bottom .opp-tile-name {
  font-size: 0.58rem;
  -webkit-line-clamp: 2;
}
.opp-tile-bottom .opp-tile-stats {
  flex-shrink: 0;
  font-size: 0.54rem;
}


/* =========================================================
   MANO FLOTANDO ("VOLANDO") POR ENCIMA DEL TAPETE
   ========================================================= */
.local-player-shell {
  position: relative;
}
.local-player-shell > .local-board {
  padding-bottom: 52px; /* Aire mínimo en el borde inferior para que las tierras no queden tapadas */
}

.local-hand-bar.floating-hand {
  position: absolute;
  left: 50%;
  bottom: 46px; /* Justo encima de .local-dock-bar */
  transform: translateX(-50%);
  z-index: 28;
  border-top: none;
  padding: 0;
  margin: 0;
  pointer-events: none;
  max-width: 92%;
  display: flex;
  justify-content: center;
}
.local-hand-bar.floating-hand.drag-over {
  pointer-events: auto;
}
.local-hand-bar.floating-hand .hand-cards {
  pointer-events: none;
  overflow: visible;
  min-height: 0;
  padding: 28px 24px 0 24px;
  justify-content: center;
}
.local-hand-bar.floating-hand .hand-card {
  pointer-events: auto;
  transform: rotate(var(--fan-angle, 0deg)) translateY(calc(var(--fan-y, 0px) + 28px));
  box-shadow: 0 -4px 22px rgba(0, 0, 0, 0.72), 0 8px 18px rgba(0, 0, 0, 0.65);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.15s ease;
}
.local-hand-bar.floating-hand .hand-card:hover {
  transform: translateY(-34px) scale(1.14) rotate(0deg);
  z-index: 45;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.88), 0 0 18px rgba(205, 155, 102, 0.35);
}

/* === BLOQUE 2: DFC, Face-Down, Stacking ×N, Star 5J, Biblioteca Grid & Scry === */
.card.is-stacked,
.opp-card-tile.is-stacked {
  box-shadow: 3px 3px 0 rgba(12, 16, 26, 0.92), 4px 4px 0 rgba(212, 163, 94, 0.35), 0 4px 10px rgba(0, 0, 0, 0.45);
}

.card-stack-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 6;
  background: linear-gradient(135deg, #d4a35e, #a87533);
  color: #10141f;
  font-weight: 800;
  font-size: 0.68rem;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.card.face-down {
  background: radial-gradient(circle at 50% 35%, rgba(212, 163, 94, 0.16), rgba(13, 18, 30, 0.96) 72%);
  border: 2px solid rgba(212, 163, 94, 0.55);
}

.face-down-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 6px;
}

.face-down-sigil,
.face-down-emblem {
  font-size: 1.55rem;
  color: var(--copper-light, #e5be82);
  text-shadow: 0 0 10px rgba(212, 163, 94, 0.45);
}

.face-down-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(235, 240, 255, 0.78);
}

.dfc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(108, 168, 255, 0.2);
  color: #9ec5ff;
  border: 1px solid rgba(108, 168, 255, 0.35);
  margin-right: 3px;
}

.star-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.star-role-badge.ally {
  background: rgba(72, 199, 142, 0.18);
  color: #7ee2b8;
  border: 1px solid rgba(72, 199, 142, 0.4);
}

.star-role-badge.target {
  background: rgba(239, 96, 96, 0.18);
  color: #ff9c9c;
  border: 1px solid rgba(239, 96, 96, 0.4);
}

.zone-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.scry-preview-bar {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16, 23, 38, 0.9);
  border: 1px solid rgba(212, 163, 94, 0.35);
}

.scry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--copper-light, #e5be82);
}

.scry-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scry-card-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
}

#zone-card-list.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  padding: 4px;
}

#zone-card-list.grid-mode .zone-grid-item {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

#zone-card-list.grid-mode .zone-grid-card {
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 0;
}

#zone-card-list.grid-mode .zone-card-row-actions {
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

/* =========================================================
   ADAPTACIÓN MÓVIL (Retrato <= 768px y Apaisado <= 500px alto)
   ========================================================= */
@media (max-width: 768px) {
  html, body.toracles-app {
    overflow-x: hidden;
  }

  /* Lobby móvil */
  .top-nav {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .brand-sub {
    display: none;
  }
  .nav-links {
    gap: 8px;
    font-size: 0.78rem;
  }
  .lobby-shell {
    padding: 14px 12px 28px;
    max-width: 100%;
    overflow-x: hidden;
  }
  .lobby-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .panel,
  .lobby-card {
    min-width: 0;
    max-width: 100%;
    padding: 14px 12px;
  }
  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .two-cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .join-code-box {
    flex-wrap: wrap;
  }
  .join-code-box .input {
    min-width: 0;
    flex: 1 1 140px;
  }
  .lobby-hero h1 {
    font-size: 1.45rem;
  }
  .referee-cards {
    grid-template-columns: 1fr;
  }
  .btn-primary, .btn-secondary, .btn-ghost-copper, input, select {
    min-height: 38px;
  }

  /* Mesa móvil: dvh real + scroll vertical suave sin desborde horizontal */
  #table-view.active {
    height: 100dvh;
    min-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .table-topbar {
    padding: 6px 10px;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .topbar-left, .topbar-right {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
  }
  .room-badge {
    font-size: 0.8rem;
    gap: 5px;
  }
  #referee-level-badge,
  #table-mode-badge,
  .switcher-label {
    display: none;
  }
  .live-seat-switcher {
    padding: 2px 4px;
  }
  .mini-seat {
    width: 26px;
    height: 26px;
  }

  .table-workspace {
    overflow: visible;
    flex: 1 0 auto;
  }
  .playmat-area {
    padding: 8px 8px 12px;
    gap: 8px;
    overflow: visible;
    height: auto;
  }

  /* Tapetes rivales en carrusel horizontal táctil (mayor especificidad que :not(.single-active-mode) y [data-turn-owner]) */
  .playmat-area[data-players] .opponents-grid:not(.single-active-mode) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    flex: 0 0 auto !important;
  }
  .playmat-area[data-players] .opponents-grid.single-active-mode {
    flex-direction: column !important;
    overflow-x: visible;
  }
  .playmat-area[data-players] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat,
  .playmat-area[data-turn-owner] .opponents-grid:not(.single-active-mode) > .opp-card.opp-playmat {
    flex: 0 0 85vw !important;
    min-width: 85vw !important;
    max-width: 85vw !important;
    scroll-snap-align: center;
    padding: 8px;
  }
  .playmat-area[data-players] .opponents-grid.single-active-mode > .opp-card.opp-playmat {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .active-opp-roster {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .opp-roster-chip {
    flex-shrink: 0;
  }
  .opp-playmat-body {
    gap: 6px;
  }
  .opp-bf-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .opp-card-tile {
    width: 58px;
    flex-shrink: 0;
  }
  .opp-card-tile.land {
    width: 50px;
  }

  /* Tu tapete móvil */
  .local-player-shell {
    flex: 0 0 auto !important;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
  }
  .local-player-shell > .local-board {
    padding: 6px;
    padding-bottom: 8px; /* Ya no necesita hueco porque la mano no tapa el tapete */
  }
  .local-player-shell .zones-rack {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 6px;
  }
  .local-player-shell .piles-stack {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }
  .local-player-shell .library-deck-card {
    max-width: 72px;
    min-width: 64px;
    margin: 0;
  }
  .local-player-shell .bf-row {
    padding: 5px;
  }
  .bf-cards {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    -webkit-overflow-scrolling: touch;
  }
  .card-tile {
    width: 82px;
    flex-shrink: 0;
  }
  .card-tile.land {
    width: 72px;
  }
  .card-tile.commander-card {
    width: 78px;
    max-width: 78px;
  }

  /* Mano convertida en bandeja deslizable táctil debajo del tapete */
  .local-hand-bar.floating-hand {
    position: static;
    transform: none;
    left: auto;
    bottom: auto;
    max-width: 100%;
    width: 100%;
    pointer-events: auto;
    background: rgba(12, 18, 17, 0.88);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px 6px;
    justify-content: flex-start;
  }
  .local-hand-bar.floating-hand .hand-cards {
    pointer-events: auto;
    overflow-x: auto;
    overflow-y: visible;
    justify-content: flex-start;
    padding: 2px;
    gap: 6px;
    width: 100%;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .local-hand-bar.floating-hand .hand-card {
    width: 72px;
    min-width: 72px;
    transform: none !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
    scroll-snap-align: start;
  }
  .local-hand-bar.floating-hand .hand-card:hover {
    transform: translateY(-6px) scale(1.04) !important;
  }

  /* Dock inferior pegado al borde inferior con safe-area */
  .local-dock-bar {
    position: sticky;
    bottom: 0;
    z-index: 35;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .seat-pill-minimal {
    gap: 6px;
  }
  .seat-name-mini {
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .quick-toolbar.minimal {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
  }
  .ui-dropdown-menu {
    max-width: calc(100vw - 24px);
    right: 0;
    left: auto;
  }

  /* Modales adaptados a móvil */
  .modal-card {
    width: calc(100vw - 20px);
    max-height: 86dvh;
    padding: 14px 12px;
  }
  #zone-card-list.grid-mode {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .table-topbar {
    padding: 4px 10px;
  }
  .card-tile,
  .hand-card {
    width: clamp(66px, 17vh, 96px);
    min-width: clamp(66px, 17vh, 96px);
  }
  .card-tile.land {
    width: clamp(58px, 15vh, 84px);
  }
  .local-hand-bar.floating-hand {
    bottom: 40px;
  }
  .local-dock-bar {
    padding: 4px 8px;
  }
}

/* === Cementerio y Exilio visual bajo la Biblioteca === */
.local-player-shell .side-piles-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 110px;
  margin: 0 auto;
}

.pile-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 4px;
  background: rgba(14, 20, 19, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  cursor: pointer;
  color: var(--ink-text-secondary);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.pile-card-btn:hover {
  border-color: var(--border-copper);
  transform: translateY(-1px);
}

.pile-mini-card {
  width: 54px;
  aspect-ratio: 3 / 4;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background-color: #161f1d;
  background-size: cover;
  background-position: center 22%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 3px;
  overflow: hidden;
  position: relative;
}

.pile-mini-card.is-exile {
  transform: rotate(90deg) scale(0.86);
  opacity: 0.62;
  filter: blur(0.65px) saturate(0.35) contrast(0.9);
  border-color: rgba(158, 197, 255, 0.45);
  box-shadow: 0 0 12px rgba(158, 197, 255, 0.25);
  margin: -6px 0;
}

.pile-mini-name {
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 1.05;
  color: #f3ede0;
  background: rgba(8, 12, 11, 0.84);
  padding: 1px 3px;
  border-radius: 3px;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}

.pile-mini-empty {
  font-size: 0.55rem;
  opacity: 0.5;
  margin: auto;
}

.pile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.65rem;
  padding: 0 2px;
}

@media (max-width: 768px) {
  .local-player-shell .side-piles-row {
    flex-direction: row;
    max-width: none;
    width: auto;
  }
  .pile-card-btn {
    width: 64px;
  }
  .pile-mini-card {
    width: 42px;
  }
}

/* === Muro de Acceso Google OIDC + Invitaciones === */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 25%, rgba(205, 155, 102, 0.14), rgba(10, 15, 14, 0.98) 65%);
}
.auth-gate.hidden {
  display: none;
}
.auth-gate-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-copper);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72);
}
.auth-gate-sigil {
  font-size: 2rem;
  color: var(--copper-base);
  margin-bottom: 8px;
}
.auth-gate-card h1 {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  margin: 8px 0 10px;
}
.auth-gate-card p {
  color: var(--ink-text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 18px;
}
.auth-gate-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.auth-gate-note {
  font-size: 0.76rem !important;
  color: var(--ink-text-muted) !important;
  margin-bottom: 0 !important;
}

.invites-list-box {
  margin-top: 14px;
  max-height: 44vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.invites-list-box h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--copper-base);
  margin-bottom: 2px;
}
.invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}
.invite-row small {
  display: block;
  color: var(--ink-text-muted);
  font-size: 0.72rem;
}
.invite-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.invite-empty {
  font-size: 0.8rem;
  color: var(--ink-text-muted);
}


/* --- Stack Add Form, Host Kick & Rule 0 Badge --- */
.stack-add-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.stack-add-form input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.14));
  background: rgba(0,0,0,0.22);
  color: inherit;
  font-size: 0.8rem;
}
.stack-item.empty {
  justify-content: center;
  color: var(--text-muted, #8fa39a);
  font-style: italic;
}
.opp-kick-btn {
  border: 1px solid rgba(220, 88, 88, 0.5);
  background: rgba(180, 40, 40, 0.2);
  color: #f3a6a6;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.72rem;
  cursor: pointer;
}
.opp-kick-btn:hover {
  background: rgba(200, 48, 48, 0.45);
  color: #fff;
}
.pill-jade {
  background: rgba(82, 163, 132, 0.16);
  color: #7cd4b2;
  border: 1px solid rgba(82, 163, 132, 0.35);
}

/* --- Fase Siguiente / Pasar Turno, Apilar desde Mano y Pegado Rápido de Mazo --- */
.phase-next-btn {
  background: rgba(205, 155, 102, 0.18);
  border: 1px solid var(--border-copper-subtle);
  color: var(--copper-hover);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: var(--font-body);
  margin-left: 4px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.phase-next-btn:hover {
  background: rgba(205, 155, 102, 0.32);
  border-color: var(--copper-base);
}
.deck-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .deck-preview-actions {
    flex-direction: row;
    align-items: center;
  }
}
.deck-paste-section {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.deck-paste-textarea {
  resize: vertical;
  min-height: 96px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.35;
}
.hand-cast-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(16, 22, 21, 0.92);
  border: 1px solid var(--copper-base);
  color: var(--copper-hover);
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s ease, background 0.14s ease;
  z-index: 4;
}
.hand-card:hover .hand-cast-btn,
.commander-card:hover .hand-cast-btn {
  opacity: 1;
}
.hand-cast-btn:hover {
  background: var(--copper-base);
  color: #101615;
}
.opp-card-tile.attacking {
  border-color: var(--danger) !important;
  box-shadow: 0 0 10px rgba(200, 86, 71, 0.55);
}


/* --- Modo Academia Links & Deck Associated Tokens --- */
.academy-links-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.academy-chip-link {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(205, 155, 102, 0.14);
  color: var(--copper-hover, #e2b483);
  border: 1px solid rgba(205, 155, 102, 0.35);
}
.academy-chip-link:hover {
  background: rgba(205, 155, 102, 0.25);
}
.deck-tokens-wrap {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
}
.deck-tokens-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--copper-hover, #deb382);
  margin-bottom: 6px;
}


/* --- Sidebar Chat & Oracle Communication --- */
.sidebar-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.sidebar-tab-btn {
  flex: 1;
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.14));
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sidebar-tab-btn.active {
  background: rgba(205, 155, 102, 0.18);
  border-color: var(--copper-base, #cd9b66);
  color: var(--copper-hover, #deb382);
}
.chat-unread {
  background: #cd9b66;
  color: #101615;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.68rem;
  font-weight: 800;
}
.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}
.chat-messages {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}
.chat-msg {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
}
.chat-msg.oracle {
  background: rgba(205, 155, 102, 0.11);
  border-color: rgba(205, 155, 102, 0.35);
}
.chat-msg-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  opacity: 0.85;
  margin-bottom: 2px;
}
.chat-msg p {
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}
.chat-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chat-chip {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.68rem;
  cursor: pointer;
}
.chat-chip:hover {
  border-color: var(--copper-base, #cd9b66);
}
.chat-form {
  display: flex;
  gap: 6px;
}
.chat-form .input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  font-size: 0.78rem;
}

/* === Modo Observador y acciones en mesas públicas === */
.room-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.btn-ghost-sage {
  border: 1px solid rgba(114, 179, 152, 0.45);
  background: rgba(114, 179, 152, 0.1);
  color: #a9dec7;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-ghost-sage:hover {
  background: rgba(114, 179, 152, 0.22);
  border-color: rgba(114, 179, 152, 0.75);
}
.playmat-area.is-spectator {
  grid-template-rows: 1fr;
}
.playmat-area.is-spectator .opponents-grid {
  max-height: none;
  height: 100%;
}

/* === Biblioteca arrastrable entre esquina inferior izquierda y derecha === */
.local-player-shell .local-left-col,
.local-player-shell .zones-rack,
.local-player-shell .piles-stack {
  height: 100%;
}
.local-player-shell .piles-stack {
  flex: 1 1 auto;
  justify-content: space-between;
}
.local-player-shell .local-board-layout {
  grid-template-columns: clamp(134px, 9.5vw, 178px) 1fr auto;
}
@media (max-width: 1100px) {
  .local-player-shell .local-board-layout {
    grid-template-columns: 1fr;
  }
}
.local-board {
  position: relative;
}
.library-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 10px;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.library-slot-left {
  margin-top: auto;
  width: 100%;
  min-height: 44px;
}
.library-slot-right {
  align-self: stretch;
  width: 0;
  overflow: hidden;
  padding: 0;
}
.library-slot-right:has(.library-deck-card) {
  width: clamp(124px, min(7.6vw, 12.4vh), 178px);
  padding: 6px;
  overflow: visible;
}
body.dragging-library .library-slot-right:not(:has(.library-deck-card)) {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 25;
  width: clamp(128px, min(8vw, 13vh), 180px);
  height: 192px;
  padding: 8px;
  overflow: visible;
  border: 3px dashed #f2c94c;
  background: rgba(14, 20, 19, 0.9);
  box-shadow: 0 0 32px rgba(242, 201, 76, 0.35), inset 0 0 20px rgba(205, 155, 102, 0.2);
}
body.dragging-library .library-slot-left {
  min-height: 168px;
  border: 3px dashed var(--copper-base);
  background: rgba(14, 20, 19, 0.78);
  box-shadow: inset 0 0 22px rgba(205, 155, 102, 0.25);
}
body.dragging-library .library-slot:not(:has(.library-deck-card))::after {
  content: "Soltar Biblioteca aquí";
  font-size: 0.76rem;
  font-weight: 800;
  color: #ffe38e;
  text-align: center;
  padding: 8px;
  margin: auto;
  pointer-events: none;
}
.library-slot.drop-active {
  border-color: #ffe28a !important;
  background: rgba(242, 201, 76, 0.26) !important;
  box-shadow: 0 0 28px rgba(242, 201, 76, 0.45) !important;
}
.library-deck-card[draggable="true"] {
  cursor: grab;
}
.library-deck-card[draggable="true"]:active {
  cursor: grabbing;
}

/* === Contador Flotante de Maná en vuelo (sobre el abanico de la mano) === */
.local-player-shell {
  position: relative;
}
.floating-mana-hud {
  position: absolute;
  left: 50%;
  bottom: clamp(192px, 21vh, 230px);
  transform: translateX(-50%) translateY(8px) scale(0.94);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 20px;
  border-radius: 999px;
  background: rgba(12, 18, 17, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(242, 201, 76, 0.78);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55), 0 0 28px rgba(242, 201, 76, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  z-index: 40;
}
.floating-mana-hud.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}
.floating-mana-hud.is-empty {
  opacity: 0;
  pointer-events: none;
}
.floating-mana-hud.mana-pulse {
  transform: translateX(-50%) translateY(-2px) scale(1.07);
  box-shadow: 0 14px 38px rgba(242, 201, 76, 0.45), 0 0 34px rgba(242, 201, 76, 0.55);
}
.mana-hud-title {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 900;
  color: #ffe694;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(242, 201, 76, 0.45);
}
.mana-orbs-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.mana-orb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.mana-orb.is-zero {
  display: none;
}
.mana-orb:hover {
  transform: translateY(-2px) scale(1.08);
}
.mana-orb.mana-W:not(.is-zero) { background: rgba(248, 231, 185, 0.32); border-color: #f8e7b9; color: #fff9e3; box-shadow: 0 0 14px rgba(248, 231, 185, 0.45); }
.mana-orb.mana-U:not(.is-zero) { background: rgba(74, 158, 255, 0.34); border-color: #6ab5ff; color: #e2f2ff; box-shadow: 0 0 14px rgba(74, 158, 255, 0.5); }
.mana-orb.mana-B:not(.is-zero) { background: rgba(164, 118, 214, 0.36); border-color: #b78ce8; color: #f4e8ff; box-shadow: 0 0 14px rgba(164, 118, 214, 0.5); }
.mana-orb.mana-R:not(.is-zero) { background: rgba(235, 92, 71, 0.36); border-color: #ff7e6b; color: #ffe6e1; box-shadow: 0 0 14px rgba(235, 92, 71, 0.52); }
.mana-orb.mana-G:not(.is-zero) { background: rgba(73, 186, 120, 0.36); border-color: #6fe39c; color: #e2ffed; box-shadow: 0 0 14px rgba(73, 186, 120, 0.5); }
.mana-orb.mana-C:not(.is-zero) { background: rgba(204, 194, 178, 0.32); border-color: #d6cfc2; color: #faf7f0; box-shadow: 0 0 14px rgba(214, 207, 194, 0.42); }
.mana-clear-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #dcd1be;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.mana-clear-btn:hover {
  color: #ffd3c9;
  border-color: rgba(235, 92, 71, 0.55);
}
.mana-burst-toast {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14, 20, 19, 0.94);
  border: 1px solid #f2c94c;
  color: #ffe48f;
  box-shadow: 0 0 18px rgba(242, 201, 76, 0.55);
  animation: manaPopFloat 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes manaPopFloat {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.75); }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -38px) scale(0.95); }
}

/* =========================================================
   CONTROLES DE AUDIO + SUBTÍTULO ORÁCULO NARRADOR
   ========================================================= */
.audio-controls-cluster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.audio-pill.is-muted {
  opacity: 0.55;
  text-decoration: line-through;
}
.audio-pill.is-speaking {
  border-color: var(--copper-base);
  color: var(--copper-hover);
  box-shadow: 0 0 10px rgba(205, 155, 102, 0.35);
}
.audio-pill-caret {
  list-style: none;
  padding-left: 7px;
  padding-right: 7px;
}
.audio-settings-menu {
  min-width: 230px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 260;
}
.audio-setting-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--ink-text-secondary);
}
.audio-setting-row label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}
.audio-setting-row input[type="range"] {
  width: 100%;
  accent-color: var(--copper-base);
}
.audio-setting-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--ink-text-secondary);
  cursor: pointer;
}
.caster-subtitle-pill {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 180;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(640px, 88vw);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(14, 19, 19, 0.92);
  border: 1px solid rgba(205, 155, 102, 0.55);
  color: #f6efe0;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
html[data-theme="light"] .caster-subtitle-pill {
  background: rgba(250, 246, 238, 0.96);
  color: #1b2422;
  border-color: rgba(155, 106, 56, 0.55);
}
.caster-sub-icon {
  font-size: 0.95rem;
}
.mana-dock-pill {
  border-color: rgba(242, 201, 76, 0.65) !important;
  background: rgba(242, 201, 76, 0.16) !important;
  color: #ffe48f !important;
  font-family: var(--font-mono);
  font-weight: 700;
}
html[data-theme="light"] .mana-dock-pill {
  background: rgba(212, 160, 44, 0.18) !important;
  border-color: rgba(155, 106, 56, 0.7) !important;
  color: #6b4513 !important;
}

/* =========================================================
   V2 MoxGate-inspired interaction layer
   ========================================================= */
.mesa-v2-beta-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid rgba(205, 155, 102, .48);
  border-radius: 999px;
  color: var(--copper-hover);
  background: rgba(205, 155, 102, .10);
  font: 600 .68rem var(--font-mono);
  text-decoration: none;
  white-space: nowrap;
}
.mesa-v2-beta-pill:hover { background: rgba(205, 155, 102, .22); }
.card-tile.tapped { transform: rotate(var(--tap-rotation, 90deg)); transform-origin: center; }
.card-tile.can-pay, .hand-card.can-pay {
  box-shadow: 0 0 0 1px rgba(242, 201, 76, .68), 0 0 22px rgba(242, 201, 76, .28);
}
.hand-card.can-pay::after {
  content: 'MANÁ DISPONIBLE';
  position: absolute;
  top: 3px;
  right: 4px;
  z-index: 4;
  padding: 2px 4px;
  border-radius: 4px;
  color: #211a0b;
  background: #f2c94c;
  font: 700 .53rem var(--font-mono);
}
.auto-pay-btn { border-color: #f2c94c !important; color: #ffe48f !important; }
.lands-turn-indicator {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid rgba(82, 163, 132, .44);
  border-radius: 999px;
  color: #9ce0bb;
  background: rgba(82, 163, 132, .12);
  font: 600 .72rem var(--font-mono);
  white-space: nowrap;
}
.lands-turn-indicator.spent { border-color: rgba(224, 159, 62, .55); color: var(--copper-hover); background: rgba(224, 159, 62, .12); }
.card-ping { animation: cardPing .85s ease-out; }
@keyframes cardPing {
  0% { box-shadow: 0 0 0 0 rgba(242, 201, 76, .9); }
  45% { box-shadow: 0 0 0 14px rgba(242, 201, 76, .22), 0 0 28px rgba(242, 201, 76, .65); }
  100% { box-shadow: 0 0 0 26px rgba(242, 201, 76, 0); }
}
.card-hovered, .stack-card-link, #action-log em { cursor: crosshair; }
.settings-modal { width: min(460px, 92vw); }
.tap-rotation-settings { display: grid; gap: 10px; border: 1px solid var(--border-subtle); padding: 14px; border-radius: 10px; color: var(--ink-text-secondary); }
.tap-rotation-settings legend { padding: 0 6px; color: var(--ink-text-primary); font-weight: 700; }
.tap-rotation-settings label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.mana-approval-banner {
  position: fixed;
  top: 98px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(480px, 92vw);
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(20, 25, 25, 0.96);
  border: 1px solid rgba(217, 155, 67, 0.7);
  color: #f6efe0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}
html[data-theme="light"] .mana-approval-banner {
  background: rgba(252, 248, 240, 0.98);
  color: #1b2422;
}
.mana-approval-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mana-approval-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--copper-hover);
}
.mana-approval-desc {
  font-size: 0.8rem;
  line-height: 1.35;
}
.mana-approval-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.beta-invite-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}
.beta-invite-form input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--ink-text-primary);
  font-size: 0.85rem;
}
.table-sidebar.is-collapsed {
  display: none !important;
}
.deck-picker-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-copper-subtle);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}
.deck-picker-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mulligan-card {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.mulligan-card.selected-bottom {
  border-color: #ef6a56 !important;
  box-shadow: 0 0 12px rgba(239, 106, 86, 0.45);
  transform: translateY(4px);
  opacity: 0.72;
}
.mana-color-picker {
  position: fixed;
  transform: translate(-50%, -100%);
  z-index: 320;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(14, 19, 19, 0.96);
  border: 1px solid rgba(205, 155, 102, 0.7);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}
.mana-color-picker .mana-orb {
  width: 30px;
  height: 30px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.mana-color-picker .mana-orb:hover {
  transform: scale(1.14);
}
.discord-link-btn,
.discord-voice-btn {
  text-decoration: none;
  border-color: rgba(88, 101, 242, 0.55) !important;
  color: #cdd4ff !important;
}
html[data-theme="light"] .discord-link-btn,
html[data-theme="light"] .discord-voice-btn {
  color: #3c48b8 !important;
  background: rgba(88, 101, 242, 0.08) !important;
}
.discord-voice-menu {
  min-width: 220px;
  padding: 6px;
  z-index: 265;
}
.discord-menu-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-text-muted);
  padding: 4px 8px 6px;
}
.discord-voice-menu a.dropdown-item {
  text-decoration: none;
  display: block;
}
.beta-invite-status {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--copper-hover);
}

/* =========================================================
   REDISEÑO VISUAL V2 — ESTILO TÁCTICO INMERSIVO (MOXGATE)
   ========================================================= */
#table-view.active {
  background: radial-gradient(circle at 50% 35%, #121a26 0%, #090d14 68%, #06090e 100%);
}
#table-view .table-topbar {
  background: rgba(8, 11, 17, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 44px;
  padding: 4px 12px;
  color: #f8fafc;
}
#table-view #table-room-title,
#table-view .table-title-block strong {
  color: #f8fafc !important;
}
#table-view .playmat-area {
  background: transparent;
  gap: 8px;
  padding: 8px 12px 6px;
}
#table-view .local-board {
  background: linear-gradient(180deg, rgba(16, 23, 34, 0.72) 0%, rgba(10, 15, 23, 0.88) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
}
#table-view .local-left-col {
  flex: 0 0 132px;
  width: 132px;
}
#table-view .bf-permanents,
#table-view .bf-lands,
#table-view .zone-box {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
#table-view .bf-permanents {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
  padding-bottom: 6px;
}
#table-view .row-label,
#table-view .zone-title {
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(203, 213, 225, 0.45);
}

/* Art View en el Campo de Batalla */
#table-view #local-permanents .card-tile,
#table-view #local-lands .card-tile,
#table-view #local-command-zone .card-tile {
  padding: 0 !important;
  border-radius: 10px !important;
  overflow: hidden;
  background: #0c1118 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.58) !important;
  position: relative;
  --tap-rotation: 45deg;
}
#table-view #local-permanents .card-tile.tapped,
#table-view #local-lands .card-tile.tapped {
  transform: rotate(45deg);
  border-color: rgba(242, 201, 76, 0.65) !important;
  margin: 0 clamp(14px, 1vw, 24px);
}
#table-view #local-permanents .card-tile .card-art-wrap,
#table-view #local-lands .card-tile .card-art-wrap,
#table-view #local-command-zone .card-tile .card-art-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
}
#table-view #local-permanents .card-tile .card-art,
#table-view #local-lands .card-tile .card-art,
#table-view #local-command-zone .card-tile .card-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#table-view #local-permanents .card-tile .card-type,
#table-view #local-lands .card-tile .card-type,
#table-view #local-permanents .card-tile .card-text,
#table-view #local-lands .card-tile .card-text {
  display: none !important;
}
#table-view #local-permanents .card-tile .card-head,
#table-view #local-lands .card-tile .card-head,
#table-view #local-command-zone .card-tile .card-head {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 18px 7px 6px;
  background: linear-gradient(to top, rgba(5, 8, 13, 0.96) 0%, rgba(5, 8, 13, 0.72) 60%, transparent 100%);
  color: #f8fafc !important;
}
#table-view #local-permanents .card-tile .card-name,
#table-view #local-lands .card-tile .card-name,
#table-view #local-command-zone .card-tile .card-name {
  color: #f8fafc !important;
  font-size: 0.72rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}
#table-view #local-permanents .card-tile .card-cost,
#table-view #local-lands .card-tile .card-cost {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}
#table-view #local-permanents .card-tile .card-stats,
#table-view #local-lands .card-tile .card-stats {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 4;
  background: rgba(10, 15, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fde68a;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 800;
}
#table-view #local-permanents .card-tile .card-actions-bar,
#table-view #local-lands .card-tile .card-actions-bar {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.14s ease;
  background: rgba(6, 10, 16, 0.86);
  border-radius: 6px;
  padding: 2px;
}
#table-view #local-permanents .card-tile:hover .card-actions-bar,
#table-view #local-lands .card-tile:hover .card-actions-bar {
  opacity: 1;
}

/* Mano en abanico: halo cian/dorado en cartas jugables */
#table-view #local-hand .card-tile.can-pay {
  box-shadow: 0 0 0 2px #56ccf2, 0 0 18px rgba(86, 204, 242, 0.55) !important;
  transform: translateY(-8px);
}

/* Panel lateral derecho más estrecho y limpio */
@media (min-width: 901px) {
  #table-view .table-sidebar {
    width: 300px;
    background: rgba(9, 13, 20, 0.94);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
  }
}
#table-view .local-dock-bar {
  position: relative;
  z-index: 180;
  background: rgba(8, 12, 19, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

/* Topbar ultra-limpia en V2: todo lo secundario pasa al menú ☰ Opciones */
#table-view .live-seat-switcher,
#table-view .opp-view-toggle,
#table-view .phase-ribbon,
#table-view .mesa-v2-beta-pill,
#table-view #copy-invite-btn,
#table-view #pause-room-btn,
#table-view #room-rule0-pill,
#table-view #room-privacy-pill,
#table-view #audio-controls-cluster {
  display: none !important;
}

.v2-primary-cta {
  position: static;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(242, 201, 76, 0.78);
  background: linear-gradient(135deg, #d99b43 0%, #a86c22 100%);
  color: #120e07;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.v2-respond-btn {
  position: fixed !important;
  right: 324px;
  bottom: 76px;
  left: auto;
  z-index: 150 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-width: 170px !important;
  min-height: 62px !important;
  padding: 16px 28px !important;
  border-radius: 999px !important;
  font-size: 1.15rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.06em !important;
  background: radial-gradient(circle at 35% 25%, #ff5a5a 0%, #dc2626 55%, #7f1d1d 100%) !important;
  border: 3px solid #fecaca !important;
  color: #ffffff !important;
  cursor: grab !important;
  user-select: none !important;
  touch-action: none !important;
  box-shadow: 0 12px 34px rgba(220, 38, 38, 0.65), 0 0 28px rgba(239, 68, 68, 0.5), inset 0 2px 6px rgba(255, 255, 255, 0.35) !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease !important;
}
.v2-respond-btn:active,
.v2-respond-btn.is-dragging {
  cursor: grabbing !important;
  transform: scale(0.97) !important;
}
.v2-respond-btn:hover {
  transform: scale(1.04) !important;
  box-shadow: 0 16px 40px rgba(220, 38, 38, 0.8), 0 0 34px rgba(248, 113, 113, 0.72), inset 0 2px 6px rgba(255, 255, 255, 0.45) !important;
}
.table-workspace.sidebar-left ~ .v2-respond-btn {
  right: 24px;
}
#table-view .dropdown-menu {
  z-index: 250 !important;
}
#table-view .stack-overlay {
  z-index: 350 !important;
}
@media (max-width: 900px) {
  .v2-respond-btn { right: 16px; bottom: 78px; min-width: 140px !important; min-height: 52px !important; padding: 12px 18px !important; font-size: 0.96rem !important; }
}

/* Animación 3D Espectacular de Vuelo e Impacto para cualquier carta jugada */
.card-flight-3d {
  position: fixed;
  z-index: 410;
  pointer-events: none;
  width: 156px;
  height: 208px;
  border-radius: 12px;
  background-color: #0e141e;
  background-size: cover;
  background-position: center;
  border: 2.5px solid var(--flight-accent, #34d399);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.75), 0 0 34px var(--flight-accent, #34d399), inset 0 0 18px rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  will-change: transform, opacity;
}
.flight-card-title {
  width: 100%;
  padding: 18px 8px 7px;
  background: linear-gradient(to top, rgba(5, 8, 13, 0.96), transparent);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 4px #000;
}
.flight-trail-dot {
  position: fixed;
  z-index: 405;
  pointer-events: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: trailFade 0.42s ease-out forwards;
}
@keyframes trailFade {
  from { opacity: 0.95; transform: translate(-50%, -50%) scale(1.2); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.15); }
}
.flight-impact-flash {
  position: fixed;
  z-index: 406;
  pointer-events: none;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--flight-accent, #34d399) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0.3);
  animation: impactFlashAnim 0.62s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes impactFlashAnim {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.1); }
}
.flight-impact-spark {
  position: fixed;
  z-index: 408;
  pointer-events: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.v2-phase-toast {
  position: fixed;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 400;
  pointer-events: none;
  padding: 12px 28px;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.94);
  border: 2px solid rgba(242, 201, 76, 0.85);
  color: #fde68a;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.75), 0 0 32px rgba(242, 201, 76, 0.45);
  animation: phaseToastAnim 1.12s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes phaseToastAnim {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.85); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.96); }
}
.landfall-shockwave {
  position: fixed;
  z-index: 407;
  pointer-events: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3.5px solid #6fe39c;
  box-shadow: 0 0 28px rgba(111, 227, 156, 0.85), inset 0 0 18px rgba(242, 201, 76, 0.65);
  transform: translate(-50%, -50%) scale(0.4);
  animation: landfallWave 0.78s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.landfall-banner-pop {
  position: fixed;
  z-index: 412;
  pointer-events: none;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(10, 16, 24, 0.96);
  border: 1.5px solid #6fe39c;
  color: #f8fafc;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.68);
  animation: landfallPop 1.08s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.landfall-shake {
  animation: landfallShake 0.42s ease;
}
@keyframes landfallWave {
  0% { opacity: 0.98; transform: translate(-50%, -50%) scale(0.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(6.4); }
}
@keyframes landfallPop {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -6px) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(0.98); }
}
@keyframes landfallShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 4px); }
  45% { transform: translate(3px, -3px); }
  70% { transform: translate(-2px, 2px); }
}
.v2-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.v2-opt-group {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}
.v2-opt-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-text-muted);
  margin-bottom: 6px;
}

/* Barra inferior limpia en V2: reducir de 11 a 5 controles esenciales */
#table-view .seat-name-mini,
#table-view #turn-owner-btn,
#table-view #untap-all-btn,
#table-view #draw-one-btn,
#table-view #fx-actions-dropdown {
  display: none !important;
}

/* Selector de lado de barra lateral (Izquierda ↔ Derecha) */
.table-workspace.sidebar-left {
  flex-direction: row-reverse;
}
.table-workspace.sidebar-left .table-sidebar {
  border-left: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* Legibilidad MoxGate en Campo: oscuro al girar, halo rojo al atacar */
#table-view #local-permanents .card-tile.tapped .card-art,
#table-view #local-lands .card-tile.tapped .card-art {
  filter: brightness(0.62) saturate(0.8);
}
#table-view #local-permanents .card-tile.attacking {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px #ef4444, 0 0 22px rgba(239, 68, 68, 0.65) !important;
}

/* Botón Principal Contextual Único integrado en la barra inferior */
.v2-primary-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65), 0 0 24px rgba(242, 201, 76, 0.55);
}

/* Vitrina visual de Mazos (#deck-picker-list) */
#deck-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px;
}
#deck-picker-list .invite-row {
  position: relative;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  min-height: 145px;
  padding: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(205, 155, 102, 0.35);
  background: linear-gradient(160deg, #1a222d 0%, #0d121a 100%);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
#deck-picker-list .invite-row:hover {
  transform: translateY(-3px);
  border-color: rgba(242, 201, 76, 0.85);
}
#deck-picker-list .deck-picker-meta {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  z-index: 2;
}
#deck-picker-list .deck-picker-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  opacity: 0.42;
  z-index: 1;
}
#deck-picker-list .invite-row::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 10, 15, 0.96) 15%, rgba(7, 10, 15, 0.45) 100%);
  z-index: 1;
}
#deck-picker-list .pick-deck-btn,
#deck-picker-list .pick-demo-btn {
  position: relative;
  z-index: 2;
  margin-top: 8px;
  width: 100%;
}

/* =========================================================
   CEREMONIA ARCADE VS ESTILO STREET FIGHTER IV (SUMI-E + MAGMA)
   ========================================================= */
.v2-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 420;
  overflow: hidden;
  background: #060302;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
.v2-intro-overlay.sf4-stage-shake {
  animation: sf4StageShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.v2-intro-overlay.is-shattering .sf4-vs-panel:nth-child(odd) {
  transform: translateX(-120%) skewX(-7deg) !important;
  opacity: 0;
  transition: transform 0.62s cubic-bezier(0.32, 0, 0.67, 0), opacity 0.55s ease-in;
}
.v2-intro-overlay.is-shattering .sf4-vs-panel:nth-child(even) {
  transform: translateX(120%) skewX(-7deg) !important;
  opacity: 0;
  transition: transform 0.62s cubic-bezier(0.32, 0, 0.67, 0), opacity 0.55s ease-in;
}
.v2-intro-overlay.is-shattering .sf4-vs-center-wrap {
  transform: translate(-50%, -50%) scale(2.4);
  opacity: 0;
  transition: transform 0.55s ease-out, opacity 0.45s ease-out;
}
.sf4-vs-backdrop {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 50% 50%, #ffae00 0%, #ff3c00 28%, #5e0802 62%, #080302 100%);
  opacity: 0.92;
  z-index: 0;
}
.sf4-speed-lines {
  position: absolute;
  inset: -20%;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    rgba(255, 210, 90, 0.16) 0deg 2.5deg,
    transparent 2.5deg 7deg,
    rgba(0, 0, 0, 0.55) 7deg 9.5deg
  );
  mix-blend-mode: overlay;
  animation: sf4VortexSpin 14s linear infinite;
  z-index: 1;
  pointer-events: none;
}
@keyframes sf4VortexSpin {
  from { transform: rotate(0deg) scale(1.15); }
  to { transform: rotate(360deg) scale(1.15); }
}

.v2-intro-commanders {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  margin: 0;
  gap: 0;
}
.sf4-vs-panel {
  flex: 1 1 0;
  position: relative;
  overflow: hidden;
  border-left: 6px solid #050505;
  border-right: 6px solid #050505;
  box-shadow: inset 0 0 65px rgba(0, 0, 0, 0.85), 0 0 38px rgba(255, 68, 0, 0.65);
  transform: skewX(-6deg) scale(1.04);
  animation: sf4PanelSlamIn 0.96s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.sf4-vs-panel.is-me-cmdr {
  box-shadow: inset 0 0 55px rgba(255, 166, 0, 0.35), 0 0 46px rgba(255, 180, 0, 0.85);
}
@keyframes sf4PanelSlamIn {
  0% {
    opacity: 0;
    transform: translateX(var(--slide-from, -100%)) skewX(-10deg) scale(1.22);
  }
  75% {
    opacity: 1;
    transform: translateX(0) skewX(-6deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) skewX(-6deg) scale(1.04);
  }
}
.sf4-panel-fire {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 4, 2, 0.55) 0%, transparent 35%, rgba(210, 38, 0, 0.45) 78%, rgba(5, 3, 2, 0.96) 100%);
  z-index: 2;
  pointer-events: none;
}
.sf4-portrait-img {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  object-position: center 22%;
  transform: skewX(6deg) scale(1.32);
  filter: contrast(1.14) saturate(1.18);
  image-rendering: auto;
  z-index: 1;
  animation: sf4PortraitLunge 3.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes sf4PortraitLunge {
  from { transform: skewX(6deg) scale(1.46); }
  to { transform: skewX(6deg) scale(1.30); }
}

/* Banner Metálico Superior de Jugador (Estilo Online SF4 37.9s) */
.sf4-player-banner {
  position: absolute;
  top: 22px;
  left: 24px;
  right: 24px;
  z-index: 5;
  transform: skewX(6deg);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(28, 32, 42, 0.94) 0%, rgba(10, 12, 18, 0.96) 100%);
  border: 2px solid rgba(255, 215, 128, 0.72);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.sf4-seat-pill {
  padding: 2px 8px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ff5100 0%, #b81400 100%);
  border: 1px solid #ffd166;
  color: #ffffff;
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.sf4-player-handle {
  flex: 1;
  color: #f8fafc;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 4px #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sf4-banner-pips {
  display: inline-flex;
  gap: 2px;
}

/* Mini Carta 3D Flotante en el Panel */
.sf4-card-mini {
  position: absolute;
  right: 26px;
  bottom: 155px;
  z-index: 4;
  width: 112px;
  height: 152px;
  border-radius: 10px;
  background-color: #0d121a;
  background-size: cover;
  background-position: center;
  border: 2.5px solid #ffd166;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.9), 0 0 22px rgba(255, 145, 0, 0.65);
  transform: skewX(6deg) perspective(600px) rotateY(-14deg) rotateZ(-4deg);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px;
}
.sf4-card-mini-tag {
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(8, 10, 15, 0.92);
  border: 1px solid #fbbf24;
  color: #fde68a;
}

/* Brochazo Sumi-e Negro Inferior + Caligrafía Blanca con Trazo Carmesí */
.sf4-ink-smear {
  position: absolute;
  left: -12px;
  right: -12px;
  bottom: 24px;
  z-index: 5;
  transform: skewX(6deg);
  padding: 18px 28px 14px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.96) 0%, rgba(12, 4, 2, 0.92) 72%, rgba(0, 0, 0, 0.4) 100%);
  border-top: 3px solid #ff3c00;
  border-bottom: 4px solid #000000;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.92);
}
.sf4-cmdr-name {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: clamp(1.35rem, 2.2vw, 2.15rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ffffff;
  transform: rotate(-2.5deg);
  text-shadow:
    0 0 12px #ff2a00,
    -2px -2px 0 #b80c00,
    2px -2px 0 #b80c00,
    -2px 2px 0 #000000,
    3px 4px 0 #000000,
    0 6px 18px rgba(0, 0, 0, 0.95);
  line-height: 1.08;
}
.sf4-callout-box {
  margin-top: 8px;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(14, 18, 26, 0.92);
  border: 1.5px solid rgba(203, 213, 225, 0.45);
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Emblema Central "VS" Sumi-e con Impacto Incandescente */
.sf4-vs-center-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.sf4-vs-flare {
  position: absolute;
  width: 780px;
  height: 18px;
  background: radial-gradient(ellipse at center, #ffffff 0%, #ffae00 45%, transparent 75%);
  transform: rotate(-14deg);
  filter: blur(2px);
  animation: sf4FlareFlash 0.95s ease-out 0.92s backwards;
}
.sf4-vs-ink-splat {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, #050505 0%, #1a0502 48%, transparent 70%);
  box-shadow: 0 0 65px #ff3c00, 0 0 120px #ff9a00;
}
.sf4-vs-emblem {
  position: relative;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: clamp(4.8rem, 9vw, 7.6rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: #090909;
  -webkit-text-stroke: 3.5px #ff4800;
  text-shadow:
    0 0 22px #ffae00,
    0 0 42px #ff2a00,
    4px 6px 0 #000000;
  transform: rotate(-8deg);
  animation: sf4VsSlam 0.92s cubic-bezier(0.16, 1, 0.3, 1) 0.88s backwards;
}
.sf4-vs-sub {
  position: relative;
  margin-top: 6px;
  padding: 4px 16px;
  background: #070707;
  border: 2px solid #ffae00;
  color: #ffffff;
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9);
}
.sf4-skip-btn {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 12px 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6a00 0%, #b81400 100%);
  border: 2.5px solid #ffe082;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85), 0 0 24px rgba(255, 94, 0, 0.75);
}
.sf4-skip-btn:hover {
  transform: translateX(-50%) scale(1.06);
}

/* Callout Gigante "¡A JUGAR!" estilo "FIGHT!" sobre el Tapete */
.sf4-fight-callout {
  position: fixed;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-9deg);
  z-index: 430;
  pointer-events: none;
  padding: 18px 48px;
  background: radial-gradient(ellipse at center, rgba(10, 4, 2, 0.92) 0%, rgba(0, 0, 0, 0.75) 65%, transparent 100%);
  animation: sf4FightBurst 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.sf4-fight-callout span {
  display: block;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: clamp(3.4rem, 7vw, 5.8rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #ffffff 0%, #ffe066 32%, #ff5e00 72%, #b80c00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 94, 0, 0.95)) drop-shadow(4px 6px 0 #000000);
}
@keyframes sf4VsSlam {
  0% {
    opacity: 0;
    transform: scale(3.4) rotate(-18deg);
    color: #ffffff;
    filter: brightness(3);
  }
  45% {
    opacity: 1;
    transform: scale(0.92) rotate(-6deg);
    color: #ffffff;
    filter: brightness(2);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-8deg);
    color: #090909;
    filter: brightness(1);
  }
}
@keyframes sf4FlareFlash {
  0% { opacity: 0; transform: rotate(-14deg) scaleX(0.2); }
  35% { opacity: 1; transform: rotate(-14deg) scaleX(1.35); }
  100% { opacity: 0.45; transform: rotate(-14deg) scaleX(1); }
}
@keyframes sf4StageShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-10px, 6px, 0); }
  40% { transform: translate3d(10px, -8px, 0); }
  60% { transform: translate3d(-6px, 4px, 0); }
  80% { transform: translate3d(5px, -4px, 0); }
}
@keyframes sf4FightBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.6); }
  22% { opacity: 1; transform: translate(-50%, -50%) rotate(-9deg) scale(0.96); }
  72% { opacity: 1; transform: translate(-50%, -50%) rotate(-9deg) scale(1.04); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-9deg) scale(1.38); }
}

/* Riffle Shuffle visual sobre la Biblioteca */
.riffle-card-sheet {
  position: fixed;
  z-index: 415;
  pointer-events: none;
  width: 72px;
  height: 100px;
  border-radius: 8px;
  border: 1.5px solid rgba(242, 201, 76, 0.75);
  background: linear-gradient(145deg, #231b12 0%, #100c08 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f2c94c;
  font-size: 1.4rem;
}

/* Mano Inicial & Mulligan Escénico: Abanico Curvo + Salida Carta a Carta con Giro 3D */
#mulligan-modal .zone-modal-box {
  width: min(1180px, 96vw);
  max-width: 96vw;
  overflow: visible;
}
.mulligan-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 280px;
  padding: 28px 24px 36px;
  margin: 8px 0 12px;
  perspective: 1200px;
}
.mulligan-card {
  flex: 0 0 156px;
  width: 156px;
  height: 218px;
  margin: 0 -8px;
  padding: 0;
  border: none;
  background: transparent;
  position: relative;
  cursor: pointer;
  user-select: none;
  transform-style: preserve-3d;
  transform-origin: 50% 125%;
  transform: rotate(var(--mull-angle, 0deg)) translateY(var(--mull-y, 0px));
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease;
}
.mulligan-card.is-dealing {
  animation: mulliganFanDeal 0.98s cubic-bezier(0.22, 1, 0.36, 1) var(--deal-delay, 0ms) backwards;
}
.mulligan-card.is-returning {
  transform: translate3d(-320px, 140px, -60px) rotate(-28deg) scale(0.45) !important;
  opacity: 0 !important;
  transition: transform 0.38s ease-in, opacity 0.35s ease-in !important;
}
.mulligan-card:hover {
  z-index: 60 !important;
  transform: rotate(0deg) translateY(-22px) scale(1.14);
}
.mulligan-card.selected-bottom .mulligan-card-front {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.65), 0 16px 36px rgba(0, 0, 0, 0.8);
  filter: saturate(0.55) brightness(0.78);
}
.mulligan-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}
.mulligan-card.is-dealing .mulligan-card-inner {
  animation: mulliganCardFlip3D 0.98s cubic-bezier(0.22, 1, 0.36, 1) var(--deal-delay, 0ms) backwards;
}
.mulligan-card-back,
.mulligan-card-front {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.mulligan-card-back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 38%, #2c2015 0%, #100c08 78%);
  border: 2px solid rgba(205, 155, 102, 0.85);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.78), inset 0 0 18px rgba(242, 201, 76, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mull-back-sigil {
  font-size: 2.2rem;
  color: #f2c94c;
  text-shadow: 0 0 16px rgba(242, 201, 76, 0.65);
}
.mull-back-brand {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  color: rgba(248, 250, 252, 0.78);
}
.mulligan-card-front {
  background: #0d131d;
  border: 1.5px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
}
.mulligan-card-front img.mulligan-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.mulligan-card-front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(4, 7, 12, 0.96) 14%, rgba(4, 7, 12, 0.45) 55%, rgba(4, 7, 12, 0.55) 100%);
  z-index: 1;
}
.mull-front-top,
.mull-front-bottom {
  position: relative;
  z-index: 2;
}
.mull-front-top {
  display: flex;
  justify-content: flex-end;
}
.mull-land-tag {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.24);
  border: 1px solid rgba(52, 211, 153, 0.6);
  color: #a7f3d0;
}
.mull-front-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.mull-type-line {
  font-size: 0.62rem;
  color: rgba(226, 232, 240, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mull-front-bottom strong {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}
@keyframes mulliganFanDeal {
  0% {
    opacity: 0;
    transform: translate3d(-340px, 150px, -90px) rotate(-32deg) scale(0.45);
  }
  65% {
    opacity: 1;
    transform: rotate(calc(var(--mull-angle, 0deg) * 1.08)) translateY(calc(var(--mull-y, 0px) - 10px)) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: rotate(var(--mull-angle, 0deg)) translateY(var(--mull-y, 0px)) scale(1);
  }
}
@keyframes mulliganCardFlip3D {
  0% { transform: rotateY(180deg); }
  35% { transform: rotateY(180deg); }
  100% { transform: rotateY(0deg); }
}

/* Despliegue Carta a Carta en Abanico sobre #local-hand al quedarse la mano */
.hand-card.hand-dealing-in {
  animation: localHandFanDeal 0.92s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes localHandFanDeal {
  0% {
    opacity: 0;
    transform: translate3d(var(--deal-from-x, -260px), var(--deal-from-y, 40px), 60px) rotate(-24deg) rotateY(140deg) scale(0.5);
  }
  72% {
    opacity: 1;
    transform: translateY(calc(var(--fan-y, 0px) - 8px)) rotate(var(--fan-angle, 0deg)) rotateY(0deg) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(var(--fan-y, 0px)) rotate(var(--fan-angle, 0deg)) rotateY(0deg) scale(1);
  }
}

.mulligan-return-btn {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 380;
}
@media (max-width: 760px) {
  .mulligan-card { width: 108px; height: 152px; margin: 0 -16px; }
  .v2-intro-cmdr { width: 140px; }
}

/* =========================================================
   MECÁNICA «👁 ¿ENTRA?» + «🔒 SILENCIO DE MESA (8s)»
   ========================================================= */
.v2-entra-btn {
  position: fixed !important;
  right: 514px;
  bottom: 76px;
  left: auto;
  z-index: 150 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-width: 170px !important;
  min-height: 62px !important;
  padding: 16px 28px !important;
  border-radius: 999px !important;
  font-family: var(--font-heading) !important;
  font-size: 1.15rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.06em !important;
  background: radial-gradient(circle at 35% 25%, #64748b 0%, #334155 55%, #0f172a 100%) !important;
  border: 3px solid #cbd5e1 !important;
  color: #f8fafc !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75) !important;
  cursor: grab !important;
  user-select: none !important;
  touch-action: none !important;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.78), 0 0 22px rgba(148, 163, 184, 0.32), inset 0 2px 6px rgba(255, 255, 255, 0.28) !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease !important;
}
.v2-entra-btn:active,
.v2-entra-btn.is-dragging {
  cursor: grabbing !important;
  transform: scale(0.97) !important;
}
.v2-entra-btn:hover {
  transform: scale(1.04) !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.9), 0 0 30px rgba(203, 213, 225, 0.52), inset 0 2px 6px rgba(255, 255, 255, 0.38) !important;
}
.v2-entra-btn.is-armed {
  animation: entraPulseGlow 0.9s ease-in-out infinite alternate !important;
}
.table-workspace.sidebar-left ~ .v2-entra-btn {
  right: 214px;
}
@media (max-width: 900px) {
  .v2-entra-btn { right: 168px; bottom: 78px; min-width: 140px !important; min-height: 52px !important; padding: 12px 18px !important; font-size: 0.96rem !important; }
}
@keyframes entraPulseGlow {
  from { box-shadow: 0 12px 34px rgba(15, 23, 42, 0.78), 0 0 18px rgba(148, 163, 184, 0.35); }
  to { box-shadow: 0 16px 42px rgba(148, 163, 184, 0.7), 0 0 34px rgba(226, 232, 240, 0.75), inset 0 2px 8px rgba(255, 255, 255, 0.5); }
}

.v2-entra-overlay {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 390;
  width: min(680px, 94vw);
  pointer-events: auto;
  animation: entraDropIn 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes entraDropIn {
  from { opacity: 0; transform: translate(-50%, -24px) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.v2-entra-box {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 16px;
  border: 2px solid #f59e0b;
  background: linear-gradient(155deg, rgba(16, 19, 28, 0.97) 0%, rgba(9, 11, 17, 0.99) 100%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.85), 0 0 42px rgba(245, 158, 11, 0.42);
  backdrop-filter: blur(12px);
}
.v2-entra-card-preview {
  flex: 0 0 112px;
  width: 112px;
  height: 152px;
  border-radius: 10px;
  background-color: #0d131d;
  background-size: cover;
  background-position: center;
  border: 2px solid #fbbf24;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.75), 0 0 22px rgba(251, 191, 36, 0.45);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  transform: perspective(600px) rotateY(-8deg);
}
.v2-entra-card-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(4, 7, 12, 0.96) 15%, transparent 65%);
  z-index: 1;
}
.v2-entra-card-top,
.v2-entra-card-bottom {
  position: relative;
  z-index: 2;
}
.v2-entra-card-top {
  display: flex;
  justify-content: flex-end;
}
.v2-entra-card-bottom {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.v2-entra-card-bottom span {
  font-size: 0.56rem;
  color: rgba(226, 232, 240, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v2-entra-card-bottom strong {
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}
.v2-entra-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.v2-entra-kicker {
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: #fbbf24;
  text-transform: uppercase;
}
.v2-entra-info h3 {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  color: #ffffff;
  margin: 0;
}
.v2-entra-silence-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.55);
  color: #fecaca;
  font-size: 0.76rem;
}
.v2-entra-rule-hint {
  margin: 0;
  font-size: 0.74rem;
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.25);
  border-left: 2px solid #60a5fa;
  padding: 4px 8px;
  border-radius: 4px;
}
.v2-entra-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.v2-entra-progress-bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.v2-entra-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 55%, #34d399 100%);
  transition: width 0.08s linear;
}
.v2-entra-timer-txt {
  font-family: 'Space Mono', var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #fde68a;
  min-width: 38px;
  text-align: right;
}
.v2-entra-actions {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}
.v2-entra-pass-btn {
  flex: 1;
  font-weight: 800;
}
.v2-entra-respond-btn {
  flex: 1;
  background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%) !important;
  border: 1.5px solid #fca5a5 !important;
  color: #ffffff !important;
  font-weight: 900 !important;
}
.chat-chip.is-locked {
  opacity: 0.65;
  border-color: rgba(239, 68, 68, 0.65) !important;
  color: #fca5a5 !important;
}

/* Lupa Gigante de Carta Completa al pasar el ratón (Hover Zoom) */
.v2-card-zoom-preview {
  position: fixed;
  z-index: 480;
  pointer-events: none;
  width: 312px;
  border-radius: 16px;
  overflow: hidden;
  background: #0b0f17;
  border: 2px solid rgba(205, 155, 102, 0.85);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.92), 0 0 36px rgba(205, 155, 102, 0.35);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.12s ease, transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}
.v2-card-zoom-preview.is-visible {
  opacity: 1;
  transform: scale(1);
}
.v2-card-zoom-img {
  display: block;
  width: 100%;
  aspect-ratio: 63 / 88;
  object-fit: cover;
  background: #0d131d;
}
.v2-card-zoom-fallback {
  padding: 16px;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.v2-card-zoom-fallback strong {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: #fde68a;
}
.v2-card-zoom-fallback span {
  font-size: 0.78rem;
  color: #cbd5e1;
}
.v2-card-zoom-fallback p {
  font-size: 0.84rem;
  line-height: 1.45;
  color: #e2e8f0;
  margin: 0;
}
.v2-card-zoom-note {
  padding: 8px 12px;
  background: rgba(8, 11, 18, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  line-height: 1.35;
  color: #e2e8f0;
}
