/* Reset y estilos base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* CSS Variables - Tema oscuro (por defecto) */
:root {
  --bg-primary: #1E2022;
  --bg-secondary: rgba(82, 97, 107, 0.15);
  --bg-tertiary: rgba(82, 97, 107, 0.25);
  --text-primary: #F0F5F9;
  --text-secondary: rgba(240, 245, 249, 0.7);
  --text-tertiary: rgba(240, 245, 249, 0.5);
  --border-color: rgba(201, 214, 223, 0.2);
  --border-hover: rgba(201, 214, 223, 0.4);
  --accent-color: #C9D6DF;
  --fab-color: #52616B; /* Color FAB en tema oscuro */
  --button-bg: rgba(82, 97, 107, 0.3);
  --button-bg-hover: rgba(82, 97, 107, 0.5);
  --card-bg: rgba(82, 97, 107, 0.15);
  --nav-bg: rgba(30, 32, 34, 0.95);
  --shadow-color: rgba(0, 0, 0, 0.4);
  /* Variables para animación de respiración */
  --inhale-color: rgba(100, 200, 255, 0.9);
  --hold-color: rgba(255, 200, 100, 0.9);
  --hold-full-color: rgba(233, 30, 99, 0.9); /* Magenta vivo para retención llenos */
  --glow-color: rgba(240, 245, 249, 0.2);
  --stop-color: rgba(255, 107, 107, 0.3);
  --stop-bg: rgba(255, 107, 107, 0.1);
  --stop-bg-hover: rgba(255, 107, 107, 0.2);
  --stop-hover: rgba(255, 107, 107, 0.5);
}

/* CSS Variables - Tema claro */
[data-theme="light"] {
  --bg-primary: #F3EEEA;
  --bg-secondary: rgba(176, 166, 149, 0.2);
  --bg-tertiary: rgba(176, 166, 149, 0.3);
  --text-primary: #776B5D;
  --text-secondary: rgba(119, 107, 93, 0.7);
  --text-tertiary: rgba(119, 107, 93, 0.5);
  --border-color: rgba(176, 166, 149, 0.3);
  --border-hover: rgba(119, 107, 93, 0.5);
  --accent-color: #52616B;
  --button-bg: rgba(176, 166, 149, 0.4);
  --button-bg-hover: rgba(119, 107, 93, 0.3);
  --card-bg: rgba(176, 166, 149, 0.25);
  --nav-bg: rgba(243, 238, 234, 0.95);
  --shadow-color: rgba(119, 107, 93, 0.15);
  /* Variables para animación de respiración */
  --inhale-color: rgba(82, 97, 107, 0.8);
  --hold-color: rgba(176, 166, 149, 0.9);
  --hold-full-color: rgba(216, 27, 96, 0.85); /* Magenta ligeramente más suave */
  --glow-color: rgba(119, 107, 93, 0.2);
  --stop-color: rgba(255, 107, 107, 0.3);
  --stop-bg: rgba(255, 107, 107, 0.1);
  --stop-bg-hover: rgba(255, 107, 107, 0.2);
  --stop-hover: rgba(255, 107, 107, 0.5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
  padding-bottom: 70px; /* Espacio para el menú inferior */
}

/* Splash Screen */
#splashScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease-out;
}

#splashScreen p {
  margin-top: 20px;
  font-size: 18px;
  color: var(--text-secondary);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--text-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Contenido principal */
#mainContent {
  width: 100%;
  max-width: 800px;
  padding: 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 20px;
}

.header-left h1 {
  font-size: 24px;
  color: var(--text-primary);
  margin: 0;
}

.btn-theme {
  padding: 8px;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-theme:hover {
  background: var(--button-bg-hover);
  border-color: var(--border-hover);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-color);
}

/* Pantallas */
.screen {
  display: none;
}

.screen:not(.hidden) {
  display: block;
  position: relative; /* Para posicionar elementos absolutos */
}

/* Clase general para ocultar elementos */
.hidden {
  display: none !important;
  visibility: hidden !important;
}

/* HomeScreen también puede ocultarse */
#homeScreen.hidden {
  display: none;
}

#homeScreen:not(.hidden) {
  display: block;
}

.screen-title {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* Tab content */
.tab-content {
  display: none;
}

.tab-content.hidden {
  display: none;
}

.tab-content:not(.hidden) {
  display: block;
}

/* Grid de sesiones */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.session-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 25px 15px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative; /* Necesario para posicionar el botón de favorito */
}

.session-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.session-card:active {
  transform: translateY(0);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 10px 0;
  line-height: 1.3;
}

.card-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* Drag handle (icono de arrastre para reordenamiento) */
.drag-handle {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transition: all 0.2s ease-in-out;
  z-index: 10; /* Aumentado para asegurar que esté por encima */
  color: var(--text-tertiary);
  opacity: 0.6;
  pointer-events: auto; /* Asegurar que reciba eventos de puntero */
}

.drag-handle:hover {
  background: var(--bg-tertiary);
  opacity: 1;
  color: var(--text-secondary);
  transform: scale(1.05);
}

.drag-handle:active {
  cursor: grabbing;
  transform: scale(0.95);
}

/* Clases para SortableJS */
.sortable-ghost {
  opacity: 0.3;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border-color);
}

.sortable-drag {
  opacity: 1;
  transform: scale(1.02);
  box-shadow: 0 8px 20px var(--shadow-color);
}

/* Botón de favorito (estrella) */
.btn-favorite {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  z-index: 10;
}

.btn-favorite:hover {
  background: var(--bg-tertiary);
  transform: scale(1.1);
}

.btn-favorite:active {
  transform: scale(0.95);
}

.btn-favorite .star-icon {
  color: var(--text-tertiary);
  transition: all 0.2s ease-in-out;
}

.btn-favorite.active .star-icon {
  color: #FFD700; /* Estrella dorada */
  fill: #FFD700;
  stroke: #FFD700;
}

.btn-favorite.active {
  background: var(--bg-tertiary);
  border-color: rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* Estado vacío */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}

.empty-title {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.empty-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 300px;
}

.btn-primary {
  padding: 12px 24px;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
  background: var(--button-bg-hover);
  border-color: var(--border-hover);
}

/* FAB (Floating Action Button) */
.fab {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 100;
}

.fab:hover {
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 6px 16px var(--shadow-color);
}

.fab:active {
  transform: translateX(-50%) scale(0.95);
}

/* FAB en tema oscuro: usar color más oscuro */
:root .fab {
  background: var(--fab-color);
}

.fab.hidden {
  display: none;
}

/* Menú inferior (Bottom Navigation) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--nav-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 200;
  will-change: transform;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  color: var(--text-tertiary);
}

.nav-item:hover {
  color: var(--text-secondary);
}

.nav-item.active {
  color: var(--accent-color);
}

.nav-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* Session Screen */
#sessionScreen {
  padding-bottom: 100px; /* Espacio para el botón de parar y el menú inferior */
}

.session-header {
  display: flex;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-back:hover {
  background: var(--button-bg-hover);
}

.session-header h2 {
  font-size: 20px;
  margin: 0;
  color: var(--text-primary);
}

/* Círculo de animación */
/* Contenedor para el círculo y la onda expansiva */
.circle-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 100px auto 30px auto;
}

#circle {
  width: 200px;
  height: 200px;
  border: 8px solid var(--text-primary);
  border-radius: 50%;
  background: none;
  transform: scale(0.5);
  transform-origin: center center;
  transition: transform 4s ease-in-out, border-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 30px var(--glow-color);
  position: relative; /* Para posicionar elementos dentro */
}

/* Círculo oculto durante cuenta regresiva inicial */
#circle.hidden {
  display: none !important;
}

#circle.inhaling {
  transform: scale(2.0); /* 400px - Animación más pronunciada */
  border-color: var(--inhale-color);
  box-shadow: 0 0 40px var(--inhale-color);
}

#circle.exhaling {
  transform: scale(0.5);
  border-color: var(--text-primary);
  box-shadow: 0 0 30px var(--glow-color);
}

#circle.holding-full {
  transform: scale(2.0); /* 400px - Animación más pronunciada */
  border-color: var(--hold-full-color);
  box-shadow: 0 0 40px var(--hold-full-color);
  transition: none;
}

#circle.holding-empty {
  transform: scale(0.5);
  border-color: var(--hold-color);
  box-shadow: 0 0 40px var(--hold-color);
  transition: none;
}

/* Physiological Sigh - Fase 1: Crecimiento normal (0s → 3.5s) */
#circle.sigh-phase-1 {
  transform: scale(1.7); /* 340px */
  border-color: var(--inhale-color);
  box-shadow: 0 0 40px var(--inhale-color);
}

/* Physiological Sigh - Fase 2: Inhalación rápida (3.5s → 4s) */
#circle.sigh-phase-2 {
  transform: scale(2.0); /* 400px */
  border-color: var(--inhale-color);
  box-shadow: 0 0 50px var(--inhale-color);
}

/* Physiological Sigh - Fase 3: Desinflado (4s → 12s) */
#circle.sigh-phase-3 {
  transform: scale(0.5); /* 100px */
  border-color: var(--text-primary);
  box-shadow: 0 0 30px var(--glow-color);
}

/* ---- Onda expansiva de expiración ---- */
#ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(2.0);
}

/* Disparar al inicio de exhale (hermano adyacente dentro de .circle-wrapper) */
#circle.exhaling ~ #ripple,
#circle.sigh-phase-3 ~ #ripple {
  animation: ripple-expand 0.5s ease-out forwards;
}

@keyframes ripple-expand {
  0%   { transform: translate(-50%, -50%) scale(2.0); opacity: 0.45; }
  100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; }
}

/* Controles */
#controls {
  margin-top: 50px;
  margin-bottom: 30px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 10;
}

#stopBtn {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid var(--stop-color);
  border-radius: 8px;
  background: var(--stop-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease-in-out, border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  white-space: nowrap;
}

#stopBtn:hover:not(:disabled) {
  background: var(--stop-bg-hover);
  border-color: var(--stop-hover);
}

#stopBtn:active:not(:disabled) {
  transform: scale(0.98);
}

#stopBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Estado */
#status {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 20px;
}

/* Configuración */
.config-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.config-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 15px;
}

.config-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.config-btn {
  padding: 10px 20px;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.config-btn:hover {
  background: var(--button-bg-hover);
  border-color: var(--border-hover);
}

.config-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Pantalla de sesión Wim Hof */
.session-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.session-description {
  margin-bottom: 30px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
}

.session-description p {
  margin: 0 0 15px 0;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

.session-description p:last-child {
  margin: 0;
}

.session-benefits {
  color: var(--text-secondary);
  font-style: italic;
}

.session-instructions {
  color: var(--text-secondary);
  font-size: 13px;
}

.session-start-container {
  margin-bottom: 30px;
  text-align: center;
}

.btn-start {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid var(--fab-color);
  border-radius: 12px;
  background: var(--fab-color);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.btn-start:hover {
  background: var(--button-bg-hover);
  border-color: var(--fab-color);
  box-shadow: 0 6px 16px var(--shadow-color);
}

.btn-start:active {
  transform: translateY(0);
}

.session-controls {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
}

.controls-title {
  margin: 0 0 20px 0;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

.session-duration {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.duration-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.duration-value {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}



.control-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-minus,
.btn-plus {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-minus:hover,
.btn-plus:hover {
  background: var(--button-bg-hover);
  border-color: var(--border-hover);
}

.btn-minus:active,
.btn-plus:active {
  transform: scale(0.95);
}

.control-input input {
  width: 80px;
  height: 40px;
  padding: 0 10px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Ocultar flechas de inputs tipo number (Chrome, Safari, Edge, Opera) */
.control-input input[type=number]::-webkit-inner-spin-button,
.control-input input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Ocultar flechas de inputs tipo number (Firefox) */
.control-input input[type=number] {
  -moz-appearance: textfield;
}

/* Toggle Switch para habilitar retenciones */
.toggle-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.toggle-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  transition: 0.3s ease-in-out;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: var(--text-secondary);
  transition: 0.3s ease-in-out;
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: var(--accent-color);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(22px);
  background-color: var(--bg-primary);
}

.toggle-switch input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-color);
}

/* Animación suave para mostrar/ocultar grupo de retenciones */
#fourfoldHoldTimesGroup.hidden,
#wimHofHoldTimesGroup.hidden {
  display: none;
}

#fourfoldHoldTimesGroup,
#wimHofHoldTimesGroup {
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* Contenedor de contenido de retenciones (para superponer elementos) */
.hold-times-content {
  position: relative;
  min-height: 150px;
}

/* Mensaje de retenciones deshabilitadas */
.hold-times-empty {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
  font-style: italic;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  transition: opacity 0.3s ease-in-out;
}

/* Contenedor de filas de retención */
.hold-times-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transition: opacity 0.3s ease-in-out;
}

/* Ocultar elementos usando opacity y visibility */
.hold-times-empty.hidden,
.hold-times-container.hidden {
  opacity: 0;
  visibility: hidden;
  z-index: 0;
}

/* Mostrar elementos */
.hold-times-empty:not(.hidden),
.hold-times-container:not(.hidden) {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.control-input input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.control-group-full {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.control-subtitle {
  margin: 0 0 15px 0;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.hold-times-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hold-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 8px;
}

.hold-time-label {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.hold-time-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hold-time-inputs input {
  width: 50px;
  height: 32px;
  padding: 0 5px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.hold-time-unit {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Pantalla de ejecución (Wim Hof) */

/* Información de ronda (encima de la burbuja) */
.round-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
  text-align: center;
}

/* Información de ciclo (Fourfold) */
.cycle-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
  text-align: center;
}

.cycle-number {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.cycle-phase-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.round-number {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.phase-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Cuenta regresiva inicial (3, 2, 1) */
.countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  text-align: center;
  pointer-events: none; /* Para no bloquear clics */
  width: 100%;
}

.countdown-text {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.countdown-number {
  font-size: 120px;
  font-weight: 800;
  color: var(--accent-color);
  text-shadow: 0 0 30px var(--glow-color);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* Contador de respiraciones dentro de la burbuja */
.breath-counter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 80px;
  font-weight: 800;
  color: var(--text-primary);
  text-shadow: 0 0 20px var(--shadow-color);
  pointer-events: none; /* Para no bloquear clics */
}



/* Cuenta regresiva de retención */
.hold-countdown {
  position: absolute;
  top: 65%; /* Posicionada bajo la burbuja */
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none; /* Para no bloquear clics */
  text-align: center;
}

.hold-countdown-number {
  font-size: 100px;
  font-weight: 800;
  color: var(--accent-color);
  text-shadow: 0 0 30px var(--glow-color);
}

/* Botón de parar */
/* Botón de parar (genérico) */
.btn-stop {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid var(--accent-color);
  border-radius: 12px;
  background: var(--button-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease-in-out, border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.1s ease-in-out;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.btn-stop:hover {
  background: var(--button-bg-hover);
  border-color: var(--border-hover);
  box-shadow: 0 6px 16px var(--shadow-color);
}

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

.btn-stop:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mostrar botón de parar genérico cuando no tiene la clase .hidden */
#stopBtn:not(.hidden) {
  display: block !important;
  position: fixed;
  bottom: 70px; /* Menú inferior + 15px de margen */
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 400px;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid var(--stop-color);
  border-radius: 12px;
  background: var(--stop-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease-in-out, border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.1s ease-in-out;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 1000;
}

#stopBtn:not(.hidden):hover {
  background: var(--stop-bg-hover);
  border-color: var(--stop-hover);
  box-shadow: 0 6px 16px var(--shadow-color);
}

#stopBtn:not(.hidden):active {
  transform: translateX(-50%) scale(0.98);
}

/* Ocultar botón de volver durante sesiones (genérico) */
.session-running #backBtn {
  display: none !important;
}

/* Contenedores genéricos de sesión */
.session-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  position: relative;
}

.session-elements-above {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  pointer-events: none;
  z-index: 50;
}

.session-elements-below {
  position: absolute;
  top: 65%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  pointer-events: none;
  z-index: 50;
}

.circle-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 80px;
  font-weight: 800;
  color: var(--text-primary);
  text-shadow: 0 0 20px var(--shadow-color);
  pointer-events: none;
}

/* Popup de confirmación de detención */
.stop-confirmation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.stop-confirmation-content {
  background: var(--bg-primary);
  padding: 30px;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 30px var(--shadow-color);
  animation: slideUp 0.3s ease-in-out;
  z-index: 2001;
  position: relative;
}

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

.stop-confirmation-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 15px 0;
}

.stop-confirmation-message {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 25px 0;
  line-height: 1.5;
}

.stop-confirmation-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-stop-cancel {
  flex: 1;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  z-index: 2001;
}

.btn-stop-cancel:hover {
  background: var(--button-bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.btn-stop-accept {
  flex: 1;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border: 2px solid var(--fab-color);
  border-radius: 10px;
  background: var(--fab-color);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  z-index: 2001;
}

.btn-stop-accept:hover {
  background: var(--button-bg-hover);
  border-color: var(--fab-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

/* Responsive móvil */
@media (max-width: 480px) {
  /* Header */
  header h1 {
    font-size: 20px;
  }

  /* Grid de sesiones */
  .sessions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .session-card {
    padding: 20px 10px;
  }

  /* Círculo */
  #circle {
    width: 150px;
    height: 150px;
    border-width: 6px;
  }

  /* Botones de control */
  #stopBtn {
    width: 200px;
    font-size: 13px;
    padding: 12px 16px;
  }

  #controls {
    flex-direction: column;
    gap: 10px;
  }

  /* Header de sesión */
  .session-header {
    margin-bottom: 20px;
  }

  .session-header h2 {
    font-size: 18px;
  }

  /* Tabs */
  .tabs {
    gap: 5px;
  }

  .tab {
    padding: 10px 15px;
    font-size: 13px;
  }
}

/* Pantallas muy pequeñas (iPhone SE y similares) */
@media (max-width: 360px) {
  .sessions-grid {
    grid-template-columns: 1fr;
  }

  .session-card {
    padding: 25px 15px;
  }

  .nav-label {
    font-size: 10px;
  }

  .nav-item {
    padding: 4px 12px;
  }
}

/* ========================================================================
   PANTALLA DE FINALIZACIÓN DE SESIÓN
   ======================================================================== */

.session-complete-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  min-height: 100vh;
  text-align: center;
}

.completion-icon {
  margin-bottom: 2rem;
  color: var(--color-success, #10b981);
  animation: celebration-pulse 0.6s ease-out;
}

@keyframes celebration-pulse {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.completion-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-text, #1f2937);
}

.completion-message {
  font-size: 1.1rem;
  color: var(--color-text-secondary, #6b7280);
  margin-bottom: 2rem;
  max-width: 500px;
  line-height: 1.6;
}

.completion-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--color-bg-secondary, #f3f4f6);
  border-radius: var(--border-radius-lg, 1rem);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--color-text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary, #6366f1);
}

.completion-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 300px;
}

.completion-buttons button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--border-radius-md, 0.5rem);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast, 150ms);
}

.btn-primary {
  background: var(--color-primary, #6366f1);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark, #4f46e5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text, #1f2937);
}

.btn-secondary:hover {
  background: var(--color-bg-tertiary, #e5e7eb);
  transform: translateY(-1px);
}

.completion-buttons button svg {
  flex-shrink: 0;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .completion-title {
    color: var(--color-text-dark, #f9fafb);
  }
  
  .completion-message {
    color: var(--color-text-secondary-dark, #9ca3af);
  }
  
  .completion-stats {
    background: var(--color-bg-secondary-dark, #1f2937);
  }
  
  .btn-secondary {
    background: var(--color-bg-secondary-dark, #1f2937);
    color: var(--color-text-dark, #f9fafb);
  }
  
  .btn-secondary:hover {
    background: var(--color-bg-tertiary-dark, #374151);
  }
}

/* ========================================
   ESTADÍSTICAS
   ======================================== */

.stats-section {
  margin-bottom: 24px;
}

.stats-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tarjetas de estadísticas semanales */
.stats-weekly {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Estadísticas totales */
.stats-total {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
  border-bottom: none;
}

/* Lista de sesiones recientes */
.session-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 12px 16px;
}

.session-history-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-history-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.session-history-time {
  font-size: 13px;
  color: var(--text-secondary);
}

.session-history-stats {
  display: flex;
  gap: 8px;
}

.session-stat {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
}

/* Empty state en estadísticas */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
}

/* ========================================
   NOTIFICACIONES
   ======================================== */

.notification {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
}

.notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.notification-success {
  background: rgba(76, 175, 80, 0.9);
  color: white;
}

.notification-error {
  background: rgba(244, 67, 54, 0.9);
  color: white;
}

.notification-info {
  background: var(--card-bg);
  color: var(--text-primary);
}

/* ========================================
   CONFIGURACIÓN - Export/Import
   ======================================== */

.config-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  line-height: 1.4;
}

.config-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.full-width {
  width: 100%;
  justify-content: center;
  gap: 8px;
}

.hidden {
  display: none !important;
}

/* ========================================================================
   EDITOR DE SESIONES PERSONALIZADAS v2
   ======================================================================== */

/* ── Estructura principal ─────────────────────────────────────────────── */

#editorScreen {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 150;
  background: var(--bg-primary);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
  min-height: 56px;
}

.editor-header h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.btn-editor-save {
  background: var(--accent-color, #4A90E2);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}

.editor-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.editor-name-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 17px;
  color: var(--text-primary);
  margin-bottom: 20px;
  min-height: 52px;
  box-sizing: border-box;
  outline: none;
}

.editor-name-input:focus {
  border-color: var(--accent-color);
}

.editor-name-input.editor-input-error {
  border-color: #e74c3c;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
  gap: 16px;
}

.editor-duration {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.editor-duration span {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.editor-duration strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-try {
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
  white-space: nowrap;
}

/* ── Botón añadir ronda ───────────────────────────────────────────────── */

.btn-add-round {
  width: 100%;
  padding: 14px;
  margin-top: 4px;
  margin-bottom: 16px;
  background: transparent;
  border: 2px dashed var(--border-color);
  border-radius: 14px;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  min-height: 52px;
  touch-action: manipulation;
  transition: border-color 0.2s, color 0.2s;
}

.btn-add-round:active {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* ── Tarjeta de ronda ────────────────────────────────────────────────── */

.editor-round-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}

.round-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.round-card-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.round-card-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-round-ctrl {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn-round-ctrl-off {
  opacity: 0.25;
  cursor: default;
}

.btn-round-delete {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(231, 76, 60, 0.3);
  background: rgba(231, 76, 60, 0.08);
  color: #e74c3c;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

/* ── Lista de subfases ───────────────────────────────────────────────── */

.round-subfases-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px;
}

.subfase-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 10px 12px 14px;
  min-height: 64px;
  cursor: pointer;
  gap: 8px;
  touch-action: manipulation;
  transition: border-color 0.15s;
}

.subfase-block:active {
  border-color: var(--accent-color);
}

.subfase-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.subfase-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.subfase-summary {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subfase-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-sf-move {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn-sf-invisible {
  opacity: 0;
  pointer-events: none;
}

.btn-sf-delete {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(231, 76, 60, 0.3);
  background: rgba(231, 76, 60, 0.08);
  color: #e74c3c;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn-sf-spacer {
  width: 36px;
  height: 36px;
  display: inline-block;
}

/* ── Botón añadir técnica ─────────────────────────────────────────────── */

.btn-add-subfase {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: transparent;
  border: 1.5px dashed var(--border-color);
  border-radius: 10px;
  color: var(--accent-color);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
}

/* ── Sección hold post-ronda ─────────────────────────────────────────── */

.round-hold-section {
  padding: 14px 16px 10px;
  border-top: 1px solid var(--border-color);
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.round-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hold-type-group {
  display: flex;
  gap: 8px;
}

.btn-hold-type {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-hold-type.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

.hold-extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hold-extra-label {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
}

/* ── Stepper inline ───────────────────────────────────────────────────── */

.inline-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-stepper {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  flex-shrink: 0;
}

.stepper-val {
  min-width: 44px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-pill-toggle {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
  touch-action: manipulation;
}

.btn-pill-toggle.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

/* ── Pausa entre rondas ───────────────────────────────────────────────── */

.round-pause-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-color);
  margin-top: 0;
  gap: 12px;
}

/* ── Drawers / Bottom sheets ─────────────────────────────────────────── */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.drawer.hidden {
  display: none;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: relative;
  background: var(--bg-primary);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 82vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.drawer-open .drawer-panel {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.drawer-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

/* ── Lista del drawer de técnicas ────────────────────────────────────── */

.drawer-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.drawer-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  touch-action: manipulation;
}

.drawer-item:active {
  background: var(--bg-secondary);
}

.drawer-item-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.drawer-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}

.drawer-item-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.drawer-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.badge-soon {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-info {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.drawer-item-desc {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Config sheet (cuerpo) ───────────────────────────────────────────── */

.drawer-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sheet-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sheet-stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stepper-input {
  width: 72px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
  outline: none;
}

.stepper-input:focus {
  border-color: var(--accent-color);
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-pill {
  padding: 0 18px;
  height: 44px;
  border-radius: 22px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-pill.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}

.sheet-note {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
  margin: 0;
}

/* ── Footer del config sheet ─────────────────────────────────────────── */

.drawer-footer {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.btn-sheet-cancel {
  flex: 1;
  padding: 0 16px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-sheet-save {
  flex: 1;
  padding: 0 16px;
  height: 50px;
  border-radius: 12px;
  border: none;
  background: var(--accent-color);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

/* ── Tarjetas custom en home ─────────────────────────────────────────── */

.btn-custom-edit,
.btn-custom-delete {
  flex: 1;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  min-height: 40px;
  touch-action: manipulation;
}

.btn-custom-delete {
  color: #e74c3c;
  border-color: #e74c3c40;
}
