* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #050505;
    color: #fff;
    font-family: 'Inter', sans-serif;
    overflow: hidden; /* Fullscreen, no scroll */
    width: 100vw;
    height: 100vh;
}

#visualizer, #threecanvas, #twodcanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(5px);
}

.overlay h1 {
    font-size: 4rem;
    margin-bottom: 3rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    background: linear-gradient(90deg, #0ff, #f0f, #0ff);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 3s linear infinite;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

@keyframes shine {
    to { background-position: 200% center; }
}

button {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #0ff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

button:hover {
    background: #0ff;
    color: #000;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8), 0 0 50px rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
}

#promo-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.8s ease-in-out;
}

#promo-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    animation: pulseImage 10s infinite alternate;
}

@keyframes pulseImage {
    0% { transform: scale(1); }
    100% { transform: scale(1.03); }
}

.hidden {
    opacity: 0 !important;
    pointer-events: none;
    z-index: -1 !important;
}

/* Admin Panel */
#admin-panel {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background: rgba(15, 15, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 2rem;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    backdrop-filter: blur(15px);
    width: 340px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    transition: all 0.3s ease;
}

#admin-panel h2 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    color: #0ff;
    text-align: center;
}

#upload-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#upload-form input[type="file"] {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem;
    border-radius: 8px;
    color: #fff;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

#upload-form input[type="file"]:hover {
    border-color: #0ff;
}

#upload-status {
    margin-top: 1rem;
    font-size: 0.95rem;
    text-align: center;
    height: 1.5rem;
}

/* Fila de acciones del panel — 2 filas: Inicio arriba, Panel+Sesión abajo */
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1.2rem;
}

.admin-actions button {
    flex: 1 1 calc(50% - 0.25rem);
    padding: 0.65rem 0.5rem;
    font-size: 0.78rem;
    border-radius: 8px;
    margin: 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
    box-shadow: none;
}

#home-btn {
    flex: 1 1 100%; /* fila propia, ancho completo */
    border-color: #ff9900;
    background: rgba(255, 153, 0, 0.12);
    color: #ff9900;
    box-shadow: 0 0 8px rgba(255, 153, 0, 0.2);
}

#home-btn:hover {
    background: #ff9900;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 153, 0, 0.8);
}

#close-admin {
    border-color: #f0f;
    background: rgba(255, 0, 255, 0.1);
    color: #f0f;
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.2);
}

#close-admin:hover {
    background: #f0f;
    color: #000;
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.8);
}

#logout-btn {
    border-color: #ff3366;
    background: rgba(255, 51, 102, 0.12);
    color: #ff3366;
    box-shadow: 0 0 8px rgba(255, 51, 102, 0.2);
}

#logout-btn:hover {
    background: #ff3366;
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.8);
}

#toggle-admin {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: all 0.3s ease;
}

/* Zona extendida invisible para que el mouse lo detecte antes de tocarlo */
#toggle-admin::after {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    right: -20px;
    bottom: -20px;
}

.watermark-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90%;
    z-index: 10;
    pointer-events: none;
    transition: opacity 1.5s ease, transform 0.1s ease-out;
}

.watermark-logo.hide {
    opacity: 0;
}

#toggle-admin:hover {
    opacity: 1;
    border-color: #0ff;
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transform: rotate(90deg);
}

#admin-panel h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #fff;
    text-align: center;
}

.promo-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 200px;
    overflow-y: auto;
}

.promo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.promo-item img {
    height: 40px;
    width: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.promo-item span {
    flex: 1;
    margin-left: 10px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
}

.delete-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-color: #f00;
    background: rgba(255, 0, 0, 0.1);
    color: #f00;
    box-shadow: none;
    border-radius: 5px;
}

.delete-btn:hover {
    background: #f00;
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    transform: none;
}

.auto-rotate-container {
    text-align: center;
    margin-bottom: 0.8rem;
    color: #ccc;
    font-size: 0.9rem;
}

.auto-rotate-container input {
    margin-right: 5px;
    cursor: pointer;
    accent-color: #0ff;
}

.pattern-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pattern-filters,
.remote-pattern-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin: 0 0 0.8rem;
}

.pattern-filter-btn,
.remote-filter-btn,
.automation-scope-btn,
.remote-automation-scope-btn {
    padding: 0.42rem 0.25rem;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.05);
    color: #bbb;
    box-shadow: none;
    font-size: 0.66rem;
}

.pattern-filter-btn.active,
.remote-filter-btn.active,
.automation-scope-btn.active,
.remote-automation-scope-btn.active {
    border-color: #0ff;
    background: rgba(0, 255, 255, 0.18);
    color: #0ff;
}

.pattern-filter-hidden {
    display: none !important;
}

.pattern-category-note,
.remote-category-note {
    margin: -0.25rem 0 0.75rem;
    color: #8f8f9c;
    font-size: 0.7rem;
    text-align: center;
}

.automation-scope,
.remote-automation-scope {
    margin: 0 0 0.85rem;
    color: #ccc;
    font-size: 0.78rem;
    text-align: center;
}

.automation-scope > span,
.remote-automation-scope > p {
    display: block;
    margin: 0 0 0.45rem;
}

.automation-scope-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
}

.pattern-btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.85rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ccc;
    box-shadow: none;
}

.pattern-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #0ff;
    color: #fff;
    transform: none;
    box-shadow: none;
}

.pattern-btn.active {
    background: #0ff;
    color: #000;
    border-color: #0ff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Footer Temporal */
.startup-footer {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1000;
    transition: opacity 0.8s ease-out;
    font-family: 'Inter', sans-serif;
}

.footer-pill {
    background: rgba(10, 10, 10, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 25px;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.15);
    color: #888;
}

.footer-pill .muted { color: #888; }
.footer-pill .highlight { color: #ffd700; font-weight: bold; text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
.footer-pill .highlight-blue { color: #00e5ff; font-weight: bold; text-shadow: 0 0 5px rgba(0, 229, 255, 0.5); }
.footer-pill a.whatsapp { 
    color: #fff; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    text-decoration: none;
    transition: color 0.3s;
}
.footer-pill a.whatsapp:hover {
    color: #25D366;
}

.footer-copy {
    margin-top: 15px;
    font-size: 11px;
    color: #555;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.startup-footer.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Logo Temporal Top-Left */
.startup-logo {
    position: absolute;
    top: 40px;
    left: 50px;
    max-height: 160px;
    width: auto;
    z-index: 1000;
    transition: opacity 0.8s ease-out;
}

.startup-logo.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Login Form */
#login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

#login-form input {
    padding: 12px;
    font-size: 1rem;
    border: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 8px;
    outline: none;
    text-align: center;
}

#login-form input:focus {
    border-color: #0ff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.error-msg {
    color: #ff3366;
    margin-top: 15px;
    font-size: 0.9rem;
    text-shadow: 0 0 5px rgba(255, 51, 102, 0.5);
}

/* Panel de control remoto */
.remote-page {
    width: 100%;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at 15% 10%, rgba(0, 255, 255, 0.12), transparent 28rem),
        radial-gradient(circle at 90% 80%, rgba(255, 0, 255, 0.1), transparent 24rem),
        #050505;
}

.remote-login,
.remote-app {
    width: min(100%, 680px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.remote-login.hidden,
.remote-app.hidden {
    display: none;
}

.remote-login {
    display: grid;
    place-items: center;
}

.remote-app {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.remote-card {
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 18px;
    background: rgba(15, 15, 20, 0.88);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
}

.login-card {
    width: min(100%, 420px);
}

.remote-kicker {
    margin-bottom: 5px;
    color: #0ff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.remote-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 4px;
}

.remote-header h1,
.remote-card h2 {
    margin: 0;
}

.remote-header h1 {
    font-size: clamp(1.65rem, 7vw, 2.1rem);
}

.remote-card h2 {
    margin-bottom: 18px;
    color: #0ff;
    font-size: 1.15rem;
}

.remote-subtitle,
.remote-note {
    color: #b7b7c0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.remote-subtitle {
    margin: 10px 0 22px;
}

.remote-login form,
.remote-upload-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.remote-login label {
    color: #d8d8df;
    font-size: 0.85rem;
    font-weight: 600;
}

.remote-login input,
.remote-upload-form input[type="file"] {
    width: 100%;
    padding: 13px;
    color: #fff;
    border: 1px solid rgba(0, 255, 255, 0.35);
    border-radius: 9px;
    outline: none;
    background: rgba(0, 0, 0, 0.45);
    font: inherit;
}

.remote-login input:focus {
    border-color: #0ff;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.25);
}

.remote-login button,
.remote-upload-form button {
    width: 100%;
    margin-top: 8px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
}

.remote-error {
    margin-top: 14px;
    color: #ff557e;
    font-size: 0.9rem;
}

.remote-status {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid rgba(0, 255, 255, 0.22);
    border-radius: 99px;
    color: #aee;
    font-size: 0.75rem;
    white-space: nowrap;
}

#connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #39f58c;
    box-shadow: 0 0 8px #39f58c;
}

#connection-dot.offline {
    background: #ff557e;
    box-shadow: 0 0 8px #ff557e;
}

.remote-pattern-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.remote-pattern-btn {
    min-height: 64px;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.25;
    box-shadow: none;
}

.remote-pattern-btn.active {
    color: #000;
    border-color: #0ff;
    background: #0ff;
    box-shadow: 0 0 18px rgba(0, 255, 255, 0.45);
}

.remote-card > .remote-note {
    margin-top: 15px;
}

.remote-toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 15px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.remote-toggle:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.remote-toggle strong,
.remote-toggle small {
    display: block;
}

.remote-toggle strong {
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.remote-toggle small {
    color: #a4a4b0;
    font-size: 0.78rem;
}

.remote-toggle input {
    position: absolute;
    opacity: 0;
}

.remote-toggle-slider {
    position: relative;
    width: 50px;
    height: 28px;
    border-radius: 99px;
    background: #31313a;
    transition: background 0.2s ease;
}

.remote-toggle-slider::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.remote-toggle input:checked + .remote-toggle-slider {
    background: #00c7c7;
}

.remote-toggle input:checked + .remote-toggle-slider::after {
    transform: translateX(22px);
}

.remote-toggle input:focus-visible + .remote-toggle-slider {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.remote-promo-list {
    margin-top: 16px;
    max-height: 360px;
}

.remote-logout {
    width: 100%;
    padding: 0.75rem 1rem;
    color: #ff557e;
    border-color: #ff557e;
    background: rgba(255, 51, 102, 0.08);
    box-shadow: none;
    font-size: 0.9rem;
}

.remote-logout:hover {
    color: #fff;
    background: #ff3366;
}

@media (max-width: 390px) {
    .remote-card {
        padding: 18px;
    }

    .remote-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .remote-pattern-grid {
        grid-template-columns: 1fr;
    }

}
