* {
    box-sizing: border-box;
}

:root {
    --bg: #eef4ff;
    --card: #ffffff;
    --line: #d9e5fb;
    --text: #16243a;
    --muted: #5a6f8f;
    --accent: #0b57d0;
    --accent-2: #12a3c8;
}

body {
    margin: 0;
    font-family: 'Nunito Sans', sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 20% 0%, #d9e9ff 0%, #eef4ff 35%, #f6faff 100%);
    min-height: 100vh;
}

.bg-orb {
    position: fixed;
    width: 40vw;
    height: 40vw;
    border-radius: 50%;
    z-index: -1;
    filter: blur(44px);
    opacity: 0.22;
}

.orb-a {
    left: -12vw;
    top: -12vw;
    background: #1b74e4;
}

.orb-b {
    right: -14vw;
    top: 20vh;
    background: #16b0cf;
}

.feed-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(11, 87, 208, 0.13);
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.brand-wrap h1 {
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    margin: 0;
    line-height: 1;
}

.brand-wrap p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #c7d8f8;
    background: #fff;
    color: #2a4f8a;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
}

.feed-shell {
    width: min(760px, 100%);
    margin: 14px auto;
    padding: 0 10px 18px;
}

.feed-tools {
    margin-bottom: 8px;
}

#feed-search {
    width: 100%;
    border: 1px solid #cfe0fb;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
}

.stories-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: none;
}

.stories-strip::-webkit-scrollbar {
    display: none;
}

.story-item {
    min-width: 78px;
    max-width: 86px;
    background: #fff;
    border: 1px solid #d8e4fa;
    border-radius: 14px;
    padding: 8px 6px;
    text-align: center;
    box-shadow: 0 5px 14px rgba(13, 35, 73, 0.08);
}

.story-item.story-create {
    cursor: pointer;
    border-style: dashed;
    border-color: #b7cff8;
    background: #f8fbff;
}

.story-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(120deg, #2d7be4, #18accb);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #8dd7ff;
}

.story-name {
    font-size: 11px;
    font-weight: 700;
    color: #38547c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-card,
.feed-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 26px rgba(13, 35, 73, 0.07);
}

.composer-card {
    padding: 12px;
    margin-bottom: 12px;
}

.composer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.composer-title {
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 700;
}

.status-pill {
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 8px;
    background: #e9f5ff;
    color: #2a5a9d;
}

#post-text {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    border: 1px solid #d5e2fb;
    border-radius: 12px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
}

.composer-actions {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    margin-top: 8px;
}

.upload-btn,
.publish-btn {
    border: none;
    border-radius: 12px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e8f4ff;
    color: #184983;
    border: 1px solid #cae1ff;
}

.upload-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

#post-image-url {
    border: 1px solid #d5e2fb;
    border-radius: 12px;
    padding: 9px 10px;
    font-size: 13px;
}

.publish-btn {
    background: linear-gradient(120deg, var(--accent), #1a84ea);
    color: #fff;
}

.image-preview-wrap {
    margin-top: 8px;
    border: 1px dashed #c8dbfb;
    border-radius: 12px;
    padding: 8px;
}

.image-preview-wrap img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 10px;
}

.image-preview-wrap button {
    margin-top: 7px;
    border: 1px solid #d6e3f8;
    background: #f4f8ff;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    cursor: pointer;
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feed-card {
    padding: 12px;
}

.feed-skeleton {
    position: relative;
    overflow: hidden;
}

.feed-skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -130px;
    width: 120px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.75), rgba(255,255,255,0));
    animation: shimmer 1.4s infinite;
}

.skeleton-line {
    height: 12px;
    background: #e9f0fd;
    border-radius: 999px;
    margin-bottom: 8px;
}

.skeleton-line.lg { width: 78%; }
.skeleton-line.md { width: 58%; }
.skeleton-line.sm { width: 38%; }

.skeleton-media {
    height: 170px;
    background: #e6eefc;
    border-radius: 12px;
    margin-bottom: 8px;
}

@keyframes shimmer {
    0% { transform: translateX(0); }
    100% { transform: translateX(980px); }
}

.feed-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.feed-author {
    display: flex;
    gap: 8px;
    align-items: center;
}

.feed-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(120deg, #2d7be4, #18accb);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.feed-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 20px;
}

.comment-avatar {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.profile-open-btn {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
}

.feed-name {
    font-weight: 800;
    font-size: 14px;
    color: #1a4780;
}

.feed-time {
    color: var(--muted);
    font-size: 11px;
}

.feed-menu {
    display: flex;
    gap: 6px;
}

.feed-text {
    white-space: pre-wrap;
    font-size: 14px;
    margin-bottom: 8px;
}

.feed-image {
    width: 100%;
    border-radius: 12px;
    max-height: 420px;
    object-fit: cover;
    border: 1px solid #d8e5fb;
    margin-bottom: 8px;
    cursor: zoom-in;
}

.feed-stats {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 7px;
}

.feed-actions {
    display: flex;
    gap: 7px;
    margin-bottom: 8px;
}

.action-btn {
    border: 1px solid #d5e2fb;
    background: #f2f7ff;
    color: #264d86;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.action-btn.active {
    background: #dcecff;
    border-color: #bad7ff;
}

.like-burst {
    position: fixed;
    pointer-events: none;
    z-index: 999;
}

.like-burst span {
    position: absolute;
    font-size: 14px;
    animation: burst-float 0.9s ease-out forwards;
}

@keyframes burst-float {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.7);
    }
    18% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(1.2);
    }
}

.comments {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comment-item {
    background: #f7faff;
    border: 1px solid #dde8fc;
    border-radius: 10px;
    padding: 7px 9px;
    font-size: 12px;
}

.comment-author {
    font-weight: 800;
    color: #214579;
}

.comment-author-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
}

.profile-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
    background: rgba(8, 18, 34, 0.56);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.profile-modal.hidden {
    display: none;
}

.profile-modal-card {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid #d8e4f7;
    border-radius: 16px;
    box-shadow: 0 16px 38px rgba(8, 31, 68, 0.24);
    padding: 14px;
    position: relative;
}

.profile-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #d3e1f7;
    background: #f8fbff;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: #2a4f85;
}


.profile-simple-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 10px 6px 6px;
}

.profile-name {
    font-size: 16px;
    font-weight: 800;
    color: #193f72;
}

.profile-email {
    font-size: 13px;
    color: #2d4465;
    word-break: break-word;
}

.profile-loading {
    font-size: 13px;
    color: #3e5a82;
    padding: 20px 8px;
}

.comment-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 7px;
}

.comment-row input {
    border: 1px solid #d5e2fb;
    border-radius: 10px;
    padding: 7px 9px;
}

.hidden {
    display: none;
}

.feed-sentinel {
    height: 22px;
}

.image-viewer {
    position: fixed;
    inset: 0;
    background: rgba(6, 13, 24, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    z-index: 120;
}

.image-viewer.hidden {
    display: none;
}

.image-viewer img {
    max-width: min(960px, 96vw);
    max-height: 88vh;
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(0,0,0,0.45);
}

.image-viewer-close {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.14);
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
}

.story-source-modal {
    position: fixed;
    inset: 0;
    z-index: 160;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(9, 20, 38, 0.52);
}

.story-source-card {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid #d7e5fb;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(6, 28, 64, 0.25);
    padding: 16px;
}

.story-source-card h3 {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    color: #183a67;
}

.story-source-card p {
    margin: 8px 0 0;
    color: #4a6488;
    font-size: 13px;
}

.story-source-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.story-source-btn,
.story-source-cancel {
    border-radius: 12px;
    border: 1px solid #cbdcf9;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.story-source-btn.camera {
    background: linear-gradient(135deg, #1d77e5 0%, #149fd0 100%);
    border: none;
    color: #fff;
}

.story-source-btn.gallery {
    background: #eef5ff;
    color: #1b4f8f;
}

.story-source-cancel {
    width: 100%;
    margin-top: 10px;
    background: #fff;
    color: #5b6f8d;
}

.empty-feed {
    text-align: center;
    padding: 26px 12px;
    border: 1px dashed #c8daf9;
    border-radius: 14px;
    color: #496790;
    background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 700px) {
    .composer-actions {
        grid-template-columns: 1fr;
    }

    .upload-btn,
    .publish-btn,
    .action-btn {
        width: 100%;
    }

    .comment-row {
        grid-template-columns: 1fr;
    }

    .story-source-actions {
        grid-template-columns: 1fr;
    }
}
