/* Login / register. Scoped under .auth so none of the global input/.btn/.container
   rules in style.css and globalExtras.css leak in. */

.auth {
    display: flex;
    justify-content: center;
    padding: 56px 16px 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    background: #26262C;
    border: 1px solid #3a3a42;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    padding: 32px 28px 24px;
    color: #fff;
    text-align: left;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 18px;
}

.auth-brand img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 26px;
    text-align: center;
}

.auth-sub {
    margin: 0 0 22px;
    text-align: center;
    color: #9b9ba7;
    font-size: 14px;
    line-height: 1.5;
}

/* server-side / validation messages */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 74, 74, 0.35);
    background: rgba(255, 74, 74, 0.1);
    color: #ff8c8c;
    font-size: 14px;
    line-height: 1.4;
}

.auth-alert svg {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.auth-alert[hidden] {
    display: none;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field > span {
    font-size: 13px;
    font-weight: bold;
    color: #cfcfd8;
}

.auth-hint {
    font-size: 12px;
    color: #80808c;
    font-weight: normal;
}

.auth .auth-input {
    width: 100%;
    box-sizing: border-box;
    float: none;
    margin: 0;
    padding: 12px 14px;
    background: #1B1B1F;
    color: #fff;
    border: 1px solid #3a3a42;
    border-radius: 8px;
    /* 16px stops iOS Safari zooming the page when a field is focused */
    font-size: 16px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth .auth-input::placeholder {
    color: #6d6d78;
}

.auth .auth-input:focus {
    outline: none;
    border-color: #8a3fd1;
    box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.3);
}

.auth .auth-input[aria-invalid="true"] {
    border-color: #ff4a4a;
}

.auth-pw {
    position: relative;
}

.auth-pw .auth-input {
    padding-right: 46px;
}

.auth-pw-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #9b9ba7;
    cursor: pointer;
}

.auth-pw-toggle:hover,
.auth-pw-toggle:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.auth-pw-toggle svg {
    width: 20px;
    height: 20px;
}

.auth-pw-toggle .icon-hide {
    display: none;
}

.auth-pw-toggle[aria-pressed="true"] .icon-show {
    display: none;
}

.auth-pw-toggle[aria-pressed="true"] .icon-hide {
    display: block;
}

.auth-terms {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #cfcfd8;
    line-height: 1.4;
    cursor: pointer;
}

.auth .auth-terms input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    padding: 0;
    float: none;
    accent-color: #6A0DAD;
    cursor: pointer;
}

.auth-terms a,
.auth-switch a {
    color: #b58be0;
}

#turnstile-container {
    display: flex;
    justify-content: center;
    min-height: 0;
}

.auth-submit {
    width: 100%;
    padding: 13px 18px;
    background: #6A0DAD;
    color: #fff;
    border: 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(106, 13, 173, 0.35);
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.auth-submit:hover:not(:disabled) {
    background: #7d29d2;
    transform: translateY(-1px);
}

.auth-submit:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.auth-submit:disabled {
    background: #3a3a42;
    color: #80808c;
    box-shadow: none;
    cursor: not-allowed;
}

.auth-switch {
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid #3a3a42;
    text-align: center;
    color: #9b9ba7;
    font-size: 14px;
}

.auth-switch p {
    margin: 0 0 8px;
}

.auth-switch p:last-child {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .auth {
        padding-top: 32px;
    }

    .auth-card {
        padding: 24px 18px 20px;
    }
}

/* the Turnstile widget is a fixed 300px wide; scale it on very narrow phones */
@media (max-width: 360px) {
    #turnstile-container {
        height: 56px;
    }

    #turnstile-container > div {
        transform: scale(.85);
        transform-origin: top center;
    }
}
