:root {
    --primary: #2196F3;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border: #e0e0e0;
    --header-height: 50px;
    --nav-height: 55px;
    --max-width: 450px;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-font-smoothing:antialiased; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    padding-bottom: calc(var(--nav-height) + 12px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 主要内容容器 - 限制宽度并居中 */
body > *:not(.loading-overlay):not(.search-panel):not(.nav-dropdown):not(.modal) {
    max-width: var(--max-width);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* 确保固定定位元素也在容器内居中显示 */
.header, .bottom-nav, .theme-toggle {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
}

/* 调整搜索面板在PC端的宽度 */
.search-panel {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    background: var(--bg);
}

/* 下拉导航也在容器内 */
.nav-dropdown {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    background: var(--surface);
}

/* 模态框限制宽度 */
.modal {
    align-items: flex-end;
    justify-content: center;
}
.modal-content {
    max-width: var(--max-width);
    width: 100%;
    border-radius: 12px 12px 0 0;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select {
    font-family: inherit; font-size: 15px; border: none; outline: none; background: transparent;
}
button { cursor: pointer; }

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: fixed; top:0; left:0; right:0; bottom:0;
    background: rgba(0,0,0,0.5); z-index: 99999;
    display: none; align-items: center; justify-content: center;
}
.loading-overlay.active { display: flex; }
.loading-box {
    background: var(--surface); border-radius: 8px;
    padding: 28px 36px; text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.loading-spinner {
    width: 36px; height: 36px; margin: 0 auto 12px;
    border: 3px solid #e0e0e0; border-top: 3px solid var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--text-secondary); }

/* ========== Header ========== */
.header {
    position: fixed; top: 0; height: var(--header-height);
    background: var(--surface); border-bottom: 1px solid var(--border);
    z-index: 1000; display: flex; align-items: center;
    padding: 0 14px;
}
.header .logo { font-size: 17px; font-weight: 700; color: var(--primary); }
.header .header-actions { margin-left: auto; display: flex; gap: 6px; }
.header .header-actions button,
.header .search-btn {
    width: 34px; height: 34px; border-radius: 4px;
    background: #f5f5f5; display: flex; align-items: center;
    justify-content: center; color: var(--text); font-size: 15px;
}

/* ========== Search Panel ========== */
.search-panel {
    position: fixed; top: 0; bottom: 0;
    z-index: 1100; display: none; flex-direction: column;
}
.search-panel.active { display: flex; }
.search-panel .search-header {
    display: flex; align-items: center; padding: 10px 14px;
    border-bottom: 1px solid var(--border); gap: 10px; background: var(--surface);
}
.search-panel input {
    flex: 1; height: 40px; background: var(--bg); border-radius: 4px;
    padding: 0 14px; color: var(--text); border: 1px solid var(--border);
}
.search-panel .close-search {
    width: 34px; height: 34px; display: flex; align-items: center;
    justify-content: center; font-size: 18px; color: var(--text-light);
}

/* ========== Nav Dropdown ========== */
.nav-dropdown {
    position: fixed; top: var(--header-height);
    z-index: 999; display: none;
    padding: 8px 14px; border-bottom: 1px solid var(--border);
}
.nav-dropdown.active { display: block; }
.nav-dropdown a {
    display: flex; align-items: center; padding: 12px 0;
    border-bottom: 1px solid var(--border); color: var(--text);
    font-size: 15px; gap: 10px;
}
.nav-dropdown a:last-child { border-bottom: none; }
.nav-dropdown a .icon { width: 26px; text-align: center; font-size: 17px; }

/* ========== Layout ========== */
.content { padding-top: calc(var(--header-height) + 0px); }
.container { padding: 0 10px; }

/* ========== Section Title ========== */
.section-title {
    font-size: 16px; font-weight: 700; margin: 16px 0 10px;
    display: flex; align-items: center; gap: 6px; color: var(--text);
}

/* ========== Song List ========== */
.song-list { display: flex; flex-direction: column; gap: 8px; }
.song-card {
    background: var(--surface); border-radius: 6px;
    border: 1px solid var(--border); display: flex;
    padding: 10px; gap: 10px;
}
.song-card .cover {
    width: 64px; height: 64px; border-radius: 4px;
    flex-shrink: 0; background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.song-card .cover .placeholder { font-size: 24px; color: #fff; }
.song-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.song-card .title {
    font-size: 14px; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.song-card .meta {
    font-size: 12px; color: var(--text-secondary); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.song-card .tags { margin-top: 5px; display: flex; gap: 5px; flex-wrap: wrap; }
.song-card .tag {
    font-size: 11px; padding: 1px 8px; border-radius: 3px;
    background: #e3f2fd; color: var(--primary);
}
.song-card .stats {
    display: flex; align-items: center; gap: 10px; margin-top: 6px;
    font-size: 11px; color: var(--text-light);
}

/* 保持单列布局 */
@media (min-width: 768px) {
    .song-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .song-grid .song-card {
        flex-direction: row !important;
        padding: 10px !important;
    }
    
    .song-grid .song-card .cover {
        width: 64px !important;
        height: 64px !important;
        border-radius: 4px !important;
        flex-shrink: 0;
    }
    
    .song-grid .song-card .info {
        padding: 0 !important;
        flex: 1;
    }
}

/* ========== Hot Tags ========== */
.hot-tags {
    display: flex; gap: 6px; padding: 10px 0; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.hot-tags::-webkit-scrollbar { display: none; }
.hot-tags a {
    white-space: nowrap; padding: 5px 14px; border-radius: 4px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
}

/* ========== Bottom Nav ========== */
.bottom-nav {
    position: fixed; bottom: 0; height: var(--nav-height);
    background: var(--surface); border-top: 1px solid var(--border);
    display: flex; justify-content: space-around; align-items: center; z-index: 1000;
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center;
    gap: 1px; color: var(--text-light); font-size: 11px; padding: 4px 12px;
}
.bottom-nav a .icon { font-size: 20px; }
.bottom-nav a.active { color: var(--primary); }

/* ========== Forms ========== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    margin-bottom: 5px; color: var(--text-secondary);
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 14px; border-radius: 4px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); font-size: 15px;
}
.form-group textarea { resize: vertical; min-height: 70px; }

.btn {
    display: block; width: 100%; padding: 12px;
    border-radius: 4px; font-size: 15px; font-weight: 600;
    text-align: center; border: none; cursor: pointer;
    background: var(--primary); color: #fff;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
    background: var(--surface); color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-sm {
    padding: 7px 14px; font-size: 13px; display: inline-block;
    width: auto; font-weight: 500;
}
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ========== Auth Pages ========== */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; }
.auth-page .auth-header {
    padding: 40px 16px 24px; text-align: center;
    background: var(--primary); color: #fff;
}
.auth-page .auth-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-page .auth-header p { opacity: 0.9; font-size: 13px; }
.auth-page .auth-body { padding: 24px 14px; flex: 1; }
.auth-page .auth-footer {
    text-align: center; padding: 14px; font-size: 13px;
    color: var(--text-light); border-top: 1px solid var(--border);
}
.auth-page .auth-footer a { color: var(--primary); }

/* ========== Profile ========== */
.profile-header {
    background: var(--primary); color: #fff;
    padding: 20px 14px 28px; text-align: center;
}
.profile-header .avatar {
    width: 68px; height: 68px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3); margin: 0 auto 10px;
    background: #fff; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700; color: var(--primary);
}
.profile-header .name { font-size: 18px; font-weight: 700; }
.profile-header .points {
    display: inline-block; margin-top: 8px; padding: 4px 16px;
    background: rgba(255,255,255,0.2); border-radius: 4px;
    font-size: 13px;
}
.profile-stats {
    display: flex; justify-content: space-around; padding: 14px;
    background: var(--surface); margin: -12px 10px 14px;
    border-radius: 6px; border: 1px solid var(--border);
    position: relative; z-index: 1;
}
.profile-stats .stat { text-align: center; }
.profile-stats .stat .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.profile-stats .stat .label { font-size: 11px; color: var(--text-light); }

/* ========== Menu Grid ========== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0 10px;
    margin-bottom: 14px;
}
.menu-grid .menu-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 5px; padding: 12px 4px; background: var(--surface);
    border-radius: 6px; border: 1px solid var(--border);
}
.menu-grid .menu-item .icon { font-size: 20px; }
.menu-grid .menu-item .label { font-size: 11px; color: var(--text); }

/* ========== Song Detail ========== */
.progress-bar {
    width: 100%; max-width: 320px; height: 4px;
    background: #e0e0e0; border-radius: 2px;
    margin: 14px auto 6px; cursor: pointer; position: relative;
}
.progress-fill {
    height: 100%; background: var(--primary);
    border-radius: 2px; width: 0%;
}
.progress-time {
    font-size: 12px; color: #999; text-align: center;
    margin-bottom: 4px;
}

/* ========== Comments ========== */
.comment-list { padding: 0 10px; }
.comment-item {
    display: flex; gap: 8px; padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-item .c-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    flex-shrink: 0; overflow: hidden; background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 600;
}
.comment-item .c-body { flex: 1; }
.comment-item .c-name { font-size: 13px; font-weight: 600; }
.comment-item .c-time { font-size: 11px; color: var(--text-light); font-weight: 400; }
.comment-item .c-text { font-size: 14px; margin-top: 3px; color: var(--text-secondary); }

/* ========== Upload ========== */
.upload-area {
    border: 2px dashed var(--border); border-radius: 6px;
    padding: 40px 16px; text-align: center; margin: 10px 0;
    background: var(--surface);
}
.upload-area .upload-icon { font-size: 44px; margin-bottom: 10px; }
.upload-area p { color: var(--text-secondary); font-size: 13px; }

/* ========== Help ========== */
.help-list { display: flex; flex-direction: column; gap: 8px; padding: 0 10px; }
.help-card {
    background: var(--surface); border-radius: 6px;
    border: 1px solid var(--border); padding: 14px; display: block;
}
.help-card .help-title { font-size: 15px; font-weight: 600; }
.help-card .help-meta {
    display: flex; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text-light);
}
.help-card .help-status {
    display: inline-block; padding: 2px 8px; border-radius: 3px;
    font-size: 12px; margin-top: 8px;
}
.help-card .help-status.pending { background: #fff3e0; color: #e65100; }
.help-card .help-status.solved { background: #e8f5e9; color: #2e7d32; }

/* ========== Modal ========== */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: none; align-items: flex-end; justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--surface);
    max-width: var(--max-width);
    width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 85vh; overflow-y: auto;
    animation: slideUp 0.25s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
    width: 30px; height: 30px; border-radius: 4px; background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--text-light); border: none;
}
.modal-body { padding: 16px; }

/* ========== Points Log ========== */
.points-log { padding: 0 10px; }
.log-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.log-item:last-child { border-bottom: none; }
.log-item .log-info .log-type { font-size: 13px; font-weight: 500; }
.log-item .log-info .log-time { font-size: 11px; color: var(--text-light); }
.log-item .log-points { font-size: 15px; font-weight: 700; }
.log-item .log-points.plus { color: var(--success); }
.log-item .log-points.minus { color: var(--error); }

/* ========== Pagination ========== */
.pagination {
    display: flex; justify-content: center; gap: 5px;
    padding: 20px 10px;
}
.pagination a, .pagination span {
    padding: 7px 12px; border-radius: 4px; font-size: 13px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); min-width: 34px; text-align: center;
}
.pagination a.active, .pagination span.current {
    background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ========== Captcha ========== */
.captcha-row { display: flex; gap: 8px; }
.captcha-row input { flex: 1; }
.captcha-row img { height: 42px; border-radius: 4px; cursor: pointer; border: 1px solid var(--border); }

/* ========== Empty ========== */
.empty { text-align: center; padding: 50px 16px; color: var(--text-light); }
.empty .empty-icon { font-size: 48px; margin-bottom: 10px; }
.empty p { font-size: 14px; }

/* ========== User Page ========== */
.user-page .user-header {
    background: var(--primary); color: #fff;
    padding: 28px 14px; text-align: center;
}
.user-page .user-header .avatar {
    width: 68px; height: 68px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3); margin: 0 auto 10px;
    background: #fff; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700; color: var(--primary);
}
.user-page .tabs {
    display: flex; justify-content: center; gap: 20px;
    padding: 14px; border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.user-page .tabs a {
    padding: 6px 0; font-size: 14px; color: var(--text-light);
    border-bottom: 2px solid transparent; font-weight: 500;
}
.user-page .tabs a.active { color: var(--primary); border-color: var(--primary); }

/* ========== Poster Preview ========== */
.poster-preview {
    width: 240px; border-radius: 6px; overflow: hidden;
    border: 1px solid var(--border); background: var(--surface);
}
.poster-preview .poster-top {
    background: var(--primary); color: #fff;
    padding: 24px 16px; text-align: center;
}
.poster-preview .poster-top h3 { font-size: 18px; margin-bottom: 4px; }
.poster-preview .poster-top .code {
    font-size: 24px; font-weight: 700; letter-spacing: 3px;
    background: rgba(255,255,255,0.2); padding: 6px 12px;
    border-radius: 4px; display: inline-block; margin-top: 8px;
}
.poster-preview .poster-bottom { padding: 14px; text-align: center; }
.poster-preview .poster-bottom p { color: var(--text-secondary); font-size: 12px; }

/* ========== Admin ========== */
.admin-header {
    background: var(--primary); color: #fff;
    padding: 12px 14px; display: flex; align-items: center; gap: 10px;
}
.admin-header h1 { font-size: 16px; font-weight: 700; }
.admin-header a { color: #fff; }
.admin-nav {
    display: flex; overflow-x: auto; gap: 6px; padding: 8px 10px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a {
    white-space: nowrap; padding: 6px 14px; border-radius: 4px;
    font-size: 12px; color: var(--text-secondary); background: var(--bg);
}
.admin-nav a.active { background: var(--primary); color: #fff; }
.admin-content { padding: 14px 10px; max-width: 1200px; margin: 0 auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th, .admin-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-light); font-weight: 600; font-size: 11px; }
.admin-table .actions { display: flex; gap: 5px; }
.admin-table .actions a, .admin-table .actions button {
    padding: 4px 10px; border-radius: 4px; font-size: 11px;
    background: var(--bg); color: var(--text); border: 1px solid var(--border);
    cursor: pointer;
}
.badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-warning { background: #fff3e0; color: #e65100; }

/* ========== Stat Cards ========== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 10px;
    margin-bottom: 14px;
}
.stat-card {
    background: var(--surface);
    border-radius: 6px;
    padding: 14px;
    border: 1px solid var(--border);
}
.stat-card .num {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 3px;
}

/* ========== 移除主题切换按钮 ========== */
/* .theme-toggle 已删除，不再显示夜间模式切换按钮 */