:root {
    --marvel-red: #e62429;
    --marvel-blue: #0a1045;
    --marvel-dark: #05060a;
    --marvel-glow: rgba(230, 36, 41, 0.55);
    --marvel-blue-glow: rgba(46, 102, 255, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto auto auto;
    row-gap: 16px;
    place-items: center;
    padding: 0;
    perspective: 1200px;
    background:
        radial-gradient(circle at 20% 20%, rgba(230, 36, 41, 0.18), transparent 25%),
        radial-gradient(circle at 80% 15%, rgba(46, 102, 255, 0.18), transparent 30%),
        linear-gradient(135deg, #0b132b, #04060d 55%, #0b0f1a);
    color: #e8ebf7;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
}

.intro-shell,
.login-shell {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 38px;
    padding: 10px;
    text-align: center;
}

.logo-frame {
    position: relative;
    display: inline-flex;
    padding: 12px;
    border-radius: 18px;
    margin-top: 40px;
    isolation: isolate;
    animation: growIntro 10s ease-out forwards;
    transform-origin: center;
    will-change: transform, opacity;
}

.logo-frame::before,
.logo-frame::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 22px;
    background: linear-gradient(120deg,
            rgba(230, 36, 41, 0.18),
            rgba(46, 102, 255, 0.25),
            rgba(230, 36, 41, 0.35),
            rgba(46, 102, 255, 0.25),
            rgba(230, 36, 41, 0.18));
    background-size: 300% 300%;
    filter: blur(10px);
    animation: borderGlow 7s ease-in-out infinite, growIntro 10s ease-out forwards;
    z-index: 0;
}

.logo-frame::after {
    inset: -14px;
    border-radius: 26px;
    filter: blur(24px);
    opacity: 0.6;
}

.logo-frame img {
    position: relative;
    z-index: 1;
    max-width: min(520px, 82vw);
    width: 90%;
    border-radius: 14px;
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.55),
        0 0 32px var(--marvel-glow),
        0 0 22px var(--marvel-blue-glow);
    animation: growIntro 10s ease-out forwards;
    transform-origin: center;
    will-change: transform, opacity;
}

.fade-out {
    opacity: 0 !important;
    transition: opacity 0.6s ease !important;
}

.login-shell {
    display: none;
    opacity: 0;
    width: 100%;
    max-width: 960px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 36px 18px 44px;
    color: #e8ebf7;
    grid-template-rows: auto 1fr auto auto;
    justify-items: center;
    align-content: space-between;
    row-gap: 18px;
}

.login-shell.visible {
    display: grid;
    animation: fadeIn 0.7s ease forwards;
}

/* --- FRASE MARVEL SUPERIOR --- */
.marvel-motto {
    margin: 24px auto 8px;
    padding-top: 0;
    color: #f5f7ff;
    font-size: clamp(1.8rem, 3vw + 0.8rem, 2.8rem);
    font-family: 'Bangers', 'Impact', 'Bebas Neue', 'Anton', 'Oswald', system-ui, sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: center;
    max-width: 100%;
    white-space: nowrap;
    text-shadow:
        0 0 12px rgba(46, 102, 255, 0.35),
        0 0 10px rgba(0, 0, 0, 0.65);
    transform: none;
    transition: opacity 0.6s ease;
}

/* --- BOX LOGIN --- */
.login-card {
    background: linear-gradient(135deg, rgba(5, 6, 10, 0.94), rgba(10, 16, 40, 0.94));
    border: 1px solid rgba(232, 235, 247, 0.14);
    box-shadow:
        0 18px 48px rgba(0, 0, 0, 0.6),
        0 0 24px rgba(46, 102, 255, 0.25),
        0 0 20px rgba(230, 36, 41, 0.25);
    border-radius: 16px;
    padding: 30px 28px 26px;
    width: min(520px, 100%);
    max-width: 520px;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.login-card h2 {
    margin: 0 0 10px;
    font-size: 1.25rem;
    letter-spacing: 0.04em;
    color: #fff;
}

/* --- CAMPOS --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    text-align: left;
}

label {
    font-size: 0.9rem;
    color: #d7ddf7;
    letter-spacing: 0.02em;
}

.input-wrap {
    position: relative;
}

input {
    padding: 12px 14px 12px 44px;
    border-radius: 10px;
    border: 1px solid rgba(232, 235, 247, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: #e8ebf7;
    font-size: 0.95rem;
    outline: none;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
    border-color: var(--marvel-red);
    box-shadow: 0 0 14px var(--marvel-glow), 0 0 8px var(--marvel-blue-glow);
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: #9fb2e7;
    opacity: 0.9;
    pointer-events: none;
}

/* --- BOTÓN --- */
.login-button {
    cursor: pointer;
    border: none;
    background: linear-gradient(135deg, #ff343a, #e62429 40%, #b5131b 90%);
    color: #fff;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 0.86rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 600;
    width: auto;
    min-width: 120px;
    align-self: center;
    box-shadow:
        0 10px 22px rgba(0, 0, 0, 0.5),
        0 0 16px var(--marvel-glow),
        0 0 11px var(--marvel-blue-glow);
    transition: transform 0.12s ease, box-shadow 0.25s ease, opacity 0.2s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.6),
        0 0 22px var(--marvel-glow),
        0 0 15px var(--marvel-blue-glow);
}

/* --- ERROR --- */
.error {
    color: #ff8a8a;
    font-size: 0.9rem;
    min-height: 18px;
}

/* --- STARS BACKGROUND --- */
.stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(1px 1px at 80% 20%, rgba(255, 255, 255, 0.35), transparent),
        radial-gradient(1px 1px at 40% 80%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(1px 1px at 65% 55%, rgba(255, 255, 255, 0.35), transparent);
    opacity: 0.45;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.25));
    pointer-events: none;
    animation: drift 18s ease-in-out infinite;
}

/* --- FRASE INFERIOR (AJUSTADA) --- */
.master-note-big {
    margin: 60px auto 6px;
    font-family: 'Bangers', 'Impact', 'Bebas Neue', 'Anton', 'Oswald', system-ui, sans-serif;
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    text-align: center;
    color: #f5f7ff;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    opacity: 0.92;
    white-space: normal;
    max-width: 90vw;
    text-shadow:
        0 0 8px rgba(46, 102, 255, 0.35),
        0 0 6px rgba(0, 0, 0, 0.55);
    transition: opacity 0.6s ease;
}

.master-note-small {
    margin: -8px auto 12px;
    font-family: 'Bangers', 'Impact', 'Bebas Neue', 'Anton', 'Oswald', system-ui, sans-serif;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    text-align: center;
    color: #e8ebf7;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.9;
    white-space: normal;
    max-width: 90vw;
    text-shadow:
        0 0 6px rgba(46, 102, 255, 0.25),
        0 0 4px rgba(0, 0, 0, 0.45);
    transition: opacity 0.6s ease;
}

/* --- ANIMACIONES --- */
@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes drift {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(8px, -10px, 0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes growIntro {
    0%   { transform: scale(1) rotate(0deg); opacity: 1; }
    25%  { transform: scale(1.05); opacity: 1; }
    55%  { transform: scale(1.12); opacity: 1; }
    75%  { transform: scale(1.16); opacity: 1; }
    85%  { transform: scale(1.20); opacity: 1; }
    92%  { transform: scale(0.95) rotate(-220deg); opacity: 0.6; }
    100% { transform: scale(0.20) rotate(-540deg); opacity: 0; }
}
