:root {
    color-scheme: light;
    --bg: #ffffff;
    --fg: #171717;
    --muted: #737373;
    --border: rgba(23, 23, 23, 0.12);
    --border-strong: rgba(23, 23, 23, 0.2);
    --surface: #fafafa;
    --primary: #171717;
    --primary-hover: #262626;
    --primary-foreground: #fafafa;
    --danger: #b91c1c;
    --danger-bg: rgba(185, 28, 28, 0.08);
    --info-bg: rgba(23, 23, 23, 0.06);
    --ring: rgba(23, 23, 23, 0.12);
    --hero-from: #9ca3af;
    --hero-via: #6b7280;
    --hero-to: #4b5563;
    --hero-grid: rgba(255, 255, 255, 0.06);
    --hero-text-soft: rgba(255, 255, 255, 0.72);
    --hero-text-faint: rgba(255, 255, 255, 0.52);
    --field-height: 48px;
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow: hidden;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    background: var(--bg);
    isolation: isolate;
}

.hero {
    position: relative;
    display: none;
    overflow: hidden;
    padding: 40px;
    color: #fff;
    background: linear-gradient(135deg, var(--hero-from), var(--hero-via), var(--hero-to));
}

.hero > * {
    position: relative;
    z-index: 2;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero::before {
    background-image:
        linear-gradient(var(--hero-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: gridDrift 24s linear infinite;
}

.hero::after {
    background:
        radial-gradient(circle at 72% 26%, rgba(255, 255, 255, 0.2), transparent 26%),
        radial-gradient(circle at 24% 74%, rgba(255, 255, 255, 0.14), transparent 34%);
    animation: auroraShift 16s ease-in-out infinite alternate;
}

.hero-shell {
    width: 100%;
    min-height: calc(100vh - 80px);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0;
}

.brand,
.mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(18px);
    animation: revealUp 820ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.brand-badge,
.mobile-badge {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-badge {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
}

.mobile-brand {
    justify-content: center;
    margin-bottom: 48px;
}

.mobile-badge {
    background: rgba(23, 23, 23, 0.08);
    color: var(--primary);
}

.hero-stage {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0 0;
    position: relative;
}

.characters {
    position: relative;
    width: 550px;
    height: 400px;
    max-width: 100%;
    transform: translateY(24px) scale(var(--character-scale, 0.8));
    transform-origin: bottom center;
    opacity: 0;
    filter: blur(10px);
    animation: characterReveal 1100ms cubic-bezier(0.22, 1, 0.36, 1) 120ms forwards;
}

.characters::before,
.characters::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.characters::before {
    bottom: -10px;
    width: 340px;
    height: 54px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.04) 60%, transparent 74%);
    filter: blur(14px);
    opacity: 0.9;
}

.characters::after {
    bottom: 8px;
    width: 460px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.16), transparent 62%);
    animation: haloBreath 6s ease-in-out infinite;
}

.character {
    position: absolute;
    bottom: 0;
    transform-origin: bottom center;
    transition: transform 700ms ease-in-out, height 700ms ease-in-out;
    will-change: transform, height;
}

.character.purple {
    left: 70px;
    width: 180px;
    height: 400px;
    border-radius: 10px 10px 0 0;
    background: #6c3ff5;
    z-index: 1;
}

.character.black {
    left: 240px;
    width: 120px;
    height: 310px;
    border-radius: 8px 8px 0 0;
    background: #2d2d2d;
    z-index: 2;
}

.character.orange {
    left: 0;
    width: 240px;
    height: 200px;
    border-radius: 120px 120px 0 0;
    background: #ff9b6b;
    z-index: 3;
}

.character.yellow {
    left: 310px;
    width: 140px;
    height: 230px;
    border-radius: 70px 70px 0 0;
    background: #e8d754;
    z-index: 4;
}

.eye-row,
.pupil-row {
    position: absolute;
    display: flex;
    transition: left 700ms ease-in-out, top 700ms ease-in-out;
}

.eye-row {
    gap: 32px;
}

.black-eyes {
    gap: 24px;
}

.orange-pupils {
    gap: 32px;
}

.yellow-pupils {
    gap: 24px;
}

.eyeball {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
    transition: height 150ms ease;
}

.purple-eye {
    width: 18px;
    height: 18px;
}

.black-eye {
    width: 16px;
    height: 16px;
}

.eye-pupil {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #2d2d2d;
    transition: transform 100ms ease-out, opacity 100ms ease-out;
}

.black-eye .eye-pupil {
    width: 6px;
    height: 6px;
}

.simple-pupil {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #2d2d2d;
    transition: transform 100ms ease-out;
}

.yellow-mouth {
    position: absolute;
    left: 40px;
    top: 88px;
    width: 80px;
    height: 4px;
    border-radius: 999px;
    background: #2d2d2d;
    transition: transform 100ms ease-out, left 200ms ease-out, top 200ms ease-out;
}

.hero-orb {
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(48px);
    z-index: 1;
    opacity: 0;
    animation: glowIn 1200ms ease forwards, orbDrift 12s ease-in-out infinite 1200ms;
}

.hero-orb.top {
    top: 18%;
    right: 18%;
    width: 256px;
    height: 256px;
    background: rgba(255, 255, 255, 0.16);
}

.hero-orb.bottom {
    left: 16%;
    bottom: 18%;
    width: 384px;
    height: 384px;
    background: rgba(255, 255, 255, 0.1);
    animation-delay: 180ms, 1400ms;
}

.hero-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.22) 65%, transparent 72%);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.28);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    animation: particleIn 900ms ease forwards, particleFloat 8s ease-in-out infinite 900ms;
}

.hero-particle.a {
    top: 18%;
    left: 22%;
    animation-delay: 260ms, 1200ms;
}

.hero-particle.b {
    top: 32%;
    right: 18%;
    width: 8px;
    height: 8px;
    animation-delay: 360ms, 1500ms;
}

.hero-particle.c {
    bottom: 24%;
    left: 30%;
    width: 6px;
    height: 6px;
    animation-delay: 460ms, 1800ms;
}

.auth-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.auth-side::before,
.auth-side::after {
    content: "";
    position: absolute;
    inset: auto;
    pointer-events: none;
    z-index: 0;
}

.auth-side::before {
    width: 520px;
    height: 520px;
    right: -140px;
    top: -120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(23, 23, 23, 0.065), rgba(23, 23, 23, 0.02) 44%, transparent 68%);
    filter: blur(20px);
    animation: authGlow 16s ease-in-out infinite alternate;
}

.auth-side::after {
    left: -120px;
    bottom: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(107, 114, 128, 0.1), rgba(107, 114, 128, 0.025) 42%, transparent 68%);
    filter: blur(18px);
    animation: authGlow 14s ease-in-out infinite alternate-reverse;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(26px);
    animation: revealUp 900ms cubic-bezier(0.22, 1, 0.36, 1) 180ms forwards;
}

.site-record-footer {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
    text-align: center;
}

.site-record-footer a {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}

.site-record-footer a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(18px);
    animation: revealUp 720ms cubic-bezier(0.22, 1, 0.36, 1) 320ms forwards;
}

.auth-header h1 {
    margin: 0 0 8px;
    font-size: clamp(30px, 3vw, 36px);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.auth-header p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.auth-tabs {
    width: fit-content;
    margin: 0 auto 18px;
    padding: 4px;
    display: inline-flex;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(23, 23, 23, 0.04);
}

.auth-tab {
    min-width: 88px;
    height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.auth-tab:hover {
    color: var(--fg);
}

.auth-tab.is-active {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 14px 30px rgba(23, 23, 23, 0.12);
}

.login-form {
    display: grid;
    gap: 20px;
    opacity: 0;
    transform: translateY(18px);
    animation: revealUp 760ms cubic-bezier(0.22, 1, 0.36, 1) 420ms forwards;
}

.field {
    display: grid;
    gap: 8px;
}

.field.is-hidden {
    display: none;
}

.field-title,
.remember-wrap {
    font-size: 14px;
    font-weight: 500;
}

.input-shell {
    position: relative;
}

.text-input {
    width: 100%;
    height: var(--field-height);
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--fg);
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.text-input::placeholder {
    color: #a3a3a3;
}

.text-input:hover {
    border-color: var(--border-strong);
}

.text-input:focus {
    border-color: rgba(23, 23, 23, 0.32);
    box-shadow: 0 0 0 4px var(--ring);
}

.password-input {
    padding-right: 52px;
}

/* Hide browser-native password reveal controls to avoid duplicate toggles. */
.password-input::-ms-reveal,
.password-input::-ms-clear {
    display: none;
}

.password-input::-webkit-credentials-auto-fill-button,
.password-input::-webkit-contacts-auto-fill-button {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}

.toggle-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 180ms ease;
}

.toggle-btn:hover {
    color: var(--fg);
}

.toggle-btn svg {
    width: 20px;
    height: 20px;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
}

.remember-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.remember-wrap input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-ui {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg);
    transition: border-color 180ms ease, background-color 180ms ease;
}

.checkbox-ui::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--primary);
    transform: scale(0);
    transition: transform 180ms ease;
}

.remember-wrap input:checked + .checkbox-ui {
    border-color: var(--primary);
    background: rgba(23, 23, 23, 0.04);
}

.remember-wrap input:checked + .checkbox-ui::after {
    transform: scale(1);
}

.status {
    min-height: 0;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease, min-height 180ms ease, padding 180ms ease;
}

.status.has-message {
    min-height: 52px;
    padding: 14px 16px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    background: var(--info-bg);
    color: var(--fg);
}

.status.has-message.is-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(185, 28, 28, 0.18);
}

.auth-mode-note {
    margin-top: -4px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted);
}

.submit-btn {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: background-color 180ms ease, transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.68;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-switch-btn {
    width: fit-content;
    margin: -4px auto 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 180ms ease, transform 180ms ease;
}

.auth-switch-btn:hover {
    color: var(--fg);
    transform: translateY(-1px);
}

@media (min-width: 1024px) {
    .page {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .hero {
        display: block;
    }

    .mobile-brand {
        display: none;
    }
}

@media (min-width: 1024px) and (max-width: 1400px) {
    .characters {
        --character-scale: 0.72;
    }
}

@media (min-width: 1024px) and (max-width: 1180px) {
    .hero {
        padding: 32px;
    }

    .hero-stage {
        padding-top: 20px;
    }

    .characters {
        --character-scale: 0.64;
    }
}

@media (max-width: 1023px) {
    body {
        overflow: auto;
    }

    .auth-side {
        padding: 24px;
    }

    .auth-card,
    .auth-header,
    .login-form {
        animation-delay: 80ms;
    }
}

@media (max-width: 640px) {
    .auth-side {
        padding: 20px;
    }

    .mobile-brand {
        margin-bottom: 36px;
    }

    .auth-header {
        margin-bottom: 32px;
    }

    .form-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .brand,
    .mobile-brand,
    .characters,
    .auth-card,
    .auth-header,
    .login-form,
    .hero-orb,
    .hero-particle {
        opacity: 1 !important;
        filter: none !important;
        transform: none !important;
    }
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes characterReveal {
    from {
        opacity: 0;
        filter: blur(10px);
        transform: translateY(54px) scale(calc(var(--character-scale, 0.8) * 0.94));
    }

    to {
        opacity: 1;
        filter: blur(0);
        transform: translateY(24px) scale(var(--character-scale, 0.8));
    }
}

@keyframes glowIn {
    from {
        opacity: 0;
        transform: scale(0.86);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes orbDrift {
    0%, 100% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(12px, -16px, 0) scale(1.04);
    }
}

@keyframes particleIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.6);
    }

    to {
        opacity: 0.9;
        transform: translateY(0) scale(1);
    }
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(10px, -12px, 0);
    }
}

@keyframes haloBreath {
    0%, 100% {
        opacity: 0.55;
        transform: translateX(-50%) scale(0.96);
    }

    50% {
        opacity: 0.88;
        transform: translateX(-50%) scale(1.04);
    }
}

@keyframes gridDrift {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 0 24px, 24px 0;
    }
}

@keyframes auroraShift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 0.92;
    }

    100% {
        transform: translate3d(-10px, 14px, 0) scale(1.06);
        opacity: 1;
    }
}

@keyframes authGlow {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    100% {
        transform: translate3d(-16px, 10px, 0) scale(1.06);
    }
}
