:root {
    --espresso-950: #160d0a;
    --espresso-900: #21130f;
    --espresso-800: #2f1c16;
    --espresso-700: #43291f;
    --cocoa-600: #674532;
    --caramel-500: #9b704f;
    --biscuit-300: #d8bea0;
    --cream-100: #f3e7d4;
    --cream-050: #fbf4e8;
    --sage: #9ea149;
    --plum: #aa8bbd;
    --ink: #342018;
    --soft-shadow: 0 26px 70px rgb(8 4 2 / 0.42);
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    background: var(--espresso-950);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    color: var(--cream-100);
    font-family: ui-rounded, "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at 15% 18%, rgb(155 112 79 / 0.14), transparent 29rem),
        radial-gradient(circle at 86% 76%, rgb(126 97 66 / 0.12), transparent 34rem),
        linear-gradient(145deg, #170e0b 0%, #2c1b15 52%, #21130f 100%);
    overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }

.page-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .22;
    background-image:
        repeating-linear-gradient(13deg, transparent 0 4px, rgb(255 255 255 / .018) 4px 5px),
        repeating-linear-gradient(101deg, transparent 0 7px, rgb(0 0 0 / .035) 7px 8px);
    mix-blend-mode: soft-light;
}

.login-page {
    width: min(1180px, calc(100% - 48px));
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    padding: max(28px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-rows: auto 1fr;
    position: relative;
    z-index: 1;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    color: var(--cream-100);
    user-select: none;
}

.brand-moon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgb(243 231 212 / .34);
    border-radius: 50%;
    font-family: Georgia, serif;
    font-size: 27px;
    color: var(--biscuit-300);
    box-shadow: inset 0 0 0 4px rgb(255 255 255 / .02);
}

.brand-name {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    letter-spacing: .025em;
    line-height: 1;
}

.brand-subtitle {
    margin-top: 5px;
    color: var(--biscuit-300);
    font-family: Georgia, "Times New Roman", serif;
    font-size: .82rem;
    font-style: italic;
    letter-spacing: .08em;
    opacity: .85;
}

.welcome-layout {
    align-self: center;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
    align-items: center;
    gap: clamp(34px, 7vw, 90px);
    padding: 44px 0 54px;
}

.guardian-side {
    position: relative;
    min-height: 560px;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.guardian-halo {
    position: absolute;
    width: min(78%, 470px);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgb(251 244 232 / .11) 0 47%, transparent 48%),
        repeating-radial-gradient(circle, transparent 0 23px, rgb(216 190 160 / .04) 24px 25px);
    filter: blur(.1px);
    z-index: -2;
}

.guardian {
    display: block;
    width: min(100%, 610px);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 28px 24px rgb(0 0 0 / .32));
    transform: translateY(16px);
    position: relative;
    z-index: 2;
}

.wood-shelf {
    position: absolute;
    left: 3%;
    right: 1%;
    bottom: 46px;
    height: 27px;
    border-radius: 8px 8px 13px 13px;
    background:
        linear-gradient(rgb(255 255 255 / .06), transparent 35%),
        repeating-linear-gradient(4deg, transparent 0 31px, rgb(17 7 3 / .16) 31px 34px),
        linear-gradient(90deg, #47281b, #71482f 36%, #4e2d20 75%, #3a2118);
    box-shadow: 0 18px 19px rgb(0 0 0 / .35), inset 0 -4px 0 rgb(0 0 0 / .22);
    z-index: 1;
}

.wood-shelf span {
    position: absolute;
    inset: auto 4% -10px;
    height: 10px;
    border-radius: 0 0 8px 8px;
    background: #2a1710;
    opacity: .9;
}

.tiny-stars {
    position: absolute;
    color: var(--biscuit-300);
    opacity: .65;
    font-family: Georgia, serif;
    letter-spacing: .4em;
    z-index: 0;
}

.stars-one { top: 13%; left: 7%; transform: rotate(-8deg); }
.stars-two { top: 28%; right: 2%; transform: rotate(10deg); }

.login-card-wrap {
    position: relative;
    padding: 16px 0;
}

.login-card {
    position: relative;
    color: var(--ink);
    background:
        linear-gradient(rgb(255 255 255 / .20), transparent 30%),
        var(--cream-100);
    padding: clamp(38px, 5vw, 58px) clamp(30px, 5vw, 56px) 36px;
    border: 1px solid rgb(110 73 51 / .28);
    border-radius: 30px;
    box-shadow: var(--soft-shadow), inset 0 1px 0 rgb(255 255 255 / .8);
}

.login-card::before,
.login-card::after {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    height: 18px;
    background: radial-gradient(circle at 9px 9px, var(--cream-100) 8px, transparent 8.7px) 0 0 / 18px 18px repeat-x;
    filter: drop-shadow(0 1px 0 rgb(103 69 50 / .18));
    pointer-events: none;
}

.login-card::before { top: -9px; }
.login-card::after { bottom: -9px; transform: rotate(180deg); }

.login-card h1 {
    margin: 0 0 34px;
    color: var(--espresso-800);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 500;
    letter-spacing: -.035em;
    line-height: .98;
}

.login-error {
    margin: -8px 0 22px;
    padding: 12px 14px;
    border: 1px solid #ad796f;
    border-radius: 14px;
    background: #f3d9d0;
    color: #66342f;
    font-size: .9rem;
    line-height: 1.4;
}

.login-form {
    display: grid;
    gap: 19px;
}

.field {
    display: grid;
    gap: 8px;
    color: var(--espresso-700);
    font-size: .79rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.field input {
    width: 100%;
    height: 54px;
    border: 1px solid #cdb69d;
    border-radius: 15px;
    outline: none;
    background: var(--cream-050);
    color: var(--espresso-800);
    padding: 0 16px;
    font-size: 1rem;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: inset 0 1px 3px rgb(55 31 21 / .06);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.field input:focus {
    border-color: var(--cocoa-600);
    background: #fffaf1;
    box-shadow: 0 0 0 4px rgb(103 69 50 / .11), inset 0 1px 3px rgb(55 31 21 / .05);
}

.password-field {
    position: relative;
    display: block;
}

.password-field input { padding-right: 72px; }

.peek-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #765944;
    padding: 9px 10px;
    font-family: Georgia, serif;
    font-size: .8rem;
    font-style: italic;
}

.peek-button:hover,
.peek-button:focus-visible {
    background: #ead9c5;
    outline: none;
}

.enter-button {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 5px;
    border: 1px solid #25150f;
    border-radius: 16px;
    padding: 0 20px;
    background:
        linear-gradient(rgb(255 255 255 / .045), transparent),
        var(--espresso-800);
    color: var(--cream-050);
    box-shadow: 0 9px 18px rgb(61 35 25 / .2), inset 0 1px 0 rgb(255 255 255 / .09);
    font-weight: 760;
    letter-spacing: .02em;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.enter-button:hover {
    transform: translateY(-2px);
    background-color: var(--espresso-700);
    box-shadow: 0 12px 22px rgb(61 35 25 / .24), inset 0 1px 0 rgb(255 255 255 / .1);
}

.enter-button:active { transform: translateY(0); }
.enter-button:focus-visible { outline: 3px solid rgb(155 112 79 / .35); outline-offset: 3px; }

@media (max-width: 880px) {
    .login-page { width: min(100% - 30px, 660px); }
    .welcome-layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding-top: 12px;
    }
    .brand { margin-bottom: 2px; }
    .guardian-side {
        min-height: 365px;
        margin: 0 -8px -26px;
    }
    .guardian {
        width: min(520px, 94%);
        transform: translateY(3px);
    }
    .guardian-halo { width: min(360px, 78%); }
    .wood-shelf { left: 8%; right: 8%; bottom: 38px; }
    .stars-one { top: 10%; left: 4%; }
    .stars-two { top: 20%; right: 3%; }
    .login-card-wrap { padding-top: 0; }
}

@media (max-width: 520px) {
    .login-page {
        width: min(100% - 24px, 470px);
        padding-top: max(18px, env(safe-area-inset-top));
    }
    .brand-moon { width: 38px; height: 38px; font-size: 23px; }
    .brand-name { font-size: 1.35rem; }
    .brand-subtitle { font-size: .74rem; }
    .guardian-side {
        min-height: 300px;
        margin-top: -4px;
        margin-bottom: -18px;
    }
    .guardian { width: 105%; max-width: 430px; }
    .wood-shelf { left: 4%; right: 4%; bottom: 34px; height: 22px; }
    .login-card {
        padding: 36px 22px 29px;
        border-radius: 24px;
    }
    .login-card::before,
    .login-card::after { left: 19px; right: 19px; }
    .login-card h1 { font-size: clamp(2.35rem, 12vw, 3.35rem); }
    .field input { height: 52px; }
}

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