:root {
    color-scheme: light;
    --bg: #f3f5f9;
    --surface: #ffffff;
    --ink: #111827;
    --muted: #5f6b7e;
    --blue: #2f5bd6;
    --blue-dark: #2248b4;
    --green: #127a5f;
    --red: #b42318;
    --surface-translucent: rgba(255, 255, 255, 0.92);
    --success-surface: #f6fcf9;
    --error-surface: #fff7f6;
    --focus-ring: rgba(47, 91, 214, 0.18);
    --accent-shadow: rgba(47, 91, 214, 0.22);
    --body-glow: rgba(47, 91, 214, 0.08);
    --workspace-line: rgba(218, 225, 235, 0.95);
    --field-line: #cfd8e6;
    --drop-line: #bfcadb;
    --success-line: #bfe5d6;
    --error-line: #efc6c1;
    --shadow: 0 1px 2px rgba(22, 34, 64, 0.04), 0 18px 48px -12px rgba(22, 34, 64, 0.12);
    --hairline: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at top left, var(--body-glow), transparent 34rem),
        var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    font-family: var(--font-display);
    text-wrap: balance;
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.auth-shell {
    width: min(460px, calc(100% - 32px));
    padding: 40px 0;
}

.auth-card {
    display: grid;
    gap: 22px;
    padding: clamp(24px, 5vw, 40px);
    border: 1px solid var(--workspace-line);
    border-radius: 28px;
    background: var(--surface-translucent);
    box-shadow: var(--hairline), var(--shadow);
}

.auth-card > * {
    animation: arcadia-rise 560ms var(--ease-out) backwards;
}

.auth-card > :nth-child(2) {
    animation-delay: 70ms;
}

.auth-card > :nth-child(3) {
    animation-delay: 140ms;
}

.auth-card > :nth-child(n + 4) {
    animation-delay: 210ms;
}

.auth-brand h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-form label {
    display: grid;
    gap: 7px;
}

.auth-form label span {
    font-size: 13px;
    font-weight: 800;
}

.auth-form input {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid var(--field-line);
    border-radius: 12px;
    outline: none;
    background: var(--surface);
    color: var(--ink);
    font-size: 16px;
    transition: border-color 160ms ease, box-shadow 240ms ease;
}

.auth-form input:hover:not(:focus):not(:disabled) {
    border-color: var(--drop-line);
}

.auth-form input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.primary-button {
    position: relative;
    padding: 14px 22px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 86%, #fff), var(--blue));
    color: white;
    font-weight: 700;
    letter-spacing: 0.005em;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 1px 2px rgba(0, 0, 0, 0.12),
        0 10px 22px -8px var(--accent-shadow);
    transition:
        background-color 160ms ease,
        box-shadow 240ms ease,
        transform 240ms var(--ease-spring);
}

.primary-button:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--blue), var(--blue-dark));
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 16px 30px -10px var(--accent-shadow);
}

.primary-button:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
    transition-duration: 80ms;
}

.primary-button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

.auth-submit {
    margin-top: 4px;
    width: 100%;
}

.auth-hint {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.auth-message {
    margin: 0;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
}

.auth-message.is-error {
    border: 1px solid var(--error-line);
    background: var(--error-surface);
    color: var(--red);
}

.auth-message.is-info {
    border: 1px solid var(--success-line);
    background: var(--success-surface);
    color: var(--green);
}

@keyframes arcadia-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card > *,
    .primary-button,
    .auth-form input {
        animation: none;
        transition: none;
    }
}
