@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Space+Mono:wght@400;700&display=swap");

:root {
    color-scheme: dark;
    --ink: #05090b;
    --panel: #0b1215;
    --surface: #101a1e;
    --access-panel: rgba(8, 14, 16, .82);
    --focus-surface: #0d191c;
    --line: rgba(135, 236, 226, 0.16);
    --cyan: #46ead8;
    --cyan-soft: #a2fff5;
    --coral: #ff6b7d;
    --text: #eef9f7;
    --muted: #859d9a;
}

:root[data-sarah-background="graphite"] {
    --ink: #171c1e;
    --panel: #20272a;
    --surface: #252e31;
    --access-panel: rgba(25, 31, 33, .9);
    --focus-surface: #2b373a;
}

:root[data-sarah-background="midnight"] {
    --ink: #061522;
    --panel: #0a1e2b;
    --surface: #0c2230;
    --access-panel: rgba(7, 22, 32, .9);
    --focus-surface: #12303e;
}

* { box-sizing: border-box; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }

body {
    background: var(--ink);
    color: var(--text);
    font-family: "DM Sans", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(70, 234, 216, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(70, 234, 216, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to right, black, transparent 68%);
}

.login-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
}

.identity-panel {
    position: relative;
    min-height: 100vh;
    padding: clamp(2rem, 4vw, 4.5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    perspective: 900px;
    border-right: 1px solid var(--line);
}

.identity-panel::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: 16%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    box-shadow: 0 0 28px rgba(70, 234, 216, 0.65);
    animation: scan 5s ease-in-out infinite;
}

.system-label, .telemetry, .form-kicker, .secure-note {
    font-family: "Space Mono", monospace;
    letter-spacing: 0;
}

.system-label {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: .65rem;
    color: var(--cyan-soft);
    font-size: .68rem;
}

.system-label span, .secure-note span {
    width: 7px;
    height: 7px;
    background: var(--cyan);
    box-shadow: 0 0 14px var(--cyan);
    animation: pulse 2s ease-in-out infinite;
}

.core-stage {
    position: absolute;
    width: min(47vw, 560px);
    aspect-ratio: 1;
    left: 50%;
    top: 47%;
    transform: translate(-50%, -50%) rotateX(64deg) rotateZ(-8deg);
    transform-style: preserve-3d;
}

.core-ring, .core-plane {
    position: absolute;
    inset: 12%;
    border: 1px solid rgba(70, 234, 216, .3);
    transform-style: preserve-3d;
}

.core-ring::before, .core-ring::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--cyan);
    box-shadow: 0 0 18px var(--cyan);
}

.core-ring::before { top: -4px; left: 20%; }
.core-ring::after { right: -4px; bottom: 24%; background: var(--coral); box-shadow: 0 0 18px var(--coral); }
.core-ring-one { animation: rotate-core 18s linear infinite; }
.core-ring-two { inset: 23%; transform: translateZ(55px) rotate(45deg); animation: rotate-core-reverse 13s linear infinite; }
.core-ring-three { inset: 34%; transform: translateZ(105px); animation: rotate-core 9s linear infinite; }
.core-plane { inset: 29%; border-color: rgba(255, 107, 125, .3); transform: translateZ(75px) rotateX(70deg) rotate(45deg); }
.core-plane-two { transform: translateZ(75px) rotateY(70deg) rotate(45deg); }

.core-mark {
    position: absolute;
    width: 24%;
    height: 24%;
    left: 38%;
    top: 38%;
    transform: translateZ(142px) rotateZ(8deg) rotateX(-64deg);
    filter: drop-shadow(0 0 28px rgba(70, 234, 216, .42));
    animation: core-float 4s ease-in-out infinite;
}

.identity-copy { position: relative; z-index: 2; max-width: 600px; }
.eyebrow, .form-kicker { margin: 0 0 .75rem; color: var(--cyan); font: 700 .68rem/1 "Space Mono", monospace; }
.identity-copy h1 { margin: 0; font-size: clamp(4.5rem, 10vw, 9rem); line-height: .82; font-weight: 600; }
.identity-copy > p:last-child { max-width: 420px; margin: 1.4rem 0 0; color: var(--muted); font-size: 1.05rem; }

.telemetry { position: relative; z-index: 2; display: flex; align-items: center; gap: 1rem; color: #58716e; font-size: .58rem; }
.telemetry i { width: 42px; height: 1px; background: rgba(70, 234, 216, .2); }

.access-panel { min-height: 100vh; padding: 2rem; display: grid; place-items: center; background: var(--access-panel); }
.login-form { width: min(100%, 390px); }
.mobile-brand { display: none; }
.login-form h2 { margin: 0; font-size: 2rem; font-weight: 500; }
.form-intro { margin: .55rem 0 2.25rem; color: var(--muted); }
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; margin-bottom: .5rem; color: #b9cfcc; font-size: .78rem; font-weight: 500; }
.input-group input {
    width: 100%; height: 52px; padding: 0 1rem; border: 1px solid var(--line); border-radius: 6px;
    outline: none; background: var(--surface); color: var(--text); font: inherit;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input-group input:focus { border-color: var(--cyan); background: var(--focus-surface); box-shadow: 0 0 0 3px rgba(70, 234, 216, .09), inset 0 0 18px rgba(70, 234, 216, .025); }

button {
    width: 100%; height: 52px; margin-top: .4rem; padding: 0 1rem; display: flex; align-items: center; justify-content: space-between;
    border: 1px solid var(--cyan); border-radius: 6px; background: var(--cyan); color: #04100f;
    font: 600 .92rem "DM Sans", sans-serif; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
button:hover { background: var(--cyan-soft); box-shadow: 0 10px 32px rgba(70, 234, 216, .18); transform: translateY(-2px); }
button:active { transform: translateY(0); }
button:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.error { margin-top: 1rem; padding: .75rem; border-left: 2px solid var(--coral); background: rgba(255,107,125,.08); color: #ff9aa7; font-size: .85rem; }
.secure-note { margin-top: 1.4rem; display: flex; align-items: center; justify-content: center; gap: .55rem; color: #58716e; font-size: .58rem; }
.secure-note span { width: 5px; height: 5px; }

@keyframes rotate-core { to { transform: rotate(360deg); } }
@keyframes rotate-core-reverse { from { transform: translateZ(55px) rotate(45deg); } to { transform: translateZ(55px) rotate(-315deg); } }
@keyframes core-float { 50% { transform: translateZ(162px) rotateZ(8deg) rotateX(-64deg); } }
@keyframes pulse { 50% { opacity: .35; box-shadow: 0 0 5px var(--cyan); } }
@keyframes scan { 0%, 100% { transform: translateY(-45vh); opacity: 0; } 30%, 70% { opacity: .5; } 50% { transform: translateY(12vh); } }

@media (max-width: 820px) {
    body::before { mask-image: none; }
    .login-shell { grid-template-columns: 1fr; }
    .identity-panel { display: none; }
    .access-panel { padding: 1.5rem; }
    .mobile-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 3.5rem; font: 700 1rem "Space Mono", monospace; }
    .mobile-brand img { width: 42px; height: 42px; }
}

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