/* ==========================================================================
   Balatro Lite - Estética Retro de Casino Psicodélico y Arcade Táctil
   ========================================================================== */

:root {
  --bg-dark: #0a0e17;
  --bg-panel: rgba(15, 23, 42, 0.92);
  --felt-green: #07432b;
  --felt-border: #0d6e46;
  
  --chips-blue: #0284c7;
  --mult-red: #e11d48;
  --gold-coin: #f59e0b;
  --ante-cyan: #06b6d4;

  --card-w: 86px;
  --card-h: 124px;
  --card-rad: 10px;

  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-main);
  background: var(--bg-dark);
  color: #f8fafc;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Canvas psicodélico de fondo */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Efecto CRT Scanlines */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
  z-index: 99;
  opacity: 0.7;
}

.crt-overlay.disabled {
  display: none;
}

#appContainer {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.screen.hidden {
  display: none !important;
  opacity: 0;
}

/* ==========================================================================
   BOTONES ESTILO BALATRO (3D TÁCTILES)
   ========================================================================== */
.btn-balatro {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.6), 0 10px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
  position: relative;
}

.btn-balatro:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.6), 0 14px 24px rgba(0, 0, 0, 0.5);
}

.btn-balatro:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn-balatro:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.8);
  box-shadow: none;
}

.btn-balatro.btn-large {
  font-size: 1.35rem;
  padding: 16px 36px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: 2px solid #38bdf8;
}

.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  border: 2px solid #34d399;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: 2px solid #f87171;
}

.btn-secondary {
  background: linear-gradient(135deg, #334155, #1e293b);
  color: #e2e8f0;
  border: 2px solid #64748b;
}

.btn-pill {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pill:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: #38bdf8;
  transform: scale(1.04);
}

/* ==========================================================================
   1. PANTALLA: MENÚ PRINCIPAL
   ========================================================================== */
#screenMenu {
  justify-content: center;
}

.menu-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 500px;
  width: 100%;
}

.balatro-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 8px;
  position: relative;
}

.logo-letter {
  font-size: 4.5rem;
  font-weight: 900;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.7), 0 0 20px currentColor;
  animation: logoBounce 2.5s ease-in-out infinite;
  transform-origin: bottom center;
}

.letter-b { color: #38bdf8; animation-delay: 0.0s; }
.letter-a1 { color: #ef4444; animation-delay: 0.1s; }
.letter-l { color: #f59e0b; animation-delay: 0.2s; }
.letter-a2 { color: #10b981; animation-delay: 0.3s; }
.letter-t { color: #f97316; animation-delay: 0.4s; }
.letter-r { color: #a855f7; animation-delay: 0.5s; }
.letter-o { color: #06b6d4; animation-delay: 0.6s; }

.logo-sub {
  position: absolute;
  bottom: -14px;
  right: -10px;
  background: #f43f5e;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 2px 10px;
  border-radius: 6px;
  transform: rotate(-8deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

@keyframes logoBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

.menu-deck-badge {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 14px;
}

.menu-buttons .btn-balatro {
  width: 100%;
}

.menu-footer {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

/* ==========================================================================
   2. PANTALLA: SELECCIÓN DE CIEGA (BLIND SELECT)
   ========================================================================== */
.top-nav {
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px 20px;
}

.ante-indicator {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ante-label {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #38bdf8;
}

.ante-number {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
}

.top-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-pill {
  font-size: 1.1rem;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 12px;
}

.money-pill {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #422006;
  box-shadow: 0 4px 10px rgba(234, 179, 8, 0.4);
}

.blind-select-container {
  width: 100%;
  max-width: 1100px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #cbd5e1;
  text-transform: uppercase;
}

.blinds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}

.blind-card {
  background: var(--bg-panel);
  border: 3px solid #334155;
  border-radius: 20px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.blind-card.available:hover {
  transform: translateY(-6px);
  border-color: #38bdf8;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.6);
}

.blind-card.defeated {
  opacity: 0.5;
  filter: grayscale(0.8);
  border-color: #1e293b;
}

.blind-card.boss-card {
  border-color: #ef4444;
  background: radial-gradient(circle at 50% 20%, rgba(239, 68, 68, 0.15) 0%, var(--bg-panel) 70%);
}

.blind-badge-icon {
  font-size: 3rem;
  margin-bottom: -6px;
}

.blind-name {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
}

.blind-target-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.blind-target-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
}

.blind-target-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: #38bdf8;
}

.blind-reward {
  font-size: 1rem;
  font-weight: 800;
  color: #fbbf24;
}

.blind-desc {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  padding: 6px 12px;
  border-radius: 8px;
  line-height: 1.3;
}

.blind-tag-box {
  background: rgba(30, 41, 59, 0.8);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #cbd5e1;
  width: 100%;
}

.blind-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: auto;
}

.blind-actions .btn-balatro {
  width: 100%;
}

/* ==========================================================================
   3. PANTALLA: MESA DE JUEGO (PLAYING)
   ========================================================================== */
.jokers-consumables-bar {
  width: 100%;
  max-width: 1100px;
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.jokers-shelf {
  flex: 3;
  background: var(--bg-panel);
  border: 2px solid #334155;
  border-radius: 16px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.consumables-shelf {
  flex: 1.2;
  background: var(--bg-panel);
  border: 2px solid #334155;
  border-radius: 16px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shelf-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 900;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.jokers-row, .consumables-row {
  display: flex;
  gap: 8px;
  min-height: 82px;
  align-items: center;
}

.joker-slot, .consumable-slot {
  flex: 1;
  height: 80px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.joker-card-sm, .consumable-card-sm {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
}

.joker-card-sm:hover, .consumable-card-sm:hover {
  transform: translateY(-3px) scale(1.02);
}

.joker-card-sm.joker-active-step {
  animation: jokerTriggerAnim 0.35s ease-out;
  box-shadow: 0 0 25px #fbbf24 !important;
}

@keyframes jokerTriggerAnim {
  0% { transform: scale(1); }
  50% { transform: scale(1.2) translateY(-6px); }
  100% { transform: scale(1); }
}

.joker-controls-hover {
  position: absolute;
  bottom: 2px;
  right: 2px;
  display: flex;
  gap: 2px;
  opacity: 0.9;
}

.btn-micro {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-micro:hover {
  background: #ef4444;
}

/* Área central de juego: HUD + Mesa */
.game-stage {
  width: 100%;
  max-width: 1100px;
  flex: 1;
  display: flex;
  gap: 16px;
  overflow: hidden;
}

.score-hud {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.blind-info-card, .hand-calc-card {
  background: var(--bg-panel);
  border: 2px solid #334155;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-blind-type {
  font-size: 0.85rem;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.hud-target-val {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
}

.hud-boss-desc {
  font-size: 0.75rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  padding: 3px 6px;
  border-radius: 6px;
}

.hud-score-progress {
  width: 100%;
  height: 10px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 4px;
}

.hud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #f43f5e);
  transition: width 0.3s ease;
}

.hud-current-score {
  font-size: 1.5rem;
  font-weight: 900;
  text-align: right;
  color: #f8fafc;
}

.hand-calc-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fbbf24;
}

.hand-calc-level {
  font-size: 0.75rem;
  font-weight: 800;
  color: #38bdf8;
}

.calc-boxes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0;
}

.calc-box {
  flex: 1;
  padding: 8px 4px;
  border-radius: 10px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.chips-box {
  background: var(--chips-blue);
  color: #fff;
}

.calc-times {
  font-size: 1.6rem;
  font-weight: 900;
  color: #facc15;
  margin: 0 6px;
}

.mult-box {
  background: var(--mult-red);
  color: #fff;
}

.calc-box.pop {
  animation: numPopAnim 0.25s ease-out;
}

@keyframes numPopAnim {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.hand-total-preview {
  font-size: 1.1rem;
  font-weight: 900;
  text-align: center;
  color: #cbd5e1;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.res-box {
  padding: 8px 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.hands-box { background: linear-gradient(135deg, #1e40af, #2563eb); }
.discards-box { background: linear-gradient(135deg, #991b1b, #dc2626); }
.money-box { background: linear-gradient(135deg, #ca8a04, #eab308); color: #422006; }
.ante-box { background: linear-gradient(135deg, #0e7490, #06b6d4); }

.res-label {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.res-val {
  font-size: 1.4rem;
  font-weight: 900;
}

/* Tapete Verde y Cartas */
.felt-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.felt-table {
  flex: 1;
  background: radial-gradient(circle at 50% 50%, #065f46 0%, #047857 50%, #064e3b 100%);
  border: 4px solid var(--felt-border);
  border-radius: 24px;
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7), 0 15px 35px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.cards-fan {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

/* Carta Individual de Póker */
.card-unit {
  width: var(--card-w);
  height: var(--card-h);
  background: #ffffff;
  border-radius: var(--card-rad);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  border: 2px solid #e2e8f0;
}

.card-unit:hover {
  transform: translateY(-10px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.6);
}

.card-unit.selected {
  transform: translateY(-24px);
  border: 3px solid #facc15;
  box-shadow: 0 0 25px rgba(250, 204, 21, 0.9), 0 20px 30px rgba(0, 0, 0, 0.6);
}

.card-unit.scoring-now {
  animation: cardScoreBounce 0.35s ease-out;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 35px #38bdf8 !important;
}

@keyframes cardScoreBounce {
  0% { transform: translateY(-24px) scale(1); }
  50% { transform: translateY(-38px) scale(1.15); }
  100% { transform: translateY(-24px) scale(1); }
}

.card-top-left {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.card-rank { font-size: 1.25rem; font-weight: 900; }
.card-suit-sm { font-size: 1rem; }
.card-center-icon {
  font-size: 2.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-bot-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
  transform: rotate(180deg);
}

.card-badge-enh {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.card-badge-enh.bonus { background: #0284c7; }
.card-badge-enh.mult { background: #e11d48; }
.card-badge-enh.glass { background: #06b6d4; }
.card-badge-enh.steel { background: #64748b; }
.card-badge-enh.gold { background: #ca8a04; }

/* Controles de Juego Inferiores */
.play-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-buttons {
  display: flex;
  gap: 12px;
}

.btn-action {
  font-size: 1.15rem;
  padding: 14px 26px;
}

/* ==========================================================================
   4. PANTALLA: COBRO (CASHOUT)
   ========================================================================== */
#screenCashout {
  justify-content: center;
}

.cashout-modal {
  background: var(--bg-panel);
  border: 3px solid #334155;
  border-radius: 24px;
  padding: 36px 32px;
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cashout-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fbbf24;
  text-align: center;
}

.cashout-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cashout-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: #cbd5e1;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 10px;
}

.cashout-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  border-top: 2px solid #334155;
  padding-top: 14px;
}

.cashout-total-val {
  color: #facc15;
  font-size: 1.6rem;
}

/* ==========================================================================
   5. PANTALLA: TIENDA (SHOP)
   ========================================================================== */
#screenShop {
  justify-content: flex-start;
  overflow-y: auto;
}

.shop-jokers-bar {
  margin-top: 4px;
}

.shop-content {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.shop-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fbbf24;
}

.shop-money-badge {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #422006;
  font-size: 1.3rem;
  font-weight: 900;
  padding: 8px 18px;
  border-radius: 12px;
}

.shop-shelves-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.shelf-section {
  background: var(--bg-panel);
  border: 2px solid #334155;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shelf-title {
  font-size: 0.85rem;
  font-weight: 900;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.shop-cards-grid, .shop-packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.shop-item-card {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.shop-item-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
}

.shop-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-item-icon { font-size: 1.8rem; }
.shop-item-name { font-size: 0.95rem; font-weight: 800; color: #fff; line-height: 1.2; }
.shop-item-desc { font-size: 0.75rem; color: #cbd5e1; line-height: 1.3; }

.shop-item-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}

.shop-item-price { font-size: 1.15rem; font-weight: 900; color: #facc15; }

.shop-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
}

/* ==========================================================================
   MODALES
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-box {
  background: #0f172a;
  border: 3px solid #334155;
  border-radius: 22px;
  padding: 24px;
  max-width: 650px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
}

.btn-close:hover { color: #fff; }

.decks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.deck-choice-card {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deck-choice-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.deck-choice-card.active-deck {
  border-color: #facc15;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.4);
}

.pack-choices-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 24px 0;
  flex-wrap: wrap;
}

.stats-table-container {
  max-height: 400px;
  overflow-y: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.stats-table th, .stats-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #1e293b;
}

.stats-table th {
  color: #94a3b8;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MÓVILES Y PANTALLAS CHICAS)
   ========================================================================== */
@media (max-width: 850px) {
  :root {
    --card-w: 68px;
    --card-h: 100px;
    --card-rad: 8px;
  }

  body { overflow-y: auto; }

  .blinds-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .game-stage {
    flex-direction: column;
  }

  .score-hud {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .hand-calc-card, .blind-info-card {
    padding: 8px 12px;
  }

  .resources-grid {
    grid-column: span 2;
    grid-template-columns: repeat(4, 1fr);
  }

  .shop-shelves-grid {
    grid-template-columns: 1fr;
  }

  .logo-letter {
    font-size: 3rem;
  }
}
