body {
    font-family: Arial;
    background: linear-gradient(270deg, #0f2027, #203a43, #2c5364);
    background-size: 600% 600%;
    animation: fondoAnimado 10s ease infinite;
    color: white;
    text-align: center;
}

/* ANIMACIÓN DE FONDO */
@keyframes fondoAnimado {
    0% {background-position: 0% 50%;}
    50% {background-position: 100% 50%;}
    100% {background-position: 0% 50%;}
}

.claro {
    background: linear-gradient(270deg, #ffffff, #dfe9f3);
    color: black;
}

/* BOTÓN TEMA */
.tema-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    border-radius: 20px;
    background: linear-gradient(45deg, #00ffc3, #00aaff);
    color: black;
    cursor: pointer;
    transition: 0.3s;
}

.tema-btn:hover {
    transform: scale(1.1);
}

/* CONTENEDOR GLASS */
.container {
    max-width: 650px;
    margin: auto;
    padding: 20px;
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    backdrop-filter: blur(15px);
    box-shadow: 0 0 30px rgba(0,255,200,0.2);
    animation: aparecer 1s ease;
}

/* ENTRADA SUAVE */
@keyframes aparecer {
    from {opacity: 0; transform: translateY(20px);}
    to {opacity: 1; transform: translateY(0);}
}

/* INPUTS */
input, select, button {
    width: 90%;
    padding: 10px;
    margin: 10px;
    border-radius: 10px;
    border: none;
    transition: 0.3s;
}

/* BOTONES */
button {
    background: linear-gradient(45deg, #00ffc3, #00aaff);
    color: black;
    font-weight: bold;
    cursor: pointer;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px #00ffc3;
}

/* RESULTADO */
.resultado {
    font-size: 24px;
    color: yellow;
    animation: glow 1.5s infinite alternate;
}

@keyframes glow {
    from {text-shadow: 0 0 5px yellow;}
    to {text-shadow: 0 0 20px orange;}
}

/* BARRA */
.barra {
    width: 80%;
    height: 15px;
    background: #333;
    margin: auto;
    border-radius: 10px;
    overflow: hidden;
}

.nivel {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, red, yellow, lime);
    transition: width 0.5s;
}

/* CIRCUITO */
.circuito {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px;
    gap: 10px;
}

.cable {
    width: 200px;
    height: 10px;
    background: #555;
    overflow: hidden;
    border-radius: 5px;
}

/* FLUJO ELECTRICO */
.flujo {
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, #00ffc3, #00aaff);
    animation: mover 2s linear infinite;
}

@keyframes mover {
    from {transform: translateX(-30px);}
    to {transform: translateX(200px);}
}

/* LED */
.led {
    width: 20px;
    height: 20px;
    background: red;
    border-radius: 50%;
    box-shadow: 0 0 10px red;
    transition: 0.3s;
}

/* SERVO */
.servo {
    font-size: 40px;
    margin: 10px;
    transition: transform 0.5s;
}

/* GRAFICA */
canvas {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 10px;
    margin-top: 10px;
}

/* BOTONES EXTRA */
.botones-extra {
    margin-top: 15px;
}

.botones-extra button {
    width: 45%;
    margin: 5px;
    background: linear-gradient(45deg, #00aaff, #00ffc3);
}

/* CARDS */
.cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.card {
    background: rgba(255,255,255,0.1);
    margin: 5px;
    padding: 10px;
    border-radius: 10px;
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 15px #00ffc3;
}

#stats {
    margin-top: 10px;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 10px;
    animation: aparecer 1s ease;
}

/* FONDO TIPO CIRCUITO */
body::after {
    content: "";
    position: fixed;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0,255,200,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,200,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* PARTÍCULAS */
.particula {
    position: absolute;
    width: 6px;
    height: 6px;
    background: cyan;
    border-radius: 50%;
    box-shadow: 0 0 10px cyan;
    animation: fluir 2s linear infinite;
}

/* EFECTO CLICK */
.overlay-efecto {
    position: fixed;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,255,200,0.2), transparent);
    opacity: 0;
    pointer-events: none;
}

@keyframes flash {
    0% {opacity: 0;}
    50% {opacity: 1;}
    100% {opacity: 0;}
}

/* LED PARPADEO REAL */
@keyframes parpadeo {
    0% {opacity: 1;}
    50% {opacity: 0.3;}
    100% {opacity: 1;}
}

/* 📱 RESPONSIVE */

/* Tablets */
@media (max-width: 768px) {
    .container {
        max-width: 90%;
        padding: 15px;
    }

    h1 {
        font-size: 22px;
    }

    input, select, button {
        width: 95%;
        font-size: 14px;
    }

    .circuito {
        flex-direction: column;
        gap: 5px;
    }

    .cable {
        width: 150px;
    }

    .servo {
        font-size: 30px;
    }
}

/* Celulares */
@media (max-width: 480px) {
    h1 {
        font-size: 18px;
    }

    .tema-btn {
        top: 5px;
        right: 5px;
        font-size: 12px;
        padding: 5px 8px;
    }

    input, select, button {
        width: 100%;
        font-size: 13px;
        padding: 8px;
    }

    .botones-extra button {
        width: 100%;
    }

    .cards {
        flex-direction: column;
        align-items: center;
    }

    .card {
        width: 90%;
    }

    canvas {
        width: 100% !important;
        height: auto !important;
    }

    .barra {
        width: 100%;
    }

    .cable {
        width: 120px;
    }
}