:root {
    --auth-bg: #0b0c0f;
    --auth-panel: #141519;
    --auth-border: #303238;
    --auth-text: #f4f1ea;
    --auth-muted: #aaa7a0;
    --auth-accent: #d79a4b;
    --auth-accent-hover: #e5aa5b;
    --auth-error: #f08d7f;
}

body.auth-pending,
body.auth-locked {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--auth-bg);
}

body.auth-pending #app,
body.auth-locked #app,
body.auth-pending #screen-class-intro,
body.auth-locked #screen-class-intro,
body.auth-pending [id^="debug-"],
body.auth-locked [id^="debug-"] {
    display: none !important;
}

.auth-shell[hidden] {
    display: none !important;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--auth-text);
    background: var(--auth-bg);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-container {
    width: min(440px, calc(100% - 32px));
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    display: grid;
    place-items: center;
}

.auth-main {
    width: 100%;
    padding: 48px 0;
}

.auth-main > h1 {
    margin: 0 0 32px;
    color: var(--auth-text);
    font-family: "Press Start 2P", monospace;
    font-size: clamp(22px, 5vw, 26px);
    line-height: 1.35;
    text-align: center;
    text-transform: uppercase;
}

.auth-panel {
    padding: 28px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: var(--auth-panel);
}

.auth-google-group[hidden] {
    display: none;
}

.auth-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--auth-border);
    border-radius: 5px;
    color: var(--auth-text);
    background: #fff;
    color: #222;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 180ms ease, border-color 180ms ease;
}

.auth-google:hover {
    border-color: #c9c9c9;
    background: #f3f3f3;
}

.auth-google:focus-visible {
    outline: 3px solid rgba(215, 154, 75, 0.45);
    outline-offset: 3px;
}

.auth-google-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--auth-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    width: 100%;
    height: 1px;
    content: "";
    background: var(--auth-border);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: 6px;
    background: #0f1013;
}

.auth-tab {
    min-height: 44px;
    border: 0;
    border-radius: 4px;
    color: var(--auth-muted);
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: color 180ms ease, background-color 180ms ease;
}

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

.auth-tab[aria-selected="true"] {
    color: #17120c;
    background: var(--auth-accent);
}

.auth-form {
    margin-top: 24px;
}

.auth-form[hidden] {
    display: none;
}

.auth-field {
    margin-top: 16px;
}

.auth-field:first-child {
    margin-top: 0;
}

.auth-field label {
    display: block;
    margin-bottom: 8px;
    color: #d5d2cb;
    font-size: 13px;
    font-weight: 700;
}

.auth-field input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--auth-border);
    border-radius: 5px;
    outline: none;
    color: var(--auth-text);
    caret-color: var(--auth-accent);
    background: #0d0e11;
    font: inherit;
    font-size: 16px;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.auth-field input:hover {
    border-color: #474a52;
}

.auth-field input:focus-visible {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(215, 154, 75, 0.16);
}

.auth-field input[aria-invalid="true"] {
    border-color: var(--auth-error);
}

.auth-field-hint {
    margin: 7px 0 0;
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.4;
}

.auth-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 22px;
    border: 0;
    border-radius: 5px;
    color: #17120c;
    background: var(--auth-accent);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 180ms ease;
}

.auth-submit:hover:not(:disabled) {
    background: var(--auth-accent-hover);
}

.auth-submit:focus-visible,
.auth-tab:focus-visible {
    outline: 3px solid rgba(215, 154, 75, 0.45);
    outline-offset: 3px;
}

.auth-submit:disabled {
    cursor: wait;
    opacity: 0.55;
}

.auth-message {
    min-height: 18px;
    margin: 14px 0 0;
    color: var(--auth-error);
    font-size: 12px;
    line-height: 1.5;
}

.account-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.account-control[hidden] {
    display: none;
}

.account-email {
    max-width: 180px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-logout {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ddd;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.account-logout:hover,
.account-logout:focus-visible {
    border-color: var(--auth-accent);
    color: #fff;
}

@media (max-width: 520px) {
    .auth-main {
        padding: 32px 0;
    }

    .auth-main > h1 {
        margin-bottom: 24px;
        font-size: 21px;
    }

    .auth-panel {
        padding: 20px;
    }

    .account-email {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit,
    .auth-tab,
    .auth-google,
    .auth-field input {
        transition: none;
    }
}
