:root {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #ffffff;
    --line: rgba(37, 99, 235, 0.35);
    --text: #1f2937;
    --muted: #667085;
    --accent: #5f738b;
    --accent-2: #a8b4c3;
    --danger: #b85c67;
    --shadow: 0 10px 24px rgba(51, 65, 85, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.98), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
    color: var(--text);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

.bg {
    position: fixed;
    width: 22rem;
    height: 22rem;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.18;
    pointer-events: none;
}

.bg-a {
    top: -6rem;
    left: -5rem;
    background: rgba(203, 213, 225, 0.05);
}

.bg-b {
    right: -7rem;
    bottom: 6rem;
    background: rgba(226, 232, 240, 0.05);
}

.auth-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.auth-card {
    width: min(560px, 100%);
    padding: 32px;
    border-radius: 30px;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.auth-brand {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.auth-mark {
    width: 58px;
    height: 58px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fafafa;
    font-weight: 900;
    letter-spacing: 0.08em;
    box-shadow: 0 16px 30px rgba(95, 115, 139, 0.16);
}

.auth-brand h1 {
    margin: 0 0 4px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.6rem;
    line-height: 1.15;
}

.auth-brand p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    display: block;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-size: 0.75rem;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(51, 65, 85, 0.03);
}

.notice.error {
    background: rgba(184, 92, 103, 0.08);
    color: #8a3f4b;
    border-color: rgba(184, 92, 103, 0.16);
}

.auth-advanced {
    margin-bottom: 20px;
    padding: 4px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.auth-advanced summary {
    padding: 10px 0;
    color: var(--muted);
    font-size: 0.88rem;
    cursor: pointer;
    list-style: none;
}

.auth-advanced summary::-webkit-details-marker {
    display: none;
}

.auth-advanced[open] summary {
    margin-bottom: 2px;
}

.auth-advanced .auth-form {
    padding-bottom: 16px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form label {
    display: grid;
    gap: 8px;
}

.auth-form span {
    color: var(--muted);
    font-size: 0.9rem;
}

.auth-form input {
    min-height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    outline: none;
    font: inherit;
}

.auth-form input:focus {
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.08);
}

.auth-form .button {
    width: 100%;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: transform 160ms ease, opacity 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fafafa;
}

.button-ghost {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--line);
}

.auth-note {
    margin: 18px 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--muted);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1722;
    --panel: rgba(17, 24, 39, 0.94);
    --line: rgba(148, 163, 184, 0.16);
    --text: #e5eef9;
    --muted: #9fb0c3;
    --accent: #a8b4c3;
    --accent-2: #78879a;
    --danger: #ef8b97;
    --shadow: 0 20px 44px rgba(0, 0, 0, 0.35);
    background:
        radial-gradient(circle at top left, rgba(95, 115, 139, 0.18), transparent 28%),
        radial-gradient(circle at right center, rgba(148, 163, 184, 0.12), transparent 30%),
        linear-gradient(180deg, #111827 0%, #0f1722 100%);
}

body[data-theme="dark"] .bg-a {
    background: rgba(95, 115, 139, 0.18);
}

body[data-theme="dark"] .bg-b {
    background: rgba(148, 163, 184, 0.12);
}

body[data-theme="dark"] .auth-card,
body[data-theme="dark"] .notice,
body[data-theme="dark"] .auth-advanced,
body[data-theme="dark"] .auth-form input {
    background: rgba(17, 24, 39, 0.94);
    border-color: rgba(148, 163, 184, 0.16);
}

body[data-theme="dark"] .auth-form input:focus {
    border-color: rgba(148, 163, 184, 0.38);
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}

body[data-theme="dark"] .notice.error {
    background: rgba(239, 139, 151, 0.14);
    color: #ffd2d7;
}

body[data-theme="dark"] .auth-mark,
body[data-theme="dark"] .button-primary {
    background: linear-gradient(135deg, #9aa7b6, #64758a);
    color: #0f1722;
}

body[data-theme="dark"] .button-ghost {
    background: rgba(15, 23, 42, 0.92);
    color: var(--text);
    border-color: rgba(148, 163, 184, 0.16);
}

@media (max-width: 640px) {
    .auth-card {
        padding: 22px;
        border-radius: 24px;
    }

    .auth-brand {
        align-items: flex-start;
    }
}
