:root {
    --blue: #2f86c8;
    --blue-dark: #2475b3;
    --blue-light: #8fd0ff;
    --text: #141b26;
    --muted: #5b6573;
    --line: #d9dee6;
    --card: #ffffff;
    --input: #ffffff;
    --error-bg: #fdecec;
    --error-text: #b42318;
    --good: #15803d;
    --page: #f2f4f7;
    --page-text: #141b26;
    --page-muted: #5b6573;
    }

:root[data-theme="dark"] {
    --good: #4ade80;
    --page-text: #ffffff;
    --page-muted: rgba(255, 255, 255, 0.8);
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --line: #2f3a4a;
    --card: #161d26;
    --input: #1f2833;
    --error-bg: #3a1d1d;
    --error-text: #ffb4ab;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    font-family: "Poppins", Arial, Helvetica, sans-serif;
    color: var(--text);
    background-color: var(--page);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 98M28 0' fill='none' stroke='%23141b26' stroke-opacity='0.05' stroke-width='2'/%3E%3C/svg%3E"),
        linear-gradient(180deg, #ffffff 0%, #eaf3fb 100%);
    background-attachment: fixed;
}

:root[data-theme="dark"] body {
    background-color: #0a1a2f;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 98M28 0' fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='2'/%3E%3C/svg%3E"),
        linear-gradient(180deg, #0a1a2f 0%, #14508c 70%, #2f86c8 100%);
}

a { color: var(--blue); }

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: var(--page-text);
    text-decoration: none;
    font-family: "Poppins", sans-serif;
    font-weight: 900;
    font-size: 22px;
}

.auth-logo img { width: 46px; height: auto; }

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 30px 28px 26px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.auth-card h1 {
    font-family: "Poppins", sans-serif;
    font-weight: 900;
    font-size: 26px;
    margin-bottom: 6px;
}

.auth-card .sub {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 22px;
    line-height: 1.5;
}

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--input);
    color: var(--text);
    font-family: inherit;
    font-size: 16px; /* 16px or more stops iPhones zooming in when a box is tapped */
}

.field input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(47, 134, 200, 0.25);
}

.field .hint {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 5px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    margin: 4px 0 18px;
    cursor: pointer;
}

.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: #111317; flex-shrink: 0; }

.submit {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 6px;
    background: #111317;
    color: #ffffff;
    font-family: "Poppins", sans-serif;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.submit:hover { background: #2b2d33; }
.submit:disabled { opacity: 0.6; cursor: wait; }

:root[data-theme="dark"] .submit { background: #ffffff; color: #111317; }

.error {
    display: none;
    background: var(--error-bg);
    color: var(--error-text);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 16px;
}

.error.show { display: block; }

.switch {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--muted);
}

.switch a { font-weight: 600; }

.back {
    margin-top: 20px;
    color: var(--page-muted);
    font-size: 14px;
    text-decoration: none;
}

.back:hover { color: var(--page-text); }

.local-note {
    display: none;
    background: #fff7e0;
    color: #6b4e00;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.local-note.show { display: block; }

/* ---------- profile picture ---------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.photo-picker {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    margin-bottom: 18px;
    border: 1px dashed var(--line);
    border-radius: 10px;
}

.photo-circle {
    position: relative;
    width: 84px;
    height: 84px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #eef2f7;
    color: #9aa6b6;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

:root[data-theme="dark"] .photo-circle { background: #1f2833; color: #5f6d83; }

.photo-circle:hover,
.photo-circle.drag { box-shadow: 0 0 0 3px rgba(47, 134, 200, 0.35); }

.photo-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.photo-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-showcase {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
}

.photo-showcase img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.photo-showcase img.on { opacity: 1; transform: scale(1); }

@media (prefers-reduced-motion: reduce) {
    .photo-showcase img { transition: none; }
}

.photo-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #111317;
    color: #ffffff;
    border: 3px solid var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-badge svg { width: 14px; height: 14px; }

.photo-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }

.photo-pick {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
}

.photo-pick:hover { color: var(--blue); }

#photoInput:focus-visible + .photo-text .photo-pick { outline: 3px solid rgba(47, 134, 200, 0.4); outline-offset: 2px; }

.photo-remove {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: var(--error-text);
    cursor: pointer;
    text-decoration: underline;
}

.photo-hint { font-size: 12.5px; color: var(--muted); }

/* ---------- password and live checks ---------- */
.password-wrap { position: relative; }

.password-wrap input { padding-right: 70px; }

.show-pass {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    height: 34px;
    padding: 0 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.show-pass:hover { background: rgba(127, 127, 127, 0.12); color: var(--text); }

.status {
    display: block;
    min-height: 0;
    font-size: 12.5px;
    margin-top: 5px;
}

.status:empty { display: none; }
.status.good { color: var(--good); }
.status.good::before { content: "\2713  "; }
.status.bad { color: var(--error-text); }

.field input.invalid { border-color: var(--error-text); }

.field input::placeholder { color: #9aa4b2; }

/* ---------- phones: tighter, so the whole form fits with less scrolling ---------- */
@media (max-width: 480px) {
    body { justify-content: flex-start; padding: 16px 12px 24px; }
    .auth-logo { margin-bottom: 14px; font-size: 19px; }
    .auth-logo img { width: 38px; }
    .auth-card { padding: 20px 18px 18px; border-radius: 12px; }
    .auth-card h1 { font-size: 22px; }
    .auth-card .sub { margin-bottom: 16px; }
    .photo-picker { padding: 10px 12px; gap: 12px; margin-bottom: 14px; }
    .photo-circle { width: 62px; height: 62px; }
    .photo-badge { width: 26px; height: 26px; }
    .photo-pick { font-size: 14.5px; }
    .field { margin-bottom: 12px; }
    .field input { height: 48px; }
    .check-field { margin: 2px 0 16px; }
    .check input { width: 20px; height: 20px; }
    .submit { height: 50px; }
    .switch { margin-top: 14px; }
    .back { margin-top: 16px; }
}

/* ---------- required and optional markers ---------- */
.req { color: var(--error-text); font-weight: 700; }

.req-note {
    font-size: 12.5px;
    color: var(--muted);
    margin: -4px 0 10px;
}

.photo-title { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.optional-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--muted);
    background: rgba(127, 127, 127, 0.12);
    border-radius: 4px;
    padding: 2px 6px;
}

.check-field { margin: 4px 0 18px; }
.check-field .check { margin: 0; }
.check-field .status { margin-left: 28px; }

.check input.invalid { outline: 2px solid var(--error-text); outline-offset: 2px; }

/* ---------- pop-up notification ---------- */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: min(380px, calc(100vw - 24px));
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 12px 16px 14px;
    background: #ffffff;
    color: #141b26;
    border: 1px solid #f1c7c3;
    border-left: 4px solid #d92d20;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show { opacity: 1; transform: translateY(0); }

:root[data-theme="dark"] .toast { background: #1f2833; color: #e6e9ee; border-color: #5c2b2b; border-left-color: #f97066; }

.toast-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #d92d20;
    color: #ffffff;
    font-weight: 900;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-text { flex: 1; display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.toast-text strong { font-size: 14.5px; line-height: 1.35; }
.toast-text span { font-size: 13px; color: var(--muted); line-height: 1.4; }

.toast-close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    margin: -4px -2px 0 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.toast-close:hover { opacity: 1; background: rgba(127, 127, 127, 0.15); }

/* Shrinking line along the bottom shows how long until it closes by itself. */
.toast-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: #d92d20;
    opacity: 0.35;
    transform-origin: left;
    animation: toast-timer 5s linear forwards;
}

@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Phones: across the top of the screen. */
@media (max-width: 480px) {
    /* Phones: centered at the top of the screen. */
    .toast { top: 12px; left: 50%; right: auto; width: calc(100vw - 24px); max-width: 420px; transform: translate(-50%, -12px); }
    .toast.show { transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; }
    .toast-bar { animation: none; display: none; }
}

/* ---------- Continue with Discord ---------- */
.discord-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    border-radius: 6px;
    background: #5865f2;
    color: #ffffff;
    font-family: "Poppins", sans-serif;
    font-weight: 800;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.15s ease;
}
.discord-btn:hover { background: #4752c4; }
.discord-btn:focus-visible { outline: 3px solid #a5adff; outline-offset: 2px; }
.or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--muted);
    font-size: 13px;
}
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line, #e3e6ea); }
@media (max-width: 480px) { .discord-btn { height: 50px; } }

/* "How did you find us?" dropdown: same look as the text boxes */
.field select {
    width: 100%;
    height: 46px;
    padding: 0 40px 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a94a3' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 134, 200, 0.25); }
.field select.invalid { border-color: #d92d20; }
