/* ==========================================================================
   Rummy Clásico de Fichas 3D - Estilos Oficiales
   Fichas de baquelita y marfil, atril de nogal y tapetes interactivos
   ========================================================================== */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --rummy-tile-bg: linear-gradient(145deg, #ffffff 0%, #fbf9f5 55%, #eee7dc 100%);
  --rummy-tile-border: #ded5c6;
  --rummy-tile-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 1px #ffffff, inset 0 -2px 3px rgba(0, 0, 0, 0.16);
  --rummy-tile-shadow-active: 0 0 0 3px #f59e0b, 0 12px 24px rgba(0, 0, 0, 0.45);

  --color-rummy-blue: #1d4ed8;
  --color-rummy-red: #dc2626;
  --color-rummy-yellow: #d97706;
  --color-rummy-black: #1e293b;

  --felt-green-bg: radial-gradient(circle at center, #134e2c 0%, #0a331c 70%, #051d10 100%);
  --felt-blue-bg: radial-gradient(circle at center, #1e3a5f 0%, #11253e 70%, #081321 100%);
  --felt-wood-bg: radial-gradient(circle at center, #422615 0%, #2b170c 70%, #170b05 100%);
}

/* Contención canónica obligatoria */
body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--font-main);
  background-color: var(--bg-body, #0b0f17);
  color: var(--text-main, #f1f5f9);
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* ==========================================================================
   Contenedor Principal del Juego
   ========================================================================== */
.rummy-game-wrapper {
  position: relative;
  background: #111827;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
}

/* Modo pantalla completa */
.rummy-game-wrapper:fullscreen {
  border-radius: 0;
  border: none;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0.5rem;
  box-sizing: border-box;
}

/* Barra de configuración y herramientas superior */
.rummy-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rummy-top-left,
.rummy-top-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.control-pill-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(30, 41, 59, 0.7);
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rummy-select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-family: var(--font-main);
  cursor: pointer;
  outline: none;
}

.rummy-select:focus {
  border-color: #3b82f6;
}

.btn-rummy-icon {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-rummy-icon:hover {
  background: #334155;
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

/* Marcador y avatares de jugadores */
.rummy-hud-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(10, 15, 26, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(30, 41, 59, 0.5);
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  transition: all 0.25s ease;
}

.player-badge.is-active-turn {
  background: rgba(30, 58, 138, 0.45);
  border-color: #3b82f6;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
}

.player-avatar-box {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  position: relative;
  flex-shrink: 0;
}

.is-active-turn .player-avatar-box {
  background: #2563eb;
  color: #ffffff;
}

.player-turn-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0f172a;
  display: none;
}

.is-active-turn .player-turn-dot {
  display: block;
}

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

.player-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  margin-bottom: 0.15rem;
}

.player-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-opened {
  font-size: 0.65rem;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
}

.status-pending {
  font-size: 0.65rem;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  padding: 1px 4px;
  border-radius: 4px;
}

.player-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.player-tile-count strong {
  color: #f1f5f9;
}

/* Indicador de turno y temporizador */
.rummy-turn-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  background: rgba(15, 23, 42, 0.85);
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.turn-banner {
  color: #cbd5e1;
}

.turn-highlight {
  color: #38bdf8;
  font-weight: 700;
}

.timer-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timer-bar-container {
  width: 80px;
  height: 6px;
  background: #334155;
  border-radius: 999px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: #10b981;
  transition: width 1s linear;
}

.timer-bar-fill.is-urgent {
  background: #ef4444;
}

.timer-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #94a3b8;
}

/* ==========================================================================
   Superficie de la Mesa / Tapete
   ========================================================================== */
.rummy-table-surface {
  position: relative;
  min-height: 380px;
  max-height: 480px;
  overflow-y: auto;
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease;
}

/* Temas de tapete */
.theme-felt-green .rummy-table-surface {
  background: var(--felt-green-bg);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6);
}

.theme-felt-blue .rummy-table-surface {
  background: var(--felt-blue-bg);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6);
}

.theme-wood-walnut .rummy-table-surface {
  background: var(--felt-wood-bg);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6);
}

/* Área central de juego con pozo y cuadrícula */
.table-play-area {
  display: flex;
  gap: 1rem;
  flex: 1;
}

/* Montón de robo lateral */
.deck-draw-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0.5rem;
  flex-shrink: 0;
}

.btn-draw-deck {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

.btn-draw-deck:hover:not(:disabled) {
  transform: translateY(-4px);
}

.btn-draw-deck:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.deck-3d-stack {
  width: 44px;
  height: 62px;
  background: #1e293b;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    2px 2px 0 #0f172a,
    4px 4px 0 #1e293b,
    6px 6px 0 #0f172a,
    8px 8px 14px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  position: relative;
}

.deck-badge {
  margin-top: 0.4rem;
  background: #0f172a;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.deck-label {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.2rem;
}

/* Cuadrícula de series de la mesa */
.rummy-board-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-content: flex-start;
}

.empty-board-hint {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.95rem;
  text-align: center;
  padding: 3rem 1rem;
}

.empty-board-hint p {
  margin-top: 0.75rem;
  max-width: 360px;
}

/* Conjunto / Set individual de fichas en la mesa */
.rummy-set-box {
  background: rgba(15, 23, 42, 0.45);
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 0.35rem 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  min-width: 140px;
  cursor: pointer;
}

.rummy-set-box:hover {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(15, 23, 42, 0.6);
}

.rummy-set-box.is-valid-set {
  border: 1.5px solid rgba(16, 185, 129, 0.45);
  background: rgba(6, 78, 59, 0.2);
}

.rummy-set-box.is-invalid-set {
  border: 1.5px solid rgba(239, 68, 68, 0.6);
  background: rgba(127, 29, 29, 0.25);
  animation: pulse-border 1.5s infinite;
}

.rummy-set-box.is-hinted-target {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.12) !important;
  animation: pulse-target-box 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

@keyframes pulse-target-box {
  0% {
    box-shadow: 0 0 0 2px #f59e0b, 0 0 10px rgba(245, 158, 11, 0.35);
  }
  100% {
    box-shadow: 0 0 0 3px #fbbf24, 0 0 22px rgba(251, 191, 36, 0.65);
  }
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(239, 68, 68, 0.6); }
  50% { border-color: rgba(239, 68, 68, 1); }
}

.set-header-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.badge-valid {
  color: #34d399;
}

.badge-invalid {
  color: #f87171;
  font-weight: 600;
}

.btn-split-set {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-split-set:hover {
  background: #334155;
  color: #38bdf8;
}

.set-tiles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ==========================================================================
   Fichas de Rummy en 3D (Baquelita / Marfil)
   ========================================================================== */
.rummy-tile {
  width: 42px;
  height: 58px;
  background: var(--rummy-tile-bg);
  border: 1px solid var(--rummy-tile-border);
  border-radius: 6px;
  box-shadow: var(--rummy-tile-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.18s ease;
  position: relative;
  flex-shrink: 0;
}

.rummy-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), inset 0 1px 1px #ffffff;
}

.rummy-tile.is-selected {
  transform: translateY(-10px) scale(1.08);
  box-shadow: var(--rummy-tile-shadow-active);
  z-index: 25;
}

.rummy-tile.is-hinted {
  border: 2px solid #f59e0b !important;
  z-index: 20;
  animation: pulse-hint-gold 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.rummy-tile.is-hinted::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: radial-gradient(circle at 50% 25%, rgba(251, 191, 36, 0.35) 0%, rgba(245, 158, 11, 0.12) 65%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

@keyframes pulse-hint-gold {
  0% {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 0 0 3px #f59e0b, 0 0 14px 4px rgba(245, 158, 11, 0.7), 0 8px 16px rgba(0, 0, 0, 0.5);
  }
  100% {
    transform: translateY(-10px) scale(1.12);
    box-shadow: 0 0 0 4px #fbbf24, 0 0 28px 8px rgba(251, 191, 36, 0.95), 0 12px 24px rgba(0, 0, 0, 0.6);
  }
}

.tile-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  position: relative;
  z-index: 2;
}

.tile-number {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}

.tile-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 3px;
  opacity: 0.85;
}

/* Colores de las fichas */
.tile-blue .tile-number {
  color: var(--color-rummy-blue);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}
.tile-blue .tile-pip {
  background: var(--color-rummy-blue);
}

.tile-red .tile-number {
  color: var(--color-rummy-red);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}
.tile-red .tile-pip {
  background: var(--color-rummy-red);
}

.tile-yellow .tile-number {
  color: var(--color-rummy-yellow);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
.tile-yellow .tile-pip {
  background: var(--color-rummy-yellow);
}

.tile-black .tile-number {
  color: var(--color-rummy-black);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
.tile-black .tile-pip {
  background: var(--color-rummy-black);
}

/* Comodín (Joker) */
.tile-is-joker .tile-joker-icon,
.tile-joker-red .tile-joker-icon,
.tile-joker-black .tile-joker-icon {
  color: #dc2626;
  margin-top: -2px;
}

.tile-joker-black .tile-joker-icon {
  color: #1e293b;
}

.tile-joker-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #713f12;
  margin-top: 2px;
}

/* ==========================================================================
   Atril de Madera 3D del Jugador
   ========================================================================== */
.rummy-rack-wrapper {
  background: #18110b;
  border-top: 2px solid #5a3821;
  padding: 0.75rem 1rem 1rem;
  box-shadow: inset 0 8px 16px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rack-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rack-label-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #d4a373;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rack-sort-buttons {
  display: flex;
  gap: 0.4rem;
}

.btn-rack-action {
  background: #2b170c;
  border: 1px solid #5a3821;
  color: #f1ece4;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.btn-rack-action:hover {
  background: #422615;
  color: #fbbf24;
  border-color: #d4a373;
}

/* Ranuras escalonadas del atril de nogal */
.rummy-player-rack {
  min-height: 80px;
  background: linear-gradient(to bottom, #2b170c 0%, #1e1008 100%);
  border-radius: 8px;
  border: 1px solid #4a2d1a;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-start;
}

.empty-rack-msg {
  color: #a89f91;
  font-size: 0.85rem;
  width: 100%;
  text-align: center;
}

/* ==========================================================================
   Barra de Acciones del Turno
   ========================================================================== */
.rummy-turn-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.turn-actions-left,
.turn-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-rummy-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: all 0.2s ease;
}

.btn-rummy-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5);
}

.btn-rummy-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-rummy-secondary {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.btn-rummy-secondary:hover:not(:disabled) {
  background: #334155;
  border-color: rgba(255, 255, 255, 0.25);
  color: #38bdf8;
}

.btn-rummy-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Historial y Crónica de Jugadas
   ========================================================================== */
.rummy-log-details {
  background: rgba(15, 23, 42, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.rummy-log-summary {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rummy-log-summary:hover {
  color: #f1f5f9;
}

.rummy-history-log {
  max-height: 140px;
  overflow-y: auto;
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.76rem;
}

.history-log-row {
  color: #cbd5e1;
  display: flex;
  gap: 0.5rem;
}

.history-time {
  color: #64748b;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ==========================================================================
   Modales Accesibles (Sin window.alert)
   ========================================================================== */
.rummy-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.rummy-modal-overlay.is-open {
  display: flex;
}

.rummy-modal-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-sizing: border-box;
  color: #f8fafc;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.rummy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rummy-modal-header h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.35rem;
}

.btn-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
}

.btn-modal-close:hover {
  color: #f8fafc;
}

/* Modal de Victoria */
.win-modal-body {
  text-align: center;
  padding: 1rem 0;
}

.win-trophy-icon {
  color: #f59e0b;
  margin-bottom: 0.75rem;
}

.win-scores-list {
  background: #1e293b;
  border-radius: 10px;
  padding: 0.75rem;
  margin: 1.2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.win-score-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.win-score-row.is-winner-row {
  color: #34d399;
  font-weight: 700;
}

/* Modal de Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin: 1.2rem 0;
}

.stat-box {
  background: #1e293b;
  border-radius: 10px;
  padding: 0.85rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 0.2rem;
}

.stat-label {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Toast de notificación */
.rummy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: #1e293b;
  color: #f8fafc;
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  max-width: 90vw;
  text-align: center;
}

.rummy-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.rummy-toast.toast-warning {
  border-color: #f59e0b;
  background: #272115;
  color: #fef3c7;
}

/* Canvas Confeti */
.rummy-confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
}

/* ==========================================================================
   Adaptabilidad Móvil y Tablets (Responsive)
   ========================================================================== */
@media (max-width: 768px) {
  .tool-layout {
    padding: 0 0.5rem;
    margin: 1rem auto 2rem;
  }

  .rummy-tile {
    width: 34px;
    height: 48px;
    border-radius: 5px;
  }

  .tile-number {
    font-size: 1.25rem;
  }

  .tile-pip {
    width: 4px;
    height: 4px;
  }

  .rummy-player-rack {
    min-height: 65px;
    padding: 0.5rem;
    gap: 0.3rem;
  }

  .table-play-area {
    flex-direction: column;
  }

  .deck-draw-zone {
    flex-direction: row;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.2rem 0;
  }

  .deck-3d-stack {
    width: 36px;
    height: 50px;
  }

  .rummy-top-bar {
    padding: 0.5rem;
  }

  .control-pill-group {
    font-size: 0.72rem;
    padding: 0.2rem 0.4rem;
  }

  .rummy-turn-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .turn-actions-left,
  .turn-actions-right {
    width: 100%;
    justify-content: stretch;
  }

  .btn-rummy-primary,
  .btn-rummy-secondary {
    flex: 1;
    justify-content: center;
    font-size: 0.82rem;
    padding: 0.6rem 0.8rem;
  }
}
