/* Reset & base */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* =========================================================
   LOADING OVERLAY — covers everything until every data
   source has resolved. Not decorative — tracks real progress.
   ========================================================= */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 400ms ease, visibility 0s linear 400ms;
}
body.loaded .loading-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none;
}

/* =========================================================
   AUTH GATE — full-screen gate shown after the loader
   finishes. Centered card with login/signup, OR an enter
   button once the user is signed in. Dims + blurs the
   underlying site until the user explicitly enters.
   ========================================================= */
.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 180;
    display: none;           /* fully removed from layout until shown */
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 400ms ease;
}
.auth-gate.show {
    display: flex;
    opacity: 1;
}

.auth-gate-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.auth-gate-card {
    position: relative;
    width: 380px;
    max-width: 92vw;
    background: var(--panel-bg);
    border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
    border-radius: 22px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-gate.show .auth-gate-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.auth-gate-brand {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.auth-gate-logo {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}
.auth-gate-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.auth-gate-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 280px;
}

.auth-gate-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    padding: 4px;
    border-radius: 12px;
}
.auth-gate-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease;
}
.auth-gate-tab.active {
    background: var(--panel-bg);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-gate-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.auth-gate-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-primary);
    font-size: 13px;
}
.auth-gate-field input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: border-color 200ms ease, background 200ms ease;
}
.auth-gate-field input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-2);
}

.auth-gate-error {
    background: rgba(242, 63, 67, 0.1);
    border: 1px solid rgba(242, 63, 67, 0.3);
    color: #f23f43;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
}

.auth-gate-submit {
    border: none;
    background: var(--accent);
    color: white;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 200ms ease,
                opacity 200ms ease;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.auth-gate-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
.auth-gate-submit:active { transform: translateY(0) scale(0.98); }

.auth-gate-discord {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #5865F2;
    background: #5865F2;
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 200ms ease, transform 200ms ease;
}
.auth-gate-discord:hover { background: #4752C4; }
.auth-gate-discord:active { transform: scale(0.98); }

.auth-gate-skip {
    text-align: center;
    margin-top: 4px;
}
.auth-gate-skip a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    transition: color 200ms ease;
}
.auth-gate-skip a:hover { color: var(--text-primary); }

/* =========================================================
   ENTER MODAL — separate full-screen modal that appears
   after auth succeeds. NOT part of the login screen.
   ========================================================= */
.enter-modal {
    position: fixed;
    inset: 0;
    z-index: 190;
    display: none;             /* fully removed from layout until shown */
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 320ms ease;
}
.enter-modal.show {
    display: flex;
    opacity: 1;
}

.enter-modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.enter-modal-card {
    position: relative;
    width: 420px;
    max-width: 92vw;
    background: var(--panel-bg);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 24px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    padding: 36px 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transform: translateY(20px) scale(0.94);
    opacity: 0;
    transition: opacity 360ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.enter-modal.show .enter-modal-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.enter-modal-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.2));
    animation: enterIconBob 2.4s ease-in-out infinite;
}
@keyframes enterIconBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.enter-modal-welcome {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.enter-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    background: var(--accent);
    color: white;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.06em;
    padding: 18px 32px;
    border-radius: 14px;
    cursor: pointer;
    margin-top: 4px;
    box-shadow:
        0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent),
        0 12px 30px color-mix(in srgb, var(--accent) 45%, transparent);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 280ms ease;
    animation: enterPulse 1.8s ease-in-out infinite;
}
@keyframes enterPulse {
    0%, 100% {
        box-shadow:
            0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent),
            0 12px 30px color-mix(in srgb, var(--accent) 45%, transparent);
    }
    50% {
        box-shadow:
            0 0 0 16px color-mix(in srgb, var(--accent) 0%, transparent),
            0 16px 40px color-mix(in srgb, var(--accent) 60%, transparent);
    }
}
.enter-modal-btn:hover {
    transform: translateY(-2px) scale(1.02);
}
.enter-modal-btn:active {
    transform: translateY(0) scale(0.98);
    animation: none;
}

.enter-modal-sub {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 2px;
}

.enter-modal-skip {
    margin-top: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 200ms ease;
}
.enter-modal-skip:hover { color: var(--text-primary); }

/* Enter button — shown after auth, the main call-to-action */
.auth-gate-enter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 0 4px;
    animation: enterAppear 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes enterAppear {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.auth-gate-welcome {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 24px 28px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--panel-shadow);
    max-width: 320px;
    width: 100%;
    animation: loadingCardIn 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes loadingCardIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid var(--surface-2);
    border-top-color: var(--accent);
    animation: spin 800ms linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    min-height: 18px;
    transition: color 200ms ease;
}

.loading-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.loading-bar-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--text-primary)));
    border-radius: 999px;
    transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent);
}

.loading-percent {
    font-size: 12px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 0.04em;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1a1a1a;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* =========================================================
   THEMES — applied via <html data-theme="..."> attribute.
   Light is the default (no attribute). Switch via Settings.
   ========================================================= */

/* CSS variables for theme tokens (default = light) */
:root {
    --bg-base: #e0fbff;
    --bg-sq-a: #b8e8f5;
    --bg-sq-b: #c8dfff;
    --panel-bg: #ffffff;
    --panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #4b5563;
    --text-muted: #9ca3af;
    --surface-1: #f9fafb;
    --surface-2: #f3f4f6;
    --surface-3: #eff6ff;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-soft: #eff6ff;
    --tab-track: #f3f4f6;
    --thumb: rgba(100, 130, 170, 0.45);
    --thumb-hover: rgba(100, 130, 170, 0.75);
    transition: background-color 400ms ease, color 400ms ease;
}

html[data-theme="dark"] {
    --bg-base: #0f172a;
    --bg-sq-a: #1e3a5f;
    --bg-sq-b: #1e293b;
    --panel-bg: #1e293b;
    --panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #cbd5e1;
    --text-muted: #64748b;
    --surface-1: #273449;
    --surface-2: #334155;
    --surface-3: #1e3a5f;
    --border: #334155;
    --accent: #60a5fa;
    --accent-soft: #1e3a5f;
    --tab-track: #334155;
    --thumb: rgba(148, 163, 184, 0.4);
    --thumb-hover: rgba(148, 163, 184, 0.7);
}

html[data-theme="midnight"] {
    --bg-base: #050816;
    --bg-sq-a: #0a0e2a;
    --bg-sq-b: #0d1130;
    --panel-bg: #0a0e2a;
    --panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(80, 100, 220, 0.25);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #cbd5e1;
    --text-muted: #475569;
    --surface-1: #111634;
    --surface-2: #161b3d;
    --surface-3: #1e2557;
    --border: #1e2557;
    --accent: #818cf8;
    --accent-soft: #1e2557;
    --tab-track: #111634;
    --thumb: rgba(129, 140, 248, 0.4);
    --thumb-hover: rgba(129, 140, 248, 0.7);
}

/* Theme transitions on themed surfaces */
body, .panel, .tab, .fandom-card, .gallery-item,
.external-link, .settings, .lightbox, input, button {
    transition-property: background-color, color, border-color, box-shadow;
    transition-duration: 320ms;
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* WebKit/Blink scrollbar — slim, themed */
html {
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--thumb) transparent;
}
html::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
html::-webkit-scrollbar-track {
    background: transparent;
}
html::-webkit-scrollbar-thumb {
    background: var(--thumb);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background-color 200ms ease;
}
html::-webkit-scrollbar-thumb:hover {
    background: var(--thumb-hover);
    background-clip: padding-box;
}
html::-webkit-scrollbar-corner { background: transparent; }

body {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
}

/* Checkerboard background that scrolls infinitely to the upper-left.
   We tile a small svg/canvas pattern of two diagonal squares (light cyan + light blue),
   then animate background-position so the pattern slides ↖ forever.
   Two colors at 50% opacity = soft pastel diamonds. */
.checkerboard {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: var(--bg-base);
    background-image:
        linear-gradient(45deg, var(--bg-sq-a) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bg-sq-b) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bg-sq-a) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bg-sq-b) 75%);
    background-size: 80px 80px;
    background-position: 0 0, 0 40px, 40px -40px, -40px 0;
    animation: scrollUpLeft 12s linear infinite;
}

@keyframes scrollUpLeft {
    from { background-position: 0 0, 0 40px, 40px -40px, -40px 0; }
    to   { background-position: -80px -80px, -80px -40px, -40px -120px, -120px -80px; }
}

/* Main white rounded panel */
.panel {
    background: var(--panel-bg);
    border-radius: 24px;
    padding: 32px;
    max-width: 560px;
    width: 100%;
    box-shadow: var(--panel-shadow);
    /* Soft accent border that picks up the active theme/accent color */
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);

    /* Load entrance: panel glides up and fades in */
    animation: panelIn 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Shared entrance for everything inside the panel.
   Each step sets --i and gets delay = i * 70ms. */
.avatar-wrapper,
.user-info,
.external-links,
.separator,
.tabs,
.tab-panel.active {
    opacity: 0;
    transform: translateY(10px);
    animation: stepIn 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(380ms + var(--i, 0) * 70ms);
}

/* After first load, tab panels drop the cascade delay so tab switches feel instant. */
body.loaded .tab-panel.active {
    animation-delay: 0ms;
}

@keyframes stepIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* Separator draws left-to-right */
.separator {
    position: relative;
    overflow: hidden;
    border: none;
    border-top: 1px solid transparent;
    margin: 24px 0 20px;
}
.separator::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    border-top: 1px solid var(--border);
    transform: scaleX(0);
    transform-origin: left center;
    animation: drawLine 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(380ms + var(--i, 0) * 70ms);
}
@keyframes drawLine {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
    .panel,
    .avatar-wrapper,
    .user-info,
    .external-links,
    .separator,
    .tabs,
    .tab-panel.active,
    .separator::after {
        animation: none;
        opacity: 1;
        transform: none;
    }
    .separator::after { transform: scaleX(1); }
}

/* Discord info */
.discord-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.avatar-wrapper {
    position: relative;
    width: 96px;
    height: 96px;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-2);
    border: 4px solid var(--panel-bg);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 320ms ease;
}

.avatar:hover {
    transform: scale(1.04);
    box-shadow:
        0 0 0 6px var(--accent-soft),
        0 8px 24px rgba(0, 0, 0, 0.18);
}

/* Soft accent pulse on entry */
@keyframes avatarPulse {
    0%   { box-shadow: 0 0 0 0   var(--accent-soft); }
    50%  { box-shadow: 0 0 0 10px transparent; }
    100% { box-shadow: 0 0 0 0   transparent; }
}
.avatar-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    animation: avatarPulse 1200ms cubic-bezier(0.22, 1, 0.36, 1) 800ms 1 both;
}

/* Soft accent border on the panel was moved up into the .panel definition above. */

.user-info { margin-top: 4px; }

.display-name {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.username {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}

.username-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #23a55a;
    box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.6);
    animation: liveDot 1.8s ease-out infinite;
}
.live-dot.idle    { background: #f0b232; box-shadow: 0 0 0 0 rgba(240, 178, 50, 0.6); }
.live-dot.dnd     { background: #f23f43; box-shadow: 0 0 0 0 rgba(242, 63, 67, 0.6); animation: none; }
.live-dot.offline { background: #80848e; animation: none; }

@keyframes liveDot {
    0%   { box-shadow: 0 0 0 0   rgba(35, 165, 90, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(35, 165, 90, 0); }
    100% { box-shadow: 0 0 0 0   rgba(35, 165, 90, 0); }
}

.external-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.external-link {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
                background 220ms ease;
}

.external-link:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.external-link img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

/* (separator moved up into the entrance animation block) */
/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--tab-track);
    padding: 4px;
    border-radius: 14px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 220ms cubic-bezier(0.22, 1, 0.36, 1),
                color 220ms ease,
                transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tab:hover { color: var(--text-primary); }
.tab:active { transform: scale(0.97); }

.tab.active {
    background: var(--panel-bg);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    animation: tabPop 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tabPop {
    0%   { transform: scale(0.96); }
    60%  { transform: scale(1.02); }
    100% { transform: scale(1);    }
}

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

#bio-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-tertiary);
    white-space: normal;
}

#bio-text strong { color: var(--text-primary); font-weight: 700; }
#bio-text em     { color: var(--text-primary); font-style: italic; }
#bio-text code {
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13px;
    color: var(--accent);
}
#bio-text .bio-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    transition: border-color 200ms ease, color 200ms ease;
}
#bio-text .bio-link:hover {
    border-bottom-color: var(--accent);
}

.muted { color: var(--text-muted); font-style: italic; }

/* Links grid */
.links-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Fandoms grid */
.fandoms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
}

.fandom-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-align: center;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
                background 220ms ease,
                border-color 220ms ease;
}

.fandom-card:hover {
    background: var(--accent-soft);
    transform: translateY(-2px);
}

.fandom-card .fandom-image {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--surface-2);
}

.fandom-card .fandom-emoji {
    font-size: 40px;
    line-height: 1;
}

.fandom-card .fandom-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.fandom-card .fandom-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Projects */
.project-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-tertiary);
    white-space: pre-wrap;
}

/* Gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}
.gallery-count { letter-spacing: 0.02em; }
.gallery-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.gallery-sort select {
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease;
}
.gallery-sort select:hover {
    background: var(--surface-2);
    border-color: var(--accent);
}

.gallery-item {
    cursor: pointer;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: var(--surface-2);
    transition: transform 250ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 250ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    z-index: 1;
}

.gallery-item:active {
    transform: translateY(-1px) scale(1.02);
    transition-duration: 90ms;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover img { transform: scale(1.08); }

.gallery-item .gallery-label {
    position: absolute;
    inset: auto 0 0 0;
    padding: 5px 6px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 250ms ease, transform 250ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover .gallery-label {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .gallery-item img, .gallery-item .gallery-label { transition: none; }
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 30, 0.5);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 40px;
}

.lightbox.open { display: flex; }

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-arrow:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox-arrow.left  { left: 20px; }
.lightbox-arrow.right { right: 20px; }

#lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    /* Lightbox entrance + crossfade on prev/next */
    animation: lightboxImgIn 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes lightboxImgIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1);    }
}

#lightbox-img.swap {
    animation: lightboxImgOut 180ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes lightboxImgOut {
    from { opacity: 1; transform: scale(1);    }
    to   { opacity: 0; transform: scale(0.99); }
}

.lightbox-caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px;
    border-radius: 999px;
    transition: opacity 200ms ease, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-caption.swap {
    opacity: 0;
    transform: translateX(-50%) translateY(6px);
}

@media (prefers-reduced-motion: reduce) {
    #lightbox-img, #lightbox-img.swap, .lightbox-caption, .lightbox-caption.swap {
        animation: none;
        transition: none;
    }
}

/* Responsive tweaks */
@media (max-width: 480px) {
    body { padding: 16px 12px; }
    .panel { padding: 22px; border-radius: 18px; }
    .tab { font-size: 13px; padding: 9px 6px; }
    .lightbox-arrow { width: 44px; height: 44px; }
}

/* =========================================================
   FLOATING MUSIC + SETTINGS CONTROLS (top-right corner)
   ========================================================= */
.floating-controls {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 50;
}

.fc-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--panel-bg);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
                background 220ms ease,
                color 220ms ease,
                border-color 220ms ease;
}
.fc-btn:hover {
    transform: translateY(-2px);
    background: var(--surface-1);
}
.fc-btn:active { transform: translateY(0) scale(0.95); }
.fc-btn.playing { color: var(--accent); }

.icon-play, .icon-pause { display: none; }
.fc-btn.playing .icon-pause { display: block; }
.fc-btn:not(.playing) .icon-play { display: block; }

/* Settings gear spins on hover */
#settings-open svg { transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1); }
#settings-open:hover svg { transform: rotate(60deg); }

/* =========================================================
   SETTINGS MODAL
   ========================================================= */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    display: none;
    transition: opacity 320ms ease;
    z-index: 90;
}
.settings-overlay.open {
    opacity: 1;
    pointer-events: auto;
    display: block;
}

/* Outer container: centered modal positioning */
.settings {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;             /* fully hidden until .open */
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.settings.open {
    display: flex;
}

/* The modal card itself */
.settings-modal {
    width: 720px;                  /* wider to fit sidebar + content */
    max-width: 92vw;
    max-height: 86vh;
    background: var(--panel-bg);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 20px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.settings.open .settings-modal {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Two-column layout: sidebar + content */
.settings-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Sidebar nav (Discord-style vertical pill list) */
.settings-nav {
    width: 180px;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--surface-1) 70%, transparent);
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.settings-nav-item:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}
.settings-nav-item.active {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
}
.settings-nav-item.active svg { color: var(--accent); }
.settings-nav-item svg { flex-shrink: 0; color: var(--text-secondary); transition: color 180ms ease; }
.settings-nav-item:hover svg { color: var(--text-primary); }
.settings-nav-item:active { transform: scale(0.98); }

.settings-nav-item.dev-only { display: none; }
body.dev-mode .settings-nav-item.dev-only { display: flex; }

/* Lock page scroll while the modal is open */
body.modal-open {
    overflow: hidden;
}

/* Floating controls stay accessible above the modal backdrop */
.floating-controls { z-index: 110; }

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.settings-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.settings-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 200ms ease, color 200ms ease;
}
.settings-close:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

/* Settings body holds the sections. The whole body has ONE main vertical
   scrollbar (the side rails the user mentioned will appear inside individual
   sections that grow tall). */
.settings-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    flex: 1;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--thumb) transparent;
}
.settings-body::-webkit-scrollbar { width: 8px; }
.settings-body::-webkit-scrollbar-track { background: transparent; }
.settings-body::-webkit-scrollbar-thumb {
    background: var(--thumb);
    border-radius: 999px;
}

.settings-section {
    display: none;             /* hidden by default */
    padding: 24px 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
    animation: settingsFadeIn 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.settings-section.active { display: block; }
.settings-section:last-child { border-bottom: none; }

@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* When a section's inner content would overflow (e.g. dev info with lots of
   rows, future profile stuff), a slim scrollbar appears on the right side of
   that section only. */
.settings-section.scroll {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--thumb) transparent;
    padding-right: 18px;
}
.settings-section.scroll::-webkit-scrollbar { width: 6px; }
.settings-section.scroll::-webkit-scrollbar-track { background: transparent; }
.settings-section.scroll::-webkit-scrollbar-thumb {
    background: var(--thumb);
    border-radius: 999px;
}
.settings-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-section h3 .dev-badge {
    background: var(--accent);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

/* Theme cards */
.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.theme-option {
    cursor: pointer;
    position: relative;
}
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--surface-1);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: border-color 220ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-option input:checked + .theme-card {
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-2px);
}
.theme-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.theme-swatch-light    { background: linear-gradient(135deg, #b8e8f5, #ffffff); }
.theme-swatch-dark     { background: linear-gradient(135deg, #1e293b, #334155); }
.theme-swatch-midnight { background: linear-gradient(135deg, #0a0e2a, #1e2557); }

/* Accent color picker row */
.accent-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
#setting-accent {
    width: 32px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}
.accent-reset {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}
.accent-reset:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    transform: rotate(-90deg);
}

/* Settings rows (label + control on the right) */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}
.settings-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}
.settings-row input[type="range"] {
    width: 130px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Generic action button */
.settings-action {
    width: 100%;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: background 200ms ease, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.settings-action:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
}
.settings-action:active { transform: translateY(0) scale(0.98); }

/* =========================================================
   PROFILE SECTION
   ========================================================= */
.profile-role {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent);
    color: white;
}

.profile-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 14px;
}
.profile-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease;
}
.profile-tab.active {
    background: var(--panel-bg);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 13px;
}
.profile-field input,
.profile-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: border-color 200ms ease, background 200ms ease;
    resize: vertical;
}
.profile-field input:focus,
.profile-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-2);
}

.profile-error {
    background: rgba(242, 63, 67, 0.1);
    border: 1px solid rgba(242, 63, 67, 0.3);
    color: #f23f43;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 10px;
}

.profile-discord {
    background: #5865F2;
    color: white;
    border-color: #5865F2;
    margin-top: 8px;
}
.profile-discord:hover {
    background: #4752C4;
    border-color: #4752C4;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
}
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-email-line { font-weight: 600; color: var(--text-primary); font-size: 14px; }
.profile-provider { font-size: 11px; color: var(--text-secondary); }

.profile-edit {
    padding: 12px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
}
.profile-edit-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.profile-edit-status {
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
    color: var(--text-secondary);
}
.profile-edit-status.success { color: #23a55a; }
.profile-edit-status.error   { color: #f23f43; }

.profile-logout {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.profile-logout:hover {
    background: var(--surface-1);
    color: var(--text-primary);
}

/* Developer info card */
.dev-section h3 span:first-child { flex: 1; }
.dev-info {
    margin-top: 12px;
    padding: 12px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: stepIn 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.dev-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-tertiary);
}
.dev-row span:first-child { color: var(--text-secondary); }
.dev-ua {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* When developer settings is enabled, surface a tiny 'DEV' badge on the panel */
body.dev-mode .panel::before {
    content: "DEV MODE";
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.panel { position: relative; }
