:root {
    --bg: #050505;
    --surface: rgba(255, 255, 255, 0.045);
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.48);
    --ios-border: rgba(255, 255, 255, 0.07);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-soft: cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* Thin momentum scrollbar */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    padding: calc(96px + env(safe-area-inset-top)) 0 calc(96px + env(safe-area-inset-bottom)) 0;
    overflow-x: hidden;
    min-height: 100dvh;
    /* iOS momentum scroll */
    -webkit-overflow-scrolling: touch;
}

/* Glow: off for perf */
.bg-glow, .glow-1 { display: none; }

/* ─── Feed Container ─────────────────── */
.feed-container {
    max-width: 450px;
    margin: 0 auto;
    padding: 10px 12px;
}

/* ─── Post Card ──────────────────────── */
.post-card {
    background: var(--surface);
    border-radius: 22px;
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid var(--ios-border);
    /* Staggered entrance set by JS inline style */
    animation: cardIn 0.45s var(--spring-soft) both;
    opacity: 0;
    contain: layout style;
    /* Press effect */
    transition: transform 0.18s var(--spring), box-shadow 0.18s ease;
    cursor: default;
}

/* Subtle depress when tapped */
.post-card:active {
    transform: scale(0.985);
}

@media (max-width: 420px) {
    .feed-container { padding: 8px 10px; }
    .post-card { border-radius: 18px; margin-bottom: 14px; }
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Post Header ────────────────────── */
.post-header {
    padding: 12px 14px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 1.5px solid var(--ios-border);
    object-fit: cover;
    /* Spring on tap */
    transition: transform 0.2s var(--spring);
}
.user-avatar:active { transform: scale(0.9); }

.username {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: -0.1px;
}

.post-time {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 400;
    margin-top: 1px;
}

/* ─── Post Image ─────────────────────── */
.post-image {
    width: 100%;
    background-color: #0a0a0a;
    position: relative;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    /* Prevent layout shift */
    transform: translateZ(0);
}

/* ─── Post Content ───────────────────── */
.post-content {
    padding: 10px 14px 14px;
}

.post-text {
    font-size: 0.88rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.82);
}

.post-text .author {
    font-weight: 700;
    margin-right: 5px;
    color: #fff;
}

.post-text .caption { font-weight: 400; }

/* ─── Loading ────────────────────────── */
.loading-text {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ─── Like Button: Heart Burst ───────── */
@keyframes heartBurst {
    0%  { transform: scale(1);   opacity: 1; fill: none; }
    40% { transform: scale(1.7); opacity: 1; fill: #ff3b30; color: #ff3b30; }
    70% { transform: scale(2.2); opacity: 0.6; }
    100%{ transform: scale(2.5); opacity: 0; }
}

.anim-burst {
    animation: heartBurst 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    pointer-events: none;
    color: #ff3b30;
}

/* ─── Like Count Text ────────────────── */
.like-text {
    font-weight: 700;
    color: #ff3b30;
    font-size: 0.88rem;
}

@keyframes likePop {
    0%  { transform: translateY(6px) scale(0.8); opacity: 0; }
    60% { transform: translateY(-2px) scale(1.08); opacity: 1; }
    100%{ transform: translateY(0) scale(1); opacity: 1; }
}

.like-text.just-liked {
    animation: likePop 0.4s var(--spring) forwards;
}

/* --- Bottom Sheet Modals --- */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sheet-overlay.active {
    display: block;
    opacity: 1;
}
.sheet-content {
    position: fixed;
    bottom: calc(90px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    background: rgba(18, 18, 18, 0.95);
    border-radius: 24px;
    padding: 20px;
    z-index: 1001;
    transform: translateY(150%);
    transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
    max-width: 420px;
    margin: 0 auto;
    border: 1px solid var(--ios-border);
    max-height: calc(75vh - 90px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.sheet-content.active {
    transform: translateY(0);
}
.sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: -8px auto 16px;
    flex-shrink: 0;
}
.sheet-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
    flex-shrink: 0;
}
.comments-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}
.comment-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: commentIn 0.3s var(--spring-soft) both;
}
@keyframes commentIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--ios-border);
    background: #1a1a1a;
}
.comment-body {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    border-radius: 16px;
    border: 1px solid var(--ios-border);
}
.comment-user {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 3px;
    color: #fff;
}
.comment-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
}
.comment-time {
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 4px;
    display: block;
}
.comment-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ios-border);
    border-radius: 20px;
    padding: 6px 6px 6px 14px;
    margin-top: auto;
    flex-shrink: 0;
}
.comment-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    padding: 8px 0;
    font-family: inherit;
}
.comment-input-wrapper button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s var(--spring);
}
.comment-input-wrapper button:active {
    transform: scale(0.88);
}
body.no-scroll {
    overflow: hidden;
}

/* Style for comment count icon button */
.comment-action-btn {
    cursor: pointer;
    width: 24px;
    transition: transform 0.2s var(--spring);
}
.comment-action-btn:active {
    transform: scale(0.82);
}
.comment-count-text {
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 500;
    margin-left: 2px;
}

.reply-tag {
    color: #3897f0;
    font-weight: 600;
    margin-right: 4px;
    cursor: pointer;
}
