:root {
    --night: #111936;
    --night-light: #1d2a55;
    --red: #ef4b4f;
    --red-dark: #b93445;
    --snow: #f5f7fb;
    --cream: #fff6df;
    --blue: #5fc9ed;
    --yellow: #ffd166;
    --ink: #17203b;
    --muted: #74809d;
    --line: #dfe5f1;
    --shadow: 0 22px 60px rgba(5, 12, 39, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { min-width: 320px; background: var(--night); }

body {
    min-height: 100vh;
    padding: 26px;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 12% 12%, rgba(95, 201, 237, 0.25), transparent 24%),
        radial-gradient(circle at 92% 78%, rgba(239, 75, 79, 0.2), transparent 24%),
        linear-gradient(145deg, #0d1430, var(--night) 54%, #202957);
}

body::before {
    content: "*  *  *  *  *";
    position: fixed;
    top: 7vh;
    right: 5vw;
    color: rgba(255, 255, 255, 0.45);
    font-family: Georgia, serif;
    font-size: 18px;
    letter-spacing: 22px;
    pointer-events: none;
}

body::after {
    content: "SINTERKLAAS";
    position: fixed;
    bottom: 8vh;
    left: 0;
    color: rgba(255, 255, 255, 0.1);
    font-family: Georgia, serif;
    font-size: clamp(3rem, 12vw, 10rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    pointer-events: none;
    transform: rotate(-90deg) translateX(-100%);
    transform-origin: left top;
}

#app { position: relative; z-index: 1; width: min(100%, 1100px); margin: 0 auto; }

.container {
    position: relative;
    overflow: hidden;
    padding: clamp(24px, 5vw, 58px);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 28px;
    background: var(--snow);
    box-shadow: var(--shadow), 0 0 0 10px rgba(255, 255, 255, 0.04);
}

.container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 9px;
    background: repeating-linear-gradient(135deg, var(--red) 0 18px, var(--cream) 18px 36px);
}

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.1; }

h1 {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto 26px;
    color: var(--night);
    text-align: center;
    font-size: clamp(2.1rem, 5.5vw, 4.7rem);
    letter-spacing: -0.055em;
}

h1::before { content: "✦"; display: block; margin-bottom: 10px; color: var(--red); font-size: 1.1rem; letter-spacing: 0; }
h1::after { content: ""; display: block; width: 75px; height: 5px; margin: 17px auto 0; border-radius: 5px; background: var(--red); }
h2 { margin-bottom: 22px; color: var(--night); text-align: center; font-size: clamp(1.45rem, 3vw, 2.2rem); }
h3 { color: var(--red-dark); }
button, input, textarea { font: inherit; }

button {
    width: 100%;
    min-height: 50px;
    margin-top: 12px;
    padding: 13px 18px;
    border: 0;
    border-radius: 14px;
    color: white;
    background: var(--red);
    box-shadow: 0 6px 0 var(--red-dark);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}
button:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 8px 0 var(--red-dark); }
button:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--red-dark); }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

.auth-page { display: grid; grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.15fr); gap: 0 52px; }
.auth-page > h1, .auth-page > .alert-banner, .auth-page > .footer-credits { grid-column: 1 / -1; }
.auth-page > h1 { margin-bottom: 30px; }
.auth-page > h1:nth-of-type(2) { margin: 27px 0 10px; color: var(--red-dark); font-size: clamp(1rem, 2.5vw, 1.35rem); letter-spacing: 0; }
.auth-page > h1:nth-of-type(2)::before, .auth-page > h1:nth-of-type(2)::after { display: none; }

.auth-tabs { grid-column: 2; display: flex; gap: 8px; max-width: none; margin: 0 0 16px; }
.auth-tab { flex: 1; min-height: 44px; margin: 0; border: 2px solid var(--line); color: var(--night); background: white; box-shadow: none; }
.auth-tab:hover { color: white; background: var(--night-light); box-shadow: none; }
.auth-tab.active { color: white; background: var(--night); box-shadow: none; }

.auth-wrapper { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.2fr); gap: clamp(30px, 7vw, 85px); align-items: center; max-width: 820px; width: 100%; margin: 0 auto; }

.decorative-wheel {
    position: relative;
    display: grid;
    place-items: center;
    width: min(240px, 62vw);
    aspect-ratio: 1;
    margin: auto;
    border: 14px solid var(--red);
    border-radius: 50%;
    background: conic-gradient(var(--blue) 0deg 90deg, var(--cream) 90deg 180deg, var(--red) 180deg 270deg, var(--yellow) 270deg 360deg);
    box-shadow: 0 0 0 5px var(--snow), 0 0 0 8px var(--night), 0 18px 30px rgba(17, 25, 54, 0.24);
}
.decorative-wheel::before { content: ""; position: absolute; inset: 18px; border: 3px dashed rgba(17, 25, 54, 0.6); border-radius: 50%; }
.decorative-wheel::after { content: ""; position: absolute; width: 3px; height: 100%; background: rgba(255, 255, 255, 0.8); transform: rotate(45deg); }
.decorative-icon { position: absolute; z-index: 1; font-size: 1.55rem; }
.decorative-icon:nth-child(1) { top: 13px; }
.decorative-icon:nth-child(2) { right: 13px; }
.decorative-icon:nth-child(3) { bottom: 13px; }
.decorative-icon:nth-child(4) { left: 13px; }

.auth-form-container, .profile-section, .user-card, .admin-user-card { border: 2px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 10px 24px rgba(17, 25, 54, 0.07); }
.auth-form-container { padding: clamp(21px, 4vw, 32px); }
.form-group { margin-bottom: 17px; }
label { display: block; margin-bottom: 7px; color: var(--night); font-size: 0.79rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
input, textarea { width: 100%; padding: 13px 14px; border: 2px solid var(--line); border-radius: 11px; color: var(--ink); background: #fbfcff; font-size: 1rem; }
input::placeholder, textarea::placeholder { color: #a2abc0; }
input:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgba(95, 201, 237, 0.14); }
textarea { min-height: 120px; resize: vertical; }

.link-text, .info-text, .user-welcome, .footer-credits { color: var(--muted); text-align: center; }
.link-text { margin-top: 21px; }
a, .link-text a, .footer-credits a { color: var(--red-dark); font-weight: 800; }

.nav-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 30px; padding: 7px; border-radius: 17px; background: #e8edf7; }
.nav-tab { width: auto; flex: 1 1 auto; min-height: 43px; margin: 0; padding: 9px 14px; border-radius: 11px; color: var(--night); background: transparent; box-shadow: none; font-size: 0.86rem; white-space: nowrap; }
.nav-tab:hover { color: white; background: var(--night-light); box-shadow: none; }
.nav-tab.active { color: white; background: var(--night); box-shadow: none; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: lift 240ms ease both; }
@keyframes lift { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.user-welcome { margin: -8px 0 24px; color: var(--red-dark); font-family: Georgia, serif; font-size: 1.08rem; font-weight: 700; }
.info-text { margin: 12px auto 17px; font-size: 0.95rem; }

.wheel-container { text-align: center; }
.wheel-wrapper { position: relative; width: min(350px, 84vw); aspect-ratio: 1; margin: 36px auto 24px; }
#wheel { width: 100%; height: 100%; overflow: hidden; border: 7px solid var(--night); border-radius: 50%; background: white; box-shadow: 0 0 0 4px var(--yellow), 0 18px 34px rgba(17, 25, 54, 0.22); }
#wheel svg { display: block; width: 100%; height: 100%; }
.wheel-arrow { position: absolute; top: -19px; left: 50%; z-index: 2; width: 0; height: 0; border-right: 17px solid transparent; border-left: 17px solid transparent; border-top: 34px solid var(--red); filter: drop-shadow(0 3px 0 var(--red-dark)); transform: translateX(-50%); }
#spin-btn, .reminder-button { max-width: 350px; margin-right: auto; margin-left: auto; }
#spin-btn { color: white; background: var(--night); box-shadow: 0 6px 0 #080d20; }
#spin-btn:hover { background: var(--night-light); box-shadow: 0 8px 0 #080d20; }
#spin-btn:active { box-shadow: 0 3px 0 #080d20; }
#spin-btn:disabled { cursor: not-allowed; filter: grayscale(1); opacity: 0.55; }

.wheel-notice, .result-message, .error-message, .success-message { max-width: 650px; margin: 16px auto; padding: 14px 18px; border-radius: 12px; line-height: 1.5; }
.wheel-notice { color: #775b17; border: 2px solid #f0d57c; background: #fff7db; font-size: 0.87rem; }
.wheel-notice strong { color: var(--red-dark); }
.result-message.success, .success-message { color: #1c5d4b; border: 2px solid #a7dfca; background: #e2f7ef; }
.error-message { color: #8c3940; border: 2px solid #f1b2b4; background: #fff0f1; }

.profile-section { padding: clamp(18px, 4vw, 32px); }
.wishlist-reminder { display: flex; align-items: center; gap: 18px; margin: 0 0 25px; padding: 19px; border: 2px solid #f0d57c; border-radius: 16px; background: #fff7db; }
.reminder-icon { flex: 0 0 auto; font-size: 2.8rem; }
.reminder-content { flex: 1; }
.reminder-content h3 { margin-bottom: 6px; }
.reminder-content p { color: var(--muted); line-height: 1.45; }
.reminder-button { display: inline-block; width: auto; margin-top: 13px; }
.users-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 15px; }
.user-card { min-height: 125px; padding: 20px; text-align: center; cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.user-card:hover { border-color: var(--red); box-shadow: 0 13px 27px rgba(17, 25, 54, 0.14); transform: translateY(-4px); }
.user-card h3 { margin-bottom: 10px; }
.user-card p, .wishlist-item, .admin-user-info { color: var(--muted); }
.wishlist-item { margin-bottom: 10px; padding: 12px 15px; border-left: 5px solid var(--blue); border-radius: 5px; background: #f4f7fc; }
.users-admin-list { display: grid; gap: 13px; }
.admin-user-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; }
.delete-user-btn { width: auto; min-height: 40px; margin: 0; background: var(--red); box-shadow: 0 4px 0 var(--red-dark); }
.logout-btn { display: block; max-width: 220px; margin: 28px auto 0; color: var(--night); border: 2px solid var(--line); background: transparent; box-shadow: none; }
.logout-btn:hover { color: white; background: var(--night); box-shadow: none; }
.footer-credits { margin-top: 28px; padding-top: 18px; border-top: 2px solid var(--line); font-size: 0.78rem; }
.alert-banner { max-width: 760px; margin: 0 auto 25px; padding: 16px 18px; border: 2px solid #f0d57c; border-radius: 14px; color: #775b17; background: #fff7db; line-height: 1.5; }

.draw-modal-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(7, 13, 36, 0.78); backdrop-filter: blur(6px); }
.draw-modal { width: min(100%, 480px); padding: clamp(24px, 5vw, 38px); border: 8px solid var(--cream); border-radius: 22px; background: var(--snow); box-shadow: 0 0 0 3px var(--red), 0 22px 60px rgba(0, 0, 0, 0.42); text-align: center; animation: modal-in 180ms ease both; }
.draw-modal h2 { margin-bottom: 16px; color: var(--night); }
.draw-modal p { margin: 10px 0; color: var(--muted); line-height: 1.55; }
.draw-modal strong { color: var(--red-dark); }
.draw-modal button { max-width: 300px; margin: 24px auto 0; }
.draw-modal-ok { background: var(--night); box-shadow: 0 6px 0 #080d20; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 760px) {
    body {
        padding: 8px;
        background: linear-gradient(145deg, #0d1430, var(--night) 60%, #202957);
    }

    body::before,
    body::after {
        display: none;
    }

    .container {
        min-height: calc(100vh - 16px);
        padding: 28px 14px 20px;
        border-radius: 18px;
        box-shadow: 0 12px 32px rgba(5, 12, 39, 0.28);
    }

    .container::before {
        height: 6px;
        background-size: 24px 24px;
    }

    h1 {
        margin-bottom: 20px;
        font-size: clamp(2rem, 11vw, 3.1rem);
        line-height: 1.04;
    }

    h1::before {
        margin-bottom: 8px;
        font-size: 0.9rem;
    }

    h1::after {
        width: 54px;
        height: 4px;
        margin-top: 13px;
    }

    h2 {
        margin-bottom: 16px;
        font-size: clamp(1.35rem, 7vw, 1.9rem);
    }

    button {
        min-height: 50px;
        padding: 13px 14px;
        font-size: 0.93rem;
    }

    .auth-page {
        display: block;
    }

    .auth-page > h1:nth-of-type(2) {
        margin: 22px 0 8px;
        font-size: 1rem;
    }

    .auth-tabs {
        width: 100%;
        margin: 20px 0 14px;
    }

    .auth-tab {
        min-height: 46px;
        padding: 10px 7px;
        font-size: 0.86rem;
    }

    .auth-wrapper {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .decorative-wheel {
        width: min(180px, 54vw);
        border-width: 10px;
    }

    .decorative-wheel::before {
        inset: 13px;
    }

    .decorative-icon {
        font-size: 1.25rem;
    }

    .decorative-icon:nth-child(1) { top: 9px; }
    .decorative-icon:nth-child(2) { right: 9px; }
    .decorative-icon:nth-child(3) { bottom: 9px; }
    .decorative-icon:nth-child(4) { left: 9px; }

    .auth-form-container {
        padding: 18px 15px;
    }

    .nav-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
        margin: 6px 0 22px;
        padding: 5px;
        border-radius: 13px;
    }

    .nav-tab {
        width: 100%;
        min-height: 46px;
        padding: 8px 5px;
        font-size: 0.75rem;
        line-height: 1.15;
        white-space: normal;
    }

    .user-welcome {
        margin: -2px 0 18px;
        font-size: 0.98rem;
    }

    .wheel-wrapper {
        width: min(330px, calc(100vw - 58px));
        margin: 28px auto 20px;
    }

    .wheel-arrow {
        top: -16px;
        border-right-width: 14px;
        border-left-width: 14px;
        border-top-width: 29px;
    }

    .info-text {
        padding: 0 8px;
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .wheel-notice,
    .result-message,
    .error-message,
    .success-message {
        padding: 12px 13px;
        font-size: 0.86rem;
    }

    .profile-section {
        padding: 17px 13px;
    }

    .wishlist-reminder,
    .admin-user-card {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .reminder-icon {
        font-size: 2rem;
    }

    .reminder-button,
    .delete-user-btn {
        width: 100%;
        max-width: none;
    }

    .users-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .user-card {
        min-height: 94px;
        padding: 15px;
    }

    .footer-credits {
        margin-top: 22px;
    }

    .draw-modal-overlay {
        align-items: end;
        padding: 10px;
    }

    .draw-modal {
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        padding: 24px 17px 20px;
        border-width: 5px;
        border-radius: 18px;
    }

    .draw-modal button {
        max-width: none;
        margin-top: 19px;
    }
}

@media (max-width: 380px) {
    body { padding: 4px; }

    .container {
        min-height: calc(100vh - 8px);
        padding-right: 10px;
        padding-left: 10px;
        border-radius: 14px;
    }

    .nav-tab {
        font-size: 0.7rem;
    }

    .wheel-wrapper {
        width: min(300px, calc(100vw - 46px));
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
