: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;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: var(--auth-text);
    overflow: hidden;
}

.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);
}

.home-link {
    text-decoration: none;
    color: inherit;
}

.home-link:hover {
    color: #222;
}

/* ---- center area ---- */
.center-container {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: clamp(12px, 3vw, 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- card ---- */
.register-box {
    width: min(92vw, 420px);
    max-height: calc(100dvh - 88px - env(safe-area-inset-bottom));
    overflow-y: auto;
    padding: clamp(22px, 5vw, 30px) clamp(18px, 4vw, 36px);
    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);
}

.register-box h2 {
    text-align: center;
    margin: 0 0 16px;
    color: var(--auth-text);
    font-size: clamp(1.22rem, 4vw, 1.45rem);
    font-weight: 700;
    line-height: 1.25;
}

/* ---- floating label form-group ---- */
.form-group {
    position: relative;
    margin-top: 18px;
}

.form-group:first-of-type {
    margin-top: 0;
}

.form-group label {
    position: absolute;
    top: -9px;
    left: 12px;
    font-size: 11px;
    color: var(--auth-muted);
    background: var(--auth-card-bg);
    padding: 0 5px;
    pointer-events: none;
}

/* ---- standard label (non-floating, e.g. resend activation) ---- */
.register-box > form > label {
    display: block;
    margin: 12px 0 6px;
    color: #405548;
    font-size: 0.9em;
    font-weight: 600;
}

/* ---- inputs ---- */
.input-field,
.form-group input,
.register-box input {
    width: 100%;
    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;
}

.input-field:focus,
.form-group input:focus,
.register-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);
}

/* ---- help / error text ---- */
.help-text {
    display: block;
    font-size: 0.84em;
    color: var(--auth-muted);
    margin-top: 5px;
    margin-left: 4px;
    line-height: 1.5;
}

.error {
    font-size: 0.88em;
    color: #8a2630;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(138, 38, 48, 0.10);
    background: rgba(255, 226, 229, 0.7);
    line-height: 1.45;
}

.error ul {
    list-style: none;
    margin: 2px 0 0;
    padding: 0;
}

.register-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;
}

.register-box .errorlist li {
    margin: 0;
}

/* ---- avatar upload ---- */
.avatar-clickable {
    cursor: pointer;
}

.avatar-preview {
    width: 72px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(152, 224, 172, 0.3);
    background-color: #f0f0f0;
    display: block;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.avatar-preview:hover {
    box-shadow: 0 0 0 5px rgba(152, 224, 172, 0.28);
    border-color: rgba(152, 224, 172, 0.55);
}

.avatar-tip {
    font-size: 0.82em;
    color: var(--auth-muted);
    margin-top: 6px;
}

.avatar-upload-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 14px;
}

.avatar-input.visually-hidden {
    display: none;
}

/* ---- captcha ---- */
.captcha-group {
    position: relative;
    margin-top: 18px;
}

.captcha-group input[type="text"] {
    width: 100%;
    padding: 12px 136px 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--auth-border);
    background-color: #f7fbf8;
    font-size: 1rem;
    line-height: 1.4;
    transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.captcha-group input[type="text"]:focus {
    border-color: rgba(68, 198, 125, 0.55);
    box-shadow: 0 0 0 4px rgba(152, 224, 172, 0.16);
}

.captcha-group img {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    height: 38px;
    aspect-ratio: 3 / 1;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    cursor: pointer;
    object-fit: scale-down;
    background: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.captcha-group img:hover {
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 0 0 3px rgba(152, 224, 172, 0.25);
}

.captcha-group > label {
    position: absolute;
    top: -9px;
    left: 12px;
    font-size: 11px;
    color: var(--auth-muted);
    background: var(--auth-card-bg);
    padding: 0 5px;
    pointer-events: none;
}

.captcha-hint {
    display: block;
    font-size: 0.78em;
    color: var(--auth-muted);
    margin-top: 4px;
    margin-left: 2px;
}

/* ---- button ---- */
.register-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;
}

.register-box button:hover {
    background-color: #76d598;
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(88, 201, 133, 0.22);
}

.register-box button:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 8px 18px rgba(88, 201, 133, 0.16);
}

/* ---- description ---- */
.auth-subtitle {
    margin: -4px 0 16px;
    color: var(--auth-muted);
    font-size: 0.9em;
    line-height: 1.55;
    text-align: left;
    overflow-wrap: anywhere;
}

/* ---- bottom links ---- */
.auth-links-bar {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    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;
}

/* =========================
   Activation page overrides
   ========================= */
.activation-box {
    max-width: min(92vw, 460px);
}

.activation-header {
    text-align: left;
}

.activation-lead {
    margin: 0;
    color: var(--auth-muted);
    line-height: 1.65;
}

.activation-email-card {
    margin-top: 22px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(180deg, #f7fbf7, #eef8f0);
    border: 1px solid rgba(152, 224, 172, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.activation-email-label {
    font-size: 0.82rem;
    color: #62806a;
    margin-bottom: 6px;
    letter-spacing: 0.04em;
}

.activation-email-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1f3323;
    word-break: break-all;
}

.activation-copy {
    margin-top: 18px;
    color: #333;
    line-height: 1.7;
}

.activation-copy p {
    margin: 0 0 10px;
}

.activation-muted {
    color: #666;
}

.activation-resend {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    text-align: left;
}

.activation-resend-form button {
    margin-top: 0;
}


/* =========================
   Responsive
   ========================= */
@media only screen and (max-width: 640px) {
    .navbar {
        height: 44px;
    }

    .navbar h1 {
        font-size: 1.3em;
    }

    .center-container {
        padding: 12px;
        align-items: center;
    }

    .register-box {
        width: min(94vw, 420px);
        padding: 22px 18px;
        border-radius: 14px;
        max-height: calc(100dvh - 68px - env(safe-area-inset-bottom));
    }

    .input-field,
    .form-group input,
    .captcha-group input[type="text"] {
        font-size: 16px;
    }

    .register-box button {
        padding: 14px;
    }

    .auth-links-bar {
        gap: 8px;
        font-size: 0.85em;
    }

    .captcha-group img {
        height: 34px;
    }
    .captcha-group input[type="text"] {
        padding-right: 120px;
    }

    .activation-box {
        padding: 22px 18px;
    }

    .activation-email-card {
        padding: 14px 16px;
    }

}

@media only screen and (max-width: 420px) {
    .center-container {
        padding: 10px;
    }

    .register-box {
        width: min(94vw, 360px);
        padding: 20px 16px;
    }

    .register-box h2 {
        margin-bottom: 14px;
    }

    .auth-links-bar {
        gap: 8px;
        font-size: 0.86em;
    }

    .captcha-group img {
        height: 30px;
    }
    .captcha-group input[type="text"] {
        padding-right: 108px;
    }
}

@media only screen and (max-width: 360px) {
    .register-box {
        width: min(95vw, 340px);
        padding: 18px 14px;
    }
}
