/* ===== TIMER & CRONÓMETRO - DISEÑO MODERNO ===== */

/* Variables del tema */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #ffffff;
    --surface: #f8fafc;
    --surface-light: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base del body */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Temas */
body.theme-dark {
    --background: #0f0f23;
    --surface: #1a1a2e;
    --surface-light: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
}

body.theme-light {
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-light: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
}

body.theme-rosa {
    --background: #fdf2f8;
    --surface: #ffffff;
    --surface-light: #fce7f3;
    --text-primary: #831843;
    --text-secondary: #be185d;
    --text-muted: #ec4899;
    --border: #f9a8d4;
    --primary-color: #ec4899;
    --primary-dark: #db2777;
}

body.theme-neon {
    --background: #0a0a0a;
    --surface: #1a1a2e;
    --surface-light: #16213e;
    --text-primary: #00ffff;
    --text-secondary: #c4b5fd;
    --text-muted: #a78bfa;
    --border: #3730a3;
    --primary-color: #8b5cf6;
    --primary-dark: #7c3aed;
}

/* === LAYOUT PRINCIPAL === */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    position: relative;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.app-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.app-title svg {
    color: var(--primary-color);
}

.app-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.timer-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Botón de volver */
.volver-menu {
    position: relative;
    z-index: 10;
}

.volver-menu button {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volver-menu button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.button-shadow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    z-index: -1;
    transform: translateY(2px);
}

/* === SELECTOR DE MODO === */
.mode-selector {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.mode-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
}

.mode-icon {
    font-size: 1.5rem;
}

.mode-text {
    font-weight: 500;
}

/* === PANELES === */
.timer-panel {
    display: none;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.timer-panel.active {
    display: block;
}

/* === DISPLAY DE TIEMPO === */
.time-display {
    text-align: center;
    margin-bottom: 2rem;
}

/* === MEJORAS DE LEGIBILIDAD === */
@media (max-width: 768px) {
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    .time-display-large {
        line-height: 1.2;
        word-spacing: 0.1em;
    }
    
    .app-title,
    .app-subtitle,
    .quick-presets h3,
    .alarms-section h3,
    .laps-section h3,
    .config-header h3 {
        line-height: 1.4;
        word-spacing: 0.05em;
    }
    
    .time-input-group label,
    .alarm-input-group label,
    .config-group label {
        line-height: 1.3;
    }
}

.time-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.time-input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.time-input {
    width: 80px;
    height: 50px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-light);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    transition: var(--transition);
}

.time-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.time-separator {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 1.5rem;
}

.time-display-large {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
}

.time-unit {
    display: inline-block;
    min-width: 1.2em;
    text-align: center;
}

.time-separator-large {
    color: var(--text-muted);
    margin: 0 0.2rem;
}

.milliseconds {
    font-size: 0.6em;
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.8;
}

/* === CONTROLES === */
.timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* === MEJORAS PARA DISPOSITIVOS TÁCTILES === */
@media (hover: none) and (pointer: coarse) {
    .control-btn {
        min-height: 44px; /* Tamaño mínimo recomendado para toque */
        touch-action: manipulation;
    }
    
    .time-input {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .preset-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .theme-btn {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .config-btn {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .remove-alarm {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
}

.control-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

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

.control-btn.primary {
    background: var(--primary-color);
    color: white;
}

.control-btn.primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.control-btn.secondary {
    background: var(--secondary-color);
    color: white;
}

.control-btn.secondary:hover:not(:disabled) {
    background: #475569;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.control-btn.danger {
    background: var(--danger-color);
    color: white;
}

.control-btn.danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.control-btn.success {
    background: var(--success-color);
    color: white;
}

.control-btn.success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* === PRESETS RÁPIDOS === */
.quick-presets {
    background: var(--surface-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.quick-presets h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}

.preset-btn {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

/* === SECCIÓN DE ALARMAS === */
.alarms-section {
    background: var(--surface-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.alarms-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.alarm-inputs {
    display: flex;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.alarm-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alarm-input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.alarm-input {
    width: 100px;
    height: 40px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.alarm-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.alarms-list {
    max-height: 200px;
    overflow-y: auto;
}

.alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.alarm-time {
    font-weight: 600;
    color: var(--text-primary);
}

.remove-alarm {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.remove-alarm:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.no-alarms {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin: 1rem 0;
}

/* === SECCIÓN DE VUELTAS === */
.laps-section {
    background: var(--surface-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.laps-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.laps-list {
    max-height: 200px;
    overflow-y: auto;
}

.lap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.lap-number {
    font-weight: 600;
    color: var(--primary-color);
}

.lap-time {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.no-laps {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin: 1rem 0;
}

/* === MODAL DE CONFIGURACIÓN === */
.config-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.config-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.config-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.config-body {
    padding: 1.5rem;
}

.config-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.config-group:last-child {
    border-bottom: none;
}

.config-group label {
    color: var(--text-primary);
    font-weight: 500;
}

.config-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

/* === MODO PANTALLA COMPLETA === */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Ocultar header cuando está en modo pantalla completa */
.fullscreen-mode.active ~ .app-header,
.fullscreen-mode.active + .app-header {
    display: none !important;
}

/* Ocultar header cuando el modo pantalla completa está activo */
body:has(.fullscreen-mode.active) .app-header {
    display: none !important;
}

/* Fallback para navegadores que no soportan :has() */
.fullscreen-mode.active ~ * .app-header {
    display: none !important;
}

.fullscreen-mode.active {
    display: flex;
}

/* Asegurar que el selector de temas mantenga su posición absoluta */
.fullscreen-mode .fullscreen-theme-selector {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    z-index: 1000 !important;
}

.fullscreen-time-display {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.fullscreen-time {
    font-size: 12rem;
    font-weight: 900;
    color: #ffffff;
    font-family: Arial, sans-serif;
    letter-spacing: 0.2em;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.fullscreen-time .time-unit {
    display: inline-block;
    min-width: 1.5em;
    text-align: center;
    font-weight: 900;
}

.fullscreen-time .time-separator {
    color: #ffffff;
    margin: 0 0.3rem;
    font-weight: 900;
}

.fullscreen-time .milliseconds {
    font-size: 0.4em;
    color: #cccccc;
    font-weight: 700;
    margin-left: 0.5rem;
}

.fullscreen-label {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.fullscreen-controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.fullscreen-controls.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fullscreen-controls .control-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    min-width: 150px;
}

/* Estados especiales en pantalla completa */
.fullscreen-mode.timer-running .fullscreen-time {
    color: #ffffff;
}

.fullscreen-mode.timer-warning .fullscreen-time {
    color: #ffffff;
}

.fullscreen-mode.timer-danger .fullscreen-time {
    color: #ffffff;
}

/* === TEMAS PARA MODO PANTALLA COMPLETA === */

/* Tema Oscuro para Pantalla Completa */
.fullscreen-mode.theme-dark {
    background: #000000 !important;
}

.fullscreen-mode.theme-dark .fullscreen-time {
    color: #ffffff !important;
}

.fullscreen-mode.theme-dark .fullscreen-label {
    color: #ffffff !important;
}

.fullscreen-mode.theme-dark .fullscreen-controls .control-btn {
    background: #1f2937 !important;
    color: #ffffff !important;
    border: 1px solid #374151 !important;
}

.fullscreen-mode.theme-dark .fullscreen-controls .control-btn:hover {
    background: #374151 !important;
}

/* Tema Claro para Pantalla Completa */
.fullscreen-mode.theme-light {
    background: #ffffff !important;
}

.fullscreen-mode.theme-light .fullscreen-time {
    color: #1f2937 !important;
}

.fullscreen-mode.theme-light .fullscreen-label {
    color: #374151 !important;
}

.fullscreen-mode.theme-light .fullscreen-controls .control-btn {
    background: #f3f4f6 !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
}

.fullscreen-mode.theme-light .fullscreen-controls .control-btn:hover {
    background: #e5e7eb !important;
}

/* Tema Rosa para Pantalla Completa */
.fullscreen-mode.theme-rosa {
    background: #fdf2f8 !important;
}

.fullscreen-mode.theme-rosa .fullscreen-time {
    color: #831843 !important;
}

.fullscreen-mode.theme-rosa .fullscreen-label {
    color: #be185d !important;
}

.fullscreen-mode.theme-rosa .fullscreen-controls .control-btn {
    background: #ec4899 !important;
    color: #ffffff !important;
    border: 1px solid #db2777 !important;
}

.fullscreen-mode.theme-rosa .fullscreen-controls .control-btn:hover {
    background: #db2777 !important;
}

/* Tema Neon para Pantalla Completa */
.fullscreen-mode.theme-neon {
    background: #0a0a0a !important;
}

.fullscreen-mode.theme-neon .fullscreen-time {
    color: #00ffff !important;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5) !important;
}

.fullscreen-mode.theme-neon .fullscreen-label {
    color: #c4b5fd !important;
    text-shadow: 0 0 5px rgba(196, 181, 253, 0.5) !important;
}

.fullscreen-mode.theme-neon .fullscreen-controls .control-btn {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border: 1px solid #7c3aed !important;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3) !important;
}

.fullscreen-mode.theme-neon .fullscreen-controls .control-btn:hover {
    background: #7c3aed !important;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5) !important;
}

/* Estilos para el selector de temas */
    .fullscreen-theme-selector {
        position: absolute !important;
        top: 1rem !important;
        right: 1rem !important;
        display: flex;
        gap: 0.5rem;
        z-index: 1000;
    }

/* Reutilizar los estilos del salvapantallas para los botones de tema */
.fullscreen-theme-selector .screensaver-theme-btn {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.fullscreen-theme-selector .screensaver-theme-btn:hover {
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.fullscreen-theme-selector .screensaver-theme-btn.active {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.6);
    transform: scale(1.2);
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.4);
}

    /* === CANVAS DE RUIDO COMO FONDO === */
    .noise-bg-canvas {
        position: absolute;
        top: 0; left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 0;
        pointer-events: none;
        opacity: 0.35;
        transition: opacity 0.3s;
        background: transparent;
        display: none;
    }

    .fullscreen-mode.noise-bg-active .noise-bg-canvas {
        display: block;
    }

    .fullscreen-mode > *:not(.noise-bg-canvas) {
        position: relative;
        z-index: 10;
    }

    /* Opcional: nivel de ruido como overlay */
    .noise-level-bg {
        position: absolute;
        left: 50%;
        top: 1.5rem;
        transform: translateX(-50%);
        color: #fff;
        font-size: 1.1rem;
        font-weight: bold;
        z-index: 15;
        text-shadow: 0 2px 8px #000, 0 0 2px #fff;
        pointer-events: none;
        opacity: 0.7;
    }

    /* === VISUALIZADOR DE RUIDO (ANTIGUO) === */
    .noise-visualizer {
        position: absolute;
        top: 2rem;
        left: 2rem;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 10px;
        padding: 1rem;
        z-index: 1000;
        display: none;
    }

    .noise-visualizer.active {
        display: block;
    }

    #noise-canvas {
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 5px;
        background: rgba(0, 0, 0, 0.5);
    }

    .noise-level {
        text-align: center;
        color: #ffffff;
        font-size: 0.9rem;
        margin-top: 0.5rem;
        font-weight: 600;
    }

    /* Temas para el visualizador */
    .fullscreen-mode.theme-dark .noise-visualizer {
        background: rgba(0, 0, 0, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .fullscreen-mode.theme-light .noise-visualizer {
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(0, 0, 0, 0.2);
    }

    .fullscreen-mode.theme-light .noise-level {
        color: #1f2937;
    }

    .fullscreen-mode.theme-rosa .noise-visualizer {
        background: rgba(236, 72, 153, 0.9);
        border: 1px solid rgba(219, 39, 119, 0.3);
    }

    .fullscreen-mode.theme-neon .noise-visualizer {
        background: rgba(0, 0, 0, 0.8);
        border: 1px solid rgba(0, 255, 255, 0.3);
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    }

    .fullscreen-mode.theme-neon .noise-level {
        color: #00ffff;
        text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    }

/* === BOTÓN DE CONFIGURACIÓN === */
.config-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 100;
}

.config-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* === ESTADOS ESPECIALES === */
.timer-running .time-display-large {
    color: var(--success-color);
    animation: pulse 2s infinite;
}

.timer-warning .time-display-large {
    color: var(--warning-color);
    animation: pulse 1s infinite;
}

.timer-danger .time-display-large {
    color: var(--danger-color);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* === TEMAS === */

/* Tema Dark */
body.theme-dark {
    --background: #0f0f23;
    --surface: #1a1a2e;
    --surface-light: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
}

body.theme-dark .app-header {
    background: rgba(0, 0, 0, 0.3);
    border-bottom-color: rgba(100, 255, 218, 0.1);
}

body.theme-dark .volver-menu button {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(100, 255, 218, 0.2);
}

body.theme-dark .volver-menu button:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(100, 255, 218, 0.3);
}

/* Tema Light */
body.theme-light {
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-light: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
}

body.theme-light .app-header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(59, 130, 246, 0.1);
}

body.theme-light .volver-menu button {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(59, 130, 246, 0.2);
}

body.theme-light .volver-menu button:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Tema Rosa */
body.theme-rosa {
    --background: #fdf2f8;
    --surface: #ffffff;
    --surface-light: #fce7f3;
    --text-primary: #831843;
    --text-secondary: #be185d;
    --text-muted: #ec4899;
    --border: #f9a8d4;
    --primary-color: #ec4899;
    --primary-dark: #db2777;
}

body.theme-rosa .app-header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(219, 39, 119, 0.1);
}

body.theme-rosa .volver-menu button {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(219, 39, 119, 0.2);
}

body.theme-rosa .volver-menu button:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(219, 39, 119, 0.3);
}

/* Tema Neon */
body.theme-neon {
    --background: #0a0a0a;
    --surface: #1a1a2e;
    --surface-light: #16213e;
    --text-primary: #00ffff;
    --text-secondary: #c4b5fd;
    --text-muted: #a78bfa;
    --border: #3730a3;
    --primary-color: #8b5cf6;
    --primary-dark: #7c3aed;
}

body.theme-neon .app-header {
    background: rgba(0, 0, 0, 0.4);
    border-bottom-color: rgba(0, 255, 255, 0.1);
}

body.theme-neon .volver-menu button {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(0, 255, 255, 0.2);
}

body.theme-neon .volver-menu button:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

/* === RESPONSIVE === */

/* === TABLETS (768px - 1024px) === */
@media (max-width: 1024px) and (min-width: 769px) {
    .app-header {
        padding: 1.5rem;
    }
    
    .header-left {
        gap: 1.5rem;
    }
    
    .app-title {
        font-size: 1.8rem;
    }
    
    .app-subtitle {
        font-size: 1rem;
        text-align: justify;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .timer-container {
        padding: 1.5rem;
    }
    
    .timer-panel {
        padding: 2rem;
    }
    
    .time-display-large {
        font-size: 4rem;
    }
    
    .time-inputs {
        gap: 1.5rem;
    }
    
    .time-input {
        width: 100px;
        height: 55px;
        font-size: 1.3rem;
    }
    
    .timer-controls {
        gap: 1.5rem;
    }
    
    .control-btn {
        padding: 1rem 2rem;
        font-size: 1.1rem;
        min-width: 140px;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .preset-btn {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .quick-presets h3,
    .alarms-section h3,
    .laps-section h3 {
        font-size: 1.3rem;
        text-align: justify;
        margin-bottom: 1.5rem;
    }
    
    .alarm-inputs {
        gap: 1rem;
    }
    
    .alarm-input {
        width: 120px;
        height: 50px;
        font-size: 1.1rem;
    }
    
    .alarm-item,
    .lap-item {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .config-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
}

/* === TABLETS PEQUEÑAS Y MÓVILES GRANDES (768px) === */
@media (max-width: 768px) {
    .fullscreen-time {
        font-size: 6rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.4em;
    }
    
    .fullscreen-label {
        font-size: 1.5rem;
        text-align: justify;
    }
    
    .fullscreen-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .fullscreen-controls .control-btn {
        width: 200px;
    }
    
    .fullscreen-theme-selector {
        top: 1rem;
        right: 1rem;
        gap: 0.3rem;
    }
    
    .fullscreen-theme-selector .screensaver-theme-btn {
        width: 35px;
        height: 35px;
    }
    
    .noise-visualizer {
        top: 1rem;
        left: 1rem;
        padding: 0.8rem;
    }
    
    #noise-canvas {
        width: 250px;
        height: 80px;
    }
    
    .noise-level {
        font-size: 0.9rem;
    }
    
    .app-header {
        padding: 1rem;
    }
    
    .header-left {
        gap: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .app-title {
        font-size: 1.5rem;
        text-align: justify;
    }
    
    .app-subtitle {
        font-size: 0.9rem;
        text-align: justify;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .timer-container {
        padding: 1rem;
    }
    
    .timer-panel {
        padding: 1.5rem;
    }
    
    .time-display-large {
        font-size: 3rem;
    }
    
    .milliseconds {
        font-size: 0.5em;
    }
    
    .time-inputs {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .time-input {
        width: 120px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .time-input-group label {
        font-size: 1rem;
        text-align: justify;
    }
    
    .timer-controls {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .preset-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
        text-align: justify;
    }
    
    .quick-presets h3,
    .alarms-section h3,
    .laps-section h3 {
        font-size: 1.2rem;
        text-align: justify;
        margin-bottom: 1rem;
    }
    
    .alarm-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .alarm-input {
        width: 100%;
        height: 50px;
        font-size: 1rem;
    }
    
    .alarm-input-group label {
        font-size: 0.9rem;
        text-align: justify;
    }
    
    .alarm-item,
    .lap-item {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .alarm-time,
    .lap-time {
        font-size: 0.9rem;
        text-align: justify;
    }
    
    .no-alarms,
    .no-laps {
        font-size: 0.9rem;
        text-align: justify;
    }
    
    .config-btn {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .config-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .config-header h3 {
        font-size: 1.2rem;
        text-align: justify;
    }
    
    .config-group label {
        font-size: 0.9rem;
        text-align: justify;
    }
}

/* === MÓVILES PEQUEÑOS (480px) === */
@media (max-width: 480px) {
    .fullscreen-time {
        font-size: 3.5rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.4em;
    }
    
    .fullscreen-label {
        font-size: 1.2rem;
        text-align: justify;
    }
    
    .fullscreen-controls .control-btn {
        width: 150px;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .fullscreen-theme-selector {
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.2rem;
    }
    
    .fullscreen-theme-selector .screensaver-theme-btn {
        width: 30px;
        height: 30px;
    }
    
    /* Centrar verticalmente en móviles */
    .fullscreen-time-display {
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 2rem 1rem;
    }
    
    .fullscreen-time {
        margin-bottom: 1rem;
    }
    
    .fullscreen-label {
        margin-bottom: 2rem;
    }
    
    .app-header {
        padding: 0.75rem;
    }
    
    .header-left {
        gap: 0.5rem;
    }
    
    .app-title {
        font-size: 1.3rem;
        text-align: justify;
    }
    
    .app-subtitle {
        font-size: 0.8rem;
        text-align: justify;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .timer-container {
        padding: 0.75rem;
    }
    
    .timer-panel {
        padding: 1rem;
    }
    
    .time-display-large {
        font-size: 2.5rem;
    }
    
    .milliseconds {
        font-size: 0.5em;
    }
    
    .time-inputs {
        gap: 0.8rem;
    }
    
    .time-input {
        width: 100px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .time-input-group label {
        font-size: 0.9rem;
        text-align: justify;
    }
    
    .timer-controls {
        gap: 0.8rem;
    }
    
    .control-btn {
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
        min-width: 120px;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .preset-btn {
        padding: 0.7rem;
        font-size: 0.85rem;
        text-align: justify;
    }
    
    .quick-presets h3,
    .alarms-section h3,
    .laps-section h3 {
        font-size: 1.1rem;
        text-align: justify;
        margin-bottom: 0.8rem;
    }
    
    .alarm-inputs {
        gap: 0.8rem;
    }
    
    .alarm-input {
        height: 45px;
        font-size: 0.9rem;
    }
    
    .alarm-input-group label {
        font-size: 0.8rem;
        text-align: justify;
    }
    
    .alarm-item,
    .lap-item {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    
    .alarm-time,
    .lap-time {
        font-size: 0.8rem;
        text-align: justify;
    }
    
    .no-alarms,
    .no-laps {
        font-size: 0.8rem;
        text-align: justify;
    }
    
    .config-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    .config-content {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .config-header h3 {
        font-size: 1.1rem;
        text-align: justify;
    }
    
    .config-group label {
        font-size: 0.8rem;
        text-align: justify;
    }
    
    .noise-visualizer {
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.5rem;
    }
    
    #noise-canvas {
        width: 200px;
        height: 60px;
    }
    
    .noise-level {
        font-size: 0.8rem;
    }
    
    .noise-visualizer {
        top: 0.3rem;
        left: 0.3rem;
        padding: 0.3rem;
    }
    
    #noise-canvas {
        width: 150px;
        height: 50px;
    }
    
    .noise-level {
        font-size: 0.7rem;
        margin-top: 0.3rem;
    }
}

/* === MÓVILES MUY PEQUEÑOS (360px) === */
@media (max-width: 360px) {
    .fullscreen-time {
        font-size: 2.8rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.35em;
    }
    
    .fullscreen-label {
        font-size: 1rem;
    }
    
    .fullscreen-controls .control-btn {
        width: 120px;
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .fullscreen-theme-selector {
        top: 0.3rem;
        right: 0.3rem;
        gap: 0.15rem;
    }
    
    .theme-btn {
        width: 25px;
        height: 25px;
    }
}

/* === ORIENTACIÓN LANDSCAPE EN MÓVILES === */
@media (max-width: 768px) and (orientation: landscape) {
    .app-header {
        padding: 0.5rem;
    }
    
    .header-left {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
    
    .app-subtitle {
        font-size: 0.7rem;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .timer-container {
        padding: 0.5rem;
    }
    
    .timer-panel {
        padding: 1rem;
    }
    
    .time-display-large {
        font-size: 2.5rem;
    }
    
    .fullscreen-time {
        font-size: 3rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.35em;
    }
    
    .fullscreen-label {
        font-size: 1.2rem;
    }
    
    /* Centrar horizontalmente en landscape */
    .fullscreen-time-display {
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 1rem;
    }
    
    .fullscreen-time {
        margin-bottom: 0.5rem;
    }
    
    .fullscreen-label {
        margin-bottom: 1rem;
    }
    
    .fullscreen-controls {
        flex-direction: row;
        gap: 1rem;
    }
    
    .fullscreen-controls .control-btn {
        width: 120px;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .time-inputs {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .time-input {
        width: 80px;
        height: 40px;
        font-size: 1rem;
    }
    
    .timer-controls {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .control-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .preset-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .quick-presets h3,
    .alarms-section h3,
    .laps-section h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .alarm-inputs {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .alarm-input {
        width: 80px;
        height: 35px;
        font-size: 0.8rem;
    }
    
    .alarm-item,
    .lap-item {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .config-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* === LANDSCAPE CON ANCHO MENOR A 1170px === */
@media (max-width: 1170px) and (orientation: landscape) {
    .fullscreen-time {
        font-size: 2.2rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.3em;
    }
    
    .fullscreen-label {
        font-size: 1.1rem;
    }
    
    .fullscreen-time-display {
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 1rem;
    }
    
    .fullscreen-time {
        margin-bottom: 0.5rem;
    }
    
    .fullscreen-label {
        margin-bottom: 1rem;
    }
    
    .fullscreen-controls {
        flex-direction: row;
        gap: 1rem;
    }
    
    .fullscreen-controls .control-btn {
        width: 110px;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .fullscreen-theme-selector {
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.2rem;
    }
    
    .theme-btn {
        width: 28px;
        height: 28px;
    }
}

/* === LANDSCAPE MEDIANO (768px - 1170px) === */
@media (max-width: 1170px) and (min-width: 769px) and (orientation: landscape) {
    .fullscreen-time {
        font-size: 2.5rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.32em;
    }
    
    .fullscreen-label {
        font-size: 1.2rem;
    }
    
    .fullscreen-controls .control-btn {
        width: 120px;
        padding: 0.7rem 1.2rem;
        font-size: 1rem;
    }
    
    .theme-btn {
        width: 30px;
        height: 30px;
    }
    
    .noise-visualizer {
        top: 0.8rem;
        left: 0.8rem;
        padding: 0.6rem;
    }
    
    #noise-canvas {
        width: 220px;
        height: 70px;
    }
    
    .noise-level {
        font-size: 0.85rem;
    }
}

/* === MÓVILES PEQUEÑOS EN LANDSCAPE === */
@media (max-width: 480px) and (orientation: landscape) {
    .fullscreen-time {
        font-size: 1.8rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.28em;
    }
    
    .fullscreen-label {
        font-size: 1rem;
    }
    
    .fullscreen-time-display {
        padding: 0.5rem;
    }
    
    .fullscreen-time {
        margin-bottom: 0.3rem;
    }
    
    .fullscreen-label {
        margin-bottom: 0.8rem;
    }
    
    .fullscreen-controls .control-btn {
        width: 100px;
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .fullscreen-theme-selector {
        top: 0.3rem;
        right: 0.3rem;
        gap: 0.15rem;
    }
    
    .theme-btn {
        width: 25px;
        height: 25px;
    }
} 

/* === LANDSCAPE MUY PEQUEÑO (360px) === */
@media (max-width: 360px) and (orientation: landscape) {
    .fullscreen-time {
        font-size: 1.2rem;
    }
    
    .fullscreen-time .milliseconds {
        font-size: 0.18em;
    }
    
    .fullscreen-label {
        font-size: 0.8rem;
    }
    
    .fullscreen-time-display {
        padding: 0.2rem;
    }
    
    .fullscreen-time {
        margin-bottom: 0.1rem;
    }
    
    .fullscreen-label {
        margin-bottom: 0.4rem;
    }
    
    .fullscreen-controls .control-btn {
        width: 60px;
        padding: 0.3rem 0.4rem;
        font-size: 0.6rem;
    }
    
    .fullscreen-theme-selector {
        top: 0.1rem;
        right: 0.1rem;
        gap: 0.05rem;
    }
    
    .theme-btn {
        width: 14px;
        height: 14px;
    }
} 

/* === PORTRAIT GENERAL (max-width: 1170px) === */
@media (max-width: 1170px) and (orientation: portrait) {
    .fullscreen-time {
        font-size: 2.6rem;
    }
    .fullscreen-time .milliseconds {
        font-size: 0.32em;
    }
    .fullscreen-label {
        font-size: 1.2rem;
    }
    .fullscreen-time-display {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 1.5rem 0.5rem;
    }
    .fullscreen-time {
        margin-bottom: 0.7rem;
    }
    .fullscreen-label {
        margin-bottom: 1.2rem;
    }
}

/* === PORTRAIT MÓVIL (max-width: 480px) === */
@media (max-width: 480px) and (orientation: portrait) {
    .fullscreen-time {
        font-size: 1.7rem;
    }
    .fullscreen-time .milliseconds {
        font-size: 0.22em;
    }
    .fullscreen-label {
        font-size: 0.95rem;
    }
    .fullscreen-time-display {
        padding: 0.7rem 0.2rem;
    }
    .fullscreen-time {
        margin-bottom: 0.3rem;
    }
    .fullscreen-label {
        margin-bottom: 0.7rem;
    }
    .fullscreen-controls .control-btn {
        width: 90px;
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
    }
    .fullscreen-theme-selector {
        top: 0.2rem;
        right: 0.2rem;
        gap: 0.1rem;
    }
    .theme-btn {
        width: 18px;
        height: 18px;
    }
}

/* === PORTRAIT MUY PEQUEÑO (max-width: 360px) === */
@media (max-width: 360px) and (orientation: portrait) {
    .fullscreen-time {
        font-size: 1.1rem;
    }
    .fullscreen-time .milliseconds {
        font-size: 0.13em;
    }
    .fullscreen-label {
        font-size: 0.7rem;
    }
    .fullscreen-time-display {
        padding: 0.2rem 0.1rem;
    }
    .fullscreen-time {
        margin-bottom: 0.1rem;
    }
    .fullscreen-label {
        margin-bottom: 0.3rem;
    }
    .fullscreen-controls .control-btn {
        width: 55px;
        padding: 0.2rem 0.3rem;
        font-size: 0.6rem;
    }
    .fullscreen-theme-selector {
        top: 0.05rem;
        right: 0.05rem;
        gap: 0.03rem;
    }
    .theme-btn {
        width: 10px;
        height: 10px;
    }
} 

/* === LANDSCAPE ENTRE 1171px y 1259px === */
@media (max-width: 1259px) and (min-width: 1171px) and (orientation: landscape) {
    .fullscreen-time-display {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 1.5rem 1rem;
    }
    .fullscreen-time {
        font-size: 3.2rem;
        margin-bottom: 0.8rem;
    }
    .fullscreen-time .milliseconds {
        font-size: 0.34em;
    }
    .fullscreen-label {
        font-size: 1.3rem;
        margin-bottom: 1.2rem;
    }
    .fullscreen-controls {
        flex-direction: row;
        gap: 1.2rem;
    }
    .fullscreen-controls .control-btn {
        width: 130px;
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
    }
    .fullscreen-theme-selector {
        top: 0.7rem;
        right: 0.7rem;
        gap: 0.25rem;
    }
    .theme-btn {
        width: 32px;
        height: 32px;
    }
} 