:root {
    --radius: 0.75rem;

    /* Brand accent — San Andreas warm gold */
    --color-brand: #d4a853;
    --color-brand-soft: rgba(212, 168, 83, 0.12);
    --color-brand-glow: rgba(212, 168, 83, 0.25);

    /* Light theme */
    --color-background: #fafaf9;
    --color-foreground: #0a0a0a;
    --color-card: #ffffff;
    --color-card-foreground: #0a0a0a;
    --color-border: #e7e5e4;
    --color-divider: rgba(0, 0, 0, 0.06);
    --color-input: #e7e5e4;
    --color-ring: #a8a29e;
    --color-primary: #1c1917;
    --color-primary-foreground: #fafaf9;
    --color-primary-50: #fafaf9;
    --color-primary-100: #f5f5f4;
    --color-primary-200: #e7e5e4;
    --color-primary-300: #d6d3d1;
    --color-primary-400: #a8a29e;
    --color-primary-500: #78716c;
    --color-primary-600: #57534e;
    --color-primary-700: #44403c;
    --color-primary-800: #292524;
    --color-primary-900: #1c1917;
    --color-muted: #f5f5f4;
    --color-muted-foreground: #78716c;
    --color-accent: #f5f5f4;
    --color-accent-foreground: #0a0a0a;
    --color-destructive: #ef4444;
    --color-destructive-foreground: #ffffff;
    --color-success: #16a34a;
    --color-success-foreground: #ffffff;
    --color-warning: #d97706;
    --color-warning-foreground: #ffffff;
    --color-scrollbar-thumb: #d6d3d1;
    --color-scrollbar-thumb-hover: #a8a29e;
}

.dark {
    --color-background: #0a0a08;
    --color-foreground: #f5f5f0;
    --color-card: #161614;
    --color-card-foreground: #f5f5f0;
    --color-border: #2a2a24;
    --color-divider: rgba(212, 168, 83, 0.08);
    --color-input: #222220;
    --color-ring: #d4a853;
    --color-primary: #f0ede4;
    --color-primary-foreground: #161614;
    --color-primary-50: #fafaf9;
    --color-primary-100: #f0ede4;
    --color-primary-200: #d4d4cc;
    --color-primary-300: #c4b896;
    --color-primary-400: #a8a890;
    --color-primary-500: #7a7a6e;
    --color-primary-600: #5a5a50;
    --color-primary-700: #404038;
    --color-primary-800: #2a2a24;
    --color-primary-900: #161614;
    --color-muted: #1e1e1a;
    --color-muted-foreground: #a8a890;
    --color-accent: #222220;
    --color-accent-foreground: #f5f5f0;
    --color-destructive: #7f1d1d;
    --color-destructive-foreground: #fecaca;
    --color-success: #14532d;
    --color-success-foreground: #86efac;
    --color-warning: #713f12;
    --color-warning-foreground: #fde047;
    --color-scrollbar-thumb: #3a3a32;
    --color-scrollbar-thumb-hover: #4a4a40;
}

/* ── Base ── */
html {
    scroll-behavior: smooth;
}

body {
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

::selection {
    background: var(--color-brand-soft);
    color: var(--color-foreground);
}

/* ── Atmospheric background ── */
.ucp-bg {
    background-color: var(--color-background);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, var(--color-brand-soft), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(212, 168, 83, 0.04), transparent);
}

.dark .ucp-bg {
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 168, 83, 0.06), transparent),
        radial-gradient(ellipse 50% 30% at 0% 80%, rgba(212, 168, 83, 0.03), transparent),
        radial-gradient(ellipse 40% 25% at 100% 60%, rgba(100, 100, 80, 0.04), transparent);
}

.ucp-auth-bg {
    background-color: var(--color-background);
    background-image:
        radial-gradient(ellipse 70% 50% at 50% 0%, var(--color-brand-soft), transparent 70%),
        radial-gradient(ellipse 50% 40% at 80% 100%, rgba(212, 168, 83, 0.05), transparent);
}

.dark .ucp-auth-bg {
    background-image:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(212, 168, 83, 0.08), transparent 70%),
        radial-gradient(ellipse 50% 40% at 20% 100%, rgba(212, 168, 83, 0.04), transparent),
        radial-gradient(ellipse 40% 30% at 80% 80%, rgba(80, 80, 60, 0.06), transparent);
}

/* ── Cards ── */
.ucp-card {
    background: var(--color-card);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.dark .ucp-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.ucp-card-hover:hover {
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(212, 168, 83, 0.06);
    transform: translateY(-1px);
}

.dark .ucp-card-hover:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(212, 168, 83, 0.1);
}

/* ── Welcome banner ── */
.ucp-welcome {
    position: relative;
    overflow: hidden;
}

.ucp-welcome::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--color-brand-soft) 0%, transparent 50%);
    pointer-events: none;
}

.ucp-welcome::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-brand-glow), transparent);
    pointer-events: none;
}

/* ── Application review note (resizable) ── */
.ucp-review-note {
    resize: vertical;
    min-height: 10rem;
    max-height: 32rem;
    line-height: 1.55;
    field-sizing: content;
}

@supports not (field-sizing: content) {
    .ucp-review-note {
        min-height: 12rem;
    }
}

/* ── Navigation ── */
.ucp-nav-item {
    position: relative;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ucp-nav-item:hover {
    background: var(--color-accent);
}

.ucp-nav-active {
    background: var(--color-accent) !important;
    color: var(--color-accent-foreground) !important;
}

.ucp-nav-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--color-brand), rgba(212, 168, 83, 0.5));
}

/* ── Buttons ── */
.ucp-btn-primary {
    background: linear-gradient(135deg, var(--color-brand) 0%, #b8923f 100%);
    color: #1a1508;
    font-weight: 600;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.ucp-btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 12px rgba(212, 168, 83, 0.25);
}

.ucp-btn-primary:active {
    transform: scale(0.97);
}

/* ── Form inputs ── */
.ucp-input {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ucp-input:focus {
    border-color: rgba(212, 168, 83, 0.4) !important;
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.12) !important;
    outline: none;
}

/* ── Server status pulse ── */
@keyframes ucp-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.85; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

.ucp-status-online {
    animation: ucp-pulse 2s ease-in-out infinite;
}

/* ── Logo glow ── */
.ucp-logo {
    box-shadow: 0 0 0 1px var(--color-divider), 0 2px 8px rgba(212, 168, 83, 0.08);
}

.dark .ucp-logo {
    box-shadow: 0 0 0 1px var(--color-divider), 0 2px 12px rgba(212, 168, 83, 0.12);
}

/* ── Section headings ── */
.ucp-section-title {
    letter-spacing: -0.01em;
}

/* ── Animations ── */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fade-in 0.25s ease-out;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-scrollbar-thumb-hover);
}

/* ── Topbar glass ── */
.ucp-topbar {
    background: color-mix(in srgb, var(--color-background) 82%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ── Auth card ── */
.ucp-auth-card {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--color-divider);
}

.dark .ucp-auth-card {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--color-divider), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* ── Stat cards accent on hover ── */
.ucp-stat-card:hover .ucp-stat-icon {
    transform: scale(1.05);
}

.ucp-stat-icon {
    transition: transform 0.2s ease;
}

/* ── Application result screens (pending / rejected / approved) ── */
.app-result {
    width: 100%;
}

.app-result__card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--color-divider);
}

.dark .app-result__card {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--color-divider), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.app-result__brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.app-result__logo {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    overflow: hidden;
    opacity: 0.9;
}

.app-result__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-result__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.app-result__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    border: 1px solid transparent;
}

.app-result__icon--pending {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.22);
    color: #fbbf24;
}

.app-result__icon--rejected {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}

.app-result__icon--approved {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.22);
    color: #86efac;
}

.app-result__icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.app-result__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    margin-bottom: 0.75rem;
}

.app-result__badge--pending {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.22);
    color: #fbbf24;
}

.app-result__badge--rejected {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}

.app-result__badge--approved {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.22);
    color: #86efac;
}

.app-result__pulse {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    background: currentColor;
    animation: app-result-pulse 1.6s ease-in-out infinite;
}

@keyframes app-result-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.app-result__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-card-foreground);
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

@media (min-width: 640px) {
    .app-result__title {
        font-size: 1.375rem;
    }
}

.app-result__lead {
    font-size: 0.875rem;
    color: var(--color-muted-foreground);
    line-height: 1.6;
    margin: 0 auto;
    max-width: 26rem;
}

.app-result__lead strong {
    color: var(--color-card-foreground);
    font-weight: 600;
}

.app-result__meta {
    margin-top: 0.85rem;
    font-size: 0.6875rem;
    color: var(--color-muted-foreground);
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

.app-result__body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.app-result__panel {
    background: var(--color-muted);
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) - 2px);
    padding: 1rem 1.1rem;
}

.app-result__panel-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted-foreground);
    margin: 0 0 0.55rem;
}

.app-result__panel-text {
    font-size: 0.8125rem;
    color: var(--color-card-foreground);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.app-result__panel-foot {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-divider);
    font-size: 0.6875rem;
    color: var(--color-muted-foreground);
    font-variant-numeric: tabular-nums;
}

.app-result__hint {
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    line-height: 1.55;
    margin: 0;
}

.app-result__actions {
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.app-result__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

.app-result__btn:active {
    transform: scale(0.98);
}

.app-result__btn--primary {
    background: var(--color-primary);
    color: var(--color-primary-foreground);
}

.app-result__btn--primary:hover {
    opacity: 0.92;
}

.app-result__btn--inline {
    width: auto;
    display: inline-flex;
}

.app-result__btn--ghost {
    background: transparent;
    color: var(--color-muted-foreground);
    border: 1px solid var(--color-border);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.55rem 1rem;
}

.app-result__btn--ghost:hover {
    color: var(--color-card-foreground);
    background: var(--color-muted);
}

.app-result__reviewer {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--color-border);
    background: var(--color-background);
}

.app-result__reviewer-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: var(--color-brand-soft);
    color: var(--color-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-result__reviewer-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.app-result__reviewer-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted-foreground);
    margin: 0 0 0.2rem;
}

.app-result__reviewer-text {
    font-size: 0.8125rem;
    color: var(--color-card-foreground);
    margin: 0;
    line-height: 1.45;
}

.app-result__reviewer-text span {
    font-weight: 600;
}

.app-result__tips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.app-result__tips li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    line-height: 1.45;
}

.app-result__tips-mark {
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    background: rgba(22, 163, 74, 0.12);
    color: #86efac;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.app-result__tips-mark svg {
    width: 0.65rem;
    height: 0.65rem;
}

.app-result__countdown {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    margin: 0;
}

/* ── Whitelist apply wizard ── */
.apply-wizard {
    width: 100%;
}

.apply-wizard__notice {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid rgba(212, 168, 83, 0.25);
    background: var(--color-brand-soft);
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    line-height: 1.55;
}

.apply-wizard__discord {
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--color-border);
    background: var(--color-muted);
}

.apply-wizard__discord-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted-foreground);
    margin: 0 0 0.25rem;
}

.apply-wizard__discord-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-card-foreground);
    margin: 0;
}

.apply-wizard__discord-id {
    font-weight: 400;
    color: var(--color-muted-foreground);
    font-size: 0.75rem;
    margin-left: 0.35rem;
}

.apply-wizard__discord-hint {
    margin: 0.35rem 0 0;
    font-size: 0.6875rem;
    color: var(--color-muted-foreground);
}

.apply-wizard__progress {
    margin-bottom: 1.25rem;
}

.apply-wizard__progress-bar {
    height: 0.35rem;
    border-radius: 9999px;
    background: var(--color-muted);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.apply-wizard__progress-fill {
    height: 100%;
    background: var(--color-brand);
    border-radius: 9999px;
    transition: width 0.25s ease;
}

.apply-wizard__progress-text {
    margin: 0.4rem 0 0;
    font-size: 0.6875rem;
    color: var(--color-muted-foreground);
    text-align: right;
}

.apply-wizard__step-head {
    margin-bottom: 0.75rem;
}

.apply-wizard__step-badge {
    display: inline-flex;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-brand);
    background: var(--color-brand-soft);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: 9999px;
    padding: 0.2rem 0.55rem;
    margin-bottom: 0.5rem;
}

.apply-wizard__step-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-card-foreground);
    margin: 0;
    letter-spacing: -0.01em;
}

.apply-wizard__prompt {
    font-size: 0.8125rem;
    color: var(--color-muted-foreground);
    line-height: 1.65;
    margin: 0 0 0.75rem;
}

.apply-wizard__prompt a {
    color: var(--color-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.apply-wizard__hint {
    font-size: 0.6875rem;
    color: var(--color-muted-foreground);
    line-height: 1.5;
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: calc(var(--radius) - 4px);
    background: var(--color-background);
    border: 1px solid var(--color-divider);
}

.apply-wizard__hint a {
    color: var(--color-brand);
    margin-left: 0.25rem;
}

.apply-wizard__textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--color-background);
    border: 1px solid var(--color-input);
    border-radius: calc(var(--radius) - 2px);
    color: var(--color-foreground);
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.apply-wizard__textarea:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand-glow);
}

.apply-wizard__textarea.is-invalid {
    border-color: rgba(239, 68, 68, 0.55);
}

.apply-wizard__field-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.4rem;
    font-size: 0.6875rem;
    color: var(--color-muted-foreground);
}

.apply-wizard__error {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    color: #fca5a5;
}

.apply-wizard__rules {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.8125rem;
    color: var(--color-muted-foreground);
    line-height: 1.55;
    cursor: pointer;
}

.apply-wizard__rules input {
    margin-top: 0.2rem;
    accent-color: var(--color-brand);
}

.apply-wizard__rules a {
    color: var(--color-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.apply-wizard__nav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-divider);
}

.apply-wizard__nav-spacer {
    flex: 1;
}

.apply-wizard__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s, transform 0.1s;
}

.apply-wizard__btn:active {
    transform: scale(0.98);
}

.apply-wizard__btn--primary {
    background: var(--color-primary);
    color: var(--color-primary-foreground);
}

.apply-wizard__btn--primary:hover {
    opacity: 0.92;
}

.apply-wizard__btn--ghost {
    background: transparent;
    color: var(--color-muted-foreground);
    border: 1px solid var(--color-border);
}

.apply-wizard__btn--ghost:hover {
    color: var(--color-card-foreground);
    background: var(--color-muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
