:root {
    color-scheme: dark;
    --bg: #090a0d;
    --surface: rgba(20, 21, 28, .96);
    --surface-strong: #0c0d12;
    --border: rgba(255, 255, 255, .14);
    --border-strong: rgba(225, 97, 255, .58);
    --text: #f7f4fb;
    --muted: #aaa5b2;
    --magenta: #e161ff;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.88), transparent 84%);
}

.login-shell {
    position: relative;
    width: min(560px, 100%);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(0,0,0,.46);
    animation: login-shell-reveal .55s .08s ease-out both;
}

.login-header {
    min-height: 176px;
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-strong);
}

.logo-wrap {
    width: 148px;
    height: 128px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.logo-wrap img { width: 100%; height: 100%; display: block; object-fit: contain; }
.eyebrow { margin: 0 0 10px; color: var(--magenta); font-size: 11px; font-weight: 850; text-transform: uppercase; }
h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    color: transparent;
    background: linear-gradient(105deg, #f7f4fb 0%, #f7f4fb 42%, #efb0ff 47%, #ffffff 50%, #e161ff 53%, #f7f4fb 58%, #f7f4fb 100%);
    background-size: 260% 100%;
    background-position: 110% 50%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 12px rgba(225,97,255,.16));
    animation: login-title-enter .55s cubic-bezier(.2,.8,.2,1) both, login-title-shimmer 4.8s .75s ease-in-out infinite;
}

@keyframes login-title-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes login-shell-reveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes login-title-shimmer {
    0%, 18% { background-position: 110% 50%; filter: drop-shadow(0 0 8px rgba(225,97,255,.1)); }
    52% { filter: drop-shadow(0 0 16px rgba(225,97,255,.34)); }
    82%, 100% { background-position: -60% 50%; filter: drop-shadow(0 0 8px rgba(225,97,255,.1)); }
}
.login-panel { padding: 26px 28px 30px; }
form { display: grid; gap: 15px; }
label { display: grid; gap: 8px; margin: 0; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }

input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0d0e12;
    color: var(--text);
    padding: 12px 14px;
    font: inherit;
    outline: none;
}

input:focus { border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(225,97,255,.14); }

button {
    width: 100%;
    min-height: 54px;
    margin-top: 3px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 12px 54px 12px 20px;
    background: #211724;
    color: #f9e8fd;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

button::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--magenta); box-shadow: 0 0 18px rgba(225,97,255,.6); }
button::after { content: "→"; position: absolute; right: 18px; top: 50%; translate: 0 -50%; font-size: 21px; color: var(--magenta); }
button:hover { transform: translateY(-2px); border-color: var(--magenta); background: #301c34; box-shadow: 0 12px 26px rgba(0,0,0,.26); }
button:focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }
button:active { transform: translateY(0); box-shadow: none; }

.error {
    background: rgba(255,96,116,.12);
    border: 1px solid rgba(255,96,116,.36);
    color: #ffc6ce;
    border-radius: 8px;
    padding: 12px 13px;
    margin-bottom: 17px;
    transition: opacity .45s ease, transform .45s ease;
}

.error.fade-out { opacity: 0; transform: translateY(-6px); }

@media (max-width: 560px) {
    body { padding: 10px; }
    .login-header { grid-template-columns: 1fr; justify-items: center; gap: 10px; min-height: 0; padding: 22px 20px; text-align: center; }
    .logo-wrap { width: 124px; height: 108px; }
    h1 { font-size: 30px; }
    .login-panel { padding: 22px 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; }
    .login-shell { animation: none; opacity: 1; }
    h1 { animation: none; background: none; color: var(--text); -webkit-text-fill-color: var(--text); filter: none; }
}
