:root {
    color-scheme: dark;
    --jj-nav-height: 68px;
    --jj-header-height: 82px;
}

html.theme-light {
    color-scheme: light;
    --cs-bg: #f7f7f9 !important;
    --cs-surface: #ffffff !important;
    --cs-text: #101116 !important;
    --cs-muted: #697080 !important;
}

html.theme-light body,
html.theme-light #app,
html.theme-light .app-view {
    background: #f7f7f9 !important;
    color: #101116 !important;
}

html.theme-light .glass,
html.theme-light .studio-shell,
html.theme-light .app-surface {
    background: rgba(255,255,255,.92) !important;
    border-color: rgba(15,23,42,.1) !important;
    color: #101116 !important;
}

html.theme-light .text-white,
html.theme-light .text-slate-300,
html.theme-light .text-slate-200\/90 {
    color: #101116 !important;
}

html.theme-light .text-slate-400,
html.theme-light .text-slate-500 {
    color: #697080 !important;
}

html.theme-light .bg-black\/25,
html.theme-light .bg-black\/30,
html.theme-light .bg-black\/35,
html.theme-light .bg-white\/5,
html.theme-light .bg-white\/\[0\.035\],
html.theme-light .bg-white\/\[0\.04\] {
    background: rgba(15,23,42,.05) !important;
}

html.theme-light .border-white\/10,
html.theme-light .border-white\/15 {
    border-color: rgba(15,23,42,.1) !important;
}

/* Splash */
#appSplash {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 25% 20%, color-mix(in srgb, var(--cs-primary) 20%, transparent), transparent 34%),
        radial-gradient(circle at 80% 75%, color-mix(in srgb, var(--cs-secondary) 22%, transparent), transparent 36%),
        #050507;
    transition: opacity .45s ease, visibility .45s ease;
}
#appSplash.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-content { display: flex; flex-direction: column; align-items: center; text-align: center; }
.splash-mark {
    position: relative;
    width: 94px;
    height: 94px;
    display: grid;
    place-items: center;
    border-radius: 28px;
    background: #fff;
    color: #07070a;
    font-size: 48px;
    line-height: 1;
    font-weight: 1000;
    letter-spacing: -8px;
    box-shadow: -8px 0 0 color-mix(in srgb, var(--cs-primary) 90%, transparent), 8px 0 0 color-mix(in srgb, var(--cs-secondary) 90%, transparent), 0 24px 60px rgba(0,0,0,.45);
    animation: splash-float 1.65s ease-in-out infinite;
}
.splash-mark::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,.18);
    animation: splash-ring 1.65s ease-out infinite;
}
.splash-title { margin-top: 26px; font-size: 30px; font-weight: 1000; letter-spacing: -.04em; color: white; }
.splash-tagline { margin-top: 6px; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.45); }
.splash-loader { width: 150px; height: 3px; margin-top: 26px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.splash-loader span { display: block; width: 45%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--cs-primary),#fff,var(--cs-secondary)); animation: splash-load 1s ease-in-out infinite; }
@keyframes splash-float { 50% { transform: translateY(-7px) rotate(-2deg); } }
@keyframes splash-ring { from { transform: scale(.88); opacity: .65; } to { transform: scale(1.22); opacity: 0; } }
@keyframes splash-load { from { transform: translateX(-110%); } to { transform: translateX(330%); } }

/* Mobile app shell */
.jj-topbar {
    position: fixed;
    z-index: 42;
    top: 0;
    left: 50%;
    width: 100%;
    max-width: 520px;
    transform: translateX(-50%);
    padding: max(10px, env(safe-area-inset-top)) 12px 8px;
    color: #fff;
    pointer-events: none;
}
.jj-topbar-inner {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.jj-brand-button,
.jj-search-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0,0,0,.28);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(14px);
}
.jj-feed-tabs { display: flex; align-items: center; justify-content: center; gap: 16px; min-width: 0; font-size: 13px; font-weight: 800; }
.jj-feed-tab { position: relative; color: rgba(255,255,255,.58); white-space: nowrap; }
.jj-feed-tab.active { color: white; }
.jj-feed-tab.active::after { content: ''; position: absolute; left: 25%; right: 25%; bottom: -8px; height: 3px; border-radius: 99px; background: white; }

.jj-bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 48;
    display: grid;
    grid-template-columns: repeat(5,1fr);
    width: 100%;
    max-width: 520px;
    min-height: var(--jj-nav-height);
    transform: translateX(-50%);
    padding: 7px 8px max(7px,env(safe-area-inset-bottom));
    background: rgba(5,5,7,.94);
    border-top: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(20px);
}
html.theme-light .jj-bottom-nav { background: rgba(255,255,255,.94); border-color: rgba(15,23,42,.1); }
.jj-nav-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; font-size: 10px; font-weight: 800; color: rgba(255,255,255,.48); }
html.theme-light .jj-nav-button { color: rgba(15,23,42,.48); }
.jj-nav-button.active { color: white; }
html.theme-light .jj-nav-button.active { color: #101116; }
.jj-nav-button svg { width: 22px; height: 22px; }
.jj-create-button { position: relative; width: 48px; height: 32px; margin: auto; border-radius: 10px; background: white; color: #08080a; box-shadow: -5px 0 0 var(--cs-primary), 5px 0 0 var(--cs-secondary); }
html.theme-light .jj-create-button { background: #101116; color: white; }

.app-view {
    position: fixed;
    inset: 0;
    z-index: 36;
    overflow-y: auto;
    padding: max(18px,env(safe-area-inset-top)) 16px calc(var(--jj-nav-height) + 18px);
    background: var(--cs-bg);
    transition: opacity .2s ease, transform .25s ease;
}
.app-view.is-hidden { opacity: 0; pointer-events: none; transform: translateY(12px); }
.app-view-inner { width: 100%; max-width: 520px; margin: 0 auto; }
.app-view-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.app-view-title { font-size: 28px; line-height: 1; font-weight: 1000; letter-spacing: -.04em; }
.app-surface { border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.045); border-radius: 22px; }

.store-search { width: 100%; border-radius: 16px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05); padding: 13px 14px; outline: none; }
.store-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.store-card { overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 18px; background: rgba(255,255,255,.045); }
.store-card-media { position: relative; aspect-ratio: 1/1; overflow: hidden; background: rgba(255,255,255,.05); }
.store-card-media img,.store-card-media video { width: 100%; height: 100%; object-fit: cover; }
.store-card-body { padding: 12px; }
.store-card-title { min-height: 38px; font-size: 13px; line-height: 1.45; font-weight: 800; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.store-card-price { margin-top: 8px; color: var(--cs-secondary); font-size: 15px; font-weight: 1000; }
.store-card-meta { margin-top: 5px; color: var(--cs-muted); font-size: 10px; }

.notification-card { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.notification-card:last-child { border-bottom: 0; }
.notification-icon { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg,var(--cs-primary),var(--cs-secondary)); color: #08080a; font-weight: 1000; }
.notification-body { min-width: 0; flex: 1; }
.notification-title { font-size: 14px; font-weight: 900; }
.notification-meta { margin-top: 4px; color: var(--cs-muted); font-size: 11px; }

.profile-hero { text-align: center; padding: 28px 18px 20px; }
.profile-avatar { position: relative; width: 96px; height: 96px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg,var(--cs-primary),var(--cs-secondary)); color: #08080a; font-size: 30px; font-weight: 1000; box-shadow: 0 0 0 5px rgba(255,255,255,.08); }
.profile-verified { position: absolute; right: 0; bottom: 2px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #1d9bf0; color: white; border: 3px solid var(--cs-bg); }
.profile-name { margin-top: 16px; font-size: 24px; font-weight: 1000; letter-spacing: -.03em; }
.profile-handle { margin-top: 3px; color: var(--cs-muted); font-size: 13px; }
.profile-stats { display: grid; grid-template-columns: repeat(3,1fr); margin-top: 22px; }
.profile-stat strong { display: block; font-size: 19px; font-weight: 1000; }
.profile-stat span { display: block; margin-top: 2px; color: var(--cs-muted); font-size: 10px; }
.wallet-card { position: relative; overflow: hidden; padding: 20px; background: linear-gradient(135deg,#101116,#24252d); color: white; }
.wallet-card::after { content:''; position:absolute; right:-35px; top:-45px; width:140px; height:140px; border-radius:50%; background:color-mix(in srgb,var(--cs-primary) 28%,transparent); filter:blur(4px); }
.wallet-label { color: rgba(255,255,255,.55); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; }
.wallet-balance { margin-top: 8px; font-size: 30px; font-weight: 1000; letter-spacing: -.04em; }
.wallet-actions { position: relative; z-index: 1; display: flex; gap: 10px; margin-top: 18px; }
.wallet-action { flex: 1; border-radius: 12px; background: white; color: #101116; padding: 11px; font-size: 12px; font-weight: 1000; }
.theme-segment { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; padding: 5px; border-radius: 15px; background: rgba(255,255,255,.06); }
.theme-option { border-radius: 11px; padding: 10px 6px; font-size: 11px; font-weight: 900; color: var(--cs-muted); }
.theme-option.active { background: white; color: #101116; }
html.theme-light .theme-option.active { background: #101116; color: white; }

/* Studio */
.studio-shell { background: rgba(12,12,15,.97); color: white; backdrop-filter: blur(26px); }
html.theme-light .studio-shell { color: #101116 !important; }
.studio-sticky-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb,var(--cs-surface) 92%,transparent); border-bottom: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(20px); }
.studio-stage-wrap { max-width: 360px; margin: 0 auto; }
.studio-stage { position: relative; width: 100%; aspect-ratio: 9/14; overflow: hidden; border-radius: 24px; background: radial-gradient(circle at 50% 25%,rgba(255,255,255,.12),transparent 32%),#060608; border: 1px solid rgba(255,255,255,.1); }
.studio-logo-mini { display:grid; place-items:center; width:68px; height:68px; border-radius:21px; background:white; color:#08080a; font-size:36px; font-weight:1000; box-shadow:-5px 0 0 var(--cs-primary),5px 0 0 var(--cs-secondary); }
.studio-choice-button { display:flex; align-items:center; justify-content:center; gap:8px; min-height:48px; border-radius:14px; background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.1); font-size:12px; font-weight:900; }
.studio-round-control { display:grid; place-items:center; width:46px; height:46px; border-radius:50%; background:rgba(0,0,0,.55); color:white; border:1px solid rgba(255,255,255,.2); backdrop-filter:blur(12px); }
.studio-record-control { display:grid; place-items:center; width:68px; height:68px; border-radius:50%; border:4px solid white; background:rgba(255,255,255,.18); }
.studio-record-control span { width:50px; height:50px; border-radius:50%; background:#fe2c55; }
.studio-chip-row { display:flex; gap:9px; overflow-x:auto; padding-bottom:4px; scrollbar-width:none; }
.studio-chip-row::-webkit-scrollbar { display:none; }
.studio-filter-chip { flex:0 0 auto; border-radius:999px; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.05); padding:9px 13px; color:rgba(255,255,255,.58); font-size:11px; font-weight:900; }
.studio-filter-chip.active { border-color:color-mix(in srgb,var(--cs-primary) 55%,transparent); background:color-mix(in srgb,var(--cs-primary) 14%,transparent); color:var(--cs-primary); }
html.theme-light .studio-filter-chip { color:#697080; border-color:rgba(15,23,42,.1); background:rgba(15,23,42,.04); }
.studio-input { width:100%; border-radius:13px; border:1px solid rgba(255,255,255,.1); background:rgba(0,0,0,.24); padding:12px 13px; color:inherit; outline:none; transition:border-color .15s,box-shadow .15s; }
.studio-input:focus { border-color:color-mix(in srgb,var(--cs-primary) 65%,transparent); box-shadow:0 0 0 3px color-mix(in srgb,var(--cs-primary) 13%,transparent); }
html.theme-light .studio-input { border-color:rgba(15,23,42,.1); background:rgba(15,23,42,.04); }

.filter-normal { filter:none; }
.filter-vivid { filter:contrast(1.08) saturate(1.35); }
.filter-warm { filter:sepia(.18) saturate(1.18) contrast(1.04); }
.filter-cool { filter:hue-rotate(8deg) saturate(1.12) brightness(1.03); }
.filter-mono { filter:grayscale(1) contrast(1.16); }
.filter-cinematic { filter:contrast(1.18) saturate(.88) brightness(.92); }
.filter-soft { filter:brightness(1.08) contrast(.94) saturate(.92); }
.filter-dramatic { filter:contrast(1.28) saturate(1.05); }

.post-image { width:100%; height:100%; object-fit:cover; }
.feed-card { padding-bottom: var(--jj-nav-height); }
.feed-card > .safe-bottom { padding-bottom: calc(var(--jj-nav-height) + max(1rem,env(safe-area-inset-bottom))) !important; }
.feed-card aside.safe-bottom { bottom: calc(var(--jj-nav-height) + 8px) !important; }

@media (min-width: 700px) {
    .jj-bottom-nav { bottom: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 22px; }
    .app-view { padding-bottom: 106px; }
}

@media (prefers-reduced-motion: reduce) {
    .splash-mark,.splash-mark::after,.splash-loader span { animation:none !important; }
}

.payment-celebration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.payment-celebration span {
    --x: 0px;
    --r: 0deg;
    --d: 0ms;
    position: absolute;
    top: 62px;
    width: 8px;
    height: 14px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--cs-primary), var(--cs-secondary));
    animation: payment-confetti 1.65s cubic-bezier(.15,.7,.28,1) var(--d) both;
}
.payment-celebration span:nth-child(3n) { background: var(--cs-accent); }
.payment-celebration span:nth-child(4n) { border-radius: 50%; height: 9px; }
@keyframes payment-confetti {
    0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0); }
    12% { opacity: 1; }
    100% { opacity: 0; transform: translate3d(var(--x), 330px, 0) rotate(var(--r)); }
}
@media (prefers-reduced-motion: reduce) {
    .payment-celebration span { animation: none; display: none; }
}
