:root {
    --ink: #171412;
    --ink-soft: #28221f;
    --coffee: #4b2f23;
    --coffee-2: #704a35;
    --cream: #f6f0e7;
    --paper: rgba(255, 255, 255, .91);
    --gold: #c89b55;
    --gold-soft: #ead5ab;
    --line: rgba(33, 25, 21, .11);
    --success: #1f8f62;
    --danger: #c94c4c;
    --ease-premium: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

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

body.premium-login {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at 14% 16%, rgba(200, 155, 85, .22), transparent 31%),
        radial-gradient(circle at 82% 76%, rgba(112, 74, 53, .25), transparent 34%),
        linear-gradient(135deg, #181513 0%, #29211d 44%, #151719 100%);
}

body.premium-login::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .32;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
    z-index: 0;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

#ambientCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: .75;
}

.auth-page {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(18px, 3vw, 46px);
}

.auth-layout {
    width: min(1180px, 100%);
    min-height: min(760px, calc(100vh - 70px));
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 34px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 40px 110px rgba(0, 0, 0, .38);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    transform-style: preserve-3d;
}

.auth-layout.is-hidden {
    opacity: 0;
    transform: translateY(24px) scale(.985);
}

.auth-layout.is-ready {
    animation: layoutReveal .78s var(--ease-premium) both;
}

.brand-side {
    position: relative;
    overflow: hidden;
    min-height: 620px;
    padding: clamp(34px, 5vw, 72px);
    color: #fff;
    isolation: isolate;
    background:
        linear-gradient(160deg, rgba(19, 17, 16, .88), rgba(59, 39, 30, .67)),
        radial-gradient(circle at 68% 30%, rgba(200, 155, 85, .33), transparent 35%);
}

.brand-side::before {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    top: -160px;
    left: -190px;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow:
        0 0 0 80px rgba(255, 255, 255, .025),
        0 0 0 160px rgba(255, 255, 255, .018);
    z-index: -1;
}

.brand-side::after {
    content: "";
    position: absolute;
    inset: auto -10% -32% 20%;
    height: 58%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(200, 155, 85, .22), transparent 64%);
    filter: blur(20px);
    z-index: -1;
}

.brand-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    position: relative;
    z-index: 3;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 13px;
}

.brand-symbol {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(255,255,255,.19), rgba(255,255,255,.08));
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}

.brand-symbol i { font-size: 22px; color: var(--gold-soft); }
.brand-name { font-weight: 800; letter-spacing: .02em; }
.brand-subname { color: rgba(255,255,255,.60); font-size: .78rem; margin-top: 2px; }

.security-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 999px;
    color: rgba(255,255,255,.82);
    font-size: .8rem;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.07);
}

.security-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4fda9d;
    box-shadow: 0 0 0 5px rgba(79,218,157,.11);
}

.brand-copy {
    position: relative;
    z-index: 3;
    width: min(540px, 100%);
    margin-top: clamp(58px, 8vh, 100px);
}

.brand-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--gold-soft);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.brand-kicker::before {
    content: "";
    width: 32px;
    height: 1px;
    background: currentColor;
}

.brand-copy h1 {
    margin: 18px 0 15px;
    font-size: clamp(2rem, 4.2vw, 4.15rem);
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: -.04em;
}

.brand-copy p {
    margin: 0;
    max-width: 530px;
    color: rgba(255,255,255,.67);
    font-size: clamp(.95rem, 1.4vw, 1.08rem);
    line-height: 1.9;
}

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: .84rem;
    color: rgba(255,255,255,.78);
    border: 1px solid rgba(255,255,255,.11);
    background: rgba(255,255,255,.055);
}

.feature-pill i { color: var(--gold-soft); }

.brand-mascot {
    position: absolute;
    z-index: 2;
    left: clamp(-95px, -5vw, -40px);
    bottom: -95px;
    width: clamp(320px, 38vw, 520px);
    opacity: .24;
    filter: saturate(.72) contrast(1.05) drop-shadow(0 28px 38px rgba(0,0,0,.33));
    mix-blend-mode: screen;
    pointer-events: none;
    transform: rotate(-8deg);
}

.login-side {
    position: relative;
    display: grid;
    place-items: center;
    padding: clamp(26px, 4vw, 64px);
    background:
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,241,235,.93));
}

.login-side::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, transparent 0 42%, rgba(255,255,255,.46) 50%, transparent 58%) -140% 0 / 220% 100% no-repeat;
    animation: surfaceSheen 8s ease-in-out infinite;
}

.login-panel {
    position: relative;
    z-index: 2;
    width: min(430px, 100%);
    transform-style: preserve-3d;
}

.login-head {
    margin-bottom: 29px;
}

.login-mini-brand {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    font-weight: 900;
}

.login-mini-brand span {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: white;
    background: linear-gradient(145deg, var(--ink), var(--coffee));
}

.login-overline {
    margin-bottom: 9px;
    color: var(--coffee-2);
    font-size: .82rem;
    font-weight: 800;
}

.login-head h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 900;
    letter-spacing: -.035em;
}

.login-head p {
    margin: 10px 0 0;
    color: #77706a;
    line-height: 1.75;
}

.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-bottom: 18px;
    padding: 13px 14px;
    border: 1px solid rgba(201, 76, 76, .2);
    border-radius: 15px;
    color: #8f3030;
    background: rgba(201, 76, 76, .08);
    animation: alertShake .55s var(--ease-premium) both;
}

.form-alert i { margin-top: 2px; }

.smart-field {
    position: relative;
    margin-bottom: 18px;
}

.smart-field label {
    display: block;
    margin-bottom: 8px;
    color: #38322e;
    font-size: .86rem;
    font-weight: 800;
}

.field-shell {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 56px;
    border: 1px solid #ded8d1;
    border-radius: 16px;
    background: rgba(255,255,255,.77);
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease, background .25s ease;
}

.smart-field:focus-within .field-shell {
    border-color: rgba(112,74,53,.62);
    background: white;
    box-shadow: 0 0 0 5px rgba(112,74,53,.08), 0 14px 30px rgba(67, 48, 38, .08);
    transform: translateY(-1px);
}

.field-icon {
    width: 49px;
    display: grid;
    place-items: center;
    color: #8a817a;
    font-size: 1.05rem;
    flex: 0 0 auto;
}

.field-shell input {
    width: 100%;
    min-width: 0;
    height: 54px;
    padding: 0 2px;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
}

.field-shell input::placeholder { color: #b1aaa4; }

.password-toggle {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 13px;
    color: #7a726b;
    background: transparent;
    cursor: pointer;
}

.password-toggle:hover { background: rgba(75,47,35,.07); color: var(--coffee); }

.form-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 2px 0 22px;
    color: #817970;
    font-size: .82rem;
}

.form-meta span { display: inline-flex; align-items: center; gap: 7px; }
.form-meta i { color: var(--success); }

.login-submit {
    position: relative;
    width: 100%;
    min-height: 56px;
    overflow: hidden;
    border: 0;
    border-radius: 17px;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    background: linear-gradient(135deg, #191614, #493126 62%, #70503b);
    box-shadow: 0 17px 34px rgba(47, 31, 24, .22);
    transition: transform .2s ease, box-shadow .2s ease;
    transform: translateZ(20px);
}

.login-submit::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.28) 45%, transparent 70%);
    transform: translateX(-130%);
    transition: transform .7s var(--ease-premium);
}

.login-submit:hover::before { transform: translateX(130%); }
.login-submit:hover { box-shadow: 0 20px 42px rgba(47,31,24,.29); }
.login-submit:active { transform: scale(.985); }

.login-submit .button-content,
.login-submit .button-loader {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-submit .button-loader { display: none; }
.login-submit.is-loading .button-content { display: none; }
.login-submit.is-loading .button-loader { display: inline-flex; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.32);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.register-row {
    margin: 24px 0 0;
    padding-top: 23px;
    text-align: center;
    border-top: 1px solid var(--line);
    color: #817970;
    font-size: .9rem;
}

.register-row a {
    color: var(--coffee);
    font-weight: 900;
    text-decoration: none;
}

.register-row a:hover { text-decoration: underline; }

.login-footnote {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    color: #9c958e;
    font-size: .76rem;
}

/* Intro */
.brand-intro {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: white;
    background:
        radial-gradient(circle at 50% 40%, rgba(125,83,59,.42), transparent 32%),
        radial-gradient(circle at 50% 110%, rgba(200,155,85,.20), transparent 35%),
        linear-gradient(145deg, #0f0e0d, #271d18 52%, #111315);
    transition: opacity .4s ease, visibility .4s ease, filter .4s ease;
    animation: introFallbackOut .38s ease 2.45s forwards;
}

.brand-intro.is-leaving {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    filter: blur(12px);
}

.intro-noise {
    position: absolute;
    inset: 0;
    opacity: .28;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='x'%3E%3CfeTurbulence baseFrequency='.92' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23x)' opacity='.13'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

.intro-skip {
    position: absolute;
    top: clamp(18px, 3vw, 32px);
    left: clamp(18px, 3vw, 32px);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    color: rgba(255,255,255,.7);
    background: rgba(255,255,255,.07);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

.intro-skip:hover {
    color: white;
    background: rgba(255,255,255,.12);
    transform: translateY(-1px);
}

.intro-content {
    width: min(92vw, 760px);
    text-align: center;
    perspective: 1100px;
}

.intro-stage {
    position: relative;
    width: min(76vw, 470px);
    height: min(65vh, 560px);
    min-height: 420px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transform-style: preserve-3d;
}

.intro-halo {
    position: absolute;
    left: 50%;
    top: 44%;
    width: min(68vw, 440px);
    aspect-ratio: 1;
    translate: -50% -50%;
    border-radius: 50%;
    border: 1px solid rgba(234,213,171,.17);
    box-shadow:
        0 0 0 58px rgba(234,213,171,.028),
        0 0 0 120px rgba(234,213,171,.018),
        inset 0 0 90px rgba(200,155,85,.07);
}

.intro-halo::before,
.intro-halo::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    translate: -50% -50%;
    border-radius: 50%;
    border: 1px solid rgba(234,213,171,.16);
    opacity: 0;
}

.intro-halo::before { width: 35%; height: 35%; }
.intro-halo::after { width: 70%; height: 70%; }
.intro-halo.is-impact::before { animation: impactRing .62s ease-out both; }
.intro-halo.is-impact::after { animation: impactRing .72s ease-out .07s both; }

.goat-wrap {
    position: absolute;
    left: 50%;
    bottom: 75px;
    z-index: 4;
    width: min(64vw, 350px);
    translate: -50% 0;
    transform-origin: 50% 100%;
    transform-style: preserve-3d;
    will-change: transform, filter;
}

.goat-wrap img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 22px 22px rgba(0,0,0,.32));
}

.goat-shadow {
    position: absolute;
    left: 50%;
    bottom: 69px;
    z-index: 2;
    width: 180px;
    height: 25px;
    translate: -50% 0;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0,0,0,.56), rgba(0,0,0,.12) 62%, transparent 74%);
    filter: blur(6px);
    will-change: transform, opacity;
}

.goat-platform {
    position: absolute;
    left: 50%;
    bottom: 31px;
    z-index: 5;
    width: min(72vw, 420px);
    height: 86px;
    translate: -50% 0;
    transform-style: preserve-3d;
    will-change: transform;
}

.platform-face {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 0 28px;
    border-radius: 7px;
    color: white;
    font-size: clamp(.78rem, 2.3vw, 1.12rem);
    font-weight: 900;
    letter-spacing: .11em;
    white-space: nowrap;
    background: linear-gradient(90deg, #271b17 0 59%, #333335 59% 100%);
    box-shadow: 0 22px 38px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.08);
}

.platform-face::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.19) 47%, transparent 64%);
    transform: translateX(-120%);
    animation: platformSheen 2.2s ease-in-out .35s both;
}

.platform-depth {
    position: absolute;
    left: 4%;
    right: 4%;
    top: 77px;
    height: 17px;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(180deg, #171312, #090908);
    transform: perspective(300px) rotateX(-54deg);
    transform-origin: top;
    opacity: .85;
}

.intro-meta {
    position: relative;
    z-index: 4;
    margin-top: -4px;
}

.intro-eyebrow {
    color: var(--gold-soft);
    font-size: .75rem;
    font-weight: 900;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.intro-title {
    margin: 8px 0 16px;
    font-size: clamp(1.15rem, 3vw, 1.65rem);
    font-weight: 900;
}

.intro-progress {
    width: min(270px, 70vw);
    height: 3px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
}

.intro-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), #fff0ce);
    box-shadow: 0 0 18px rgba(200,155,85,.7);
}

@keyframes layoutReveal {
    from { opacity: 0; transform: translateY(24px) scale(.985); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes surfaceSheen {
    0%, 72% { background-position: -140% 0; }
    100% { background-position: 180% 0; }
}

@keyframes platformSheen {
    from { transform: translateX(-120%); }
    to { transform: translateX(130%); }
}

@keyframes impactRing {
    from { opacity: .72; transform: scale(.25); }
    to { opacity: 0; transform: scale(2.7); }
}

@keyframes alertShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(5px); }
    55% { transform: translateX(-5px); }
    78% { transform: translateX(2px); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes introFallbackOut {
    to { opacity: 0; visibility: hidden; pointer-events: none; }
}

@media (max-width: 960px) {
    .auth-layout { grid-template-columns: 1fr; min-height: auto; max-width: 560px; }
    .brand-side { display: none; }
    .login-side { min-height: min(690px, calc(100vh - 36px)); }
    .login-mini-brand { display: flex; }
}

@media (max-width: 560px) {
    .auth-page { padding: 0; align-items: stretch; }
    .auth-layout { min-height: 100vh; border: 0; border-radius: 0; }
    .login-side { min-height: 100vh; padding: 28px 21px; }
    .login-panel { width: 100%; }
    .form-meta { align-items: flex-start; flex-direction: column; gap: 7px; }
    .intro-stage { min-height: 390px; height: 56vh; }
    .goat-wrap { width: min(68vw, 320px); bottom: 70px; }
    .goat-platform { width: min(84vw, 390px); height: 72px; }
    .platform-depth { top: 64px; }
    .goat-shadow { bottom: 61px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
