* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #080504;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

#app {
    position: relative;
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    overflow: hidden;
    background: #120806;
}

/* =========================================
   LUMIÈRE
========================================= */

#lightScreen {
    position: absolute;
    inset: 0;
    background: #ff7a00;
    overflow: hidden;
}

#candleEffect,
#starsEffect,
#auroraEffect,
#blueFilter {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#candleEffect {
    opacity: 0;
}

#starsEffect {
    opacity: 0;
}

#auroraEffect {
    opacity: 0;
}

#blueFilter {
    opacity: 0;
    background: rgba(255, 35, 0, 0.24);
    mix-blend-mode: multiply;
    z-index: 20;
}

/* =========================================
   RECTANGLE DES COMMANDES
========================================= */

#controlPanel {
    position: absolute;

    left: 8px;
    right: 8px;

    /* UNIQUEMENT MODIFIÉ : rectangle remonté */
    bottom: 180px;

    padding: 11px;

    border-radius: 24px;

    background: rgba(10, 8, 8, 0.96);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    display: grid;

    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 7px;

    z-index: 1000;

    opacity: 1;
    transform: translateY(0);

    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
}

/* =========================================
   BOUTONS
========================================= */

.mainButton {
    width: 100%;
    min-width: 0;

    height: 78px;
    min-height: 78px;

    padding: 7px 3px;

    border-radius: 15px;

    color: #ffffff;

    background:
        rgba(255, 255, 255, 0.11);

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 7px;

    overflow: hidden;
}

.mainButton:active,
.hideButton:active,
.effectChoice:active,
.colorChoice:active {
    transform: scale(0.94);
}

.buttonTitle {
    width: 100%;

    font-size: 10px;
    line-height: 12px;

    font-weight: 700;

    text-align: center;

    white-space: normal;

    overflow: visible;

    word-break: normal;
}

.buttonValue {
    width: 100%;

    min-height: 20px;

    padding: 2px 1px;

    font-size: 8px;
    line-height: 10px;

    font-weight: 400;

    color: rgba(255, 255, 255, 0.72);

    text-align: center;

    white-space: normal;

    overflow: visible;

    word-break: normal;
}

/* =========================================
   BOUTON EFFACER
========================================= */

.hideButton {
    grid-column: 1 / -1;

    width: 100%;

    height: 38px;

    border-radius: 12px;

    color: #eeeeee;

    background:
        rgba(255, 255, 255, 0.08);

    font-size: 10px;

    font-weight: 600;

    display: flex;

    align-items: center;
    justify-content: center;
}

#controlPanel.hidden {
    opacity: 0;

    transform: translateY(150%);

    pointer-events: none;
}

/* =========================================
   PANNEAUX
========================================= */

.toolPanel {
    position: absolute;

    left: 10px;
    right: 10px;

    bottom: 105px;

    max-height: 70dvh;

    overflow-y: auto;

    padding: 18px;

    border-radius: 24px;

    background:
        rgba(12, 9, 9, 0.97);

    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);

    color: white;

    z-index: 2000;

    transform: translateY(120%);

    opacity: 0;

    pointer-events: none;

    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
}

.toolPanel.open {
    transform: translateY(0);

    opacity: 1;

    pointer-events: auto;
}

/* =========================================
   EN-TÊTE DES PANNEAUX
========================================= */

.toolHeader {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 18px;
}

.toolHeader h2 {
    margin: 0;

    font-size: 20px;

    font-weight: 700;
}

.closeTool {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    color: white;

    background:
        rgba(255, 255, 255, 0.10);

    font-size: 24px;
}

/* =========================================
   COULEURS
========================================= */

.colorGrid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;
}

.colorChoice {
    min-height: 64px;

    padding: 8px;

    border-radius: 15px;

    color: white;

    background:
        rgba(255, 255, 255, 0.07);

    display: flex;

    align-items: center;

    gap: 10px;

    text-align: left;

    font-size: 12px;
}

.colorChoice span {
    width: 35px;
    height: 35px;

    flex: 0 0 35px;

    border-radius: 50%;

    box-shadow:
        0 0 15px rgba(255,255,255,0.08);
}

/* =========================================
   LUMINOSITÉ
========================================= */

.brightnessBox {
    padding: 15px 5px 5px;
}

.brightnessNumber {
    text-align: center;

    font-size: 42px;

    font-weight: 600;

    margin-bottom: 25px;
}

#brightnessSlider {
    width: 100%;

    height: 8px;

    accent-color: #ff8a00;
}

.rangeLabels {
    display: flex;

    justify-content: space-between;

    margin-top: 10px;

    font-size: 11px;

    opacity: 0.5;
}

/* =========================================
   EFFETS
========================================= */

.effectList {
    display: flex;

    flex-direction: column;

    gap: 9px;
}

.effectChoice {
    width: 100%;

    padding: 17px;

    border-radius: 15px;

    color: white;

    background:
        rgba(255, 255, 255, 0.07);

    text-align: left;

    font-size: 14px;
}

/* =========================================
   MINUTEUR
========================================= */

.timerBox {
    display: flex;

    flex-direction: column;

    gap: 10px;
}

.timerBox label {
    font-size: 12px;

    opacity: 0.6;
}

.timerBox input {
    width: 100%;

    height: 52px;

    border: 0;

    outline: 0;

    border-radius: 13px;

    padding: 0 15px;

    color: white;

    background:
        rgba(255, 255, 255, 0.08);
}

#timerCountdown {
    text-align: center;

    font-size: 48px;

    font-variant-numeric:
        tabular-nums;

    margin: 12px 0;
}

#startTimer,
#stopTimer,
#nightToggle {
    height: 50px;

    border-radius: 14px;

    color: white;

    background:
        rgba(255, 255, 255, 0.10);
}

#startTimer {
    background: #c45b1b;
}

#stopTimer {
    background:
        rgba(255, 255, 255, 0.06);
}

/* =========================================
   MODE NUIT
========================================= */

.nightBox {
    display: flex;

    flex-direction: column;

    gap: 18px;
}

.nightBox p {
    margin: 0;

    line-height: 1.5;

    font-size: 13px;

    opacity: 0.7;
}

#nightToggle.active {
    background: #7c250f;
}

/* =========================================
   FLAMME DE BOUGIE
========================================= */

#lightScreen.candle #candleEffect {
    opacity: 0.55;

    background:
        radial-gradient(
            ellipse at center,
            rgba(255,245,180,0.35) 0%,
            rgba(255,140,20,0.2) 25%,
            transparent 65%
        );

    animation:
        candle 1.5s
        infinite
        alternate
        ease-in-out;
}

@keyframes candle {

    0% {
        transform: scale(0.96);
        filter: blur(2px);
    }

    50% {
        transform: scale(1.05);
        filter: blur(7px);
    }

    100% {
        transform: scale(0.99);
        filter: blur(3px);
    }
}

/* =========================================
   CIEL ÉTOILÉ
========================================= */

#lightScreen.stars #starsEffect {
    opacity: 0.8;

    background-image:
        radial-gradient(
            circle,
            white 1px,
            transparent 2px
        ),
        radial-gradient(
            circle,
            rgba(255,255,255,.8) 1px,
            transparent 2px
        ),
        radial-gradient(
            circle,
            rgba(255,230,170,.7) 1px,
            transparent 2px
        );

    background-size:
        85px 85px,
        130px 130px,
        190px 190px;

    animation:
        starsMove 12s
        linear
        infinite;
}

@keyframes starsMove {

    from {
        background-position:
            0 0,
            40px 60px,
            90px 20px;
    }

    to {
        background-position:
            85px 85px,
            170px 190px,
            280px 210px;
    }
}

/* =========================================
   AURORE BORÉALE
========================================= */

#lightScreen.aurora #auroraEffect {
    opacity: 0.6;

    background:
        radial-gradient(
            ellipse at 20% 30%,
            rgba(80,255,180,0.45),
            transparent 45%
        ),
        radial-gradient(
            ellipse at 80% 40%,
            rgba(100,180,255,0.4),
            transparent 45%
        ),
        radial-gradient(
            ellipse at 50% 80%,
            rgba(200,80,255,0.35),
            transparent 50%
        );

    filter: blur(30px);

    animation:
        aurora 8s
        ease-in-out
        infinite
        alternate;
}

@keyframes aurora {

    from {
        transform:
            translateX(-10%)
            scale(1);
    }

    to {
        transform:
            translateX(10%)
            scale(1.15);
    }
}

/* =========================================
   PETITS TÉLÉPHONES
========================================= */

@media (max-width: 360px) {

    #controlPanel {
        left: 5px;
        right: 5px;

        /* UNIQUEMENT MODIFIÉ : remonté aussi */
        bottom: 150px;

        padding: 8px;

        gap: 5px;

        border-radius: 21px;
    }

    .mainButton {
        height: 72px;
        min-height: 72px;

        padding: 6px 2px;

        border-radius: 13px;
    }

    .buttonTitle {
        font-size: 9px;

        line-height: 11px;
    }

    .buttonValue {
        font-size: 7px;

        line-height: 9px;

        min-height: 18px;
    }

    .hideButton {
        height: 34px;

        font-size: 9px;
    }

    .toolPanel {
        left: 7px;
        right: 7px;

        bottom: 85px;

        padding: 15px;
    }
}

/* =========================================
   ÉCRAN DESKTOP : APERÇU TÉLÉPHONE
========================================= */

@media (min-width: 481px) {

    body {
        background: #050505;
    }

    #app {
        width: 390px;

        height: 844px;

        border-radius: 30px;

        box-shadow:
            0 0 80px rgba(0,0,0,0.8);
    }
}