/* Stories strip */
.stories-strip-wrap {
    position: relative; margin-bottom: 16px;
}
.stories-strip {
    display: flex; gap: 14px; overflow-x: auto; padding: 8px 4px 12px;
    scroll-snap-type: x mandatory; scrollbar-width: none;
}
.stories-strip::-webkit-scrollbar { display: none; }

.story-item {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; scroll-snap-align: start; background: none; border: none; font-family: inherit;
    text-decoration: none; color: inherit; padding: 0; position: relative;
}
.story-item.add-story .story-ring {
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
    border: 2px dashed var(--border-strong);
}
.story-item.add-story .story-ring-inner {
    background: transparent; display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 1.4rem;
}
.story-ring {
    width: 68px; height: 68px; border-radius: 50%; padding: 3px;
    background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    transition: transform 0.2s;
}
.story-ring.seen { background: var(--border-strong); }
.story-item:hover .story-ring { transform: scale(1.05); }
.story-ring-inner {
    width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
    background: var(--bg-card); border: 3px solid var(--bg-card);
    display: flex; align-items: center; justify-content: center;
}
.story-ring-inner img { width: 100%; height: 100%; object-fit: cover; }
.story-label {
    font-size: 0.68rem; text-align: center; max-width: 72px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary);
}
.story-count {
    position: absolute; bottom: 28px; right: 4px; background: var(--accent); color: #fff;
    font-size: 0.6rem; font-weight: 700; padding: 1px 5px; border-radius: 8px;
}

/* Fullscreen viewer */
.story-viewer {
    position: fixed; inset: 0; z-index: 800; background: #000;
    display: none; flex-direction: column; user-select: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.story-viewer-profile {
    display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
    text-decoration: none; color: inherit;
}
.story-viewer-profile:hover .name { text-decoration: underline; }
.story-viewer-mute {
    width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,0.15);
    color: #fff; cursor: pointer; font-size: 0.95rem; margin-right: 8px;
    display: none; align-items: center; justify-content: center;
}
.story-viewer.active { display: flex; }
.story-viewer-progress {
    display: flex; gap: 4px; padding: 10px 12px 6px; position: absolute; top: 0; left: 0; right: 0; z-index: 10;
}
.story-progress-seg {
    flex: 1; height: 3px; background: rgba(255,255,255,0.25); border-radius: 2px; overflow: hidden;
}
.story-progress-fill {
    height: 100%; width: 0%; background: #fff; border-radius: 2px; transition: width linear;
}
.story-viewer-header {
    position: absolute; top: 24px; left: 0; right: 0; z-index: 10;
    display: flex; align-items: center; gap: 10px; padding: 0 16px;
}
.story-viewer-header img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.story-viewer-header .name { color: #fff; font-weight: 600; font-size: 0.9rem; }
.story-viewer-header .time { color: rgba(255,255,255,0.6); font-size: 0.75rem; }
.story-viewer-close {
    width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,0.15);
    color: #fff; cursor: pointer; font-size: 1.1rem;
}
.story-viewer-body {
    flex: 1; display: flex; align-items: center; justify-content: center; position: relative;
}
.story-viewer-media {
    max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
}
.story-viewer-media-wrap {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: #111;
}
.story-viewer-caption {
    position: absolute; bottom: 80px; left: 16px; right: 16px; text-align: center;
    color: #fff; font-size: 0.95rem; text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.story-tap-zone { position: absolute; top: 60px; bottom: 60px; width: 35%; z-index: 5; }
.story-tap-prev { left: 0; }
.story-tap-next { right: 0; }
.story-nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.12); color: #fff; cursor: pointer; font-size: 1.2rem;
    display: none;
}
.story-nav-prev { left: 16px; }
.story-nav-next { right: 16px; }
@media (min-width: 768px) {
    .story-nav-btn { display: flex; align-items: center; justify-content: center; }
    .story-viewer-media-wrap { max-width: 420px; max-height: 90vh; margin: 0 auto; border-radius: 16px; overflow: hidden; }
}

/* Create story modal */
.story-create-modal {
    position: fixed; inset: 0; z-index: 700; display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.85); padding: 16px;
}
.story-create-modal.active { display: flex; }
.story-create-box {
    background: var(--bg-card); border-radius: var(--radius-xl); padding: 24px;
    width: 100%; max-width: 420px; border: 1px solid var(--border);
}
.story-create-preview {
    width: 100%; aspect-ratio: 9/16; max-height: 320px; border-radius: var(--radius);
    background: var(--bg-surface); margin: 12px 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.story-create-preview img, .story-create-preview video { width: 100%; height: 100%; object-fit: cover; }

/* Donate modal */
.donate-modal {
    position: fixed; inset: 0; z-index: 650; display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.7); padding: 16px;
}
.donate-modal.active { display: flex; }
.donate-box {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
    padding: 24px; width: 100%; max-width: 400px;
}
.donate-box h3 { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.donate-coins-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.donate-coin-btn {
    padding: 10px 16px; border-radius: 20px; border: 1px solid var(--border-strong);
    background: var(--bg-surface); color: var(--text); cursor: pointer; font-family: inherit;
    transition: var(--transition);
}
.donate-coin-btn:hover, .donate-coin-btn.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.donate-balance { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.donate-external {
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
    font-size: 0.85rem; color: var(--text-secondary);
}
.donate-external a { color: var(--accent); }

@media (max-width: 600px) {
    .story-ring { width: 58px; height: 58px; }
    .story-nav-btn { display: none; }
    .story-viewer-media-wrap { width: 100%; height: 100%; max-width: none; border-radius: 0; }
    .story-viewer-caption { bottom: max(40px, env(safe-area-inset-bottom)); }
}
