/* ============================================================
   Lethe Sparks – TikTok-style Feed Styles
   Design: Dark theme, Gold accents, matching Android App
   ============================================================ */

:root {
    --bg:           #07131F;
    --surface:      #0F1E35;
    --surface2:     #162840;
    --surface3:     #1D3250;
    --primary:      #A8A800;
    --primary-dim:  #6B6B00;
    --primary-glow: rgba(168,168,0,0.25);
    --text:         rgba(255,255,255,0.92);
    --text-dim:     rgba(255,255,255,0.55);
    --text-faint:   rgba(255,255,255,0.30);
    --border:       rgba(255,255,255,0.07);
    --border-gold:  rgba(168,168,0,0.35);
    --accent-red:   #E53935;
    --accent-green: #43A047;
    --overlay-bg:   rgba(7,19,31,0.85);
    --radius:       12px;
    --transition:   0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
#auth-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 60% 40%, #0D2640 0%, #07131F 70%);
    padding: 24px;
    z-index: 9999;
}

.auth-wrapper {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.auth-logo { text-align: center; }
.auth-logo-icon { font-size: 56px; margin-bottom: 8px; }
.auth-logo h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}
.auth-subtitle { color: var(--text-dim); font-size: 14px; }

.qr-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.qr-steps {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qr-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-dim);
}

.step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qr-step strong { color: var(--text); }

.qr-canvas-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    background: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.qr-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ddd;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner-spin 0.8s linear infinite;
}

.qr-status {
    font-size: 13px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
}

.status-dot.pulsing { animation: pulse-dot 1.4s ease-in-out infinite; }
.status-dot.success { background: var(--accent-green); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============================================================
   MAIN APP SHELL
   ============================================================ */
#sparks-app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.sparks-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: env(safe-area-inset-top, 0) 0 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%, transparent 100%);
    pointer-events: none;
}

.sparks-topbar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 8px;
    pointer-events: all;
}

.category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1.5px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cat-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cat-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    font-weight: 700;
}

.search-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.4);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background var(--transition);
}

.search-btn:hover { background: rgba(168,168,0,0.3); }

/* ============================================================
   FEED CONTAINER
   ============================================================ */
.sparks-feed {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}

.sparks-feed::-webkit-scrollbar { display: none; }

/* ============================================================
   SINGLE SPARK PAGE
   ============================================================ */
.spark-page {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

/* Background blur layer */
.spark-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(18px) brightness(0.4);
    transform: scale(1.05);
    z-index: 0;
}

/* Video element */
.spark-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    cursor: pointer;
    display: block;
}

/* Image slideshow container */
.spark-images {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
}

.spark-img-track {
    display: flex;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.spark-img-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Dot indicators for image slideshow */
.spark-dots {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.spark-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: all 0.25s ease;
}

.spark-dot.active {
    width: 20px;
    border-radius: 3px;
    background: var(--primary);
}

/* Bottom gradient overlay */
.spark-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65%;
    background: linear-gradient(to top,
        rgba(0,0,0,0.85) 0%,
        rgba(0,0,0,0.5) 40%,
        transparent 100%
    );
    z-index: 5;
    pointer-events: none;
}

/* Top gradient for topbar readability */
.spark-top-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to bottom,
        rgba(0,0,0,0.5) 0%,
        transparent 100%
    );
    z-index: 5;
    pointer-events: none;
}

/* ============================================================
   CREATOR INFO (bottom left)
   ============================================================ */
.creator-info {
    position: absolute;
    bottom: 24px;
    left: 16px;
    right: 90px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.creator-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.creator-avatar-sm {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2.5px solid var(--primary);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface2);
}

.creator-avatar-sm.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    background: var(--surface2);
}

.creator-meta { flex: 1; min-width: 0; }

.creator-name {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.creator-handle {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.spark-description {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}

.spark-description.expanded {
    -webkit-line-clamp: unset;
    overflow: visible;
}

.spark-tag {
    color: var(--primary);
    font-weight: 600;
}

/* ============================================================
   ACTION BAR (right side)
   ============================================================ */
.action-bar {
    position: absolute;
    bottom: 24px;
    right: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.45);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    flex-shrink: 0;
}

.action-btn:active { transform: scale(0.88); }

.action-btn.liked { color: #ff4d6d; }
.action-btn.liked svg { fill: #ff4d6d; }

.action-btn.saved { color: var(--primary); }
.action-btn.saved svg { fill: var(--primary); }

.action-btn.subscribed {
    background: var(--primary);
    color: #000;
}

.action-btn.subscribed svg { fill: #000; }

.action-label {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    text-align: center;
}

/* Profile add button (+ on avatar) */
.profile-action-btn {
    position: relative;
    width: 52px;
    height: 52px;
}

.profile-action-btn .creator-avatar-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    cursor: pointer;
    background: var(--surface2);
    display: block;
}

.profile-action-btn .subscribe-badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
    color: #000;
    line-height: 1;
    cursor: pointer;
    transition: transform var(--transition);
}

.profile-action-btn .subscribe-badge:hover { transform: translateX(-50%) scale(1.15); }
.profile-action-btn .subscribe-badge.subscribed { background: var(--accent-green); }

/* Vinyl disc animation */
.vinyl-disc {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%,
        #1a1a1a 0%,
        #0a0a0a 30%,
        #2a2a2a 50%,
        #111 70%,
        #000 100%
    );
    border: 2px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.vinyl-disc::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    z-index: 2;
}

.vinyl-disc::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle,
        transparent 0px,
        transparent 3px,
        rgba(255,255,255,0.03) 3px,
        rgba(255,255,255,0.03) 4px
    );
}

.vinyl-disc.spinning {
    animation: vinyl-spin 3s linear infinite;
}

@keyframes vinyl-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Play/Pause tap indicator */
.tap-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
    transition: none;
}

.tap-indicator.show {
    animation: tap-fade 0.6s ease forwards;
}

.tap-indicator svg { width: 36px; height: 36px; fill: #fff; }

@keyframes tap-fade {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    50%  { transform: translate(-50%, -50%) scale(1);   opacity: 0.9; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

/* ============================================================
   18+ BLUR OVERLAY
   ============================================================ */
.adult-overlay {
    position: absolute;
    inset: 0;
    z-index: 15;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    background: rgba(7,19,31,0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px;
    text-align: center;
}

.adult-icon {
    font-size: 48px;
    line-height: 1;
}

.adult-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.adult-subtitle {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.5;
    max-width: 280px;
}

.adult-btn {
    padding: 12px 28px;
    border-radius: 24px;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.adult-btn:hover {
    background: var(--primary);
    color: #000;
}

/* ============================================================
   LOADING / EMPTY STATES
   ============================================================ */
.feed-loader {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg);
    scroll-snap-align: start;
}

.feed-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--surface2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner-spin 0.9s linear infinite;
}

@keyframes spinner-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.feed-empty {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    text-align: center;
    background: var(--bg);
    scroll-snap-align: start;
}

.feed-empty-icon { font-size: 56px; }
.feed-empty h3 { font-size: 20px; font-weight: 700; }
.feed-empty p { color: var(--text-dim); font-size: 14px; }

/* ============================================================
   COMMENTS DRAWER
   ============================================================ */
.comments-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 80vh;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    border-top: 1px solid var(--border);
}

.comments-drawer.open {
    transform: translateY(0);
}

.comments-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 12px auto 0;
    flex-shrink: 0;
}

.comments-header {
    padding: 14px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.comments-title {
    font-size: 16px;
    font-weight: 700;
}

.comments-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.comments-close:hover { background: var(--surface3); }

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface2);
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

.comment-body { flex: 1; min-width: 0; }
.comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 3px;
}

.comment-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
}

.comment-time { font-size: 12px; color: var(--text-faint); }

.comment-like-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color var(--transition);
}

.comment-like-btn:hover { color: #ff4d6d; }
.comment-like-btn.liked { color: #ff4d6d; }
.comment-like-btn svg { width: 14px; height: 14px; }

.comments-input-row {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 10px;
    align-items: flex-end;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.comments-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    font-family: inherit;
    transition: border-color var(--transition);
}

.comments-input:focus { border-color: var(--primary); }
.comments-input::placeholder { color: var(--text-faint); }

.comments-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity var(--transition);
}

.comments-send:disabled { opacity: 0.4; cursor: not-allowed; }
.comments-send svg { width: 20px; height: 20px; }

.comments-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--text-dim);
    font-size: 14px;
    gap: 10px;
}

/* ============================================================
   DRAWER BACKDROP
   ============================================================ */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 490;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.visible {
    opacity: 1;
    pointer-events: all;
}

/* ============================================================
   PROFILE PANEL
   ============================================================ */
.profile-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100%);
    background: var(--surface);
    z-index: 600;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    border-left: 1px solid var(--border);
}

.profile-panel.open {
    transform: translateX(0);
}

.profile-panel-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

.panel-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition);
}

.panel-back:hover { background: var(--surface3); }

.profile-panel-scroll {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 20px 20px;
    gap: 12px;
}

.profile-avatar-lg {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    object-fit: cover;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

.profile-display-name {
    font-size: 20px;
    font-weight: 800;
    text-align: center;
}

.profile-handle-text {
    font-size: 14px;
    color: var(--text-dim);
    text-align: center;
}

.profile-stats {
    display: flex;
    gap: 24px;
    margin: 4px 0;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.profile-stat-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.profile-stat-label {
    font-size: 12px;
    color: var(--text-dim);
}

.profile-subscribe-btn {
    padding: 10px 32px;
    border-radius: 24px;
    border: 2px solid var(--primary);
    background: var(--primary);
    color: #000;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}

.profile-subscribe-btn.subscribed {
    background: transparent;
    color: var(--primary);
}

.profile-subscribe-btn:hover { opacity: 0.85; }

.profile-sparks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 0 0 32px;
}

.profile-grid-thumb {
    aspect-ratio: 9/16;
    object-fit: cover;
    width: 100%;
    background: var(--surface2);
    cursor: pointer;
    transition: opacity var(--transition);
    display: block;
}

.profile-grid-thumb:hover { opacity: 0.75; }

.profile-grid-placeholder {
    aspect-ratio: 9/16;
    width: 100%;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    font-size: 24px;
    cursor: pointer;
}

/* ============================================================
   SEARCH OVERLAY
   ============================================================ */
.search-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 700;
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.search-overlay.open {
    transform: translateY(0);
}

.search-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-dim);
    pointer-events: none;
}

.search-field {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 16px 10px 42px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition);
    font-family: inherit;
}

.search-field:focus { border-color: var(--primary); }
.search-field::placeholder { color: var(--text-faint); }

.search-cancel {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    padding: 4px;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.search-result-item {
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: background var(--transition);
}

.search-result-item:hover { background: var(--surface); }

.search-result-thumb {
    width: 64px;
    height: 96px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface2);
    flex-shrink: 0;
}

.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-weight: 600; margin-bottom: 3px; }
.search-result-handle { font-size: 13px; color: var(--text-dim); }
.search-result-desc {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 32px;
    text-align: center;
    color: var(--text-dim);
    font-size: 15px;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    animation: toast-in 0.3s ease, toast-out 0.3s ease 2.2s forwards;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ============================================================
   HEART BURST ANIMATION
   ============================================================ */
.heart-burst {
    position: absolute;
    font-size: 72px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 50;
    pointer-events: none;
    animation: heart-pop 0.7s ease forwards;
    line-height: 1;
}

@keyframes heart-pop {
    0%   { transform: translate(-50%, -50%) scale(0);   opacity: 1; }
    40%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    80%  { transform: translate(-50%, -50%) scale(1);   opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0; }
}

/* ============================================================
   LIKE COUNTER ANIMATION
   ============================================================ */
.count-bump {
    animation: count-bump 0.3s ease;
}

@keyframes count-bump {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ============================================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 480px) {
    .action-bar { right: 8px; gap: 12px; }
    .action-btn { width: 44px; height: 44px; }
    .creator-info { left: 12px; right: 76px; }
    .profile-panel { width: 100%; }
    .category-tabs { gap: 4px; }
    .cat-tab { padding: 6px 12px; font-size: 13px; }
}

@media (min-width: 768px) {
    .sparks-feed {
        max-width: 480px;
        margin: 0 auto;
    }

    .sparks-topbar {
        max-width: 480px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 480px;
    }

    #sparks-app {
        background: #000;
    }
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg,
        var(--surface2) 25%,
        var(--surface3) 50%,
        var(--surface2) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-gold   { color: var(--primary); }
.text-dim    { color: var(--text-dim); }
.text-faint  { color: var(--text-faint); }
.fw-700      { font-weight: 700; }
.text-center { text-align: center; }

.divider {
    width: 100%;
    height: 1px;
    background: var(--border);
    flex-shrink: 0;
}

.btn-gold {
    padding: 10px 24px;
    border-radius: 20px;
    border: none;
    background: var(--primary);
    color: #000;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity var(--transition);
}

.btn-gold:hover { opacity: 0.85; }
.btn-gold:active { opacity: 0.7; }
