:root {
    --auth-bg: #eeeeee;
    --auth-card-bg: rgba(255, 255, 255, 0.96);
    --auth-text: #222222;
    --auth-muted: #657168;
    --auth-border: rgba(143, 179, 154, 0.22);
    --auth-accent: #98e0ac;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: var(--auth-text);
    overflow: hidden;
}

* {
    box-sizing: border-box;
}

.wrapper {
    position: relative;
    max-width: 650px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    background-color: var(--auth-bg);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

.navbar {
    width: 100%;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
}

.navbar h1 {
    margin: 0;
    font-size: 1.5em;
    color: black;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
}

.center-container {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: clamp(14px, 3vw, 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.login-box {
    width: min(92vw, 380px);
    max-height: calc(100dvh - 88px - env(safe-area-inset-bottom));
    overflow-y: auto;
    padding: clamp(22px, 5vw, 30px);
    border-radius: 16px;
    border: 1px solid var(--auth-border);
    background: linear-gradient(180deg, var(--auth-card-bg) 0%, #ffffff 100%);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.13);
    color: var(--auth-text);
}

.login-box h2 {
    margin: 0 0 16px;
    color: var(--auth-text);
    font-size: clamp(1.22rem, 4vw, 1.45rem);
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.auth-subtitle {
    margin: -6px 0 18px;
    color: var(--auth-muted);
    font-size: 0.9em;
    line-height: 1.55;
    text-align: left;
    overflow-wrap: anywhere;
}

.login-box label {
    display: block;
    margin: 12px 0 6px;
    color: #405548;
    font-size: 0.9em;
    font-weight: 600;
}

.login-box input {
    width: 100%;
    margin-top: 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--auth-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-color: #f7fbf8;
    color: var(--auth-text);
    font-size: 1rem;
    line-height: 1.4;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}

.login-box input:focus {
    border-color: rgba(68, 198, 125, 0.55);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(152, 224, 172, 0.16);
}

.login-box .helptext {
    display: block;
    margin-top: 6px;
    color: #6d7b71;
    font-size: 0.84em;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.login-box .errorlist {
    list-style: none;
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(138, 38, 48, 0.12);
    background: rgba(255, 226, 229, 0.9);
    color: #8a2630;
    font-size: 0.88em;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.login-box .errorlist li {
    margin: 0;
}

.login-box button {
    width: 100%;
    margin-top: 20px;
    padding: 13px;
    border: none;
    border-radius: 100px;
    background-color: var(--auth-accent);
    color: #173a22;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(88, 201, 133, 0.18);
    transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.login-box button:hover {
    background-color: #76d598;
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(88, 201, 133, 0.22);
}

.login-box button:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 8px 18px rgba(88, 201, 133, 0.16);
}

.auth-links-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    margin-top: 16px;
    font-size: 0.9em;
    line-height: 1.5;
    flex-wrap: wrap;
}

.auth-link-action {
    color: #3b6d58;
    text-decoration: none;
    text-underline-offset: 3px;
    transition: color 0.18s ease;
}

.auth-link-action:hover {
    color: #24583e;
}

.auth-links-divider {
    color: #9aa59f;
}

.register-link {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
}

.home-link {
    text-decoration: none;
    color: inherit;
}

.home-link:hover {
    text-decoration: none;
    color: #222;
}

@media only screen and (max-width: 640px) {
    .navbar {
        height: 44px;
    }

    .navbar h1 {
        font-size: 1.3em;
    }

    .center-container {
        padding: 12px;
        align-items: center;
    }

    .login-box {
        width: min(94vw, 380px);
        max-height: calc(100dvh - 68px - env(safe-area-inset-bottom));
        padding: 22px 18px;
        border-radius: 14px;
    }

    .login-box input {
        font-size: 16px;
    }

    .login-box button {
        padding: 14px;
    }
}

@media only screen and (max-width: 420px) {
    .center-container {
        padding: 10px;
    }

    .login-box {
        width: min(94vw, 360px);
        padding: 20px 16px;
    }

    .login-box h2 {
        margin-bottom: 14px;
    }

    .auth-links-bar {
        gap: 8px;
        font-size: 0.86em;
    }
}

@media only screen and (max-width: 360px) {
    .login-box {
        width: min(95vw, 340px);
        padding: 18px 14px;
    }

    .auth-subtitle {
        font-size: 0.86em;
    }
}
