:root {
    --bg-dark: #050a13;
    --text-main: #a7b0c2;
    --text-bright: #ffffff;
    --tech-blue: #00aaff;
    --tech-cyan: #00ffff;
    --imp-red: #d9534f;
    --imp-crimson: #ff4d4d;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Orbitron', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image:
        radial-gradient(circle at top right, rgba(139, 0, 0, 0.18), transparent 45%),
        radial-gradient(circle at bottom left, rgba(0, 170, 255, 0.12), transparent 50%);
}

/* ---------- Starfield canvas ---------- */
#stars {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* ---------- Scanlines overlay ---------- */
.scanlines {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom,
            transparent,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px);
    animation: scan-drift 10s linear infinite;
}

@keyframes scan-drift {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100px;
    }
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: 49;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.6) 100%);
}

/* ---------- Top / bottom status bars ---------- */
.top-bar,
.bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    font-size: 0.7em;
    letter-spacing: 1px;
    z-index: 20;
    color: var(--tech-blue);
    text-shadow: 0 0 6px rgba(0, 170, 255, 0.4);
}

.top-bar {
    top: 0;
    border-bottom: 1px solid rgba(0, 170, 255, 0.2);
}

.bottom-bar {
    bottom: 0;
    border-top: 1px solid rgba(217, 83, 79, 0.2);
    color: #7a889f;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    background: var(--tech-cyan);
    box-shadow: 0 0 8px var(--tech-cyan);
    animation: pulse-online 2.2s ease-in-out infinite;
}

@keyframes pulse-online {

    0%,
    100% {
        box-shadow: 0 0 6px var(--tech-cyan);
    }

    50% {
        box-shadow: 0 0 18px var(--tech-cyan), 0 0 30px rgba(0, 255, 255, 0.4);
    }
}

/* ---------- Login container ---------- */
.gate-wrap {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
}

.gate-panel {
    background-color: rgba(0, 0, 0, 0.72);
    border: 1px solid #1e3a59;
    border-image: linear-gradient(135deg, var(--tech-blue), var(--imp-red)) 1;
    border-radius: 10px;
    padding: 2.2rem 2rem 1.8rem;
    box-shadow: 0 0 30px rgba(0, 170, 255, 0.15), 0 0 30px rgba(217, 83, 79, 0.1);
    position: relative;
    overflow: hidden;
    animation: panel-breathe 4s ease-in-out infinite;
}

@keyframes panel-breathe {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(0, 170, 255, 0.15), 0 0 30px rgba(217, 83, 79, 0.1);
    }

    50% {
        box-shadow: 0 0 45px rgba(0, 170, 255, 0.3), 0 0 45px rgba(217, 83, 79, 0.22);
    }
}

.gate-panel.erro {
    animation: gate-shake 0.4s ease, panel-breathe 4s ease-in-out infinite;
    border-color: var(--imp-crimson) !important;
}

.gate-panel.sucesso {
    animation: panel-success-glow 1.2s ease-in-out infinite;
}

@keyframes panel-success-glow {

    0%,
    100% {
        box-shadow: 0 0 25px rgba(0, 255, 150, 0.35);
    }

    50% {
        box-shadow: 0 0 55px rgba(0, 255, 150, 0.6);
    }
}

@keyframes gate-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-10px);
    }

    40% {
        transform: translateX(9px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(4px);
    }
}

.gate-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--tech-blue), var(--imp-red), var(--tech-blue));
    background-size: 200% 100%;
    animation: strip-run 3s linear infinite;
}

@keyframes strip-run {
    0% {
        background-position: 0% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Corner brackets like the imperial deco */
.gate-panel .corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--tech-cyan);
    opacity: 0.8;
}

.corner.tl {
    top: 8px;
    left: 8px;
    border-top: 2px solid;
    border-left: 2px solid;
}

.corner.br {
    bottom: 8px;
    right: 8px;
    border-bottom: 2px solid;
    border-right: 2px solid;
}

.emblem {
    width: 62px;
    height: 62px;
    margin: 0 auto 0.8rem;
    border-radius: 50%;
    border: 2px solid var(--tech-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.4);
    animation: emblem-spin 12s linear infinite;
}

.emblem::before,
.emblem::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1px dashed rgba(217, 83, 79, 0.6);
}

.emblem::after {
    inset: 16px;
    border-color: rgba(0, 255, 255, 0.5);
    animation: emblem-spin-rev 8s linear infinite;
}

@keyframes emblem-spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes emblem-spin-rev {
    100% {
        transform: rotate(-360deg);
    }
}

.emblem svg {
    width: 26px;
    height: 26px;
    fill: var(--tech-cyan);
    filter: drop-shadow(0 0 6px var(--tech-cyan));
    animation: emblem-spin-rev 12s linear infinite;
}

.gate-eyebrow {
    text-align: center;
    font-size: 0.62rem;
    letter-spacing: 0.25em;
    color: var(--tech-blue);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    opacity: 0.85;
}

.gate-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 3px;
    margin: 0 0 0.3rem;
    color: var(--text-bright);
    text-shadow: 0 0 10px rgba(0, 170, 255, 0.6), 0 0 24px rgba(217, 83, 79, 0.3);
    position: relative;
}

.gate-title::before,
.gate-title::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    overflow: hidden;
    opacity: 0;
}

.gate-title.glitching::before {
    color: var(--tech-cyan);
    clip-path: polygon(0 15%, 100% 15%, 100% 35%, 0 35%);
    transform: translateX(-3px);
    opacity: 0.8;
    animation: glitch-a 0.18s steps(1) forwards;
}

.gate-title.glitching::after {
    color: var(--imp-crimson);
    clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
    transform: translateX(3px);
    opacity: 0.8;
    animation: glitch-b 0.18s steps(1) forwards;
}

@keyframes glitch-a {
    0% {
        transform: translateX(-3px);
    }

    100% {
        transform: translateX(0);
        opacity: 0;
    }
}

@keyframes glitch-b {
    0% {
        transform: translateX(3px);
    }

    100% {
        transform: translateX(0);
        opacity: 0;
    }
}

.gate-sub {
    text-align: center;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: #627595;
    margin-bottom: 1.6rem;
    font-family: 'Courier New', monospace;
    min-height: 1.4em;
}

.gate-sub .cursor-blink {
    animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.gate-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.field {
    position: relative;
}

.field label {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--tech-cyan);
    margin-bottom: 0.4rem;
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.3);
}

.field .input-wrap {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid #1e3a59;
    border-radius: 6px;
    padding: 0 0.7rem;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.field .input-wrap svg {
    width: 16px;
    height: 16px;
    fill: var(--tech-blue);
    opacity: 0.8;
    flex-shrink: 0;
}

.field input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-bright);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    letter-spacing: 1px;
    padding: 0.75rem 0.6rem;
}

.field .input-wrap.focused {
    border-color: var(--tech-cyan);
    box-shadow: 0 0 14px rgba(0, 255, 255, 0.35);
}

.field .input-wrap.focused svg {
    fill: var(--tech-cyan);
}

.gate-btn {
    margin-top: 0.4rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.18), rgba(217, 83, 79, 0.18));
    border: 1px solid var(--tech-blue);
    color: var(--text-bright);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 3px;
    font-size: 0.8rem;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    transition: box-shadow 0.25s, transform 0.15s;
}

.gate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-20deg);
    animation: btn-sweep 2.6s ease-in-out infinite;
}

@keyframes btn-sweep {
    0% {
        left: -60%;
    }

    50% {
        left: 130%;
    }

    100% {
        left: 130%;
    }
}

.gate-btn:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.5), 0 0 20px rgba(217, 83, 79, 0.3);
    transform: translateY(-1px);
}

.gate-btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
}

.gate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* progress bar during "authentication" */
.auth-progress {
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.9rem;
    display: none;
}

.auth-progress.show {
    display: block;
}

.auth-progress .bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--tech-blue), var(--tech-cyan));
    box-shadow: 0 0 10px var(--tech-cyan);
    transition: width 1.4s cubic-bezier(.4, 0, .2, 1);
}

.gate-feedback {
    text-align: center;
    min-height: 1.4em;
    margin-top: 0.9rem;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    font-family: 'Courier New', monospace;
}

.gate-feedback.erro {
    color: var(--imp-crimson);
    text-shadow: 0 0 6px rgba(255, 77, 77, 0.5);
}

.gate-feedback.ok {
    color: #5cffa0;
    text-shadow: 0 0 6px rgba(92, 255, 160, 0.5);
}

.gate-feedback.info {
    color: var(--tech-blue);
}

/* Mini terminal log under the panel */
.mini-log {
    margin-top: 1.4rem;
    border-top: 1px dashed rgba(0, 170, 255, 0.2);
    padding-top: 0.7rem;
    height: 62px;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    font-size: 0.62rem;
    color: #536078;
    line-height: 1.5;
}

.mini-log p {
    margin: 0 0 2px;
    opacity: 0;
    animation: log-fade-in 0.4s forwards;
}

@keyframes log-fade-in {
    to {
        opacity: 1;
    }
}

.mini-log .ok-log {
    color: #4caf7d;
}

.mini-log .warn-log {
    color: #d9a441;
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.62rem;
    color: #7a889f;
    letter-spacing: 0.05em;
    margin-top: -0.4rem;
}

.remember-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.remember-row input[type="checkbox"] {
    appearance: none;
    width: 13px;
    height: 13px;
    border: 1px solid var(--tech-blue);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
}

.remember-row input[type="checkbox"]:checked {
    background: var(--tech-blue);
    box-shadow: 0 0 8px var(--tech-blue);
}

.remember-row a {
    color: var(--imp-crimson);
    text-decoration: none;
}

.remember-row a:hover {
    text-decoration: underline;
}

/* Success checkmark overlay */
.success-check {
    display: none;
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem;
    position: relative;
}

.success-check.show {
    display: block;
    animation: pop-in 0.4s ease;
}

@keyframes pop-in {
    from {
        transform: scale(0.4);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-check svg {
    width: 100%;
    height: 100%;
}

.success-check circle {
    fill: none;
    stroke: #5cffa0;
    stroke-width: 3;
    stroke-dasharray: 190;
    stroke-dashoffset: 190;
    animation: draw-circle 0.6s ease forwards;
    filter: drop-shadow(0 0 8px #5cffa0);
}

.success-check path {
    fill: none;
    stroke: #5cffa0;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: draw-check 0.4s ease 0.5s forwards;
}

@keyframes draw-circle {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes draw-check {
    to {
        stroke-dashoffset: 0;
    }
}

.hidden-block {
    display: none !important;
}

@media (max-width: 480px) {
    .gate-panel {
        padding: 1.7rem 1.3rem 1.4rem;
    }

    .top-bar,
    .bottom-bar {
        font-size: 0.58em;
        padding: 8px 12px;
    }
}