:root {
    --bg: #02070c;
    --bg-deep: #010408;
    --panel: rgba(5, 15, 24, .965);
    --panel-soft: rgba(8, 20, 31, .82);
    --cyan: #39bff5;
    --cyan-strong: #67d5ff;
    --cyan-soft: rgba(57, 191, 245, .12);
    --green: #2bd39f;
    --red: #ff4053;
    --text: #edf6fb;
    --text-soft: #b7c9d6;
    --muted: #69849a;
    --line: rgba(83, 146, 188, .27);
    --line-strong: rgba(92, 176, 229, .58);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.gateway-body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    color: var(--text);
    font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background:
        radial-gradient(circle at 34% 46%, rgba(18, 107, 169, .15), transparent 29%),
        radial-gradient(circle at 62% 47%, rgba(13, 74, 117, .065), transparent 31%),
        linear-gradient(180deg, #02080d 0%, #01050a 100%);
}

.gateway-shell {
    position: relative;
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    min-height: 720px;
    margin: 20px;
    overflow: hidden;
    border: 1px solid rgba(54, 124, 169, .26);
    background:
        radial-gradient(circle at 38% 48%, rgba(15, 85, 137, .075), transparent 30%),
        linear-gradient(180deg, rgba(2, 9, 15, .985), rgba(1, 5, 9, .995));
    box-shadow: inset 0 0 150px rgba(0, 0, 0, .86), 0 0 65px rgba(0, 105, 175, .05);
}

.gateway-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(42, 110, 154, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(42, 110, 154, .035) 1px, transparent 1px),
        radial-gradient(circle, rgba(54, 133, 183, .095) 1px, transparent 1.15px);
    background-size: 54px 54px, 54px 54px, 13px 13px;
    opacity: .42;
    mask-image: radial-gradient(circle at 43% 48%, #000 0 42%, rgba(0,0,0,.45) 66%, transparent 94%);
}

.gateway-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 20%, rgba(0,0,0,.15) 60%, rgba(0,0,0,.62) 100%);
}

.corner { position: absolute; z-index: 20; width: 30px; height: 30px; pointer-events: none; }
.corner::before, .corner::after { content: ""; position: absolute; background: var(--cyan); box-shadow: 0 0 10px rgba(57,191,245,.55); }
.corner::before { width: 24px; height: 2px; }
.corner::after { width: 2px; height: 24px; }
.corner-tl { top: -1px; left: -1px; } .corner-tr { top: -1px; right: -1px; }
.corner-bl { bottom: -1px; left: -1px; } .corner-br { right: -1px; bottom: -1px; }
.corner-tr::before, .corner-br::before, .corner-tr::after, .corner-br::after { right: 0; }
.corner-bl::before, .corner-br::before, .corner-bl::after, .corner-br::after { bottom: 0; }

.gateway-header {
    position: absolute;
    top: 28px; left: 48px; right: 48px;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 24px;
    color: #7898b0;
    font-size: 10px;
    letter-spacing: .12em;
}
.brand-block { display: flex; flex-direction: column; align-items: flex-start; }
.brand-logo { display: block; width: clamp(155px, 11vw, 205px); height: auto; max-height: 68px; object-fit: contain; object-position: left center; transform: translateX(-18px); filter: drop-shadow(0 0 6px rgba(255,45,63,.13)); }
.brand-kicker { margin-top: 1px; color: #a7bdcd; }
.brand-meta { margin-top: 7px; color: #536f85; font-size: 9px; }
.gateway-id { padding-top: 5px; color: #86a9c2; opacity: .72; }
.network-state { justify-self: end; display: flex; align-items: center; gap: 8px; padding-top: 5px; color: #88a5b9; text-align: right; }
.state-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; vertical-align: middle; }
.state-dot-green { background: var(--green); box-shadow: 0 0 9px rgba(43,211,159,.68); }
.state-dot-cyan { background: var(--cyan); box-shadow: 0 0 9px rgba(57,191,245,.68); }

.gateway-layout {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(520px, 1.08fr) minmax(430px, .84fr) minmax(160px, .28fr);
    align-items: center;
    gap: clamp(28px, 3vw, 52px);
    width: 100%; height: 100%;
    padding: 100px clamp(40px, 4vw, 72px) 88px;
}

.identity-visual { position: relative; min-height: 570px; height: 100%; display: flex; align-items: center; justify-content: center; }
.identity-visual::before {
    content: ""; position: absolute; width: min(51vw, 720px); aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle, rgba(18,118,183,.105), rgba(3,37,61,.025) 44%, transparent 70%); filter: blur(7px);
}
.ambient-map { position: absolute; inset: 6% 0 auto -4%; height: 56%; opacity: .13; background-image: radial-gradient(circle, rgba(57,191,245,.56) 0 1px, transparent 1.2px); background-size: 12px 12px; mask-image: radial-gradient(ellipse at 43% 48%, #000 0 56%, transparent 74%); }
.data-ray { position: absolute; height: 1px; background: linear-gradient(90deg, transparent, rgba(57,191,245,.38), transparent); opacity: .55; transform-origin: left center; }
.data-ray::after { content: ""; position: absolute; right: 18%; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px rgba(57,191,245,.75); }
.data-ray-a { width: 235px; left: 5%; top: 27%; transform: rotate(-7deg); }
.data-ray-b { width: 190px; left: 11%; bottom: 31%; transform: rotate(5deg); opacity: .33; }

.identity-stage { position: relative; width: min(50vw, 710px); aspect-ratio: 1; display: grid; place-items: center; }
.orbit { position: absolute; border-radius: 50%; border: 1px solid rgba(66,153,211,.20); pointer-events: none; }
.orbit-outer { inset: 0; border-style: dashed; animation: rotateCW 40s linear infinite; }
.orbit-mid { inset: 10%; border-color: rgba(69,171,231,.26); border-top-color: rgba(103,213,255,.84); border-right-color: transparent; animation: rotateCCW 25s linear infinite; }
.orbit-inner { inset: 20%; border-color: rgba(60,139,194,.24); border-left-color: rgba(57,191,245,.62); animation: rotateCW 16s linear infinite; }
.orbit-break { position: absolute; width: 70px; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); box-shadow: 0 0 10px rgba(57,191,245,.38); }
.orbit-break-a { right: -25px; top: 34%; transform: rotate(-12deg); }
.orbit-break-b { left: -14px; bottom: 27%; width: 45px; transform: rotate(8deg); opacity: .55; }

.logo-core { position: relative; z-index: 3; width: 88%; aspect-ratio: 1; display: grid; place-items: center; overflow: visible; border-radius: 50%; }
.center-emblem { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; filter: drop-shadow(0 0 13px rgba(71,196,255,.28)) drop-shadow(0 0 28px rgba(57,191,245,.10)); }
.scan-line { position: absolute; left: 11%; right: 11%; height: 1px; top: 28%; background: linear-gradient(90deg, transparent, rgba(91,208,255,.72), transparent); box-shadow: 0 0 10px rgba(57,191,245,.45); opacity: .65; animation: scan 4.6s ease-in-out infinite; }

.authorization-strip {
    position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 9px; min-width: 330px; justify-content: center;
    padding: 9px 14px; border-top: 1px solid rgba(65,145,196,.27); border-bottom: 1px solid rgba(65,145,196,.15);
    background: linear-gradient(90deg, transparent, rgba(4,18,28,.72) 15%, rgba(4,18,28,.72) 85%, transparent);
    color: #9eb7c9; font-size: 10px; letter-spacing: .11em; white-space: nowrap;
}
.auth-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 9px rgba(57,191,245,.65); }
.authorization-strip.is-denied { color: #e48a94; border-color: rgba(255,64,83,.25); }
.authorization-strip.is-denied .auth-dot { background: var(--red); box-shadow: 0 0 9px rgba(255,64,83,.6); }

.system-log {
    position: absolute; left: 3%; bottom: 0; width: min(330px, 46%); padding: 13px 15px;
    border: 1px solid rgba(61,112,148,.22); background: rgba(1,7,12,.68); backdrop-filter: blur(8px);
    color: #58bf9c; font-size: 8px; line-height: 1.75; box-shadow: 0 12px 30px rgba(0,0,0,.18);
}
.system-log-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 4px; color: #91aabd; font-size: 10px; letter-spacing: .11em; }
.log-status { color: var(--green); font-size: 8px; }
.system-log div:not(.system-log-head) { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.system-log time { color: #46748e; }
.cursor { animation: cursorBlink 1s steps(1) infinite; }

.login-panel {
    position: relative; width: 100%; max-width: 530px; justify-self: end; padding: clamp(38px, 4vw, 56px) clamp(30px, 3.2vw, 44px) 34px;
    border: 1px solid rgba(91,154,194,.51); background:
        radial-gradient(circle at 50% 0%, rgba(39,101,142,.10), transparent 30%),
        linear-gradient(180deg, rgba(7,18,28,.985), rgba(2,8,14,.995));
    box-shadow: inset 0 1px 0 rgba(224,242,255,.035), 0 34px 85px rgba(0,0,0,.48), 0 0 42px rgba(20,117,175,.035);
    clip-path: polygon(16px 0, 36% 0, 39% 6px, 77% 6px, 80% 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 22% 100%, 19% calc(100% - 6px), 14px calc(100% - 6px), 0 calc(100% - 20px), 0 20px);
}
.panel-marker { position: absolute; z-index: 2; background: var(--cyan); box-shadow: 0 0 10px rgba(57,191,245,.5); }
.marker-top { width: 42px; height: 2px; top: 0; right: 18%; }
.marker-side { width: 2px; height: 34px; right: 0; top: 39%; }
.has-error .panel-marker { background: var(--red); box-shadow: 0 0 10px rgba(255,64,83,.6); }

.panel-eyebrow { margin-bottom: 15px; color: #5d8dab; font-size: 9px; letter-spacing: .14em; text-align: center; }
.panel-title-row { display: flex; align-items: center; justify-content: center; gap: 13px; }
.panel-title-row h1 { margin: 0; color: #f0f7fb; font-size: clamp(20px, 1.55vw, 27px); line-height: 1.1; letter-spacing: .075em; text-align: center; }
.lock-icon { width: 23px; height: 23px; color: var(--cyan); filter: drop-shadow(0 0 6px rgba(57,191,245,.42)); }
.lock-icon svg { width: 100%; height: 100%; }
.has-error .lock-icon, .has-error .panel-title-row h1 { color: #ff7887; }
.panel-subtitle { max-width: 390px; margin: 14px auto 36px; color: #9eb1c0; font-size: 11px; line-height: 1.6; text-align: center; }

.login-form { display: grid; gap: 15px; }
.field-shell { position: relative; display: flex; align-items: center; min-height: 64px; border: 1px solid rgba(92,137,169,.36); border-radius: 5px; background: linear-gradient(180deg, rgba(8,19,28,.82), rgba(3,10,16,.97)); transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease; }
.field-shell:hover { border-color: rgba(105,159,194,.5); }
.field-shell:focus-within { border-color: rgba(76,191,243,.78); background: linear-gradient(180deg, rgba(8,27,40,.94), rgba(3,12,20,.99)); box-shadow: 0 0 0 3px rgba(57,191,245,.045), 0 0 26px rgba(57,191,245,.08); }
.field-shell.field-error { border-color: rgba(255,64,83,.5); }
.field-icon { width: 22px; height: 22px; flex: 0 0 auto; margin-left: 18px; color: #91aabd; }
.field-icon svg { width: 100%; height: 100%; }
.field-shell input { width: 100%; min-width: 0; min-height: 62px; border: 0; outline: 0; padding: 0 50px 0 16px; background: transparent; color: #dce8ef; font-family: inherit; font-size: 13px; letter-spacing: .11em; }
.field-shell input::placeholder, .field-shell input[readonly] { color: #688195; opacity: 1; }
.password-toggle { position: absolute; right: 12px; top: 50%; width: 38px; height: 38px; transform: translateY(-50%); display: grid; place-items: center; border: 0; padding: 8px; background: transparent; color: #7892a6; cursor: pointer; }
.password-toggle:hover { color: #dcecf5; }
.password-toggle svg { width: 21px; height: 21px; }

.gateway-submit { position: relative; overflow: hidden; width: 100%; min-height: 66px; margin-top: 3px; border: 1px solid rgba(66,184,237,.75); border-radius: 5px; background: linear-gradient(180deg, rgba(6,30,45,.91), rgba(2,13,21,.99)); color: #edf9ff; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 700; letter-spacing: .12em; box-shadow: inset 0 0 24px rgba(57,191,245,.07), 0 0 18px rgba(57,191,245,.055); transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, transform 150ms ease; }
.gateway-submit::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 20%, rgba(79,198,250,.03) 34%, rgba(92,207,255,.18) 48%, rgba(255,255,255,.045) 54%, transparent 72%); transform: translateX(-135%); }
.gateway-submit:hover { border-color: rgba(103,213,255,.96); background: linear-gradient(180deg, rgba(8,42,60,.98), rgba(2,15,24,.99)); box-shadow: inset 0 0 34px rgba(57,191,245,.12), 0 0 28px rgba(57,191,245,.16), 0 0 55px rgba(57,191,245,.045); }
.gateway-submit:hover::before { animation: buttonSweep .85s ease; }
.gateway-submit:active { transform: scale(.994); }
.gateway-submit:disabled { opacity: .7; cursor: wait; }
.gateway-submit.is-processing::before { animation: buttonSweep 1s linear infinite; }
.submit-arrow { position: absolute; right: 21px; top: 50%; transform: translateY(-52%); color: var(--red); font-size: 21px; line-height: 1; text-shadow: 0 0 9px rgba(255,64,83,.48); }

.verification { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 24px; color: #7fa7be; font-size: 9px; letter-spacing: .11em; }
.verification-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px rgba(57,191,245,.62); }
.verification.is-error { color: #e1818c; }
.verification.is-error .verification-dot { background: var(--red); box-shadow: 0 0 8px rgba(255,64,83,.62); }
.verification.is-verifying .verification-dot { animation: pulseCyan .8s ease-in-out infinite; }

.security-note { margin-top: 27px; padding-top: 17px; border-top: 1px solid rgba(78,124,155,.18); display: flex; align-items: center; justify-content: center; gap: 11px; color: #728b9e; }
.security-note-icon { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid rgba(115,157,184,.30); border-radius: 50%; color: #8aa3b5; font-size: 10px; }
.security-note strong { display: block; font-size: 9px; letter-spacing: .09em; font-weight: 600; }
.security-note span:not(.security-note-icon) { display: block; margin-top: 5px; color: #587086; font-size: 8px; letter-spacing: .055em; }

.telemetry { align-self: center; width: 100%; border: 1px solid rgba(57,116,155,.24); background: linear-gradient(180deg, rgba(4,13,20,.70), rgba(1,7,11,.76)); box-shadow: inset 0 1px 0 rgba(255,255,255,.012); }
.telemetry-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 12px 11px; border-bottom: 1px solid rgba(57,116,155,.18); color: #699ab9; font-size: 8px; letter-spacing: .1em; }
.telemetry-pulse { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(43,211,159,.62); animation: pulseGreen 2.2s ease-in-out infinite; }
.telemetry-row { display: flex; flex-direction: column; gap: 5px; padding: 12px; border-bottom: 1px solid rgba(57,116,155,.13); }
.telemetry-row:last-child { border-bottom: 0; }
.telemetry-row small { color: #4f86a7; font-size: 8px; letter-spacing: .08em; }
.telemetry-row strong { color: #a8c0d0; font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.telemetry-row strong.ok { color: var(--green); }
.telemetry-row > span { color: #6d8ba0; font-size: 8px; line-height: 1.4; overflow-wrap: anywhere; }

.gateway-footer { position: absolute; left: 48px; right: 48px; bottom: 25px; z-index: 10; display: flex; justify-content: space-between; gap: 20px; color: #6e899e; font-size: 8px; letter-spacing: .08em; }
.gateway-footer .state-dot { margin-right: 7px; }
.footer-muted { color: #48647a; margin-left: 9px; }
.footer-right { text-align: right; }

.has-error .login-panel { border-color: rgba(181,77,91,.50); box-shadow: inset 0 1px 0 rgba(255,255,255,.028), 0 34px 85px rgba(0,0,0,.48), 0 0 34px rgba(255,64,83,.025); }
.has-error .gateway-submit { border-color: rgba(76,164,207,.65); }

@keyframes rotateCW { to { transform: rotate(360deg); } }
@keyframes rotateCCW { to { transform: rotate(-360deg); } }
@keyframes scan { 0%, 100% { transform: translateY(-62px); opacity: .12; } 50% { transform: translateY(68px); opacity: .7; } }
@keyframes cursorBlink { 0%, 48% { opacity: 1; } 49%, 100% { opacity: 0; } }
@keyframes buttonSweep { from { transform: translateX(-135%); } to { transform: translateX(135%); } }
@keyframes pulseCyan { 0%, 100% { opacity: .35; } 50% { opacity: 1; box-shadow: 0 0 14px rgba(57,191,245,.9); } }
@keyframes pulseGreen { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

@media (max-width: 1380px) {
    .gateway-layout { grid-template-columns: minmax(500px, 1fr) minmax(420px, .88fr); padding-right: 54px; }
    .telemetry { display: none; }
    .identity-stage { width: min(48vw, 630px); }
}

@media (max-width: 980px) {
    .gateway-body { overflow: auto; }
    .gateway-shell { width: 100%; height: auto; min-height: 100dvh; margin: 0; border-left: 0; border-right: 0; }
    .gateway-header { position: relative; top: auto; left: auto; right: auto; padding: calc(18px + env(safe-area-inset-top)) 22px 8px; grid-template-columns: 1fr auto; }
    .gateway-id { display: none; }
    .gateway-layout { grid-template-columns: 1fr; height: auto; padding: 12px 20px 95px; gap: 12px; }
    .identity-visual { min-height: 420px; }
    .identity-stage { width: min(76vw, 510px); }
    .system-log { left: 4%; width: 290px; }
    .authorization-strip { bottom: 16%; }
    .login-panel { justify-self: center; max-width: 560px; }
    .gateway-footer { left: 22px; right: 22px; bottom: 22px; }
}

@media (max-width: 600px) {
    .gateway-header { grid-template-columns: 1fr; padding-left: 14px; padding-right: 14px; }
    .network-state { display: none; }
    .brand-logo { width: min(190px, 62vw); transform: translateX(-18px); }
    .gateway-layout { padding: 4px 10px calc(18px + env(safe-area-inset-bottom)); }
    .identity-visual { min-height: 235px; max-height: 235px; overflow: hidden; }
    .identity-stage { width: 265px; }
    .authorization-strip { min-width: 0; width: min(94%, 360px); bottom: 3px; padding: 8px 9px; font-size: 8px; white-space: normal; text-align: center; }
    .system-log, .ambient-map, .data-ray { display: none; }
    .login-panel { width: 100%; padding: 28px 15px 22px; clip-path: none; border-radius: 6px; }
    .panel-title-row h1 { font-size: 20px; }
    .panel-subtitle { margin-bottom: 23px; font-size: 10px; }
    .field-shell { min-height: 58px; }
    .field-shell input { min-height: 56px; font-size: 16px; }
    .gateway-submit { min-height: 59px; font-size: 13px; }
    .gateway-footer { display: none; }
}

@media (max-width: 380px) {
    .identity-visual { min-height: 205px; max-height: 205px; }
    .identity-stage { width: 220px; }
    .authorization-strip { font-size: 7px; }
    .login-panel { padding-left: 12px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
