/* =========================================
   CONFIGURACIÓN GENERAL
   ========================================= */
:root {
    /*
     * Evita que el navegador transforme
     * automáticamente nuestros colores.
     */
    color-scheme: only light;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}


body {
    position: relative;

    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;

    display: grid;
    grid-template-rows: auto minmax(0, 1fr);

    overflow: hidden;

    font-family: Arial, Helvetica, sans-serif;

    color: #e8eeff;

    background:
        radial-gradient(
            circle at top left,
            #1b3a9a 0%,
            #091d63 35%,
            #04103c 70%,
            #020a26 100%
        );
}

body::before {
    content: "";

    position: fixed;
    inset: 0;
    z-index: -1;

    pointer-events: none;

    background:
        radial-gradient(
            circle at 80% 80%,
            rgba(56, 96, 224, 0.18),
            transparent 35%
        );
}


/* =========================================
   BARRA SUPERIOR
   ========================================= */

.nav-superior {
    position: relative;
    z-index: 10;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 20px 28px;
}

.marca {
    display: flex;
    align-items: center;
    gap: 10px;
}

.marca-punto {
    width: 16px;
    height: 16px;

    border-radius: 50%;

    background-color: #7ea2ff;

    box-shadow:
        0 0 8px rgba(126, 162, 255, 0.65),
        0 0 18px rgba(126, 162, 255, 0.35);
}

.marca-texto {
    font-size: 20px;
    font-weight: bold;
}

.boton-tuerca {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 52px;
    height: 52px;
    padding: 0;

    border: 1px solid rgba(173, 191, 255, 0.2);
    border-radius: 14px;

    background-color: rgba(18, 38, 109, 0.65);
    color: #dce5ff;

    font-size: 24px;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease,
        border-color 0.2s ease;
}

.boton-tuerca:hover {
    background-color: rgba(29, 55, 147, 0.9);
    border-color: rgba(173, 191, 255, 0.4);

    transform: rotate(12deg);
}


/* =========================================
   CONTENIDO PRINCIPAL
   ========================================= */

.contenedor-principal {
    position: relative;
    z-index: 10;

    min-height: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 10px 20px 24px;
}

.tarjeta-timer {
    width: 100%;
    max-width: 430px;

    padding: 35px 25px;

    text-align: center;

    background: rgba(6, 26, 102, 0.75);

    border: 1px solid rgba(161, 180, 255, 0.15);
    border-radius: 28px;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.estado-timer {
    display: inline-block;

    margin: 0 0 25px;
    padding: 10px 20px;

    border-radius: 999px;

    background-color: #b9cbff;
    color: #0d1a55;

    font-size: 14px;
    font-weight: bold;

    text-transform: uppercase;
    letter-spacing: 2px;
}


/* =========================================
   CÍRCULO DEL TEMPORIZADOR
   ========================================= */

.circulo-timer {
    --progreso: 360deg;

    position: relative;

    display: flex;
    justify-content: center;
    align-items: center;

    width: 280px;
    height: 280px;

    margin: 0 auto 28px;

    border-radius: 50%;

    background:
        conic-gradient(
            from 0deg,
            #b9cbff 0deg,
            #b9cbff var(--progreso),
            rgba(185, 203, 255, 0.18) var(--progreso),
            rgba(185, 203, 255, 0.18) 360deg
        );

    box-shadow:
        0 0 30px rgba(126, 162, 255, 0.16);
}

.circulo-timer::before {
    content: "";

    position: absolute;
    inset: 18px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(10, 30, 105, 0.98) 0%,
            rgba(3, 15, 62, 0.98) 100%
        );

    box-shadow:
        inset 0 0 28px rgba(0, 0, 0, 0.18);
}

#contador {
    position: relative;
    z-index: 1;
    margin: 0;

    color: #eef3ff;

    font-size: 64px;
    font-weight: bold;

    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
}


/* =========================================
   BOTONES DEL TEMPORIZADOR
   ========================================= */

.controles {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
}

button {
    padding: 14px 22px;

    border: none;
    border-radius: 14px;

    font-family: inherit;
    font-size: 16px;

    cursor: pointer;

    transition:
        filter 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

button:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#boton-iniciar {
    min-width: 126px;

    background-color: #9fb4ee;
    color: #111d4d;

    font-weight: bold;

    box-shadow: 0 8px 18px rgba(126, 162, 255, 0.18);
}

#boton-pausar,
#boton-reiniciar {
    background-color: rgba(20, 42, 122, 0.9);
    color: #dce5ff;

    border: 1px solid rgba(173, 191, 255, 0.15);
}


/* =========================================
   MENSAJE ENTRE ETAPAS
   ========================================= */

.mensaje-etapa {
    position: fixed;
    top: 25px;
    left: 50%;
    z-index: 2000;

    width: calc(100% - 40px);
    max-width: 540px;

    padding: 18px 22px;

    border: 1px solid rgba(181, 199, 255, 0.2);
    border-radius: 14px;

    background-color: rgba(24, 43, 116, 0.96);
    color: white;

    text-align: center;

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

    opacity: 1;

    transform:
        translateX(-50%)
        translateY(0);

    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

.mensaje-etapa.oculto {
    opacity: 0;
    pointer-events: none;

    transform:
        translateX(-50%)
        translateY(-20px);
}


/* =========================================
   FONDO OSCURO DEL PANEL
   ========================================= */

.overlay-ajustes {
    position: fixed;
    inset: 0;
    z-index: 1200;

    background-color: rgba(0, 0, 0, 0.5);

    opacity: 1;
}

.overlay-ajustes.oculto {
    display: none;
}


/* =========================================
   PANEL DE AJUSTES
   ========================================= */

.panel-ajustes {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1300;

    display: flex;
    flex-direction: column;

    width: 100%;
    max-width: 380px;
    height: 100vh;

    overflow: hidden;

    color: #e8eeff;

    background:
        linear-gradient(
            180deg,
            #09227f 0%,
            #061b68 100%
        );

    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35);

    transform: translateX(100%);

    transition: transform 0.3s ease;
    
}

.panel-ajustes.abierto {
    transform: translateX(0);
}


/* Encabezado fijo */

.encabezado-ajustes {
    display: flex;
    justify-content: space-between;
    align-items: center;

    flex-shrink: 0;

    padding: 22px 24px;

    border-bottom: 1px solid rgba(173, 191, 255, 0.2);

    background-color: #09227f;
}

.encabezado-ajustes h2 {
    margin: 0;

    font-size: 28px;
}

.boton-cerrar-ajustes {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 48px;
    height: 48px;
    padding: 0;

    border: 1px solid rgba(173, 191, 255, 0.2);
    border-radius: 14px;

    background-color: transparent;
    color: #dce5ff;

    font-size: 26px;
}

.boton-cerrar-ajustes:hover {
    background-color: rgba(255, 255, 255, 0.06);
}


/* Parte desplazable */

.contenido-ajustes {
    flex: 1;
    min-height: 0;

    padding: 24px;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior: contain;
}

.contenido-ajustes::-webkit-scrollbar {
    width: 8px;
}

.contenido-ajustes::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.08);
}

.contenido-ajustes::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background-color: #3565eb;
}


/* Títulos del panel */

.contenido-ajustes h3 {
    margin: 0 0 18px;

    color: #8fa7f4;

    font-size: 14px;
    font-weight: bold;

    text-transform: uppercase;
    letter-spacing: 2px;
}

.contenido-ajustes h3:not(:first-child) {
    margin-top: 30px;
}


/* =========================================
   CAMPOS DE TIEMPO
   ========================================= */

.grupo-campo {
    margin-bottom: 18px;
}

.grupo-campo label {
    display: block;

    margin-bottom: 8px;

    color: #c8d4ff;

    font-size: 15px;
}

.grupo-campo input {
    width: 100%;

    padding: 14px 16px;

    border: 1px solid #2f58db;
    border-radius: 14px;
    outline: none;

    background-color: #0a216f;
    color: #eef3ff;

    font-family: inherit;
    font-size: 16px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.grupo-campo input:focus {
    border-color: #91adff;

    box-shadow:
        0 0 0 3px
        rgba(126, 162, 255, 0.16);
}


/* =========================================
   BOTÓN GUARDAR TIEMPOS
   ========================================= */

.boton-guardar-ajustes {
    width: 100%;

    margin-top: 4px;

    background-color: #a7b9ef;
    color: #13235d;

    font-weight: bold;

    box-shadow:
        0 7px 18px
        rgba(126, 162, 255, 0.15);
}

.mensaje-configuracion {
    min-height: 20px;

    margin: 10px 0 0;

    font-size: 14px;
}


/* =========================================
   SELECTOR DE REPRODUCCIÓN
   ========================================= */

.selector-reproduccion {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 5px;

    width: 100%;

    padding: 5px;

    border-radius: 17px;

    background-color:
        rgba(3, 19, 77, 0.75);
}

.boton-reproduccion {
    min-width: 0;
    min-height: 50px;

    padding: 9px 8px;

    border: 1px solid transparent;
    border-radius: 13px;

    background-color: transparent;
    color: #87a5ff;

    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;

    white-space: normal;
}

.boton-reproduccion:hover:not(.activo) {
    background-color:
        rgba(30, 60, 155, 0.5);

    color: #cbd8ff;
}

.boton-reproduccion.activo {
    background-color: #a7b9ef;
    color: #13235d;

    box-shadow:
        0 5px 14px
        rgba(126, 162, 255, 0.16);
}


/* =========================================
   MODO AUTOMÁTICO
   ========================================= */

.grupo-check {
    margin: 24px 0 4px;
}

.opcion-automatica {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    color: #d3ddff;

    font-size: 14px;
    line-height: 1.4;

    cursor: pointer;
}

.opcion-automatica input {
    flex-shrink: 0;

    width: 18px;
    height: 18px;

    margin: 1px 0 0;

    accent-color: #9fb4ee;

    cursor: pointer;
}

/* =========================================
   SONIDO DE FONDO
   ========================================= */

.selector-sonido {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;

    width: 100%;
    padding: 5px;
    margin-bottom: 16px;

    border-radius: 17px;

    background-color: rgba(0, 0, 0, 0.2);
}

.boton-sonido {
    min-width: 0;
    min-height: 48px;

    padding: 9px 7px;

    border: 1px solid transparent;
    border-radius: 13px;

    background-color: transparent;
    color: var(--tema-claro);

    font-size: 13px;
    font-weight: 600;
}

.boton-sonido:hover:not(.activo) {
    background-color: rgba(var(--tema-rgb), 0.18);
    color: var(--tema-texto);
}

.boton-sonido.activo {
    background-color: var(--tema-claro);
    color: var(--tema-texto-oscuro);

    box-shadow:
        0 5px 14px
        rgba(var(--tema-rgb), 0.18);
}


/* Ocultar las opciones que no correspondan */

.opciones-audio.oculto,
.control-volumen.oculto {
    display: none;
}


/* Selector de ambiente o música */

.opciones-audio {
    display: grid;
    gap: 8px;

    margin-bottom: 16px;
}

.opciones-audio label {
    color: var(--tema-texto);

    font-size: 14px;
    font-weight: 600;
}

.opciones-audio select {
    width: 100%;

    padding: 13px 40px 13px 14px;

    border: 1px solid var(--tema-borde);
    border-radius: 13px;
    outline: none;

    background-color: rgba(var(--tema-rgb), 0.1);
    color: var(--tema-texto);

    font-family: inherit;
    font-size: 14px;

    cursor: pointer;
}

.opciones-audio select:focus {
    border-color: var(--tema-claro);

    box-shadow:
        0 0 0 3px
        rgba(var(--tema-rgb), 0.18);
}

.opciones-audio select option {
    background-color: var(--tema-panel-1);
    color: var(--tema-texto);
}


/* Control de volumen */

.control-volumen {
    margin-top: 4px;
    margin-bottom: 24px;
}

.encabezado-volumen {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 10px;

    color: var(--tema-texto);

    font-size: 14px;
    font-weight: 600;
}

#valor-volumen {
    color: var(--tema-claro);
}

#volumen-audio {
    width: 100%;
    height: 6px;

    margin: 0;

    appearance: none;
    -webkit-appearance: none;

    border-radius: 999px;

    background:
        linear-gradient(
            to right,
            var(--tema-principal) 0%,
            var(--tema-principal) 50%,
            rgba(var(--tema-rgb), 0.2) 50%,
            rgba(var(--tema-rgb), 0.2) 100%
        );

    cursor: pointer;
}

#volumen-audio::-webkit-slider-thumb {
    width: 20px;
    height: 20px;

    appearance: none;
    -webkit-appearance: none;

    border: 3px solid var(--tema-panel-1);
    border-radius: 50%;

    background-color: var(--tema-claro);

    box-shadow:
        0 0 0 2px var(--tema-principal),
        0 4px 10px rgba(0, 0, 0, 0.2);
}

#volumen-audio::-moz-range-thumb {
    width: 16px;
    height: 16px;

    border: 3px solid var(--tema-panel-1);
    border-radius: 50%;

    background-color: var(--tema-claro);

    box-shadow:
        0 0 0 2px var(--tema-principal),
        0 4px 10px rgba(0, 0, 0, 0.2);
}


/* Tema claro */

body[data-tema="claro"] .selector-sonido {
    background-color: rgba(var(--tema-rgb), 0.14);
}

body[data-tema="claro"] .boton-sonido {
    color: var(--tema-texto);
}

body[data-tema="claro"] .opciones-audio select {
    background-color: rgba(255, 255, 255, 0.55);
    color: var(--tema-texto-oscuro);
}

body[data-tema="claro"] .opciones-audio select option {
    background-color: var(--tema-panel-1);
    color: var(--tema-texto-oscuro);
}

/* =========================================
   PALETA DE COLORES
   ========================================= */

.selector-paleta {
    display: grid;
    grid-template-columns: repeat(6, 42px);
    gap: 10px;

    margin-bottom: 24px;
}

.boton-color {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 42px;
    height: 42px;
    padding: 3px;

    border: 2px solid transparent;
    border-radius: 50%;

    background-color: transparent;

    cursor: pointer;
}

.boton-color:hover:not(.activo) {
    transform: scale(1.08);
    filter: brightness(1.12);
}

.boton-color.activo {
    border-color: #e8eeff;

    box-shadow:
        0 0 0 2px rgba(7, 22, 78, 0.9),
        0 0 12px rgba(190, 210, 255, 0.35);
}

.muestra-color {
    display: block;

    width: 100%;
    height: 100%;

    border-radius: 50%;
}


/* Negro */

.color-negro {
    background:
        linear-gradient(
            135deg,
            #333642,
            #090b12
        );

    border: 1px solid rgba(255, 255, 255, 0.25);
}


/* Azul */

.color-azul {
    background:
        linear-gradient(
            135deg,
            #6591ff,
            #1645d8
        );
}


/* Rosa */

.color-rosa {
    background:
        linear-gradient(
            135deg,
            #ff8fc7,
            #e13687
        );
}


/* Verde */

.color-verde {
    background:
        linear-gradient(
            135deg,
            #7ee8a4,
            #159957
        );
}


/* Violeta */

.color-violeta {
    background:
        linear-gradient(
            135deg,
            #d18cff,
            #8034d9
        );
}


/* Rojo */

.color-rojo {
    background:
        linear-gradient(
            135deg,
            #ff7777,
            #c51f35
        );
}

/* =========================================
   SELECTOR DE TEMA
   ========================================= */

.selector-tema {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;

    width: 100%;
    padding: 5px;
    margin-bottom: 24px;

    border-radius: 17px;

    background-color: rgba(0, 0, 0, 0.2);
}

.boton-tema {
    min-height: 48px;
    padding: 10px 14px;

    border: 1px solid transparent;
    border-radius: 13px;

    background-color: transparent;
    color: var(--tema-texto);

    font-size: 14px;
    font-weight: 600;
}

.boton-tema:hover:not(.activo) {
    background-color: rgba(var(--tema-rgb), 0.18);
}

.boton-tema.activo {
    background-color: var(--tema-claro);
    color: var(--tema-texto-oscuro);

    box-shadow:
        0 5px 14px
        rgba(var(--tema-rgb), 0.18);
}

/* =========================================
   SELECTOR DE FONDO
   ========================================= */

.selector-fondo {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;

    margin-bottom: 24px;
}

.boton-fondo {
    min-height: 48px;
    padding: 10px 12px;

    border:
        1px solid
        rgba(91, 126, 230, 0.65);

    border-radius: 14px;

    background-color:
        rgba(5, 25, 94, 0.65);

    color: #9db7ff;

    font-size: 14px;
    font-weight: 600;
}

.boton-fondo:hover:not(.activo) {
    background-color:
        rgba(26, 57, 154, 0.8);
}

.boton-fondo.activo {
    border-color: transparent;

    background-color: #a7b9ef;
    color: #13235d;

    box-shadow:
        0 6px 15px
        rgba(126, 162, 255, 0.14);
}


/* =========================================
   CAPAS DE LOS FONDOS
   ========================================= */

.fondo-efecto {
    position: fixed;
    inset: 0;
    z-index: 1;

    overflow: hidden;

    pointer-events: none;
}

.fondo-efecto.oculto {
    display: none;
}


/* =========================================
   BURBUJAS
   ========================================= */

#fondo-burbujas span {
    position: absolute;
    bottom: -120px;

    display: block;

    border:
        1px solid
        rgba(190, 215, 255, 0.22);

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 30% 25%,
            rgba(225, 238, 255, 0.35),
            rgba(120, 170, 255, 0.15) 45%,
            rgba(70, 120, 230, 0.08) 70%,
            transparent 100%
        );

    box-shadow:
        inset 0 0 12px
        rgba(255, 255, 255, 0.08),

        0 0 18px
        rgba(100, 150, 255, 0.12);

    animation-name: subir-burbuja;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes subir-burbuja {
    0% {
        opacity: 0;

        transform:
            translateY(0)
            translateX(0)
            scale(0.9);
    }

    10% {
        opacity: 0.75;
    }

    45% {
        transform:
            translateY(-48vh)
            translateX(22px)
            scale(1);
    }

    80% {
        opacity: 0.5;
    }

    100% {
        opacity: 0;

        transform:
            translateY(-115vh)
            translateX(-18px)
            scale(1.15);
    }
}


/* =========================================
   LLUVIA CÁLIDA
   ========================================= */

#fondo-lluvia span {
    position: absolute;
    top: -180px;

    display: block;

    width: 3px;

    border-radius: 999px;

    background:
        linear-gradient(
            to bottom,
            transparent 0%,
            rgba(255, 233, 178, 0.9) 35%,
            rgba(255, 184, 102, 0.7) 75%,
            transparent 100%
        );

    box-shadow:
        0 0 7px
        rgba(255, 208, 138, 0.3),

        0 0 14px
        rgba(255, 166, 94, 0.15);

    animation-name:
        caer-lluvia-calida;

    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes caer-lluvia-calida {
    0% {
        opacity: 0;

        transform:
            translateY(-10vh)
            translateX(0)
            rotate(10deg);
    }

    12% {
        opacity: 0.8;
    }

    85% {
        opacity: 0.65;
    }

    100% {
        opacity: 0;

        transform:
            translateY(125vh)
            translateX(80px)
            rotate(10deg);
    }
}


/* =========================================
   BARRA DE LUZ
   ========================================= */

.barra-luz {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;

    display: flex;
    align-items: flex-end;
    gap: 6px;

    height: 150px;

    padding: 0 6px 10px;

    pointer-events: none;

    background:
        linear-gradient(
            to top,
            rgba(122, 149, 255, 0.28) 0%,
            rgba(122, 149, 255, 0.1) 35%,
            rgba(122, 149, 255, 0) 100%
        );
}

.barra-luz.oculto {
    display: none;
}

.barra-luz span {
    flex: 1;

    min-width: 10px;
    height: var(--altura-min, 28px);

    border-radius: 6px 6px 0 0;

    background:
        linear-gradient(
            to top,
            rgba(120, 150, 255, 0.68) 0%,
            rgba(206, 221, 255, 0.95) 100%
        );

    box-shadow:
        0 0 8px
        rgba(147, 174, 255, 0.26),

        0 0 16px
        rgba(147, 174, 255, 0.17);

    transform-origin: bottom;

    animation-name: subir-bajar-barra;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

@keyframes subir-bajar-barra {
    0% {
        height: var(--altura-min, 28px);
        opacity: 0.7;
    }

    25% {
        height:
            calc(
                var(--altura-max, 80px) * 0.72
            );

        opacity: 0.88;
    }

    50% {
        height: var(--altura-max, 80px);
        opacity: 1;
    }

    75% {
        height:
            calc(
                var(--altura-max, 80px) * 0.6
            );

        opacity: 0.85;
    }

    100% {
        height: var(--altura-min, 28px);
        opacity: 0.7;
    }
}


/* =========================================
   FOCO Y ACCESIBILIDAD
   ========================================= */

button:focus-visible,
input:focus-visible {
    outline:
        3px solid
        rgba(173, 195, 255, 0.6);

    outline-offset: 3px;
}


/* =========================================
   PANTALLAS PEQUEÑAS
   ========================================= */

@media (max-width: 600px) {
    .nav-superior {
        padding: 16px;
    }

    .marca-texto {
        font-size: 18px;
    }

    .boton-tuerca {
        width: 46px;
        height: 46px;
        font-size: 21px;
    }

    .contenedor-principal {
        padding: 10px 14px 20px;
    }

    .tarjeta-timer {
        padding: 28px 18px;
        border-radius: 24px;
    }

    .circulo-timer {
        width: 240px;
        height: 240px;
        border-width: 15px;
    }

    #contador {
        font-size: 52px;
    }

    .controles {
        gap: 9px;
    }

    .controles button {
        padding: 12px 16px;
        font-size: 14px;
    }

    #boton-iniciar {
        min-width: 105px;
    }

    /* Panel completo en pantallas chicas */
    .panel-ajustes {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .encabezado-ajustes {
        padding: 18px 20px;
    }

    .encabezado-ajustes h2 {
        font-size: 26px;
    }

    /* Esta parte es la que se desplaza */
    .contenido-ajustes {
        min-height: 0;
        padding: 20px;

        overflow-x: hidden;
        overflow-y: auto;

        overscroll-behavior: contain;
    }

    .selector-reproduccion {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .boton-reproduccion {
        padding: 8px 5px;
        font-size: 12px;
    }

    .barra-luz {
        height: 120px;
        gap: 4px;
        padding: 0 4px 8px;
    }

    .barra-luz span {
        min-width: 7px;
        border-radius: 4px 4px 0 0;
    }
}

@media (max-height: 700px) {
    .nav-superior {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .tarjeta-timer {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .estado-timer {
        margin-bottom: 16px;
        padding: 8px 18px;
    }

    .circulo-timer {
        width: 250px;
        height: 250px;

        margin-bottom: 20px;

        border-width: 15px;
    }

    #contador {
        font-size: 56px;
    }

    .controles button {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

@media (max-width: 360px) {
    .circulo-timer {
        width: 210px;
        height: 210px;
    }

    #contador {
        font-size: 45px;
    }

    .selector-reproduccion {
        grid-template-columns: 1fr;
    }

    .boton-reproduccion {
        min-height: 44px;

        font-size: 13px;
    }

    .selector-paleta {
        grid-template-columns: repeat(3, 42px);
    }

    .selector-fondo {
        grid-template-columns: 1fr;
    }
    
    .selector-sonido {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   REDUCIR ANIMACIONES
   ========================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;

        transition-duration:
            0.01ms !important;
    }
}

/* =========================================
   TEMAS DE COLORES
   ========================================= */

/* Violeta predeterminado */

body {
    --tema-fondo-1: #511570;
    --tema-fondo-2: #30093f;
    --tema-fondo-3: #190522;
    --tema-fondo-4: #0d0212;

    --tema-panel-1: #551878;
    --tema-panel-2: #300a48;

    --tema-superficie: rgba(83, 27, 119, 0.76);
    --tema-superficie-solida: #40105f;

    --tema-principal: #a64ce5;
    --tema-claro: #d19af4;
    --tema-borde: #8c35ce;

    --tema-texto: #f5eaff;
    --tema-texto-oscuro: #361047;

    --tema-rgb: 174, 93, 232;
}


/* Negro */

body[data-paleta="negro"] {
    --tema-fondo-1: #30333b;
    --tema-fondo-2: #17191e;
    --tema-fondo-3: #0c0d10;
    --tema-fondo-4: #030405;

    --tema-panel-1: #24262c;
    --tema-panel-2: #101115;

    --tema-superficie: rgba(29, 31, 37, 0.82);
    --tema-superficie-solida: #17191e;

    --tema-principal: #767c89;
    --tema-claro: #d3d6dc;
    --tema-borde: #555b66;

    --tema-texto: #f0f1f3;
    --tema-texto-oscuro: #1a1c20;

    --tema-rgb: 180, 185, 196;
}


/* Azul */

body[data-paleta="azul"] {
    --tema-fondo-1: #1b3a9a;
    --tema-fondo-2: #091d63;
    --tema-fondo-3: #04103c;
    --tema-fondo-4: #020a26;

    --tema-panel-1: #09227f;
    --tema-panel-2: #061b68;

    --tema-superficie: rgba(6, 26, 102, 0.76);
    --tema-superficie-solida: #0a216f;

    --tema-principal: #5480ee;
    --tema-claro: #b9cbff;
    --tema-borde: #2f58db;

    --tema-texto: #e8eeff;
    --tema-texto-oscuro: #111d4d;

    --tema-rgb: 126, 162, 255;
}


/* Rosa */

body[data-paleta="rosa"] {
    --tema-fondo-1: #9a2863;
    --tema-fondo-2: #5e1039;
    --tema-fondo-3: #35071f;
    --tema-fondo-4: #1b030f;

    --tema-panel-1: #8a2057;
    --tema-panel-2: #501031;

    --tema-superficie: rgba(123, 28, 78, 0.77);
    --tema-superficie-solida: #67163f;

    --tema-principal: #f04991;
    --tema-claro: #ffadd2;
    --tema-borde: #d9367d;

    --tema-texto: #fff0f7;
    --tema-texto-oscuro: #4d102b;

    --tema-rgb: 240, 73, 145;
}


/* Verde */

body[data-paleta="verde"] {
    --tema-fondo-1: #19764f;
    --tema-fondo-2: #0b4931;
    --tema-fondo-3: #052b1d;
    --tema-fondo-4: #02160f;

    --tema-panel-1: #146643;
    --tema-panel-2: #093c28;

    --tema-superficie: rgba(15, 91, 59, 0.76);
    --tema-superficie-solida: #0d5337;

    --tema-principal: #31c879;
    --tema-claro: #9ce8bd;
    --tema-borde: #27a866;

    --tema-texto: #ecfff4;
    --tema-texto-oscuro: #07351f;

    --tema-rgb: 49, 200, 121;
}


/* Violeta */

body[data-paleta="violeta"] {
    --tema-fondo-1: #511570;
    --tema-fondo-2: #30093f;
    --tema-fondo-3: #190522;
    --tema-fondo-4: #0d0212;

    --tema-panel-1: #551878;
    --tema-panel-2: #300a48;

    --tema-superficie: rgba(83, 27, 119, 0.76);
    --tema-superficie-solida: #40105f;

    --tema-principal: #a64ce5;
    --tema-claro: #d19af4;
    --tema-borde: #8c35ce;

    --tema-texto: #f5eaff;
    --tema-texto-oscuro: #361047;

    --tema-rgb: 174, 93, 232;
}


/* Rojo */

body[data-paleta="rojo"] {
    --tema-fondo-1: #941f2f;
    --tema-fondo-2: #5a0c18;
    --tema-fondo-3: #33060d;
    --tema-fondo-4: #1a0206;

    --tema-panel-1: #801827;
    --tema-panel-2: #4c0a14;

    --tema-superficie: rgba(121, 22, 38, 0.78);
    --tema-superficie-solida: #661421;

    --tema-principal: #ed4055;
    --tema-claro: #ffabb5;
    --tema-borde: #ca3044;

    --tema-texto: #fff0f2;
    --tema-texto-oscuro: #4c0b14;

    --tema-rgb: 237, 64, 85;
}


/* =========================================
   APLICAR LAS VARIABLES AL DISEÑO
   ========================================= */

body {
    color: var(--tema-texto);

    background:
        radial-gradient(
            circle at top left,
            var(--tema-fondo-1) 0%,
            var(--tema-fondo-2) 35%,
            var(--tema-fondo-3) 70%,
            var(--tema-fondo-4) 100%
        );
}

body::before {
    background:
        radial-gradient(
            circle at 80% 80%,
            rgba(var(--tema-rgb), 0.2),
            transparent 35%
        );
}


/* Barra superior */

.marca-punto {
    background-color: var(--tema-principal);

    box-shadow:
        0 0 8px rgba(var(--tema-rgb), 0.7),
        0 0 18px rgba(var(--tema-rgb), 0.4);
}

.boton-tuerca {
    background-color: rgba(var(--tema-rgb), 0.12);
    color: var(--tema-texto);

    border-color: rgba(var(--tema-rgb), 0.35);
}

.boton-tuerca:hover {
    background-color: rgba(var(--tema-rgb), 0.25);
    border-color: rgba(var(--tema-rgb), 0.55);
}


/* Tarjeta */

.tarjeta-timer {
    background: var(--tema-superficie);

    border-color: rgba(var(--tema-rgb), 0.22);

    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.estado-timer {
    background-color: var(--tema-claro);
    color: var(--tema-texto-oscuro);
}


/* Progreso circular */

.circulo-timer {
    background:
        conic-gradient(
            from 0deg,
            var(--tema-claro) 0deg,
            var(--tema-claro) var(--progreso),
            rgba(var(--tema-rgb), 0.22) var(--progreso),
            rgba(var(--tema-rgb), 0.22) 360deg
        );

    box-shadow:
        0 0 34px rgba(var(--tema-rgb), 0.18);
}

.circulo-timer::before {
    background:
        radial-gradient(
            circle,
            var(--tema-superficie-solida) 0%,
            var(--tema-fondo-4) 100%
        );
}


/* Botones */

#boton-iniciar,
.boton-guardar-ajustes,
.boton-reproduccion.activo,
.boton-fondo.activo {
    background-color: var(--tema-claro);
    color: var(--tema-texto-oscuro);

    box-shadow:
        0 7px 18px rgba(var(--tema-rgb), 0.2);
}

#boton-pausar,
#boton-reiniciar {
    background-color: rgba(var(--tema-rgb), 0.13);
    color: var(--tema-texto);

    border-color: rgba(var(--tema-rgb), 0.3);
}


/* Mensaje */

.mensaje-etapa {
    background-color: var(--tema-panel-1);
    color: var(--tema-texto);

    border-color: rgba(var(--tema-rgb), 0.35);
}


/* Panel lateral */

.panel-ajustes {
    color: var(--tema-texto);

    background:
        linear-gradient(
            180deg,
            var(--tema-panel-1) 0%,
            var(--tema-panel-2) 100%
        );
}

.encabezado-ajustes {
    background-color: var(--tema-panel-1);

    border-color: rgba(var(--tema-rgb), 0.3);
}

.boton-cerrar-ajustes {
    color: var(--tema-texto);

    border-color: rgba(var(--tema-rgb), 0.35);
}

.contenido-ajustes::-webkit-scrollbar-thumb {
    background-color: var(--tema-principal);
}

.contenido-ajustes h3 {
    color: var(--tema-claro);
}


/* Campos */

.grupo-campo label,
.opcion-automatica {
    color: var(--tema-texto);
}

.grupo-campo input {
    background-color: rgba(var(--tema-rgb), 0.1);
    color: var(--tema-texto);

    border-color: var(--tema-borde);
}

.grupo-campo input:focus {
    border-color: var(--tema-claro);

    box-shadow:
        0 0 0 3px rgba(var(--tema-rgb), 0.18);
}

.opcion-automatica input {
    accent-color: var(--tema-principal);
}


/* Reproducción y fondos */

.selector-reproduccion {
    background-color: rgba(0, 0, 0, 0.2);
}

.boton-reproduccion,
.boton-fondo {
    color: var(--tema-claro);
}

.boton-fondo {
    background-color: rgba(var(--tema-rgb), 0.08);

    border-color: rgba(var(--tema-rgb), 0.55);
}

.boton-fondo:hover:not(.activo),
.boton-reproduccion:hover:not(.activo) {
    background-color: rgba(var(--tema-rgb), 0.18);
    color: var(--tema-texto);
}


/* Burbujas */

#fondo-burbujas span {
    border-color: rgba(var(--tema-rgb), 0.3);

    background:
        radial-gradient(
            circle at 30% 25%,
            rgba(255, 255, 255, 0.3),
            rgba(var(--tema-rgb), 0.2) 45%,
            rgba(var(--tema-rgb), 0.08) 70%,
            transparent 100%
        );

    box-shadow:
        inset 0 0 12px rgba(255, 255, 255, 0.09),
        0 0 18px rgba(var(--tema-rgb), 0.2);
}


/* Lluvia */

#fondo-lluvia span {
    background:
        linear-gradient(
            to bottom,
            transparent 0%,
            rgba(var(--tema-rgb), 0.95) 35%,
            rgba(var(--tema-rgb), 0.6) 75%,
            transparent 100%
        );

    box-shadow:
        0 0 7px rgba(var(--tema-rgb), 0.4),
        0 0 14px rgba(var(--tema-rgb), 0.2);
}


/* Barra de luz */

.barra-luz {
    background:
        linear-gradient(
            to top,
            rgba(var(--tema-rgb), 0.3) 0%,
            rgba(var(--tema-rgb), 0.1) 35%,
            rgba(var(--tema-rgb), 0) 100%
        );
}

.barra-luz span {
    background:
        linear-gradient(
            to top,
            rgba(var(--tema-rgb), 0.65) 0%,
            var(--tema-claro) 100%
        );

    box-shadow:
        0 0 8px rgba(var(--tema-rgb), 0.35),
        0 0 16px rgba(var(--tema-rgb), 0.22);
}

/* =========================================
   TEMA CLARO
   ========================================= */

body[data-tema="claro"] {
    --tema-fondo-1:
        color-mix(
            in srgb,
            var(--tema-principal) 22%,
            white
        );

    --tema-fondo-2:
        color-mix(
            in srgb,
            var(--tema-principal) 14%,
            white
        );

    --tema-fondo-3:
        color-mix(
            in srgb,
            var(--tema-principal) 9%,
            white
        );

    --tema-fondo-4:
        color-mix(
            in srgb,
            var(--tema-principal) 5%,
            white
        );

    --tema-panel-1:
        color-mix(
            in srgb,
            var(--tema-principal) 14%,
            white
        );

    --tema-panel-2:
        color-mix(
            in srgb,
            var(--tema-principal) 7%,
            white
        );

    --tema-superficie:
        rgba(255, 255, 255, 0.72);

    --tema-superficie-solida:
        color-mix(
            in srgb,
            var(--tema-principal) 6%,
            white
        );

    --tema-claro:
        color-mix(
            in srgb,
            var(--tema-principal) 38%,
            white
        );

    --tema-borde:
        color-mix(
            in srgb,
            var(--tema-principal) 75%,
            white
        );

    --tema-texto:
        color-mix(
            in srgb,
            var(--tema-principal) 24%,
            black
        );

    --tema-texto-oscuro:
        color-mix(
            in srgb,
            var(--tema-principal) 60%,
            black
        );
}


/* Contenido general en modo claro */

body[data-tema="claro"] {
    color: var(--tema-texto);
}


/* Barra superior */

body[data-tema="claro"] .marca-texto {
    color: var(--tema-texto);
}

body[data-tema="claro"] .boton-tuerca {
    background-color: rgba(255, 255, 255, 0.4);
    color: var(--tema-texto);

    border-color: rgba(var(--tema-rgb), 0.45);
}


/* Tarjeta */

body[data-tema="claro"] .tarjeta-timer {
    border-color: rgba(255, 255, 255, 0.8);

    box-shadow:
        0 20px 50px rgba(var(--tema-rgb), 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body[data-tema="claro"] #contador {
    color: var(--tema-texto-oscuro);
}


/* Botones del temporizador */

body[data-tema="claro"] #boton-pausar,
body[data-tema="claro"] #boton-reiniciar {
    background-color: rgba(255, 255, 255, 0.32);
    color: var(--tema-texto-oscuro);

    border-color: rgba(var(--tema-rgb), 0.45);
}


/* Panel de ajustes */

body[data-tema="claro"] .panel-ajustes {
    color: var(--tema-texto);

    border-left:
        1px solid
        rgba(var(--tema-rgb), 0.4);
}

body[data-tema="claro"] .encabezado-ajustes {
    color: var(--tema-texto);

    border-color: rgba(var(--tema-rgb), 0.35);
}

body[data-tema="claro"] .boton-cerrar-ajustes {
    color: var(--tema-texto);

    border-color: rgba(var(--tema-rgb), 0.45);
}

body[data-tema="claro"] .contenido-ajustes h3 {
    color: var(--tema-principal);
}


/* Campos */

body[data-tema="claro"] .grupo-campo label,
body[data-tema="claro"] .opcion-automatica {
    color: var(--tema-texto);
}

body[data-tema="claro"] .grupo-campo input {
    background-color: rgba(255, 255, 255, 0.55);
    color: var(--tema-texto-oscuro);

    border-color: rgba(var(--tema-rgb), 0.55);
}


/* Selectores */

body[data-tema="claro"] .selector-reproduccion,
body[data-tema="claro"] .selector-tema {
    background-color: rgba(var(--tema-rgb), 0.14);
}

body[data-tema="claro"] .boton-reproduccion,
body[data-tema="claro"] .boton-tema,
body[data-tema="claro"] .boton-fondo {
    color: var(--tema-texto);
}

body[data-tema="claro"] .boton-fondo {
    background-color: rgba(255, 255, 255, 0.25);
}


/* Mensajes */

body[data-tema="claro"] .mensaje-etapa {
    background-color: var(--tema-panel-1);
    color: var(--tema-texto-oscuro);
}


/* Fondo detrás del panel */

body[data-tema="claro"] .overlay-ajustes {
    background-color: rgba(255, 255, 255, 0.35);

    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* La altura ahora la controla el MP3 desde JavaScript */

.barra-luz span {
    animation: none;

    height: 14px;

    will-change:
        height,
        opacity;

    transition:
        opacity 80ms linear;
}

/* =========================================
   BOTÓN SALTAR DESCANSO
   ========================================= */

.boton-saltar-descanso {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 52px;
    height: 52px;
    padding: 0;

    border:
        1px solid
        rgba(var(--tema-rgb), 0.45);

    border-radius: 14px;

    background-color:
        rgba(var(--tema-rgb), 0.13);

    color: var(--tema-texto);

    font-size: 21px;
    line-height: 1;
}

.boton-saltar-descanso:hover:not(:disabled) {
    background-color:
        rgba(var(--tema-rgb), 0.28);
}

.boton-saltar-descanso.oculto {
    display: none;
}

body[data-tema="claro"]
.boton-saltar-descanso {
    background-color:
        rgba(255, 255, 255, 0.32);

    color: var(--tema-texto-oscuro);
}

/* =========================================
   VENTANAS ANGOSTAS
   ========================================= */

@media (max-width: 520px) {
    .nav-superior {
        padding: 12px 16px;
    }

    .contenedor-principal {
        padding: 6px 12px 12px;
    }

    .tarjeta-timer {
        width: 100%;
        max-width: 360px;

        padding: 18px 14px;

        border-radius: 22px;
    }

    .estado-timer {
        margin-bottom: 12px;
        padding: 7px 16px;
    }

    .circulo-timer {
        width: 210px;
        height: 210px;

        margin-bottom: 14px;
    }

    .circulo-timer::before {
        inset: 14px;
    }

    #contador {
        font-size: 45px;
    }

    .controles {
        gap: 8px;
    }

    .controles button {
        padding: 10px 12px;

        font-size: 13px;
    }

    #boton-iniciar {
        min-width: 95px;
    }

    .boton-saltar-descanso {
        width: 44px;
        height: 44px;

        padding: 0;

        font-size: 18px;
    }
}

/* =========================================
   CORRECCIÓN DEL PANEL EN CELULARES
   ========================================= */

@media (max-width: 600px) {
    .panel-ajustes {
        height: 100dvh;
        min-height: 100svh;
        max-height: 100dvh;
    }

    .contenido-ajustes {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;

        /*
         * Espacio extra para que la barra
         * inferior del navegador no tape
         * las últimas opciones.
         */
        padding-bottom:
            calc(
                120px +
                env(safe-area-inset-bottom)
            );
    }

    .selector-fondo {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}