:root {
    --color-cream: #faf3e0;
    --color-cream-deep: #f0e6d0;
    --color-espresso: #3c2415;
    --color-espresso-soft: #5a3a28;
    --color-terracotta: #ad452d;
    --color-terracotta-deep: #8f3723;
    --color-olive: #606c38;
    --color-olive-soft: #7a8650;
    --color-berry: #b24a35;
    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Source Sans 3", "Segoe UI", sans-serif;
    --radius: 1.25rem;
    --shadow: 0 18px 50px rgba(60, 36, 21, 0.12);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-body);
    color: var(--color-espresso);
    background: var(--color-cream);
    -webkit-font-smoothing: antialiased;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.auth-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    overflow: hidden;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(173, 69, 45, 0.12), transparent 55%),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(96, 108, 56, 0.14), transparent 50%),
        radial-gradient(ellipse 40% 35% at 0% 80%, rgba(178, 74, 53, 0.08), transparent 45%),
        linear-gradient(165deg, var(--color-cream) 0%, var(--color-cream-deep) 100%);
    z-index: 0;
}

.auth-backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    pointer-events: none;
}

.auth-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 26rem);
    padding: 2rem 1.75rem 2.25rem;
    text-align: center;
    animation: rise-in 0.7s var(--ease) both;
}

.auth-panel--connected {
    animation-delay: 0.05s;
}

.auth-brand {
    margin-bottom: 1.75rem;
}

.auth-logo {
    display: block;
    width: min(100%, 18rem);
    height: auto;
    margin: 0 auto 1.25rem;
    filter: drop-shadow(0 8px 20px rgba(60, 36, 21, 0.1));
    animation: logo-settle 0.9s var(--ease) both;
}

.auth-logo--sm {
    width: min(100%, 14rem);
    margin-bottom: 1.5rem;
}

.auth-title {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.15rem);
    font-weight: 600;
    color: var(--color-espresso);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.auth-lead {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--color-espresso-soft);
}

.auth-lead strong {
    color: var(--color-terracotta);
    font-weight: 600;
}

.auth-alert {
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--color-terracotta-deep);
    background: rgba(173, 69, 45, 0.1);
    border: 1px solid rgba(173, 69, 45, 0.25);
    border-radius: 0.75rem;
    animation: shake 0.45s var(--ease);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    text-align: left;
    animation: rise-in 0.75s var(--ease) 0.12s both;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field label {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--color-espresso);
}

.field input {
    width: 100%;
    padding: 0.85rem 1rem;
    font: inherit;
    font-size: 1rem;
    color: var(--color-espresso);
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(60, 36, 21, 0.22);
    border-radius: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input:hover {
    border-color: rgba(60, 36, 21, 0.4);
}

.field input:focus {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--color-olive);
    box-shadow: 0 0 0 3px rgba(96, 108, 56, 0.2);
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    padding: 0.85rem 1.25rem;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s var(--ease), background 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    margin-top: 0.35rem;
    color: #fff;
    background: var(--color-terracotta);
    box-shadow: 0 10px 24px rgba(173, 69, 45, 0.28);
}

.btn-primary:hover {
    background: var(--color-terracotta-deep);
    transform: translateY(-1px);
}

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

.btn-primary:focus-visible {
    outline: 2px solid var(--color-olive);
    outline-offset: 3px;
}

.btn-secondary {
    color: var(--color-espresso);
    background: transparent;
    border: 1.5px solid rgba(60, 36, 21, 0.28);
}

.btn-secondary:hover {
    background: rgba(96, 108, 56, 0.1);
    border-color: var(--color-olive);
}

.btn-secondary:focus-visible {
    outline: 2px solid var(--color-terracotta);
    outline-offset: 3px;
}

.auth-actions {
    margin-top: 0.5rem;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logo-settle {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@media (min-width: 480px) {
    .auth-panel {
        padding: 2.5rem 2.25rem 2.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
