:root {
    color-scheme: dark;
    --ink: #eef2e9;
    --muted: #aeb9b6;
    --gold: #f0b94a;
    --gold-deep: #cc8628;
    --panel: rgba(15, 29, 38, 0.92);
    --line: rgba(240, 185, 74, 0.25);
    font-family: "Segoe UI", "Noto Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(8, 16, 23, 0.25), rgba(8, 16, 23, 0.78)),
        url("/images/login_bg.png") center / cover fixed;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 65%, rgba(4, 10, 15, 0.8));
}

button, input { font: inherit; }

.portal-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(28px, 6vw, 90px);
}

.portal-story { display: none; }

.brand-mark {
    color: var(--gold);
    letter-spacing: .42em;
    font-size: 13px;
    font-weight: 800;
}

.portal-story h1 {
    margin: 12px 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(58px, 9vw, 118px);
    line-height: .9;
    letter-spacing: -.045em;
}

.story-copy {
    max-width: 510px;
    color: #dce3dc;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(18px, 2vw, 26px);
}

.server-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 28px;
    padding: 10px 14px;
    border: 1px solid rgba(127, 231, 177, .28);
    border-radius: 999px;
    background: rgba(7, 22, 25, .58);
    color: #c8e9d8;
    font-size: 13px;
}

.server-status span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64e7a1;
    box-shadow: 0 0 14px #64e7a1;
}

.auth-card {
    width: min(100%, 440px);
    padding: clamp(26px, 4vw, 42px);
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--panel);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
    backdrop-filter: blur(18px);
}

.auth-card__head h2 {
    margin: 6px 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 32px;
}

.auth-card__head p { margin: 0; color: var(--muted); line-height: 1.55; }
.auth-card__head .eyebrow { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .24em; }

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 26px 0 22px;
    padding: 5px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
}

.auth-tab {
    min-height: 42px;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.auth-tab.is-active { color: #172128; background: linear-gradient(135deg, #ffd66c, var(--gold)); }

form { display: grid; gap: 16px; }
label { display: grid; gap: 8px; color: #cbd3d1; font-size: 13px; font-weight: 700; }
.confirm-row[hidden] { display: none; }

input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 12px;
    outline: 0;
    color: var(--ink);
    background: rgba(5, 14, 20, .55);
    transition: border-color .2s, box-shadow .2s;
}

input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240, 185, 74, .12); }

.password-field { position: relative; display: block; }
.password-field input { padding-right: 62px; }
.password-toggle {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 52px;
    height: 38px;
    border: 0;
    color: var(--gold);
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.primary-button {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 50px;
    padding: 0 18px;
    border: 0;
    border-radius: 13px;
    color: #172128;
    background: linear-gradient(135deg, #ffd66c, var(--gold-deep));
    box-shadow: 0 10px 30px rgba(218, 146, 40, .22);
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
}

.primary-button:disabled { opacity: .65; cursor: wait; }
.text-button { width: 100%; margin-top: 14px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.auth-message { min-height: 20px; margin: 0; color: #ff9b8f; font-size: 13px; }
.auth-message.is-success { color: #76e5a8; }
.security-note { margin: 22px 0 0; color: #77878a; text-align: center; font-size: 11px; }

.account-summary {
    display: grid;
    gap: 7px;
    margin: 28px 0 18px;
    padding: 17px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
}

.account-summary span { color: var(--muted); font-size: 12px; }
.account-summary strong { font-size: 18px; }

@media (max-width: 820px) {
    body { background-position: 38% center; }
    .portal-shell { padding: 24px 16px max(24px, env(safe-area-inset-bottom)); }
    .auth-card { border-radius: 22px; }
}
