/* ============================================================
   AdProof — Instagram Clone UI v2
   Pixel-perfect replica, mobile-first, light + dark
   System theme detection + manual override
   ============================================================ */

/* System theme: auto-detect */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #000000;
        --bg-secondary: #000000;
        --bg-elevated: #262626;
        --bg-wash: #121212;
        --separator: #262626;
        --border: #363636;
        --text-primary: #f5f5f5;
        --text-secondary: #a8a8a8;
        --text-tertiary: #555555;
        --text-link: #e0f1ff;
        --header-bg: #000000;
        --header-border: #262626;
        --nav-bg: #000000;
        --nav-border: #262626;
        --story-seen: #555555;
        --overlay: rgba(0,0,0,0.8);
        --modal-bg: #262626;
        --skeleton: #363636;
    }
}

:root, [data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --bg-elevated: #ffffff;
    --bg-wash: #fafafa;
    --separator: #efefef;
    --border: #dbdbdb;
    --text-primary: #000000;
    --text-secondary: #737373;
    --text-tertiary: #c7c7c7;
    --text-link: #00376b;
    --blue: #0095f6;
    --blue-hover: #1877f2;
    --red: #ff3040;
    --green: #58c322;
    --header-bg: #ffffff;
    --header-border: #dbdbdb;
    --nav-bg: #ffffff;
    --nav-border: #dbdbdb;
    --story-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --story-seen: #c7c7c7;
    --overlay: rgba(0,0,0,0.5);
    --modal-bg: #ffffff;
    --skeleton: #efefef;
}

[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-elevated: #262626;
    --bg-wash: #121212;
    --separator: #262626;
    --border: #363636;
    --text-primary: #f5f5f5;
    --text-secondary: #a8a8a8;
    --text-tertiary: #555555;
    --text-link: #e0f1ff;
    --header-bg: #000000;
    --header-border: #262626;
    --nav-bg: #000000;
    --nav-border: #262626;
    --story-seen: #555555;
    --overlay: rgba(0,0,0,0.8);
    --modal-bg: #262626;
    --skeleton: #363636;
}

/* ============ RESET ============ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100%;
    font-size: 14px;
    line-height: 18px;
}

button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ============ SHELL LAYOUT ============ */
.ig-shell {
    max-width: 470px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
}

/* ============ HEADER — exact IG ============ */
.ig-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    height: 44px;
}

.ig-header-inner {
    max-width: 470px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.ig-logo-wrap {
    display: flex; align-items: center; gap: 3px;
}

.ig-logo {
    font-size: 25px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 44px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ig-logo-caret {
    display: flex; align-items: center;
    color: var(--text-primary);
}

.ig-header-icons {
    display: flex; align-items: center; gap: 20px;
}

.ig-icon-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-primary);
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    position: relative;
    width: 24px; height: 24px;
}

.ig-icon-btn svg { width: 24px; height: 24px; }

.ig-badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px;
    background: var(--red);
    color: #fff;
    font-size: 11px; font-weight: 600;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--header-bg);
}

.ig-badge-dot {
    position: absolute; top: -2px; right: -2px;
    width: 8px; height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--header-bg);
}

/* ============ STORIES TRAY — exact IG ============ */
.ig-stories-tray {
    position: fixed;
    top: 44px; left: 0; right: 0;
    z-index: 90;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--separator);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    height: 100px;
    padding: 8px 4px 8px 12px;
}
.ig-stories-tray::-webkit-scrollbar { display: none; }

.ig-stories-tray.hidden {
    display: none;
}

.ig-story-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: 64px;
    margin-right: 6px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ig-story-ring {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--story-gradient);
    padding: 2.5px;
    margin-bottom: 4px;
    transition: opacity 0.15s;
}

.ig-story-ring.seen {
    background: var(--story-seen);
}

.ig-story-ring-inner {
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 2.5px solid var(--bg-secondary);
    overflow: hidden;
    background: var(--skeleton);
}

.ig-story-ring-inner img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.ig-story-initial {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #515BD4, #8134AF, #DD2A7B, #FEDA77);
    color: #fff;
    font-size: 20px; font-weight: 700;
}

.ig-story-username {
    font-size: 11px;
    color: var(--text-primary);
    text-align: center;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 14px;
}

/* ============ MAIN FEED ============ */
.ig-main {
    padding-top: 144px;
    padding-bottom: 50px;
    max-width: 470px;
    margin: 0 auto;
}

.ig-main.no-stories {
    padding-top: 44px;
}

/* ============ POST — exact IG ============ */
.ig-post {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--separator);
}

/* Post header */
.ig-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 8px 12px;
    height: 54px;
}

.ig-post-header-left {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}

.ig-post-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--skeleton);
}

.ig-post-avatar img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.ig-post-avatar-initial {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #515BD4, #8134AF, #DD2A7B, #FEDA77);
    color: #fff; font-size: 13px; font-weight: 700;
}

.ig-post-user-info {
    min-width: 0;
}

.ig-post-username-row {
    display: flex; align-items: center; gap: 4px;
}

.ig-post-username {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ig-verified-badge {
    width: 12px; height: 12px; flex-shrink: 0;
}

.ig-post-location {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 16px;
}

.ig-post-more-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    margin-right: -8px;
    display: flex; align-items: center;
    -webkit-tap-highlight-color: transparent;
}

/* Post media */
.ig-post-media {
    position: relative;
    width: 100%;
    background: #1a1a1a;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

.ig-post-media > img,
.ig-post-media > video {
    width: 100%;
    display: block;
    object-fit: contain;
    max-height: 585px;
    background: #1a1a1a;
}

/* Carousel */
.ig-carousel-wrap {
    position: relative;
    overflow: hidden;
}

.ig-carousel-track {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    touch-action: pan-y;
}

.ig-carousel-slide {
    min-width: 100%;
    flex-shrink: 0;
}

.ig-carousel-slide img,
.ig-carousel-slide video {
    width: 100%; display: block;
    object-fit: contain;
    max-height: 585px;
    background: #1a1a1a;
}

.ig-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 8px 0 0;
}

.ig-carousel-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: background 0.2s, transform 0.2s;
}

.ig-carousel-dot.active {
    background: var(--blue);
    transform: scale(1.1);
}

/* Carousel nav arrows */
.ig-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.87);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 3;
    opacity: 0;
    transition: opacity 0.15s;
}

.ig-carousel-wrap:hover .ig-carousel-arrow { opacity: 1; }
.ig-carousel-arrow.prev { left: 8px; }
.ig-carousel-arrow.next { right: 8px; }
.ig-carousel-arrow svg { width: 16px; height: 16px; fill: #333; }

/* Video mute/unmute toggle — IG style */
.ig-mute-btn {
    position: absolute;
    bottom: 14px; right: 14px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(38,38,38,0.8);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 4;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}

.ig-mute-btn svg { width: 12px; height: 12px; fill: #fff; }

.ig-mute-btn.fade {
    animation: muteFade 2s ease forwards;
}

@keyframes muteFade {
    0%, 60% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Reel mute button */
.ig-reel .ig-mute-btn {
    bottom: auto;
    top: 14px; right: 14px;
}

/* Double-tap heart animation */
.ig-heart-pop {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 10;
    pointer-events: none;
    opacity: 0;
}

.ig-heart-pop.animate {
    animation: heartPop 0.8s ease forwards;
}

@keyframes heartPop {
    0% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
    15% { transform: translate(-50%,-50%) scale(1.2); opacity: 1; }
    30% { transform: translate(-50%,-50%) scale(0.95); opacity: 1; }
    45%, 70% { transform: translate(-50%,-50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1); opacity: 0; }
}

/* Actions bar — exact IG spacing */
.ig-post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px 0;
    height: 40px;
}

.ig-actions-left {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: -8px;
}

.ig-actions-right {
    margin-right: -8px;
}

.ig-action-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.1s;
}

.ig-action-btn:active { opacity: 0.5; }
.ig-action-btn svg { width: 24px; height: 24px; }

.ig-action-btn.liked svg { color: var(--red); fill: var(--red); }
.ig-action-btn.liked { animation: likeBounce 0.3s ease; }

@keyframes likeBounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(0.95); }
}

/* Post info section — exact IG */
.ig-post-info {
    padding: 0 12px 12px;
}

.ig-likes-count {
    font-size: 14px; font-weight: 600;
    margin-bottom: 4px;
    cursor: default;
}

.ig-caption {
    font-size: 14px;
    line-height: 18px;
    margin-bottom: 4px;
    word-wrap: break-word;
}

.ig-caption-username {
    font-weight: 600;
    margin-right: 4px;
}

.ig-caption-more {
    color: var(--text-secondary);
    cursor: pointer;
    border: none; background: none;
    font: inherit;
}

.ig-view-comments {
    font-size: 14px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
    cursor: pointer;
    border: none; background: none;
    font: inherit; padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.ig-add-comment-row {
    display: none; /* Hidden on mobile like real IG */
}

.ig-post-time {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.2px;
    line-height: 18px;
}

/* ============ BOTTOM NAV — exact IG ============ */
.ig-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    height: 50px;
}

.ig-nav-inner {
    max-width: 470px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.ig-nav-item {
    background: none; border: none; cursor: pointer;
    color: var(--text-primary);
    padding: 6px 12px;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.ig-nav-item svg { width: 24px; height: 24px; }
.ig-nav-item .nav-fill { display: none; }
.ig-nav-item .nav-outline { display: block; }
.ig-nav-item.active .nav-fill { display: block; }
.ig-nav-item.active .nav-outline { display: none; }

.ig-nav-profile {
    width: 24px; height: 24px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid transparent;
}

.ig-nav-item.active .ig-nav-profile {
    border-color: var(--text-primary);
}

.ig-nav-profile img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.ig-nav-profile-initial {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #515BD4, #DD2A7B);
    color: #fff; font-size: 11px; font-weight: 700;
}

/* ============ STORY VIEWER — fullscreen ============ */
.ig-story-viewer {
    position: fixed; inset: 0;
    z-index: 200;
    background: #000;
    display: none;
}

.ig-story-viewer.open { display: flex; flex-direction: column; }

.ig-story-progress {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    gap: 3px;
    padding: 6px 6px 0;
    z-index: 10;
}

.ig-story-bar {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,0.35);
    border-radius: 1px;
    overflow: hidden;
}

.ig-story-bar-fill {
    height: 100%;
    background: #fff;
    width: 0%;
    border-radius: 1px;
}

.ig-story-bar-fill.completed { width: 100%; }

.ig-story-header {
    position: absolute;
    top: 14px; left: 8px; right: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.ig-story-user {
    display: flex; align-items: center; gap: 8px;
}

.ig-story-user img {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.ig-story-user-initial {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #515BD4, #DD2A7B);
    color: #fff; font-size: 13px; font-weight: 700;
}

.ig-story-user-name {
    color: #fff; font-size: 13px; font-weight: 600;
}

.ig-story-time {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    margin-left: 8px;
}

.ig-story-close {
    background: none; border: none;
    cursor: pointer; padding: 4px;
    color: #fff;
    display: flex; align-items: center;
}

.ig-story-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ig-story-media img,
.ig-story-media video {
    width: 100%; height: 100%;
    object-fit: contain;
}

.ig-story-tap-left,
.ig-story-tap-right {
    position: absolute;
    top: 50px; bottom: 0;
    width: 35%;
    z-index: 5;
    cursor: pointer;
}
.ig-story-tap-left { left: 0; }
.ig-story-tap-right { right: 0; width: 65%; }

/* ============ MODALS — IG bottom sheet ============ */
.ig-overlay {
    position: fixed; inset: 0;
    z-index: 150;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.ig-overlay.open { display: flex; }

.ig-overlay-bg {
    position: absolute; inset: 0;
    background: var(--overlay);
}

.ig-sheet {
    position: relative;
    z-index: 1;
    background: var(--modal-bg);
    width: 100%;
    max-width: 470px;
    border-radius: 12px 12px 0 0;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: sheetUp 0.25s ease;
}

@keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.ig-sheet-handle {
    width: 36px; height: 4px;
    background: var(--text-tertiary);
    border-radius: 2px;
    margin: 10px auto 0;
}

.ig-sheet-title {
    text-align: center;
    font-size: 16px; font-weight: 700;
    padding: 12px 16px;
    border-bottom: 1px solid var(--separator);
    position: relative;
}

.ig-sheet-close {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    cursor: pointer; color: var(--text-primary);
    display: flex; padding: 4px;
}

.ig-sheet-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

/* Comments */
.ig-comment {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
}

.ig-comment-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--skeleton);
}

.ig-comment-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ig-comment-avatar-initial {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #515BD4, #DD2A7B);
    color: #fff; font-size: 12px; font-weight: 700;
}

.ig-comment-body {
    flex: 1; min-width: 0;
}

.ig-comment-username {
    font-size: 13px; font-weight: 600;
}

.ig-comment-text {
    font-size: 14px; line-height: 18px;
    word-wrap: break-word;
}

.ig-comment-meta {
    display: flex; gap: 12px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.ig-comment-input-bar {
    display: flex; align-items: center;
    padding: 10px 16px;
    border-top: 1px solid var(--separator);
    gap: 12px;
    background: var(--modal-bg);
}

.ig-comment-field {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px; font-family: inherit;
    color: var(--text-primary);
    outline: none;
    padding: 0;
    min-height: 18px;
}

.ig-comment-field::placeholder { color: var(--text-secondary); }

.ig-comment-post {
    background: none; border: none;
    color: var(--blue);
    font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    opacity: 0.4;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.ig-comment-post.active { opacity: 1; }

/* Menu sheet */
.ig-menu-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    border: none; background: none;
    width: 100%; text-align: left;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.ig-menu-item:active { background: var(--bg-wash); }
.ig-menu-item.destructive { color: var(--red); }

.ig-menu-divider {
    height: 6px;
    background: var(--separator);
}

.ig-menu-section-title {
    padding: 14px 16px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ig-approval-row {
    display: flex; gap: 8px;
    padding: 6px 16px 14px;
    flex-wrap: wrap;
}

.ig-approval-pill {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-wash);
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.ig-approval-pill.sel-pending   { background: var(--bg-elevated); border-color: var(--text-secondary); }
.ig-approval-pill.sel-approved  { background: #dcfce7; border-color: var(--green); color: #166534; }
.ig-approval-pill.sel-revision  { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.ig-approval-pill.sel-rejected  { background: #fde2e2; border-color: var(--red); color: #991b1b; }

[data-theme="dark"] .ig-approval-pill.sel-approved  { background: rgba(88,195,34,0.15); color: #86efac; }
[data-theme="dark"] .ig-approval-pill.sel-revision  { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .ig-approval-pill.sel-rejected  { background: rgba(255,48,64,0.15); color: #fca5a5; }

/* Share sheet */
.ig-share-grid {
    display: flex;
    padding: 20px 16px;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.ig-share-item {
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
    background: none; border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 11px; font-family: inherit;
    width: 72px;
}

.ig-share-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--bg-wash);
    border: 1px solid var(--separator);
    display: flex; align-items: center; justify-content: center;
}

/* ============ REELS ============ */
.ig-reels-view {
    position: fixed;
    top: 44px; bottom: 50px;
    left: 0; right: 0;
    z-index: 80;
    background: #000;
    display: none;
}

.ig-reels-view.open { display: block; }

.ig-reels-scroll {
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}
.ig-reels-scroll::-webkit-scrollbar { display: none; }

.ig-reel {
    height: 100%;
    scroll-snap-align: start;
    position: relative;
    display: flex; align-items: center; justify-content: center;
}

.ig-reel video {
    width: 100%; height: 100%;
    object-fit: cover;
}

.ig-reel-info {
    position: absolute;
    bottom: 16px; left: 12px; right: 56px;
    color: #fff; z-index: 5;
}

.ig-reel-user-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}

.ig-reel-user-row img {
    width: 28px; height: 28px;
    border-radius: 50%; object-fit: cover;
    border: 1.5px solid #fff;
}

.ig-reel-username { font-size: 13px; font-weight: 600; }

.ig-reel-follow-btn {
    padding: 4px 12px;
    border: 1px solid #fff;
    border-radius: 8px;
    color: #fff;
    font-size: 12px; font-weight: 600;
    background: none;
    cursor: pointer;
    margin-left: 8px;
}

.ig-reel-caption {
    font-size: 13px; line-height: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ig-reel-actions {
    position: absolute;
    right: 8px; bottom: 80px;
    display: flex; flex-direction: column;
    align-items: center; gap: 16px; z-index: 5;
}

.ig-reel-action {
    display: flex; flex-direction: column;
    align-items: center; gap: 2px;
    background: none; border: none;
    cursor: pointer; color: #fff;
}

.ig-reel-action svg { width: 28px; height: 28px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }

.ig-reel-action-count {
    font-size: 12px; font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ============ EXPLORE GRID ============ */
.ig-explore-view {
    padding-top: 44px;
    padding-bottom: 50px;
    max-width: 470px;
    margin: 0 auto;
    display: none;
}

.ig-explore-view.open { display: block; }

.ig-explore-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
}

.ig-explore-item {
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: var(--skeleton);
}

.ig-explore-item.span-2 {
    grid-column: span 2;
    grid-row: span 2;
}

.ig-explore-item img,
.ig-explore-item video {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}

.ig-explore-badge {
    position: absolute; top: 8px; right: 8px;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

/* ============ ANNOTATIONS ============ */
.ig-anno-pin {
    position: absolute;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 5;
    border: 2px solid rgba(255,255,255,0.5);
    transition: transform 0.1s;
}

.ig-anno-pin:active { transform: translate(-50%,-50%) scale(0.9); }
.ig-anno-pin svg { width: 14px; height: 14px; fill: #fff; }

.ig-anno-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px; line-height: 16px;
    max-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    white-space: normal;
    pointer-events: none;
    z-index: 6;
}

.ig-anno-tooltip strong {
    display: block;
    font-size: 12px;
    margin-bottom: 2px;
}

.ig-anno-tooltip::after {
    content: '';
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-elevated);
}

.ig-anno-input {
    position: fixed; z-index: 160;
    background: var(--bg-elevated);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: none;
    padding: 8px;
    gap: 8px;
    width: 260px;
    flex-direction: row;
    border: 1px solid var(--border);
}

.ig-anno-input.open { display: flex; }

.ig-anno-input input {
    flex: 1;
    border: none;
    background: var(--bg-wash);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px; font-family: inherit;
    color: var(--text-primary);
    outline: none;
}

.ig-anno-input button {
    background: var(--blue);
    color: #fff; border: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    white-space: nowrap;
}

/* ============ LOADING ============ */
.ig-loading {
    display: flex; justify-content: center;
    padding: 32px;
}

.ig-spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--skeleton);
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty */
.ig-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}
.ig-empty h3 { font-size: 16px; color: var(--text-primary); margin-bottom: 4px; }

/* ============ UTILITIES ============ */
.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* New post indicator */
.ig-new-dot {
    width: 6px; height: 6px;
    background: var(--blue);
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

/* ============ CAMPAIGN PROFILE VIEW ============ */
.ig-profile-view {
    padding-top: 44px;
    padding-bottom: 50px;
    max-width: 470px;
    margin: 0 auto;
    display: none;
}

.ig-profile-view.open { display: block; }

.ig-profile-header {
    padding: 16px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.ig-profile-pic {
    width: 77px; height: 77px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--skeleton);
}

.ig-profile-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ig-profile-pic-initial {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #515BD4, #8134AF, #DD2A7B, #FEDA77);
    color: #fff; font-size: 28px; font-weight: 700;
}

.ig-profile-stats {
    flex: 1;
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding-top: 10px;
}

.ig-profile-stat-num {
    font-size: 17px; font-weight: 700;
    display: block;
}

.ig-profile-stat-label {
    font-size: 13px;
    color: var(--text-primary);
}

.ig-profile-info {
    padding: 0 16px 16px;
}

.ig-profile-name {
    font-size: 14px; font-weight: 600;
    display: flex; align-items: center; gap: 4px;
}

.ig-profile-bio {
    font-size: 14px;
    line-height: 18px;
    margin-top: 2px;
    color: var(--text-primary);
}

.ig-profile-actions {
    display: flex; gap: 6px;
    padding: 0 16px 12px;
}

.ig-profile-btn {
    flex: 1;
    padding: 7px 0;
    border-radius: 8px;
    font-size: 14px; font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-wash);
    color: var(--text-primary);
    font-family: inherit;
}

.ig-profile-btn.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.ig-profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--separator);
}

.ig-profile-tab {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    background: none; border: none;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 1px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
}

.ig-profile-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.ig-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
}

.ig-profile-grid-item {
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: var(--skeleton);
}

.ig-profile-grid-item img,
.ig-profile-grid-item video {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}

.ig-profile-grid-badge {
    position: absolute; top: 6px; right: 6px;
    color: #fff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.ig-profile-back {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 101;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    height: 44px;
    display: flex; align-items: center;
    padding: 0 12px;
    gap: 12px;
    max-width: 470px;
    margin: 0 auto;
}

.ig-profile-back-btn {
    background: none; border: none;
    cursor: pointer; color: var(--text-primary);
    display: flex; align-items: center;
    padding: 4px;
}

.ig-profile-back-title {
    font-size: 16px; font-weight: 600;
}

@media (min-width: 471px) {
    .ig-profile-back { left: 50%; transform: translateX(-50%); width: 470px; }
}

/* ============ COMMENT REPLIES ============ */
.ig-comment-replies {
    margin-left: 44px;
    margin-top: 4px;
}

.ig-comment-replies .ig-comment {
    padding: 8px 16px 8px 0;
}

.ig-comment-replies .ig-comment-avatar {
    width: 24px; height: 24px;
}

.ig-comment-replies .ig-comment-avatar-initial {
    font-size: 10px;
}

.ig-reply-toggle {
    margin-left: 44px;
    padding: 4px 0;
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    background: none; border: none;
    cursor: pointer; font-family: inherit;
}

.ig-reply-btn {
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    background: none; border: none;
    cursor: pointer; font-family: inherit;
    padding: 0;
}

.ig-replying-to {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 16px;
    background: var(--bg-wash);
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid var(--separator);
}

.ig-replying-to-cancel {
    background: none; border: none;
    cursor: pointer; color: var(--text-secondary);
    font-size: 18px; padding: 0 4px;
    font-family: inherit;
}

/* ============ RESPONSIVE ============ */
@media (min-width: 471px) {
    .ig-header, .ig-nav { left: 50%; transform: translateX(-50%); width: 470px; }
    .ig-stories-tray { max-width: 470px; left: 50%; transform: translateX(-50%); }
}

@media (min-width: 735px) {
    .ig-post { border: 1px solid var(--separator); border-radius: 8px; margin-bottom: 12px; }
}
