:root {
    --accent-rgb: 64, 142, 255;
    --bg: #05070f;
    --panel: rgba(13, 22, 40, .78);
    --text: #cdd9ec;
    --text-dim: #6f8198;
    --white: #eaf4ff;
    --display: 'Orbitron', ui-monospace, monospace;
    --mono: 'Share Tech Mono', ui-monospace, monospace;
    --body: 'Rajdhani', system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-family: var(--body);
    font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; min-height: 100vh; min-height: 100dvh; margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
input, textarea, [contenteditable="true"] { caret-color: transparent; }
input:focus, textarea:focus, [contenteditable="true"]:focus { caret-color: rgb(var(--accent-rgb)); }

.login-page, .signed-in-page {
    background: radial-gradient(120% 120% at 50% -10%, #0a0f1c, var(--bg) 60%);
}
.login-page::before, .signed-in-page::before {
    position: fixed;
    inset: 0;
    content: '';
    pointer-events: none;
    background-image:
        linear-gradient(rgba(120, 145, 180, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 145, 180, .05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(100% 90% at 50% 50%, #000 20%, transparent 85%);
}
.login-shell, .logout-shell {
    position: relative;
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    padding: 20px;
}
.login-card {
    position: relative;
    width: min(100%, 420px);
    padding: 34px 42px 28px;
    border: 1px solid rgba(var(--accent-rgb), .3);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: inset 0 0 30px rgba(var(--accent-rgb), .05), 0 22px 60px rgba(0, 0, 0, .26);
    backdrop-filter: blur(6px);
    transform-origin: center;
    animation: card-appear .55s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes card-appear {
    0% { opacity: 0; transform: scale(.93); }
    72% { opacity: 1; transform: scale(1.015); }
    100% { opacity: 1; transform: scale(1); }
}
.panel-corner { position: absolute; width: 13px; height: 13px; border: 2px solid rgb(var(--accent-rgb)); pointer-events: none; }
.panel-corner--tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel-corner--tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.panel-corner--bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.panel-corner--br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
h1 {
    position: absolute;
    top: auto;
    bottom: 100%;
    left: -1px;
    width: max-content;
    margin: 0;
    padding: 9px 14px;
    background: rgb(var(--accent-rgb));
    color: var(--bg);
    font-family: var(--display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .16em;
    line-height: 1;
    transform: translateY(50%);
}
.outlined-field {
    width: 100%;
    height: 62px;
    min-width: 0;
    margin: 0;
    padding: 0 15px 5px;
    border: 1px solid rgba(var(--accent-rgb), .48);
    border-radius: 3px;
    background: rgba(5, 7, 15, .58);
    transition: border-color .18s, box-shadow .18s;
}
.outlined-field:focus-within { border-color: rgb(var(--accent-rgb)); box-shadow: 0 0 12px rgba(var(--accent-rgb), .34); }
.outlined-field.has-error,
.outlined-field.has-error:focus-within {
    border-color: #ff7777;
    box-shadow: 0 0 12px rgba(255, 119, 119, .3);
}
.outlined-field legend {
    margin-left: 4px;
    padding: 0 6px;
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 15px;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}
.outlined-field label { cursor: text; }
.outlined-field input {
    display: block;
    width: 100%;
    height: 38px;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--white);
    font-size: 19px;
    font-weight: 500;
}
.outlined-field input[type="search"] {
    appearance: none;
    -webkit-appearance: none;
}
.outlined-field input[type="search"]::-webkit-search-cancel-button,
.outlined-field input[type="search"]::-webkit-search-decoration {
    display: none;
    -webkit-appearance: none;
}
.outlined-field input:autofill,
.outlined-field input:-webkit-autofill,
.outlined-field input:-webkit-autofill:hover,
.outlined-field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #080d18 inset;
    box-shadow: 0 0 0 1000px #080d18 inset;
    -webkit-text-fill-color: var(--white);
}
#code { letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.code-notice {
    margin: 0 2px 18px;
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.45;
}
.code-notice span {
    display: block;
    margin-top: 3px;
    color: var(--text);
    overflow-wrap: anywhere;
}
.navigation-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.navigation-button {
    display: grid;
    width: 100%;
    height: 40px;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), .72);
    border-radius: 3px;
    background: rgba(var(--accent-rgb), .14);
    transition: background .18s, box-shadow .18s, transform .18s;
}
.navigation-button:not(:disabled):hover { background: rgba(var(--accent-rgb), .25); box-shadow: 0 0 12px rgba(var(--accent-rgb), .5); transform: translateY(-1px); }
.navigation-button:not(:disabled):active { transform: translateY(0); }
.navigation-button:disabled { border-color: rgba(var(--accent-rgb), .24); background: rgba(var(--accent-rgb), .04); cursor: default; opacity: .38; }
.navigation-button:focus-visible, .logout-button:focus-visible { outline: 2px solid rgb(var(--accent-rgb)); outline-offset: 3px; }
.navigation-button img { width: 21px; height: 21px; filter: invert(49%) sepia(97%) saturate(1971%) hue-rotate(196deg) brightness(106%); }
.loading-stage { display: grid; min-height: 62px; place-items: center; }
.loading-stage #loading-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.spinner { width: 38px; height: 38px; border: 3px solid rgba(var(--accent-rgb), .2); border-top-color: rgb(var(--accent-rgb)); border-radius: 50%; box-shadow: 0 0 16px rgba(var(--accent-rgb), .2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-message { margin: 18px 0 0; color: #ff7777; font-family: var(--mono); font-size: 12px; line-height: 1.45; }

.logout-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 21px;
    border: 1px solid rgba(var(--accent-rgb), .72);
    border-radius: 3px;
    background: rgba(var(--accent-rgb), .14);
    color: var(--white);
    font-family: var(--mono);
    font-size: 14px;
    letter-spacing: .06em;
    text-transform: uppercase;
    transition: background .18s, box-shadow .18s, transform .18s;
}
.logout-button:hover { background: rgba(var(--accent-rgb), .25); box-shadow: 0 0 12px rgba(var(--accent-rgb), .5); transform: translateY(-1px); }
.logout-button img { width: 21px; height: 21px; filter: brightness(0) invert(1); }

@media (max-width: 480px) {
    .login-card { padding: 32px 25px 26px; }
}
@media (prefers-reduced-motion: reduce) {
    .navigation-button, .logout-button, .outlined-field { transition: none; }
    .spinner { animation-duration: 1.5s; }
    .login-card { animation: none; }
}
