@property --auth-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

:root {
    color-scheme: dark;
    --night: #080d18;
    --surface: #121b2b;
    --surface-raised: #1a293b;
    --ink: #f4f0e7;
    --muted: #aeb8c5;
    --line: #40556b;
    --gold: #f3be63;
    --signal: #59dced;
    --danger: #ff6889;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at 18% 74%, rgba(243,190,99,.13), transparent 31%),
        radial-gradient(circle at 82% 12%, rgba(89,220,237,.13), transparent 35%),
        linear-gradient(rgba(89,220,237,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(89,220,237,.025) 1px, transparent 1px),
        linear-gradient(145deg, #0b1422, #080d18 62%, #111a2a);
    background-size: auto, auto, 64px 64px, 64px 64px, auto;
    overflow-x: hidden;
}
button, input { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.auth-viewport {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
    align-items: center;
    gap: clamp(36px, 6vw, 110px);
    width: min(100%, 1480px);
    min-height: 100dvh;
    margin-inline: auto;
    padding: 80px clamp(24px, 5vw, 88px) 42px;
}
.auth-home-link {
    position: absolute;
    top: 28px;
    left: clamp(24px, 5vw, 88px);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 650;
    text-decoration: none;
    transition: color .18s;
}
.auth-home-link:hover { color: var(--gold); }

.auth-scene { min-width: 0; max-width: 720px; animation: scene-in .65s both; }
.auth-scene__eyebrow,
.auth-scene__footer {
    color: var(--gold);
    font-family: 'Space Mono', monospace;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .15em;
}
.auth-scene__eyebrow { margin: 0 0 20px; }
.auth-scene h2 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(3.2rem, 5.4vw, 5.9rem);
    font-weight: 800;
    line-height: .99;
    letter-spacing: -.055em;
}
.auth-scene h2 em { color: var(--gold); font-style: normal; }
.auth-scene__intro { max-width: 460px; margin: 22px 0 25px; color: var(--muted); font-size: .97rem; line-height: 1.65; }
.auth-scene__footer { margin: 18px 0 0; color: #9ab3bf; }

.auth-map {
    position: relative;
    width: 100%;
    aspect-ratio: 640 / 390;
    overflow: hidden;
    border: 1px solid #456375;
    border-radius: 16px;
    background:
        radial-gradient(circle at 15% 80%, rgba(243,190,99,.19), transparent 28%),
        radial-gradient(circle at 85% 20%, rgba(89,220,237,.2), transparent 28%),
        repeating-radial-gradient(ellipse at 55% 55%, transparent 0 35px, rgba(147,177,188,.055) 36px 37px, transparent 38px 69px),
        linear-gradient(145deg, #172b3b, #0d1b2b 60%, #172537);
    box-shadow: 0 25px 55px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.08);
}
.auth-map::before,
.auth-map::after { content: ''; position: absolute; z-index: 2; width: 27px; height: 27px; border: 2px solid var(--gold); pointer-events: none; }
.auth-map::before { top: 15px; left: 15px; border-right: 0; border-bottom: 0; }
.auth-map::after { right: 15px; bottom: 15px; border-left: 0; border-top: 0; }
.auth-map svg { width: 100%; height: 100%; display: block; }
.auth-map__contour { fill: none; stroke: rgba(151,191,203,.15); stroke-width: 1.2; }
.auth-map__route-base { fill: none; stroke: rgba(5,13,24,.8); stroke-width: 13; stroke-linecap: round; }
.auth-map__route { fill: none; stroke: url(#auth-route-gradient); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 7 9; animation: route-flow 1.5s linear infinite; }
.auth-map__ring { fill: none; stroke: rgba(89,220,237,.27); stroke-width: 1.5; stroke-dasharray: 4 7; transform-box: fill-box; transform-origin: center; animation: ring-turn 28s linear infinite; }
.auth-map__point { stroke: #0c1725; stroke-width: 5; }
.auth-map__point--home { fill: var(--gold); }
.auth-map__point--target { fill: var(--signal); }
.auth-map__traveler { fill: #fff6da; filter: drop-shadow(0 0 9px var(--gold)); }
.auth-map__label {
    position: absolute;
    z-index: 3;
    padding: 8px 10px;
    color: var(--ink);
    border: 1px solid rgba(211,222,217,.35);
    background: rgba(8,19,31,.9);
    box-shadow: 0 9px 18px rgba(0,0,0,.25);
    font-family: 'Space Mono', monospace;
    font-size: .57rem;
    font-weight: 700;
    letter-spacing: .08em;
}
.auth-map__label--origin { left: 16%; bottom: 5%; }
.auth-map__label--target { top: 5%; right: 13%; }

.auth-card-container { width: 100%; min-width: 0; animation: card-in .52s .08s both; }
.auth-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
    overflow: hidden;
    padding: clamp(26px, 3vw, 38px);
    border: 1px solid #547083;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(27,44,61,.98), rgba(15,26,42,.99) 65%);
    box-shadow: 0 28px 75px rgba(0,0,0,.36), 0 0 40px rgba(89,220,237,.08), inset 0 1px rgba(255,255,255,.1);
}
.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    pointer-events: none;
    border-radius: inherit;
    background: conic-gradient(from var(--auth-angle), transparent 0 81%, rgba(89,220,237,.14) 86%, var(--signal) 93%, #fff1cd 96%, var(--gold) 98%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    animation: auth-border-orbit 10s linear infinite;
}
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand-icon {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    flex: none;
    border-radius: 9px;
    color: #101b29;
    background: linear-gradient(135deg, #ffe6a6, var(--gold));
    box-shadow: 0 0 24px rgba(243,190,99,.27);
}
.auth-brand-icon svg { width: 20px; height: 20px; }
.auth-brand-text { font-family: 'Outfit', sans-serif; font-size: 1.23rem; font-weight: 800; letter-spacing: .075em; }
.auth-heading { display: flex; flex-direction: column; gap: 5px; }
.auth-heading h1 { margin: 0; font-family: 'Outfit', sans-serif; font-size: clamp(1.8rem, 3vw, 2.25rem); letter-spacing: -.035em; line-height: 1.12; }
.auth-heading p { margin: 0; color: var(--muted); font-size: .87rem; line-height: 1.5; }
body[data-auth-mode='login'] .auth-heading-signup,
body[data-auth-mode='login'] .auth-signup-form,
body[data-auth-mode='signup'] .auth-heading-login,
body[data-auth-mode='signup'] .auth-login-form { display: none; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-input-group { display: flex; flex-direction: column; gap: 6px; }
.auth-input-group label { color: #c5d2db; font-size: .78rem; font-weight: 700; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--signal); pointer-events: none; }
.input-field {
    width: 100%;
    min-height: 47px;
    padding: 11px 14px 11px 43px;
    color: var(--ink);
    border: 1px solid #486079;
    border-radius: 9px;
    outline: 0;
    background: #101d2d;
    font-size: .9rem;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.input-field::placeholder { color: #8293a3; }
.input-field:hover { border-color: #7094a3; }
.input-field:focus { border-color: var(--signal); background: #14283a; box-shadow: 0 0 0 3px rgba(89,220,237,.13); }
.auth-options { display: flex; align-items: center; justify-content: space-between; }
.remember-me { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .8rem; cursor: pointer; }
.remember-me input { width: 17px; height: 17px; margin: 0; accent-color: var(--signal); }
.custom-checkbox { display: none; }
.auth-submit-btn {
    min-height: 48px;
    margin-top: 3px;
    padding: 10px 18px;
    color: #09202d;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(110deg, #7de5ef, var(--signal));
    box-shadow: 0 10px 28px rgba(89,220,237,.2);
    font-size: .9rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s, filter .18s;
}
.auth-submit-btn:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 14px 32px rgba(89,220,237,.32); }
.auth-submit-btn:disabled { opacity: .7; cursor: wait; transform: none; }
.auth-footer-links { padding-top: 3px; color: var(--muted); text-align: center; font-size: .81rem; }
.link-btn { padding: 0; color: var(--gold); border: 0; background: none; font-weight: 750; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: #ffdf9c; }
.login-info-banner { display: none; padding: 10px 12px; color: #ffd0d9; border: 1px solid rgba(255,104,137,.48); border-radius: 8px; background: rgba(255,104,137,.12); font-size: .79rem; line-height: 1.4; }
.login-info-banner:not(:empty) { display: block; }

@keyframes card-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scene-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes route-flow { to { stroke-dashoffset: -16; } }
@keyframes ring-turn { to { transform: rotate(360deg); } }
@keyframes auth-border-orbit { to { --auth-angle: 360deg; } }

@media (max-width: 900px) {
    .auth-viewport { display: flex; justify-content: center; padding: 78px 18px 24px; }
    .auth-scene { display: none; }
    .auth-card-container { max-width: 480px; }
    .auth-home-link { left: 20px; top: 24px; }
}
@media (max-height: 760px) and (min-width: 901px) {
    .auth-viewport { padding-top: 62px; padding-bottom: 20px; }
    .auth-scene__eyebrow { margin-bottom: 12px; }
    .auth-scene h2 { font-size: clamp(3rem, 4.6vw, 4.6rem); }
    .auth-scene__intro { margin: 14px 0 16px; }
    .auth-map { aspect-ratio: 640 / 330; }
    .auth-scene__footer { margin-top: 10px; }
}
@media (max-width: 480px) {
    .auth-viewport { align-items: center; padding-inline: 12px; }
    .auth-card { padding: 24px 19px; gap: 19px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .auth-map__traveler { display: none; }
    .auth-card::before { background: linear-gradient(125deg, var(--gold), var(--signal)); }
}
