:root {
    /* Light theme (default) */
    --bg: #ffffff;
    --bg-elev: #f6f7f9;
    --bg-subtle: #fafafa;
    --ink: #0b1220;
    --ink-muted: #6b7280;
    --ink-subtle: #9ca3af;
    --line: rgba(11, 18, 32, 0.06);
    --line-strong: rgba(11, 18, 32, 0.12);
    --danger: #ef4444;
    --warn: #f59e0b;
    --success: #16a34a;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Dark theme overrides */
.dark {
    --bg: #0a0a0a;
    --bg-elev: #131313;
    --bg-subtle: #1c1c1c;
    --ink: #ffffff;
    --ink-muted: #8b8b8b;
    --ink-subtle: #4a4a4a;
    --line: rgba(255, 255, 255, 0.06);
    --line-strong: rgba(255, 255, 255, 0.12);
    --danger: #ef4444;
    --warn: #f59e0b;
    --success: #22c55e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 2.5rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
p { margin: 0; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-muted); }
button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }
input, textarea, select { font-family: inherit; }

/* LOGO */
.logo { display: inline-flex; align-items: center; gap: 0.625rem; text-decoration: none; color: var(--ink); }
.logo-mark {
    width: 32px; height: 32px;
    background: var(--ink);
    color: var(--bg);
    border: 2px solid var(--ink);
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ink);
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.875rem;
    letter-spacing: -0.05em;
    position: relative;
    transform: rotate(-3deg);
    transition: transform 0.2s var(--ease-out);
}
.logo:hover .logo-mark { transform: rotate(0deg) scale(1.05); }
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 0.875rem; letter-spacing: 0.05em; text-transform: uppercase; }

/* NAV */
.nav { position: sticky; top: 0; z-index: 40; background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-inner { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav-links { display: flex; align-items: center; gap: 0.25rem; position: relative; }

/* Nav link with hover underline animation (Fix 1) */
.nav-link {
    color: var(--ink-muted);
    padding: 6px 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    position: relative;
    text-decoration: none;
    transition: color 0.2s;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--ink);
    transition: all 0.25s ease-out;
    transform: translateX(-50%);
}
.nav-link:hover { color: var(--ink); }
.nav-link:hover::after { width: calc(100% - 20px); }

/* Coin pill in nav */
.coin-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s;
}
.coin-pill:hover { border-color: var(--line-strong); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; font-weight: 600; font-size: 0.875rem; padding: 10px 18px; border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease-out; white-space: nowrap; line-height: 1; text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #d0d0d0; }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { color: var(--ink); background: var(--bg-elev); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--ink); }
.btn-icon { width: 36px; height: 36px; padding: 0; background: transparent; color: var(--ink-muted); border: 1px solid transparent; display: grid; place-items: center; }
.btn-icon:hover { color: var(--ink); background: var(--bg-elev); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 3rem 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.section-link { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.section-link:hover { color: var(--ink); }
.section-meta { color: var(--ink-muted); font-size: 0.8125rem; font-family: var(--font-mono); margin-top: 0.25rem; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .grid { grid-template-columns: 1fr; } }

.marketplace-layout { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; }
@media (max-width: 1024px) { .marketplace-layout { grid-template-columns: 1fr; } }

.hero { position: relative; overflow: hidden; padding: 5rem 1.5rem; background: #000; border-bottom: 1px solid var(--line); min-height: 520px; display: flex; align-items: center; }
.hero-particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-particle { position: absolute; width: 2px; height: 2px; background: rgba(255, 255, 255, 0.5); border-radius: 50%; animation: float linear infinite; }
.hero-particle:nth-child(1) { left: 8%; animation-duration: 9s; animation-delay: 0s; }
.hero-particle:nth-child(2) { left: 18%; animation-duration: 11s; animation-delay: 0.5s; }
.hero-particle:nth-child(3) { left: 28%; animation-duration: 8s; animation-delay: 1s; }
.hero-particle:nth-child(4) { left: 38%; animation-duration: 12s; animation-delay: 1.5s; }
.hero-particle:nth-child(5) { left: 48%; animation-duration: 10s; animation-delay: 2s; }
.hero-particle:nth-child(6) { left: 58%; animation-duration: 9s; animation-delay: 2.5s; }
.hero-particle:nth-child(7) { left: 68%; animation-duration: 11s; animation-delay: 3s; }
.hero-particle:nth-child(8) { left: 78%; animation-duration: 8s; animation-delay: 3.5s; }
.hero-particle:nth-child(9) { left: 88%; animation-duration: 12s; animation-delay: 4s; }
.hero-particle:nth-child(10) { left: 95%; animation-duration: 10s; animation-delay: 4.5s; }
@keyframes float { 0% { transform: translateY(100vh); opacity: 0; } 10% { opacity: 0.8; } 90% { opacity: 0.8; } 100% { transform: translateY(-100px); opacity: 0; } }

.hero-glow { position: absolute; width: 500px; height: 500px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%); pointer-events: none; z-index: 0; }

.hero-inner { max-width: 1280px; margin: 0 auto; position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center; width: 100%; }
@media (max-width: 768px) { .hero-inner { grid-template-columns: 1fr; gap: 2rem; } .hero { min-height: auto; padding: 3rem 1.5rem; } }

.hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.625rem; font-weight: 600; color: var(--ink-muted); margin-bottom: 1.25rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 4px 10px; border: 1px solid var(--line); }
.hero-eyebrow::before { content: ''; width: 6px; height: 6px; background: var(--ink); border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.hero-headline { font-family: var(--font-display); font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.035em; margin-bottom: 1.5rem; color: var(--ink); }
.hero-headline .gradient { background: linear-gradient(135deg, #fff 0%, #888 50%, #fff 100%); background-size: 200% 200%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 3s linear infinite; }
@keyframes shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }

.hero-visual { position: relative; aspect-ratio: 16/10; overflow: hidden; border: 1px solid var(--line); transition: border-color 0.3s; }
.hero-visual:hover { border-color: var(--line-strong); }
.hero-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-visual .showcase-watermark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 1.5rem; font-weight: 300; color: #fff; letter-spacing: 8px; font-family: var(--font-mono); z-index: 2; user-select: none; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }

.card { background: var(--bg-elev); border: 1px solid var(--line); padding: 1.25rem; transition: border-color 0.2s; }
.card:hover { border-color: var(--line-strong); }

.thumb-card { background: var(--bg-elev); border: 1px solid var(--line); overflow: hidden; transition: all 0.25s ease-out; position: relative; }
.thumb-card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); }
.thumb-link { display: block; color: inherit; text-decoration: none; }
.thumb-image { aspect-ratio: 16/9; background: var(--bg-subtle); overflow: hidden; position: relative; }
.thumb-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease-out; display: block; }
.thumb-card:hover .thumb-image img { transform: scale(1.04); }
.thumb-placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: var(--bg-subtle); color: var(--ink-subtle); font-size: 0.75rem; text-align: center; padding: 1rem; }
.thumb-fav { position: absolute; top: 8px; right: 8px; z-index: 5; width: 32px; height: 32px; background: rgba(0,0,0,0.5); display: grid; place-items: center; cursor: pointer; transition: background 0.2s; color: #fff; border: 1px solid var(--line); }
.thumb-fav:hover { background: rgba(0,0,0,0.7); color: var(--danger); }
.thumb-new-badge { position: absolute; top: 8px; left: 8px; background: var(--ink); color: var(--bg); font-size: 0.5625rem; font-weight: 700; padding: 2px 7px; letter-spacing: 0.05em; z-index: 5; }
.thumb-free-badge { position: absolute; top: 8px; left: 8px; background: var(--success); color: #fff; font-size: 0.5625rem; font-weight: 700; padding: 2px 7px; letter-spacing: 0.05em; z-index: 5; }
.thumb-body { padding: 0.875rem; }
.thumb-title { font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.25rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.thumb-meta { display: flex; align-items: center; gap: 0.375rem; font-size: 0.6875rem; color: var(--ink-muted); }
.thumb-creator { font-weight: 500; color: var(--ink-muted); }
.thumb-price { color: var(--ink); font-weight: 600; font-family: var(--font-mono); }
.thumb-divider { opacity: 0.3; }

.form-input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink); font-size: 0.9375rem; font-family: inherit; transition: border-color 0.15s; }
.form-input:focus { outline: none; border-color: var(--ink-muted); }
.form-input::placeholder { color: var(--ink-subtle); }
.form-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--ink-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
textarea.form-input { resize: vertical; min-height: 100px; line-height: 1.6; }

.avatar { display: inline-grid; place-items: center; background: var(--bg-subtle); color: var(--ink-muted); font-weight: 700; flex-shrink: 0; overflow: hidden; position: relative; line-height: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-wrap { position: relative; display: inline-block; flex-shrink: 0; line-height: 0; font-size: 0; }
.avatar-wrap.w-7 { width: 28px; }
.avatar-wrap.w-8 { width: 32px; }
.avatar-wrap.w-10 { width: 40px; }
.avatar-wrap.w-12 { width: 48px; }
.avatar-wrap.w-14 { width: 56px; }
.avatar-wrap.w-16 { width: 64px; }
.avatar-wrap.w-24 { width: 96px; }
.avatar-wrap .avatar { width: 100%; height: 100%; }
.online-dot { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-subtle); flex-shrink: 0; box-sizing: border-box; border: 2px solid var(--bg-elev); }
.online-dot.online { background: #22c55e; animation: pulse-online 2s ease-in-out infinite; }
.online-dot.offline { background: var(--ink-subtle); }
@keyframes pulse-online { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.8); } }

.empty-state { text-align: center; padding: 4rem 1.5rem; border: 1px dashed var(--line-strong); }
.empty-state-art { width: 80px; height: 80px; margin: 0 auto 1.25rem; color: var(--ink-subtle); }
.empty-state-title { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; margin-bottom: 0.5rem; }
.empty-state-body { color: var(--ink-muted); margin-bottom: 1.5rem; max-width: 360px; margin-left: auto; margin-right: auto; font-size: 0.875rem; }

.activity-feed { background: var(--bg-elev); border: 1px solid var(--line); padding: 1rem; position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow-y: auto; }
.activity-feed-title { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; color: var(--ink-muted); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.08em; display: flex; align-items: center; gap: 0.375rem; }
.activity-feed-list { display: flex; flex-direction: column; gap: 0.75rem; }
.activity-item { display: flex; align-items: start; gap: 0.5rem; font-size: 0.8125rem; line-height: 1.5; }
.activity-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex-shrink: 0; font-size: 0.625rem; }

.commission-card { background: var(--bg-elev); border: 1px solid var(--line); padding: 1.25rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-decoration: none; color: inherit; transition: border-color 0.15s; }
.commission-card:hover { border-color: var(--line-strong); }
.status-pill { display: inline-block; padding: 3px 9px; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-subtle); color: var(--ink-muted); }
.status-pill.status-requested { background: #422006; color: #fbbf24; }
.status-pill.status-accepted { background: #1e3a8a; color: #93c5fd; }
.status-pill.status-in_progress { background: #1e1b4b; color: #a5b4fc; }
.status-pill.status-delivered { background: #064e3b; color: #6ee7b7; }
.status-pill.status-completed { background: #14532d; color: #86efac; }
.status-pill.status-declined, .status-pill.status-refunded { background: #7f1d1d; color: #fca5a5; }

.hidden { display: none !important; }

.dropdown { position: absolute; top: 100%; right: 0; margin-top: 8px; background: var(--bg-elev); border: 1px solid var(--line-strong); box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5); min-width: 220px; max-width: 320px; z-index: 50; overflow: hidden; }
.dropdown-item { display: block; padding: 8px 14px; font-size: 0.8125rem; transition: background 0.15s; color: var(--ink-muted); text-decoration: none; }
.dropdown-item:hover { background: var(--bg-subtle); color: var(--ink); }
.user-menu-btn { display: flex; align-items: center; gap: 0.5rem; padding: 4px 8px; background: transparent; cursor: pointer; color: var(--ink-muted); border: none; }
.user-menu-btn:hover { color: var(--ink); }
.nav-username { display: none; font-size: 0.8125rem; color: var(--ink-muted); }
@media (min-width: 640px) { .nav-username { display: inline; } }

.tag { display: inline-block; padding: 2px 7px; font-size: 0.625rem; font-weight: 600; background: var(--bg-subtle); color: var(--ink-muted); text-decoration: none; }
.tag:hover { background: var(--bg-elev); color: var(--ink); }
.tag.tag-free { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.tag.tag-new { background: var(--ink); color: var(--bg); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.4s ease-out backwards; }
.stagger > * { animation: fadeUp 0.4s ease-out backwards; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(n+7) { animation-delay: 300ms; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-subtle); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

.splash-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #000; animation: splash-fade 1.5s ease-out forwards; }
@keyframes splash-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; pointer-events: none; } }

.earnings-card { background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.02)); border: 1px solid rgba(34, 197, 94, 0.2); padding: 1.5rem; text-align: center; }
.earnings-amount { font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; color: var(--success); margin-bottom: 0.25rem; }
.earnings-label { font-size: 0.75rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; }

#chat-messages { scrollbar-width: thin; }
.msg-bubble { max-width: 70%; padding: 0.5rem 0.875rem; border-radius: 16px; word-wrap: break-word; }
.msg-mine { background: var(--ink); color: var(--bg); margin-left: auto; }
.msg-them { background: var(--bg-elev); color: var(--ink); border: 1px solid var(--line); }
.msg-bubble img { max-width: 100%; border-radius: 8px; margin-bottom: 0.375rem; display: block; }
