:root {
    color-scheme: dark;
    --accent: #9b5cff;
    --accent-2: #6d35d6;
    --panel: rgba(8, 8, 10, 0.96);
    --line: rgba(155, 92, 255, 0.32);
    --text: #f8f8f8;
    --muted: #b7b7b7;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 50% 38%, rgba(155, 92, 255, 0.1), transparent 34%),
        #000;
    color: var(--text);
    display: grid;
    place-items: center;
    padding: 24px;
}

.card {
    width: min(100%, 430px);
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.72), 0 0 40px rgba(155, 92, 255, 0.05);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(16, 16, 18, 0.98), rgba(0, 0, 0, 0.96));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(155, 92, 255, 0.32), rgba(109, 53, 214, 0.15));
    overflow: hidden;
}

.brand-mark img {
    width: 30px;
    height: 30px;
    display: block;
    object-fit: contain;
}

.brand-name {
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.07em;
}

.brand-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.75rem;
}

.content {
    padding: 30px;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    color: #d8cbff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.eyebrow span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(155, 92, 255, 0.85);
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(1.65rem, 7vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.auth-error {
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 109, 156, 0.32);
    border-radius: 8px;
    background: rgba(255, 109, 156, 0.08);
    color: #ff9fbe;
    font-size: 0.8rem;
}

.actions {
    margin-top: 26px;
    display: grid;
    gap: 12px;
}

.discord-button {
    appearance: none;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(155, 92, 255, 0.75);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(155, 92, 255, 0.92), rgba(109, 53, 214, 0.92));
    color: white;
    font-weight: 700;
    font-size: 1rem;
    padding: 13px 16px;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    box-shadow: 0 12px 28px rgba(109, 53, 214, 0.24);
}

.discord-button svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.button-arrow {
    margin-left: auto;
    font-size: 1.2rem;
    line-height: 1;
}

.discord-button:hover {
    transform: translateY(-1px);
    border-color: #c39cff;
    box-shadow: 0 14px 34px rgba(109, 53, 214, 0.38);
}

.discord-button:active {
    transform: translateY(0);
}

.hint {
    font-size: 0.75rem;
    color: #8b8b8b;
    text-align: center;
}

.service-screen {
    position: fixed;
    z-index: 9;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.94);
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.service-screen.is-visible {
    opacity: 1;
    visibility: visible;
}

.service-card {
    width: min(100%, 430px);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.72);
}

.service-card h2 {
    margin: 0 0 10px;
    font-size: 1.65rem;
}

.service-options {
    display: grid;
    gap: 9px;
    margin-top: 24px;
}

.service-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    font-weight: 800;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.service-option:hover {
    transform: translateY(-1px);
    border-color: rgba(155, 92, 255, 0.75);
    background: linear-gradient(135deg, rgba(155, 92, 255, 0.24), rgba(109, 53, 214, 0.18));
}

.service-option:disabled {
    cursor: wait;
    opacity: 0.55;
}

.service-error {
    min-height: 1.2em;
    margin-top: 12px;
    color: #ff8eb3;
    font-size: 0.8rem;
}

.loading-screen {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at center, rgba(155, 92, 255, 0.12), transparent 32%),
        #000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 280ms ease, visibility 280ms ease;
}

.loading-screen.is-visible {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.loading-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 22px;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    margin-bottom: 26px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: loading-spin 700ms linear infinite;
}

.loading-greeting {
    color: var(--text);
    font-size: clamp(1.5rem, 5vw, 2rem);
    line-height: 1.2;
}

.loading-greeting strong {
    font-weight: 800;
}

.loading-service {
    margin-top: 9px;
    color: #d8cbff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    body { padding: 16px; }
    .content { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .discord-button { transition: none; }
    .service-screen, .service-option { transition: none; }
    .loading-screen { transition: none; }
    .loading-spinner { animation-duration: 1.4s; }
}

.theme-toggle { width:42px;height:42px;margin-left:auto;flex:0 0 42px;display:grid;place-items:center;border:1px solid rgba(255,255,255,.1);border-radius:50%;background:rgba(255,255,255,.04);color:var(--text);cursor:pointer;transition:transform 160ms ease,background 250ms ease,border-color 250ms ease; }
.theme-toggle:hover { transform:rotate(8deg);border-color:var(--line); }
.theme-icon { grid-area:1/1;font-size:1.2rem;line-height:1; }
.theme-icon-sun,body[data-theme='dark'] .theme-icon-moon{display:none}body[data-theme='dark'] .theme-icon-sun{display:block}
body{transition:background 250ms ease,color 250ms ease}
body[data-theme='light']{--panel:rgba(255,255,255,.9);--line:rgba(109,53,214,.2);--text:#29252d;--muted:#746f79;background:radial-gradient(circle at 50% 38%,rgba(155,92,255,.15),transparent 36%),#f7f4fa}
body[data-theme='light'] .card,body[data-theme='light'] .service-card{box-shadow:0 26px 70px rgba(58,43,72,.14)}
body[data-theme='light'] .brand{background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(246,241,250,.96));border-bottom-color:rgba(41,37,45,.08)}
body[data-theme='light'] .brand-mark img,body[data-theme='light'] .loading-logo{filter:invert(1)}
body[data-theme='light'] .eyebrow,body[data-theme='light'] .loading-service{color:#6d35d6}
body[data-theme='light'] .theme-toggle{background:rgba(255,255,255,.8);border-color:rgba(41,37,45,.1)}
body[data-theme='light'] .service-screen,body[data-theme='light'] .loading-screen{background:radial-gradient(circle at center,rgba(155,92,255,.12),transparent 32%),#f7f4fa}
body[data-theme='light'] .service-option{border-color:rgba(41,37,45,.1);background:rgba(109,53,214,.035)}
body[data-theme='light'] .auth-error,body[data-theme='light'] .service-error{color:#a72855}
body[data-theme='light'] .hint{color:#69636e}
body[data-theme='dark'] .hint{color:#a8a8ad}
