:root {
    --blue: #007AFF; --red: #FF3B30; --orange: #FF9500; --green: #34C759;
    --mint: #00C7BE; --indigo: #5856D6; --purple: #AF52DE; --pink: #FF2D55;
    --gray: #8E8E93; --gray2: #AEAEB2; --gray3: #C7C7CC; --gray4: #D1D1D6;
    --gray5: #E5E5EA; --gray6: #F2F2F7;
    --bg: #FFFFFF; --bg2: #F2F2F7; --text: #000000;
    --text2: #3C3C43; --text3: #8E8E93;
    --sep: rgba(60,60,67,0.12);
    --headerH: 44px; --tabH: 50px;
    --safeB: env(safe-area-inset-bottom, 0px);
}
.dark-mode {
    --bg: #000000 !important; --bg2: #1C1C1E !important; --text: #FFFFFF !important;
    --text2: #EBEBF5 !important; --text3: #8E8E93 !important;
    --sep: rgba(255,255,255,0.12) !important;
}
.dark-mode .header, .dark-mode .tab-bar { background: rgba(0,0,0,0.82) !important; }
.dark-mode .app-container, .dark-mode body { background: #000 !important; }
.dark-mode .modal-sheet { background: #1C1C1E !important; color: #fff !important; }
.dark-mode .modal-title { color: #fff !important; }
.dark-mode .modal-textarea { background: #2C2C2E !important; color: #fff !important; border-color: rgba(255,255,255,0.15) !important; }
.dark-mode .modal-chip { background: #2C2C2E !important; color: #fff !important; border-color: rgba(255,255,255,0.15) !important; }
.dark-mode .modal-photo-add { background: #2C2C2E !important; border-color: rgba(255,255,255,0.2) !important; color: #aaa !important; }
.dark-mode .comments-sheet { background: #1C1C1E !important; color: #fff !important; }
.dark-mode .comments-title { color: #fff !important; }
.dark-mode .comments-input { background: #2C2C2E !important; color: #fff !important; border-color: rgba(255,255,255,0.15) !important; }
.dark-mode .comment-text, .dark-mode .comment-text strong { color: #fff !important; }
.dark-mode .comments-input-bar { background: #1C1C1E !important; border-color: rgba(255,255,255,0.15) !important; }
.dark-mode .comment-item { color: #fff !important; }
.dark-mode .comment-meta { color: var(--text3) !important; }
.dark-mode .ctx-menu { background: #1C1C1E !important; }
.dark-mode .ctx-item { color: #fff !important; }
.dark-mode .ctx-cancel { background: #2C2C2E !important; color: #fff !important; }
.dark-mode .search-bar, .dark-mode .edit-input, .dark-mode .edit-textarea { background: #2C2C2E !important; color: #fff !important; border-color: rgba(255,255,255,0.15) !important; }
.dark-mode .feed-card, .dark-mode .notif-item, .dark-mode .chat-item, .dark-mode .row, .dark-mode .avatar-row { background: #000 !important; }
.dark-mode .section { background: #1C1C1E !important; }
.dark-mode .profile-header { background: #000 !important; }
.dark-mode .search-bar-wrap { background: #000 !important; }
.dark-mode .search-tabs { background: #000 !important; }
.dark-mode .search-people, .dark-mode .search-person { background: #000 !important; }
.dark-mode .search-person { border-color: rgba(255,255,255,0.12) !important; }
.dark-mode .notif-title { background: #000 !important; }
.dark-mode .chat-input-bar { background: #000 !important; border-color: rgba(255,255,255,0.12) !important; }
.dark-mode .chat-input { background: #2C2C2E !important; color: #fff !important; }
.dark-mode .modal-cancel, .dark-mode .row-value { color: #aaa !important; }
.dark-mode .search-tab { color: var(--text3) !important; }
.dark-mode .search-tab.active { color: #fff !important; border-bottom-color: #fff !important; }
.dark-mode .custom-player-controls { background: rgba(28,28,30,0.95) !important; }

* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
    background: var(--bg2); color: var(--text);
    min-height: 100dvh; position: relative; overflow-x: hidden;
    letter-spacing: -0.022em; display: flex; justify-content: center;
    -webkit-user-select: none; user-select: none;
}
.app-container {
    width: 100%; max-width: 430px; min-height: 100dvh;
    background: var(--bg); position: relative;
    display: flex; flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,0.1);
}
@media (min-width: 768px) {
    body { background: #1a1a1a; align-items: center; padding: 20px; }
    .app-container { border-radius: 40px; min-height: 90dvh; max-height: 95dvh; overflow: hidden; }
}
@media (min-width: 1025px) {
    body { padding: 0; align-items: center; justify-content: center; overflow: hidden; height: 100vh; }
    .app-container {
        max-width: 430px; width: 430px; min-height: 90dvh; max-height: 95dvh;
        border-radius: 40px; overflow: hidden; box-shadow: 0 0 60px rgba(0,0,0,0.3);
        transform: scale(1.25); transform-origin: center center;
    }
    .tab-bar { max-width: 406px; }
}
@media (min-width: 1400px) { .app-container { transform: scale(1.35); } }
@media (min-width: 1600px) { .app-container { transform: scale(1.45); } }

.header {
    position: sticky; top: 8px; z-index: 200; flex-shrink: 0;
    background: rgba(255,255,255,0.82); backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    height: var(--headerH); display: flex; align-items: center;
    padding: 0 16px; margin: 8px 12px; border-radius: 22px;
    border: 0.5px solid var(--sep);
}
.header-back { background: none; border: none; color: var(--blue); padding: 4px; cursor: pointer; display: none; }
.header-back svg { width: 22px; height: 22px; }
.apple-logo { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.apple-logo svg { width: 24px; height: 24px; }
.apple-logo svg path { fill: var(--text); }
.header-title { font-size: 17px; font-weight: 590; flex: 1; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-btn {
    background: none; border: none; color: var(--blue); padding: 6px;
    cursor: pointer; display: flex; position: relative; border-radius: 50%;
    transition: background 0.15s;
}
.header-btn:active { background: rgba(0,122,255,0.08); }
.header-btn svg { width: 22px; height: 22px; }
.header-badge {
    position: absolute; top: 0; right: 0; background: var(--red); color: #fff;
    font-size: 10px; font-weight: 600; min-width: 16px; height: 16px;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; border: 1.5px solid #fff;
}
.content {
    flex: 1; overflow-y: auto; padding-bottom: var(--tabH);
    -webkit-overflow-scrolling: touch;
}
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s cubic-bezier(0.2,0,0,1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.verified-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; vertical-align: middle;
    margin-left: 2px; flex-shrink: 0; position: relative; top: -1px;
}
.verified-badge svg { width: 100%; height: 100%; display: block; }

.feed-card {
    position: relative; cursor: pointer; background: var(--bg);
    border-radius: 24px; overflow: hidden; margin: 6px 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.feed-img-wrap {
    width: 100%; aspect-ratio: 4/5; overflow: hidden;
    position: relative; background: var(--bg2);
}
.feed-img, .feed-video {
    width: 100%; height: 100%; object-fit: cover;
    display: block; transition: transform 0.3s;
}
.feed-img-wrap:active .feed-img, .feed-img-wrap:active .feed-video { transform: scale(1.02); }
.video-indicator {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,0,0,0.55); color: #fff; font-size: 11px;
    padding: 4px 8px; border-radius: 10px; z-index: 3;
    display: flex; align-items: center; gap: 3px;
}
.play-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    z-index: 4; pointer-events: none;
}
.play-btn-circle {
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,0.5);
}
.play-btn-circle::after {
    content: ''; width: 0; height: 0;
    border-left: 18px solid #fff;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    margin-left: 4px;
}
.photo-counter {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.55); color: #fff; font-size: 11px;
    padding: 4px 8px; border-radius: 10px; z-index: 3;
    display: flex; align-items: center; gap: 3px;
}
.photo-dots {
    position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 4px; z-index: 3;
}
.photo-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.4); transition: all 0.2s; }
.photo-dot.active { background: #fff; width: 8px; height: 8px; }
.heart-burst {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0);
    font-size: 80px; color: #fff;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
    pointer-events: none; z-index: 10; opacity: 0;
}
.heart-burst.pop { animation: heartPop 0.8s ease-out forwards; }
@keyframes heartPop {
    0% { transform: translate(-50%,-50%) scale(0); opacity: 1; }
    30% { transform: translate(-50%,-50%) scale(1.3); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1.6); opacity: 0; }
}
.feed-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 40px 14px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff; pointer-events: none; z-index: 2;
}
.feed-overlay .feed-user {
    font-size: 14px; font-weight: 600; display: flex; align-items: center;
    gap: 3px; color: #fff; cursor: pointer; pointer-events: auto;
}
.feed-overlay .feed-caption {
    font-size: 13px; margin: 2px 0; color: rgba(255,255,255,0.9); line-height: 1.3;
}
.feed-overlay .feed-time { font-size: 10px; color: rgba(255,255,255,0.6); letter-spacing: 0.03em; }
.feed-actions {
    position: absolute; top: 12px; right: 10px;
    display: flex; flex-direction: column; gap: 16px; z-index: 3;
}
.feed-action {
    background: none; border: none; cursor: pointer; color: #fff;
    padding: 4px; display: flex;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
    transition: transform 0.15s;
}
.feed-action:active { transform: scale(0.85); }
.feed-action.liked { color: var(--red); animation: likePop 0.35s cubic-bezier(0.175,0.885,0.32,1.275); }
@keyframes likePop {
    0% { transform: scale(1); } 40% { transform: scale(1.4); }
    70% { transform: scale(0.9); } 100% { transform: scale(1); }
}
.feed-action.saved { color: var(--orange); }

/* Custom Player */
.custom-player {
    position: fixed; inset: 0; background: #000; z-index: 600;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.custom-player.active { opacity: 1; pointer-events: auto; }
.custom-player video {
    max-width: 100%; max-height: calc(100% - 120px);
    object-fit: contain;
}
.custom-player-controls {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.9); backdrop-filter: blur(20px);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; gap: 8px;
    transform: translateY(0); transition: transform 0.3s;
}
.custom-player-controls.hidden { transform: translateY(100%); }
.player-progress-bar {
    width: 100%; height: 4px; background: rgba(255,255,255,0.2);
    border-radius: 2px; cursor: pointer; position: relative;
}
.player-progress-fill {
    height: 100%; background: var(--blue); border-radius: 2px;
    width: 0%; transition: width 0.1s linear;
}
.player-progress-thumb {
    position: absolute; top: 50%; transform: translate(-50%,-50%);
    width: 14px; height: 14px; background: #fff; border-radius: 50%;
    left: 0%; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.player-controls-row {
    display: flex; align-items: center; justify-content: space-between;
}
.player-btn {
    background: none; border: none; color: #fff; cursor: pointer;
    padding: 8px; display: flex; align-items: center; justify-content: center;
}
.player-btn svg { width: 24px; height: 24px; }
.player-time {
    font-size: 13px; color: rgba(255,255,255,0.7);
    font-variant-numeric: tabular-nums; font-family: -apple-system, monospace;
}
.player-close {
    position: absolute; top: 20px; right: 20px;
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 50%; font-size: 18px;
    cursor: pointer; z-index: 601; display: flex; align-items: center; justify-content: center;
}
.viewer-img { max-width: 100%; max-height: calc(100% - 120px); object-fit: contain; }

.video-preview-thumb { position: relative; }
.video-preview-thumb .pick-preview-btn {
    position: absolute; bottom: 4px; left: 4px; right: 4px;
    background: rgba(0,0,0,0.7); color: #fff; border: none;
    border-radius: 8px; padding: 4px 8px; font-size: 10px;
    cursor: pointer; font-family: inherit; text-align: center;
}

.ctx-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 400;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.ctx-overlay.active { opacity: 1; pointer-events: auto; }
.ctx-menu {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%) translateY(100%);
    width: 100%; max-width: 430px; background: var(--bg);
    border-radius: 20px 20px 0 0; padding: 6px 0 calc(16px + var(--safeB));
    z-index: 401; transition: transform 0.3s;
}
.ctx-overlay.active .ctx-menu { transform: translateX(-50%) translateY(0); }
.ctx-item {
    width: 100%; padding: 14px 20px; border: none; background: none;
    font-size: 15px; cursor: pointer; text-align: left; color: var(--text);
    font-family: inherit; display: flex; align-items: center; gap: 10px;
}
.ctx-item:active { background: var(--bg2); }
.ctx-item.danger { color: var(--red); }
.ctx-cancel {
    width: calc(100% - 24px); margin: 4px 12px 0; padding: 14px;
    border: none; background: var(--bg2); font-size: 15px; font-weight: 590;
    cursor: pointer; border-radius: 14px; font-family: inherit;
}

.comments-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500;
    display: flex; align-items: flex-end; opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.comments-overlay.active { opacity: 1; pointer-events: auto; }
.comments-sheet {
    background: var(--bg); width: 100%; max-width: 430px; margin: 0 auto;
    border-radius: 20px 20px 0 0; transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.2,0,0,1);
    max-height: 75dvh; display: flex; flex-direction: column;
}
.comments-overlay.active .comments-sheet { transform: translateY(0); }
.comments-handle { width: 36px; height: 5px; background: var(--gray4); border-radius: 3px; margin: 10px auto 6px; flex-shrink: 0; }
.comments-header { display: flex; align-items: center; justify-content: center; padding: 4px 16px 10px; border-bottom: 0.5px solid var(--sep); position: relative; flex-shrink: 0; }
.comments-title { font-size: 15px; font-weight: 600; }
.comments-close { position: absolute; right: 12px; background: none; border: none; color: var(--text3); font-size: 22px; cursor: pointer; }
.comments-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.comment-item { display: flex; gap: 10px; padding: 8px 16px; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg2); cursor: pointer; }
.comment-body { flex: 1; min-width: 0; }
.comment-text { font-size: 13px; line-height: 1.35; }
.comment-text strong { font-weight: 600; margin-right: 4px; cursor: pointer; }
.comment-meta { display: flex; gap: 14px; margin-top: 3px; font-size: 11px; color: var(--text3); }
.comment-meta span { cursor: pointer; }
.comment-like { cursor: pointer; transition: color 0.15s; }
.comment-like.liked { color: var(--red); }
.comments-input-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 0.5px solid var(--sep); flex-shrink: 0; }
.comments-input { flex: 1; border: 0.5px solid var(--sep); background: var(--bg2); border-radius: 20px; padding: 10px 14px; font-size: 14px; outline: none; font-family: inherit; color: var(--text); }
.comments-post { background: none; border: none; color: var(--blue); font-weight: 600; font-size: 14px; cursor: pointer; }
.comments-post:disabled { opacity: 0.4; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500;
    display: flex; align-items: flex-end; opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-sheet {
    background: var(--bg); width: 100%; max-width: 430px; margin: 0 auto;
    border-radius: 20px 20px 0 0; padding: 12px 16px 20px;
    transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.2,0,0,1);
    max-height: 85dvh; overflow-y: auto;
}
.modal-overlay.active .modal-sheet { transform: translateY(0); }
.modal-handle { width: 36px; height: 5px; background: var(--gray4); border-radius: 3px; margin: 0 auto 10px; }
.modal-title { font-size: 16px; font-weight: 600; text-align: center; margin-bottom: 12px; }
.modal-textarea {
    width: 100%; border: 0.5px solid var(--sep); background: var(--bg2);
    border-radius: 14px; padding: 12px; font-size: 14px; font-family: inherit;
    resize: none; min-height: 100px; outline: none; color: var(--text); margin-bottom: 12px;
}
.modal-textarea:focus { border-color: var(--blue); }
.modal-photos-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin-bottom: 12px; }
.modal-photo-thumb { aspect-ratio: 1; border-radius: 12px; overflow: hidden; position: relative; background: var(--bg2); }
.modal-photo-thumb img, .modal-photo-thumb video { width: 100%; height: 100%; object-fit: cover; }
.modal-photo-thumb .remove-btn {
    position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
    border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff;
    border: none; cursor: pointer; display: flex; align-items: center;
    justify-content: center; font-size: 12px; z-index: 2;
}
.modal-photo-add {
    aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--gray4);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 28px; color: var(--gray4); background: var(--bg2);
}
.modal-chips { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.modal-chip {
    padding: 7px 14px; border-radius: 20px; border: 0.5px solid var(--sep);
    background: var(--bg2); cursor: pointer; font-size: 12px; font-family: inherit;
}
.modal-submit {
    width: 100%; padding: 12px; background: var(--blue); color: #fff;
    border: none; border-radius: 14px; font-size: 15px; font-weight: 590;
    cursor: pointer; margin-bottom: 6px; font-family: inherit;
}
.modal-submit:disabled { opacity: 0.4; }
.modal-cancel { width: 100%; padding: 10px; background: none; border: none; color: var(--text3); font-size: 14px; cursor: pointer; }

.profile-header { background: var(--bg); padding: 16px 16px 0; position: relative; }
.profile-settings-btn { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--text2); cursor: pointer; padding: 4px; z-index: 5; }
.profile-settings-btn svg { width: 22px; height: 22px; }
.profile-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.profile-avatar { width: 86px; height: 86px; border-radius: 50%; object-fit: cover; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.06); cursor: pointer; flex-shrink: 0; }
.profile-info { flex: 1; padding-top: 4px; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.profile-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.profile-username { font-size: 13px; color: var(--text3); }
.profile-bio { font-size: 13px; color: var(--text2); margin: 4px 0; line-height: 1.35; }
.profile-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.profile-link { font-size: 13px; color: var(--blue); font-weight: 500; cursor: pointer; }
.profile-dot { width: 3px; height: 3px; background: var(--text3); border-radius: 50%; flex-shrink: 0; }
.profile-followers { font-size: 13px; color: var(--text2); font-weight: 500; }
.profile-followers span { color: var(--text); font-weight: 600; }
.profile-btns { display: flex; gap: 6px; margin-top: 12px; padding-bottom: 14px; }
.btn {
    flex: 1; padding: 7px 0; border-radius: 50px; font-size: 13px;
    font-weight: 590; cursor: pointer; font-family: inherit; letter-spacing: -0.01em;
    border: none; transition: all 0.15s; text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.secondary { background: var(--bg2); color: var(--text); }
.btn.following { background: var(--green); color: #fff; }

.search-bar-wrap { padding: 8px 16px; background: var(--bg); border-bottom: 0.5px solid var(--sep); }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 12px; padding: 8px 12px; }
.search-bar svg { width: 16px; height: 16px; color: var(--text3); flex-shrink: 0; }
.search-bar input { flex: 1; border: none; background: none; font-size: 15px; outline: none; color: var(--text); font-family: inherit; }
.search-tabs { display: flex; border-bottom: 0.5px solid var(--sep); background: var(--bg); }
.search-tab { flex: 1; padding: 8px; border: none; background: none; font-size: 13px; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit; }
.search-tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 590; }
.search-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; padding: 2px; }
.search-grid-item { aspect-ratio: 1; overflow: hidden; cursor: pointer; background: var(--bg); border-radius: 8px; }
.search-grid-item img { width: 100%; height: 100%; object-fit: cover; }
.search-people { background: var(--bg); }
.search-person { display: flex; align-items: center; padding: 10px 16px; gap: 10px; cursor: pointer; border-bottom: 0.5px solid var(--sep); }
.search-person:active { background: var(--bg2); }
.search-person-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.search-person-info { flex: 1; }
.search-person-name { font-size: 14px; font-weight: 590; display: flex; align-items: center; gap: 2px; }
.search-person-username { font-size: 12px; color: var(--text3); }

.notif-item { display: flex; align-items: flex-start; padding: 10px 16px; gap: 10px; background: var(--bg); border-bottom: 0.5px solid var(--sep); cursor: pointer; }
.notif-item:active { background: var(--bg2); }
.notif-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg2); }
.notif-content { flex: 1; font-size: 13px; line-height: 1.35; }
.notif-content b { font-weight: 600; }
.notif-time { font-size: 11px; color: var(--text3); margin-top: 1px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text3); }
.empty-icon { font-size: 40px; margin-bottom: 8px; }
.empty-text { font-size: 14px; }

.chat-item { display: flex; align-items: center; padding: 10px 16px; gap: 12px; cursor: pointer; border-bottom: 0.5px solid var(--sep); background: var(--bg); }
.chat-item:active { background: var(--bg2); }
.chat-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg2); }
.chat-info { flex: 1; min-width: 0; }
.chat-name { font-size: 15px; font-weight: 590; display: flex; align-items: center; gap: 2px; }
.chat-last { font-size: 13px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.chat-meta { text-align: right; flex-shrink: 0; }
.chat-time { font-size: 11px; color: var(--text3); }
.chat-badge { display: inline-block; background: var(--blue); color: #fff; font-size: 10px; font-weight: 600; min-width: 18px; height: 18px; border-radius: 9px; text-align: center; line-height: 18px; padding: 0 5px; margin-top: 4px; }
.chat-container { display: flex; flex-direction: column; height: calc(100dvh - var(--headerH) - var(--tabH) - 8px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); background-size: cover; background-position: center; background-repeat: no-repeat; position: relative; }
.chat-messages::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.85); z-index: 0; pointer-events: none; }
.dark-mode .chat-messages::before { background: rgba(0,0,0,0.85); }
.chat-bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.3; animation: bubbleIn 0.2s ease; position: relative; z-index: 1; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-bubble.sent { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.received { align-self: flex-start; background: var(--gray5); color: var(--text); border-bottom-left-radius: 4px; }
.chat-bg-btn { background: none; border: 0.5px solid var(--sep); color: var(--blue); font-size: 11px; cursor: pointer; padding: 4px 10px; border-radius: 12px; font-family: inherit; margin-left: auto; }
.chat-input-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg); border-top: 0.5px solid var(--sep); }
.chat-input { flex: 1; border: 0.5px solid var(--sep); background: var(--bg2); border-radius: 20px; padding: 10px 14px; font-size: 14px; outline: none; font-family: inherit; color: var(--text); }
.chat-send { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-send svg { width: 18px; height: 18px; }
.typing-indicator { font-size: 11px; color: var(--text3); padding: 2px 16px; font-style: italic; position: relative; z-index: 1; }

.section { margin: 16px; background: var(--bg); border-radius: 14px; overflow: hidden; }
.section-header { padding: 6px 16px; font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.row { display: flex; align-items: center; padding: 12px 16px; gap: 12px; cursor: pointer; border-bottom: 0.5px solid var(--sep); background: var(--bg); }
.row:last-child { border-bottom: none; }
.row:active { background: var(--bg2); }
.row-label { flex: 1; font-size: 15px; }
.row-value { font-size: 13px; color: var(--text3); }
.row-arrow { color: var(--gray4); font-size: 14px; }
.row.danger .row-label { color: var(--red); }
.toggle { width: 48px; height: 28px; border-radius: 14px; background: var(--gray4); cursor: pointer; position: relative; transition: background 0.3s; border: none; padding: 0; flex-shrink: 0; }
.toggle.on { background: var(--green); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: left 0.3s; }
.toggle.on::after { left: 22px; }
.avatar-row { display: flex; align-items: center; padding: 12px 16px; gap: 12px; cursor: pointer; background: var(--bg); }
.avatar-row:active { background: var(--bg2); }
.avatar-row img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.avatar-row .info { flex: 1; }
.avatar-row .name { font-size: 15px; font-weight: 590; }
.avatar-row .sub { font-size: 12px; color: var(--text3); margin-top: 1px; }

.edit-section { padding: 16px; }
.edit-avatar-wrap { text-align: center; margin-bottom: 20px; position: relative; display: inline-block; left: 50%; transform: translateX(-50%); }
.edit-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.edit-avatar-btn { position: absolute; bottom: 0; right: 0; width: 32px; height: 32px; background: var(--blue); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px solid #fff; color: #fff; font-size: 16px; }
.edit-field { margin-bottom: 14px; }
.edit-label { font-size: 11px; color: var(--text3); margin-bottom: 3px; display: block; }
.edit-input, .edit-textarea { width: 100%; padding: 10px 12px; border: 0.5px solid var(--sep); border-radius: 10px; font-size: 14px; font-family: inherit; outline: none; color: var(--text); background: var(--bg2); }
.edit-input:focus, .edit-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,122,255,0.12); }
.edit-textarea { resize: vertical; min-height: 70px; }
.edit-save { width: 100%; padding: 12px; background: var(--blue); color: #fff; border: none; border-radius: 14px; font-size: 15px; font-weight: 590; cursor: pointer; font-family: inherit; }

.hud { position: fixed; top: 56px; left: 50%; transform: translateX(-50%) translateY(-16px); background: rgba(0,0,0,0.8); color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 500; z-index: 999; opacity: 0; pointer-events: none; transition: all 0.3s ease; white-space: nowrap; }
.hud.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hud.success { background: rgba(52,199,89,0.9); }
.hud.error { background: rgba(255,59,48,0.9); }

.tab-bar { position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%); width: calc(100% - 24px); max-width: 406px; background: rgba(255,255,255,0.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); height: var(--tabH); display: flex; align-items: center; justify-content: space-around; padding: 0 8px; z-index: 100; border-radius: 25px; border: 0.5px solid var(--sep); }
.tab-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; border: none; background: none; color: var(--text3); font-size: 9px; font-weight: 500; font-family: inherit; padding: 3px 8px; border-radius: 10px; transition: all 0.15s; min-width: 48px; position: relative; }
.tab-item:active { background: rgba(0,0,0,0.04); }
.tab-item.active { color: var(--blue); }
.tab-item svg { width: 24px; height: 24px; }
.tab-badge { position: absolute; top: -2px; right: 0; background: var(--red); color: #fff; font-size: 9px; font-weight: 600; min-width: 14px; height: 14px; border-radius: 7px; display: flex; align-items: center; justify-content: center; padding: 0 3px; border: 1.5px solid #fff; }
.tab-center-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,122,255,0.3); transition: all 0.15s; }
.tab-center-btn:active { transform: scale(0.9); opacity: 0.8; }
.tab-center-btn svg { width: 20px; height: 20px; }

.saved-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; padding: 2px; background: var(--bg2); }
.saved-grid-item { aspect-ratio: 1; overflow: hidden; cursor: pointer; background: var(--bg); border-radius: 8px; }
.saved-grid-item img, .saved-grid-item video { width: 100%; height: 100%; object-fit: cover; }

.hashtag { color: var(--blue); cursor: pointer; font-weight: 500; }