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

:root {
    --primary: #FE2C55;
    --primary-dark: #d6244a;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 16px;
    --nav-height: 64px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    padding-bottom: var(--nav-height);
    user-select: none;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
}

/* 底部导航 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    height: var(--nav-height);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(0,0,0,0.06);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 6px 12px;
    border-radius: 12px;
    position: relative;
}

.tab-item .tab-icon {
    font-size: 24px;
    line-height: 1;
}

.tab-item .tab-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.tab-item.active .tab-label {
    color: var(--primary);
    font-weight: 600;
}

.tab-item.active .tab-icon {
    transform: scale(1.1);
}

.publish-btn {
    background: linear-gradient(135deg, var(--primary), #ff6b6b);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(254,44,85,0.4);
    transform: translateY(-8px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.publish-btn .tab-icon {
    font-size: 28px;
    color: white;
}

.publish-btn:active {
    transform: translateY(-4px) scale(0.95);
    box-shadow: 0 2px 8px rgba(254,44,85,0.3);
}

/* 页面容器 */
.main-content {
    padding-top: 0;
}

.page {
    display: none;
    padding: 8px 12px;
    animation: fadeSlideIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Feed 视频卡片 */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
}

.video-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.video-card:active {
    transform: scale(0.98);
}

.video-card .thumb {
    width: 100%;
    aspect-ratio: 9 / 16;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.video-card .thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 60%, rgba(0,0,0,0.5));
}

.video-card .thumb .play-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.video-card .card-body {
    padding: 12px 14px;
}

.video-card .card-body .user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.video-card .card-body .user-row .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff6b6b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.video-card .card-body .user-row .uname {
    font-weight: 600;
    font-size: 14px;
}

.video-card .card-body .desc {
    font-size: 14px;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.video-card .card-body .meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.video-card .card-body .meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 发现页 */
.explore-header {
    padding: 12px 0;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}

.search-input {
    width: 100%;
    padding: 12px 18px;
    border-radius: 24px;
    border: none;
    background: rgba(0,0,0,0.06);
    font-size: 15px;
    outline: none;
    transition: box-shadow 0.2s;
}

.search-input:focus {
    box-shadow: 0 0 0 2px var(--primary);
    background: white;
}

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

.explore-item {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #2d3436, #636e72);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.explore-item:active {
    transform: scale(0.95);
}

.explore-item .item-label {
    position: absolute;
    bottom: 6px;
    left: 6px;
    right: 6px;
    text-align: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* 消息页 */
.messages-header h2 {
    padding: 12px 0;
    font-size: 20px;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    background: var(--card-bg);
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

.msg-item:active {
    background: rgba(0,0,0,0.03);
}

.msg-item .msg-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    flex-shrink: 0;
}

.msg-item .msg-body {
    flex: 1;
    min-width: 0;
}

.msg-item .msg-body .msg-name {
    font-weight: 600;
    font-size: 15px;
}

.msg-item .msg-body .msg-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-item .msg-time {
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* 个人中心 */
.profile-header {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    align-items: center;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff6b6b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(254,44,85,0.3);
}

.profile-info h2 {
    font-size: 20px;
    margin-bottom: 2px;
}

.profile-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.profile-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-stats strong {
    color: var(--text);
    font-weight: 700;
}

.profile-tabs {
    display: flex;
    gap: 0;
    margin: 12px 0;
    border-bottom: 2px solid rgba(0,0,0,0.06);
}

.profile-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.profile-tab.active {
    color: var(--primary);
}

.profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.profile-works {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding-bottom: 20px;
}

.work-item {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #2d3436, #636e72);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: transform 0.2s;
}

.work-item:active {
    transform: scale(0.95);
}

/* 视频弹窗 */
.video-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.video-modal.open {
    display: flex;
}

.video-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.video-modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.video-player {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.play-icon {
    font-size: 64px;
    color: rgba(255,255,255,0.6);
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.video-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    color: white;
}

.video-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.video-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.video-user .username {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
}

.follow-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.follow-btn:active {
    transform: scale(0.95);
    background: var(--primary-dark);
}

.video-desc {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 12px;
    opacity: 0.9;
}

.video-actions {
    display: flex;
    gap: 20px;
}

.action-btn {
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
    padding: 4px 0;
}

.action-btn:active {
    transform: scale(0.9);
    opacity: 1;
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.close-modal:active {
    background: rgba(0,0,0,0.7);
}

/* 发布弹窗 */
.publish-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
}

.publish-modal.open {
    display: flex;
}

.publish-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.publish-content {
    position: relative;
    width: 85%;
    max-width: 360px;
    background: white;
    border-radius: 20px;
    padding: 24px 20px 20px;
    animation: scaleIn 0.3s ease;
}

.publish-content h3 {
    text-align: center;
    margin-bottom: 16px;
    font-size: 18px;
}

.publish-textarea {
    width: 100%;
    height: 100px;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.publish-textarea:focus {
    border-color: var(--primary);
}

.publish-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.publish-submit {
    flex: 1;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.publish-submit:active {
    transform: scale(0.97);
    background: var(--primary-dark);
}

.publish-cancel {
    flex: 1;
    padding: 12px;
    background: #f0f0f0;
    color: var(--text);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.publish-cancel:active {
    transform: scale(0.97);
    background: #e0e0e0;
}

/* 响应式 */
@media (min-width: 768px) {
    #app {
        max-width: 600px;
    }
    .tab-bar {
        max-width: 600px;
    }
    .explore-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .profile-works {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 375px) {
    .tab-item .tab-label {
        font-size: 10px;
    }
    .tab-item .tab-icon {
        font-size: 22px;
    }
    .publish-btn {
        width: 44px;
        height: 44px;
    }
    .publish-btn .tab-icon {
        font-size: 24px;
    }
    .profile-avatar {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
}