/* ==========================================================================
   Simulador y reloj de las 12 campanadas de Nochevieja - Fijate Tools
   Tema oscuro por defecto (:root y [data-theme="dark"]) + [data-theme="light"]
   ========================================================================== */

:root,
[data-theme="dark"] {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta nocturna de Nochevieja / Puerta del Sol */
  --bg-page: #090d16;
  --bg-surface: #111827;
  --bg-card: #111827;
  --bg-card-header: #19243d;
  --bg-input: #0f172a;
  --bg-elevated: #1e293b;
  --bg-subtle: rgba(245, 158, 11, 0.08);

  --text-main: #f8fafc;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-color: #243247;
  --border-gold: rgba(251, 191, 36, 0.35);

  --primary: #f59e0b;
  --primary-color: #f59e0b;
  --primary-hover: #d97706;
  --primary-light: rgba(245, 158, 11, 0.14);

  --gold: #fbbf24;
  --gold-deep: #b45309;
  --gold-soft: rgba(251, 191, 36, 0.14);
  --grape-green: #22c55e;
  --grape-soft: rgba(34, 197, 94, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --success: #10b981;

  /* Variables específicas del escenario del reloj */
  --stage-bg: radial-gradient(circle at 50% 24%, #1e293b 0%, #0b1120 55%, #060911 100%);
  --stage-border: rgba(251, 191, 36, 0.24);
  --clock-building-fill: #1b2436;
  --clock-building-stroke: #3b4b68;
  --clock-face-bg: #fffdf5;
  --clock-face-rim: #fbbf24;
  --clock-ink: #0f172a;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 12px 32px -6px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 36px rgba(251, 191, 36, 0.16);
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-header: #f1f5f9;
  --bg-input: #f8fafc;
  --bg-elevated: #e2e8f0;
  --bg-subtle: #fffbeb;

  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border-color: #e2e8f0;
  --border-gold: #fcd34d;

  --primary: #d97706;
  --primary-color: #d97706;
  --primary-hover: #b45309;
  --primary-light: rgba(217, 119, 6, 0.12);

  --gold: #d97706;
  --gold-deep: #92400e;
  --gold-soft: #fef3c7;
  --grape-green: #16a34a;
  --grape-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --success: #059669;

  --stage-bg: radial-gradient(circle at 50% 24%, #eff6ff 0%, #e2e8f0 68%, #cbd5e1 100%);
  --stage-border: #cbd5e1;
  --clock-building-fill: #334155;
  --clock-building-stroke: #64748b;
  --clock-face-bg: #fffef9;
  --clock-face-rim: #d97706;
  --clock-ink: #0f172a;

  --shadow-card: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 24px rgba(217, 119, 6, 0.16);
}

/* Base y contención canónica */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.status-headline {
  font-family: var(--font-heading);
  margin-top: 0;
}

.mono,
code {
  font-family: var(--font-mono);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Layout principal canónico (PROHIBIDO flex-direction: column en .tool-with-sidebar) */
.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%;
}

/* Confeti festivo a pantalla completa */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9500;
}

/* ==========================================================================
   TEATRO DEL SIMULADOR (Compatible con modo normal y Fullscreen)
   ========================================================================== */
.campanadas-theater {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: clamp(1rem, 2.5vw, 1.75rem);
  margin-bottom: 2rem;
  position: relative;
}

.campanadas-theater:fullscreen {
  background: var(--bg-page);
  padding: 1.25rem clamp(1rem, 4vw, 3rem);
  overflow-y: auto;
  border-radius: 0;
  border: none;
}

.campanadas-theater:-webkit-full-screen {
  background: var(--bg-page);
  padding: 1.25rem clamp(1rem, 4vw, 3rem);
  overflow-y: auto;
  border-radius: 0;
  border: none;
}

/* Barra superior de modos y utilidades */
.theater-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.mode-segmented {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  max-width: 100%;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  min-height: 40px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.mode-tab-btn:hover {
  color: var(--text-main);
}

.mode-tab-btn.is-active {
  background: var(--primary);
  color: #0b0f17;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

[data-theme="light"] .mode-tab-btn.is-active {
  color: #ffffff;
}

.theater-utility-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  min-height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.btn-utility:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-utility.is-muted {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
  background: var(--danger-soft);
}

/* Barra de aviso de desbloqueo de audio en móviles */
.audio-unlock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  background: var(--gold-soft);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  margin-bottom: 1.25rem;
}

.audio-unlock-text {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 500;
}

.audio-unlock-text svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* Paneles de configuración por modo */
.mode-config-panel {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.practice-controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.control-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.control-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.6rem 40px 0.6rem 0.85rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Botones de acción principales */
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.94rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  touch-action: manipulation;
  text-decoration: none;
}

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

.btn-primary-gold {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #0b0f17;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.32);
}

.btn-primary-gold:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.45);
}

.btn-danger-stop {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger-stop:hover {
  background: #dc2626;
}

.btn-secondary-outline {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-whatsapp {
  background: #16a34a;
  color: #ffffff;
}

.btn-whatsapp:hover {
  background: #15803d;
}

/* Panel Modo Nochevieja en directo */
.live-panel-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.live-countdown-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.live-target-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grape-green);
  box-shadow: 0 0 8px var(--grape-green);
  animation: pulseDot 1.4s infinite ease-in-out;
}

.live-dot.is-simulated {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

.live-countdown-digits {
  font-size: clamp(1.45rem, 3.2vw, 2.25rem);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.live-clock-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.live-actions-col {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   CARTEL GIGANTE DE ESTADO Y ESCENARIO DEL RELOJ
   ========================================================================== */
.status-banner {
  border-radius: var(--radius-md);
  padding: 0.95rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border: 1.5px solid var(--border-color);
  background: var(--bg-input);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.status-banner.phase-ball {
  background: var(--info-soft);
  border-color: rgba(56, 189, 248, 0.55);
}

.status-banner.phase-quarters {
  background: var(--danger-soft);
  border-color: var(--danger);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.24);
  animation: alertPulse 0.9s infinite alternate;
}

.status-banner.phase-ready {
  background: var(--gold-soft);
  border-color: var(--primary);
}

.status-banner.phase-chimes {
  background: rgba(245, 158, 11, 0.16);
  border-color: var(--gold);
  box-shadow: 0 0 26px rgba(251, 191, 36, 0.24);
}

.status-banner.phase-finished {
  background: var(--grape-soft);
  border-color: var(--grape-green);
  box-shadow: 0 0 26px rgba(34, 197, 94, 0.24);
}

@keyframes alertPulse {
  from { box-shadow: 0 0 10px rgba(239, 68, 68, 0.18); }
  to { box-shadow: 0 0 26px rgba(239, 68, 68, 0.42); }
}

.status-text-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 260px;
}

.status-kicker {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}

.status-banner.phase-quarters .status-kicker {
  color: var(--danger);
}

.status-banner.phase-finished .status-kicker {
  color: var(--grape-green);
}

.status-headline {
  font-size: clamp(1.15rem, 2.5vw, 1.65rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  color: var(--text-main);
}

.status-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
}

.status-counter-pill {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  flex-shrink: 0;
}

.counter-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.counter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.counter-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
}

.counter-divider {
  width: 1px;
  height: 30px;
  background: var(--border-color);
}

/* Rejilla del escenario principal: Reloj Puerta del Sol + Panel de uvas */
.stage-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(280px, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

/* Columna izquierda: Reloj monumental SVG */
.clock-stage-card {
  background: var(--stage-bg);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glow);
}

.clock-stage-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  z-index: 2;
}

.clock-location-pill {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(251, 191, 36, 0.32);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

[data-theme="light"] .clock-location-pill {
  background: rgba(255, 255, 255, 0.88);
  color: var(--gold-deep);
}

.clock-digital-readout {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
}

[data-theme="light"] .clock-digital-readout {
  background: rgba(255, 255, 255, 0.92);
}

.clock-svg-wrapper {
  width: 100%;
  max-width: 370px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem auto;
}

.sol-clock-svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.35));
}

.clock-pulse-ring {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.clock-pulse-ring.is-chime {
  opacity: 1;
  stroke: #fbbf24;
  animation: chimeRingPulse 0.8s ease-out;
}

.clock-pulse-ring.is-quarter {
  opacity: 0.9;
  stroke: #ef4444;
  animation: chimeRingPulse 0.65s ease-out;
}

@keyframes chimeRingPulse {
  0% { stroke-width: 10; opacity: 1; }
  100% { stroke-width: 2; opacity: 0; }
}

.clock-bell-swing {
  transform-origin: 180px 56px;
}

.clock-bell-swing.is-ringing {
  animation: bellSwing 0.55s ease-in-out 2;
}

@keyframes bellSwing {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(9deg); }
  75% { transform: rotate(-9deg); }
  100% { transform: rotate(0deg); }
}

.clock-stage-caption {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  margin-top: 0.5rem;
}

[data-theme="light"] .clock-stage-caption {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

/* Columna derecha: Bandeja de 12 uvas e interacción */
.grapes-interaction-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.15rem;
}

.grapes-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.grapes-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--text-main);
}

.grapes-card-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0;
}

.quarters-indicator-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.quarter-pill {
  text-align: center;
  padding: 0.42rem 0.35rem;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.quarter-pill.is-active {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  transform: translateY(-1px);
}

.quarter-pill.is-done {
  background: var(--gold-soft);
  border-color: var(--border-gold);
  color: var(--gold);
}

/* Rejilla de las 12 uvas de la suerte */
.grapes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.grape-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.65rem 0.4rem;
  min-height: 76px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.grape-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #bef264 0%, #65a30d 55%, #3f6212 100%);
  box-shadow: inset -2px -3px 6px rgba(0, 0, 0, 0.32), 0 3px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.grape-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.grape-slot.is-current {
  border-color: var(--gold);
  background: var(--gold-soft);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.25);
  transform: scale(1.03);
}

.grape-slot.is-current .grape-icon {
  animation: grapeBounce 0.6s infinite alternate ease-in-out;
}

@keyframes grapeBounce {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

.grape-slot.is-eaten {
  border-color: var(--grape-green);
  background: var(--grape-soft);
}

.grape-slot.is-eaten .grape-icon {
  opacity: 0.25;
  transform: scale(0.65);
  filter: grayscale(0.4);
}

.grape-slot.is-missed {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.grape-slot.is-missed .grape-icon {
  background: radial-gradient(circle at 35% 30%, #fca5a5 0%, #ef4444 65%, #991b1b 100%);
}

.grape-check-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--grape-green);
}

.grape-slot.is-missed .grape-check-badge {
  color: var(--danger);
}

/* Botón gigante táctil para comer uva */
.eat-grape-action-area {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-eat-grape {
  width: 100%;
  min-height: 62px;
  padding: 0.9rem 1.25rem;
  border-radius: 14px;
  border: 2px solid rgba(132, 204, 22, 0.6);
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
  transition: transform 0.1s ease, filter 0.15s ease, opacity 0.2s ease;
  touch-action: manipulation;
}

.btn-eat-grape:hover:not(:disabled) {
  filter: brightness(1.06);
}

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

.btn-eat-grape:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: grayscale(0.4);
  box-shadow: none;
}

.btn-eat-grape.is-quarter-warning {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: #fca5a5;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

.eat-feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  min-height: 22px;
}

.eat-feedback-msg {
  font-weight: 600;
  color: var(--text-secondary);
}

.eat-feedback-msg.is-warn {
  color: var(--danger);
}

.eat-feedback-msg.is-good {
  color: var(--grape-green);
}

/* ==========================================================================
   TARJETA DE RESUMEN Y VIRALIDAD TRAS LAS 12 CAMPANADAS
   ========================================================================== */
.summary-result-card {
  margin-top: 1.5rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  animation: fadeSlideUp 0.35s ease;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.summary-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
}

.summary-rank-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid var(--border-gold);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
}

.summary-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.summary-metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
}

.summary-metric-val {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.summary-metric-lbl {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.summary-verdict-text {
  margin: 0 0 1rem 0;
  font-size: 0.94rem;
  color: var(--text-secondary);
}

.summary-actions-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   MODALES ACCESIBLES (Prohibido window.alert)
   ========================================================================== */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9800;
}

.app-modal-backdrop.is-open {
  display: flex;
}

.app-modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  color: var(--text-main);
}

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.app-modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-close:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.app-modal-body {
  padding: 1.25rem;
  font-size: 0.94rem;
  color: var(--text-secondary);
}

.app-modal-body ul {
  margin: 0.75rem 0 0 1.2rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-modal-footer {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ==========================================================================
   ADAPTACIÓN RESPONSIVE (Tablet y Móvil 375 px)
   ========================================================================== */
@media (max-width: 960px) {
  .stage-grid {
    grid-template-columns: 1fr;
  }

  .practice-controls-grid {
    grid-template-columns: 1fr 1fr;
  }

  .practice-controls-grid .control-field:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .tool-layout {
    margin: 1rem auto 2rem;
    padding: 0 0.75rem;
  }

  .campanadas-theater {
    padding: 1rem 0.85rem;
  }

  .mode-segmented {
    width: 100%;
  }

  .mode-tab-btn {
    flex: 1 1 0%;
    font-size: 0.82rem;
    padding: 0.55rem 0.45rem;
    white-space: nowrap;
  }

  .theater-utility-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .btn-utility {
    width: 100%;
    padding: 0.55rem 0.5rem;
    font-size: 0.82rem;
  }

  .practice-controls-grid {
    grid-template-columns: 1fr;
  }

  .practice-controls-grid .control-field:last-child {
    grid-column: auto;
  }

  .btn-action,
  .live-actions-col .btn-action,
  .summary-actions-row .btn-action {
    width: 100%;
  }

  .status-counter-pill {
    width: 100%;
    justify-content: space-around;
  }

  .grapes-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .grape-slot {
    min-height: 66px;
    padding: 0.45rem 0.25rem;
  }

  .grape-icon {
    width: 24px;
    height: 24px;
  }

  .summary-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .eat-feedback-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
