@import url('https://fonts.googleapis.com/css2?family=Metamorphous&family=Cinzel+Decorative:wght@400;700&display=swap');

:root {
    --auth-bg-void: #060404;
    --auth-bg-deep: #160f0c;
    --auth-gold-dark: #5c3d0c;
    --auth-gold-mid: #8a5e14;
    --auth-gold-base: #c2891e;
    --auth-gold-light: #dfb03a;
    --auth-gold-bright: #f0cf5c;
    --auth-gold-pure: #ffe878;
    --auth-arcane-mid: #16305a;
    --auth-arcane-bright: #5a90ce;
    --auth-arcane-glow: #80b4ee;
    --auth-metal-mid: #363129;
    --auth-metal-base: #4a4540;
    --auth-text-primary: #f0e4d0;
    --auth-text-secondary: #c4a87e;
    --auth-text-muted: #8a6e50;
    --auth-text-disabled: #4e3e30;
    --auth-error: #ee4444;
    --auth-success: #5cce8e;
    --auth-success-bg: rgba(30, 92, 58, .2);
    --auth-success-border: rgba(30, 92, 58, .4);
    --auth-font-base: 'Metamorphous', Georgia, serif;
    --auth-font-logo: 'Cinzel Decorative', 'Metamorphous', Georgia, serif;
}

.auth-body {
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
}

.auth-screen,
.auth-screen *,
.auth-screen *::before,
.auth-screen *::after {
    box-sizing: border-box;
}

.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 80;
    overflow: hidden;
    background: var(--auth-bg-void);
    font-family: var(--auth-font-base);
}

.auth-screen__video,
.auth-screen__fallback,
.auth-screen__vignette,
.auth-screen__particles {
    position: fixed;
    inset: 0;
}

.auth-screen__video {
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-screen__fallback {
    z-index: 0;
    opacity: 0;
    transition: opacity .8s ease;
    background:
        radial-gradient(ellipse at 15% 70%, rgba(120, 40, 20, .22) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 25%, rgba(22, 48, 90, .18) 0%, transparent 55%),
        linear-gradient(155deg, #0a0604 0%, #100c08 35%, #0e0b08 65%, #080604 100%);
}

.auth-screen__fallback.is-visible {
    opacity: 1;
}

.auth-screen__vignette {
    z-index: 1;
    background:
        radial-gradient(ellipse at center, rgba(4, 2, 2, .25) 0%, rgba(4, 2, 2, .78) 100%),
        linear-gradient(180deg, rgba(4, 2, 2, .55) 0%, rgba(4, 2, 2, .05) 25%, rgba(4, 2, 2, .05) 75%, rgba(4, 2, 2, .65) 100%);
}

.auth-screen__particles {
    z-index: 2;
    pointer-events: none;
}

.auth-ember {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: authFloatUp linear infinite;
}

@keyframes authFloatUp {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }

    8% {
        opacity: .9;
    }

    88% {
        opacity: .25;
    }

    100% {
        transform: translateY(-95vh) translateX(var(--ember-dx)) scale(.15);
        opacity: 0;
    }
}

.auth-screen__version {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 30;
    color: var(--auth-text-disabled);
    font-size: 11px;
    letter-spacing: .05em;
}

.auth-screen__exit {
    position: fixed;
    right: 24px;
    bottom: 20px;
    z-index: 30;
    color: var(--auth-text-muted);
    text-decoration: none;
    font-size: 12px;
    letter-spacing: .14em;
    transition: color .2s ease;
}

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

.auth-screen__links {
    position: fixed;
    left: 38px;
    bottom: 52px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-screen__link {
    color: var(--auth-text-secondary);
    text-decoration: none;
    font-size: 13px;
    letter-spacing: .02em;
    transition: color .2s ease;
}

.auth-screen__link:hover,
.auth-screen__link.is-active {
    color: var(--auth-gold-light);
}

.auth-screen__link--small {
    margin-top: 6px;
    color: var(--auth-text-muted);
    font-size: 11px;
}

.auth-screen__wrap {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 16px;
    padding-right: clamp(2rem, 11vw, 13rem);
}

.auth-brand,
.auth-card {
    width: clamp(340px, 26vw, 430px);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-brand__logo {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(194, 137, 30, .35));
}

.auth-brand__fallback {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 0 14px rgba(194, 137, 30, .32));
}

.auth-brand__title {
    background: linear-gradient(180deg, var(--auth-gold-pure) 0%, var(--auth-gold-bright) 25%, var(--auth-gold-base) 60%, var(--auth-gold-mid) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--auth-font-logo);
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    font-weight: 700;
    letter-spacing: .22em;
    text-align: center;
    line-height: 1;
}

.auth-brand__subtitle {
    width: 100%;
    margin-top: 6px;
    padding: 4px 0;
    color: var(--auth-text-muted);
    background: linear-gradient(90deg, transparent, var(--auth-gold-dark) 20%, var(--auth-gold-mid) 50%, var(--auth-gold-dark) 80%, transparent);
    font-size: .6rem;
    letter-spacing: .26em;
    text-align: center;
    text-transform: uppercase;
}

.auth-brand__deco {
    position: relative;
    width: 60%;
    height: 1px;
    margin-top: 12px;
    background: linear-gradient(90deg, transparent, var(--auth-gold-dark) 20%, var(--auth-gold-base) 50%, var(--auth-gold-dark) 80%, transparent);
}

.auth-brand__deco::before,
.auth-brand__deco::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--auth-gold-base);
    transform: translateY(-50%);
}

.auth-brand__deco::before {
    left: 20%;
}

.auth-brand__deco::after {
    right: 20%;
}

.auth-card {
    position: relative;
    background:
        radial-gradient(ellipse at 45% 8%, rgba(90, 60, 12, .28) 0%, transparent 55%),
        radial-gradient(ellipse at 55% 92%, rgba(50, 35, 22, .45) 0%, transparent 50%),
        linear-gradient(170deg, #2e1d10 0%, #1a1008 42%, #1e140c 78%, #221710 100%);
    border: 1px solid var(--auth-gold-mid);
    box-shadow:
        0 0 0 1px rgba(90, 60, 12, .2),
        inset 0 0 70px rgba(6, 4, 4, .45),
        0 0 0 8px rgba(6, 4, 4, .35),
        0 28px 80px rgba(3, 2, 1, .97),
        0 0 120px rgba(3, 2, 1, .8);
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 7px;
    z-index: 0;
    border: 1px solid rgba(138, 94, 20, .16);
    pointer-events: none;
}

.auth-card__corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--auth-gold-mid);
    border-style: solid;
}

.auth-card__corner--tl {
    top: 10px;
    left: 10px;
    border-width: 2px 0 0 2px;
}

.auth-card__corner--tr {
    top: 10px;
    right: 10px;
    border-width: 2px 2px 0 0;
}

.auth-card__corner--bl {
    bottom: 10px;
    left: 10px;
    border-width: 0 0 2px 2px;
}

.auth-card__corner--br {
    right: 10px;
    bottom: 10px;
    border-width: 0 2px 2px 0;
}

.auth-card__body {
    position: relative;
    z-index: 1;
    padding: 26px 34px 28px;
}

.auth-card__body--compact {
    padding: 22px 34px 24px;
}

.auth-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.auth-card__title {
    background: linear-gradient(180deg, var(--auth-gold-bright) 0%, var(--auth-gold-base) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--auth-font-logo);
    font-size: 1rem;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.auth-card__back,
.auth-card__link {
    color: var(--auth-text-muted);
    text-decoration: none;
    font-size: 9.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    transition: color .2s ease;
}

.auth-card__back:hover,
.auth-card__link:hover {
    color: var(--auth-gold-light);
}

.auth-card__link {
    display: block;
    width: 100%;
    margin-top: 10px;
    text-align: center;
}

.auth-card__divider {
    height: 1px;
    margin: 14px 0;
    background: linear-gradient(90deg, transparent 0%, var(--auth-gold-dark) 20%, var(--auth-gold-base) 50%, var(--auth-gold-dark) 80%, transparent 100%);
}

.auth-card__divider--sm {
    margin: 10px 0;
}

.auth-card__tagline {
    color: var(--auth-text-disabled);
    text-align: center;
    font-size: 7.5px;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.auth-card__text {
    margin: 0 0 16px;
    color: var(--auth-text-muted);
    font-size: 10px;
    letter-spacing: .06em;
    line-height: 1.6;
}

.auth-message {
    margin-bottom: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(122, 26, 26, .38);
    background: rgba(122, 26, 26, .2);
    color: var(--auth-error);
    font-size: 10.5px;
    letter-spacing: .04em;
    text-align: center;
    line-height: 1.5;
}

.auth-message--success {
    color: var(--auth-success);
    background: var(--auth-success-bg);
    border-color: var(--auth-success-border);
}

.auth-form {
    display: block;
}

.auth-form__group {
    margin-bottom: 14px;
}

.auth-form__group--sm {
    margin-bottom: 11px;
}

.auth-form__group--last {
    margin-bottom: 20px;
}

.auth-form__label {
    display: block;
    margin-bottom: 5px;
    color: var(--auth-text-muted);
    font-size: 9px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.auth-form__input {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--auth-metal-mid);
    background: var(--auth-bg-deep);
    color: var(--auth-text-primary);
    font-family: var(--auth-font-base);
    font-size: 13px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.auth-form__input--sm {
    padding: 8px 12px;
    font-size: 12.5px;
}

.auth-form__input:focus {
    border-color: var(--auth-gold-mid);
    box-shadow: 0 0 0 1px rgba(138, 94, 20, .22), inset 0 0 12px rgba(5, 3, 2, .35);
}

.auth-form__input::placeholder {
    color: var(--auth-text-disabled);
    font-family: Georgia, serif;
    font-size: 12.5px;
}

.auth-form__password-wrap {
    position: relative;
}

.auth-form__input--password {
    padding-right: 38px;
}

.auth-form__toggle {
    position: absolute;
    top: 50%;
    right: 11px;
    transform: translateY(-50%);
    padding: 0;
    border: 0;
    background: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color .2s ease;
}

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

.auth-form__match {
    position: absolute;
    top: 50%;
    right: 11px;
    transform: translateY(-50%);
    font-size: 11px;
}

.auth-form__match--ok {
    color: var(--auth-success);
}

.auth-form__match--no {
    color: var(--auth-error);
}

.auth-form__check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
}

.auth-form__check-row--top {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
}

.auth-form__check {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-top: 2px;
    border: 1px solid var(--auth-metal-base);
    background: var(--auth-bg-deep);
    cursor: pointer;
    transition: all .15s ease;
}

.auth-form__check:checked {
    border-color: var(--auth-gold-base);
    background: var(--auth-gold-mid);
}

.auth-form__check:checked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 3px;
    width: 4px;
    height: 7px;
    border: 1.5px solid var(--auth-bg-void);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.auth-form__check-label {
    color: var(--auth-text-muted);
    cursor: pointer;
    user-select: none;
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
    line-height: 1.4;
}

.auth-form__highlight {
    color: var(--auth-gold-light);
}

.auth-btn {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 12px 24px;
    cursor: pointer;
    font-family: var(--auth-font-base);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    transition: transform .15s, border-color .2s;
}

.auth-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(180, 220, 255, .12), transparent);
    animation: authShimmer 3.5s ease-in-out infinite;
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

.auth-btn--arcane {
    border: 1.5px solid var(--auth-arcane-bright);
    background: linear-gradient(158deg, #1e3a6a 0%, var(--auth-arcane-mid) 50%, #0e1e3a 100%);
    color: #deeeff;
    animation: authArcaneGlow 2.8s ease-in-out infinite;
}

.auth-btn--arcane:hover {
    border-color: var(--auth-arcane-glow);
    transform: translateY(-1px);
}

.auth-btn--gold {
    border: 1.5px solid var(--auth-gold-base);
    background: linear-gradient(158deg, #3a2608 0%, var(--auth-gold-dark) 50%, #2a1a06 100%);
    color: #ffe8c0;
    animation: authGoldGlow 3s ease-in-out infinite;
}

.auth-btn--gold:hover {
    border-color: var(--auth-gold-pure);
    transform: translateY(-1px);
}

@keyframes authArcaneGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(90, 144, 206, .42), 0 0 50px rgba(90, 144, 206, .12), inset 0 0 18px rgba(90, 144, 206, .07);
    }
    50% {
        box-shadow: 0 0 42px rgba(90, 144, 206, .72), 0 0 90px rgba(90, 144, 206, .22), inset 0 0 36px rgba(90, 144, 206, .14);
    }
}

@keyframes authGoldGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(194, 137, 30, .38), 0 0 50px rgba(194, 137, 30, .1), inset 0 0 18px rgba(194, 137, 30, .06);
    }
    50% {
        box-shadow: 0 0 40px rgba(194, 137, 30, .65), 0 0 80px rgba(194, 137, 30, .2), inset 0 0 32px rgba(194, 137, 30, .12);
    }
}

@keyframes authShimmer {
    0% {
        left: -120%;
    }
    60%, 100% {
        left: 140%;
    }
}

.is-hidden {
    display: none !important;
}

@media (max-width: 980px) {
    .auth-screen__wrap {
        align-items: center;
        padding-right: 0;
        padding-left: 0;
    }

    .auth-screen__links {
        left: 18px;
        bottom: 26px;
    }
}

@media (max-width: 640px) {
    .auth-screen__version {
        top: 12px;
        right: 14px;
    }

    .auth-screen__exit {
        right: 14px;
        bottom: 14px;
    }

    .auth-screen__links {
        left: 14px;
        right: 14px;
        bottom: 58px;
        gap: 6px;
    }

    .auth-brand,
    .auth-card {
        width: min(92vw, 430px);
    }

    .auth-card__body,
    .auth-card__body--compact {
        padding: 24px 22px 26px;
    }

    .auth-brand__title {
        font-size: 2rem;
        letter-spacing: .16em;
    }

    .auth-brand__subtitle {
        font-size: .62rem;
        letter-spacing: .18em;
    }
}

.character-card__portrait {
    width: 64px;
    height: 64px;
    border: 1px solid rgba(138, 94, 20, .35);
    object-fit: cover;
    background: #120c08;
}