/* ============================================================
   前台主样式文件（深色主题专用，全面变量化，含字体应用）
   所有颜色、尺寸、圆角、阴影均引用 theme-vars.css 中的变量
   不再支持亮色模式切换
   ============================================================ */

/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family-base);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== 标题字体 ========== */
h1, h2, h3, h4, h5, h6,
.site-logo,
.modal-card h3,
.card h2,
.login-card h1,
.announcement-card h3,
.control-panel > div:first-child,
.glass-card h2,
.glass-card h3 {
    font-family: var(--font-family-heading);
}

/* ========== 等宽字体 ========== */
code, pre, .loaded-data-item, .song-number, .mono,
.db-checkbox span,
.result-item,
input[type="text"][data-var] {
    font-family: var(--font-family-mono);
}

/* ========== 卡片 ========== */
.glass-card {
    background: var(--bg-card);
    border-radius: 32px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ========== 头部样式 ========== */
.header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
    padding: 16px 28px;
    background: var(--bg-header);
    border-radius: 80px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.site-logo {
    font-weight: 700;
    font-size: 1.8rem;
    background: var(--gradient-logo);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.header-nav-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.online-users-wrapper {
    display: none;
}

.desktop-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ========== 用户下拉菜单 ========== */
.nav-user-dropdown {
    position: relative;
}
.nav-user-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}
.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 8px;
    background: var(--bg-input);
    border-radius: 40px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    height: 40px;
}
.user-dropdown-trigger:hover {
    background: var(--bg-card-hover);
}
.desktop-avatar {
    width: 32px;
    height: 32px;
    border-radius: 32px;
    object-fit: cover;
    border: 2px solid var(--primary);
}
.desktop-username {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}
.dropdown-arrow {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: 4px;
}
.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--dropdown-bg) !important;
    border-radius: var(--dropdown-border-radius);
    padding: var(--dropdown-padding);
    box-shadow: var(--dropdown-shadow);
    border: 1px solid var(--dropdown-border) !important;
    z-index: 1000;
}
.nav-user-dropdown:hover .user-dropdown-menu {
    display: block;
}
.user-dropdown-menu a,
.user-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 40px;
    color: var(--text-primary) !important;
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.user-dropdown-menu a:hover,
.user-dropdown-menu .dropdown-item:hover {
    background: var(--dropdown-item-hover) !important;
    color: var(--text-primary) !important;
}

/* ========== 移动端菜单按钮 ========== */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
}

/* ========== 侧边菜单（强制背景变量） ========== */
.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-sidebar) !important;
    box-shadow: var(--shadow-lg);
    transition: left var(--transition-slow) ease;
    z-index: 2000;
    padding: 60px 20px 20px;   /* 顶部留出空间给关闭按钮 */
    overflow-y: auto;
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
}
.side-menu.open { left: 0; }

/* 关闭按钮——固定在右上角 */
.side-menu .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    margin-bottom: 0;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}
.side-menu .close-btn:hover {
    background: var(--border);
}

.side-menu a, .side-menu button {
    display: block;
    width: 100%;
    text-align: left;
    margin: 8px 0;
    padding: 12px 16px;
    background: var(--bg-input) !important;
    border-radius: 40px;
    color: var(--text-primary) !important;
    text-decoration: none;
    font-size: 1rem;
    border: none;
    cursor: pointer;
}
.side-menu a:hover,
.side-menu button:hover {
    background: var(--bg-card-hover) !important;
}
.side-menu button {
    background: var(--btn-primary-bg) !important;
    color: var(--btn-primary-text) !important;
}
.menu-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--modal-backdrop-bg);
    z-index: 1999;
    display: none;
}
.menu-overlay.active { display: block; }

.side-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 12px;
    background: var(--secondary) !important;
    border-radius: 20px;
    margin-bottom: 16px;
}
.side-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 48px;
    object-fit: cover;
    border: 2px solid white;
    flex-shrink: 0;
}
.side-user-details {
    flex: 1;
}
.side-user-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}
.side-user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8);
    background: rgba(0,0,0,0.2);
    display: inline-block;
    padding: 2px 10px;
    border-radius: 30px;
}

/* ========== 按钮系统（全面变量化） ========== */
button, .btn {
    background: var(--btn-primary-bg);
    border: none;
    padding: var(--btn-padding-y) var(--btn-padding-x);
    border-radius: var(--btn-border-radius);
    font-weight: var(--btn-font-weight);
    letter-spacing: var(--btn-letter-spacing);
    color: var(--btn-primary-text);
    cursor: pointer;
    transition: var(--btn-transition);
    margin: 0 8px 8px 0;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: var(--btn-box-shadow);
}
button:hover, .btn:hover {
    transform: var(--btn-hover-transform);
    box-shadow: var(--btn-hover-box-shadow);
    filter: brightness(var(--hover-brightness));
}
button:active, .btn:active {
    transform: scale(var(--btn-active-scale));
    filter: brightness(var(--active-brightness));
}

/* 按钮颜色变体 */
.btn-success {
    background: var(--btn-success-bg) !important;
    color: var(--btn-success-text) !important;
}
.btn-success:hover {
    background: var(--btn-success-hover) !important;
}
.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger-text);
}
.btn-danger:hover {
    background: var(--btn-danger-hover);
}
.btn-warning {
    background: var(--btn-warning-bg);
    color: var(--btn-warning-text);
}
.btn-warning:hover {
    background: var(--btn-warning-hover);
}
.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}
.btn-secondary:hover {
    background: var(--btn-secondary-hover);
}
.btn-copy {
    background: var(--btn-copy-bg) !important;
    color: white !important;
}
.btn-copy:hover {
    background: var(--btn-copy-bg) !important;
    filter: brightness(var(--hover-brightness));
}
.btn-clear {
    background: var(--btn-clear-bg) !important;
    color: white !important;
}
.btn-clear:hover {
    background: var(--btn-clear-bg) !important;
    filter: brightness(var(--hover-brightness));
}
.btn.active {
    background: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(168,85,247,0.5);
}

/* ========== 底部三按钮强制变量 ========== */
#mainCopyQueue,
#mainClearQueue,
#markAllPlayedBtn,
#playedCopyQueue,
#playedClearQueue {
    background: var(--btn-copy-bg) !important;
    color: white !important;
    border: none !important;
}
#mainClearQueue,
#playedClearQueue {
    background: var(--btn-clear-bg) !important;
}
#markAllPlayedBtn {
    background: var(--btn-success-bg) !important;
}
#mainCopyQueue:hover,
#mainClearQueue:hover,
#markAllPlayedBtn:hover,
#playedCopyQueue:hover,
#playedClearQueue:hover {
    filter: brightness(var(--hover-brightness));
    transform: var(--btn-hover-transform);
    box-shadow: var(--btn-hover-box-shadow);
}

/* ========== 表单元素（全面变量化） ========== */
input, textarea, select {
    width: 100%;
    padding: var(--input-padding-y) var(--input-padding-x);
    background: var(--input-bg);
    border: var(--input-border-width) solid var(--input-border);
    border-radius: var(--input-border-radius);
    color: var(--input-text);
    font-size: 0.95rem;
    outline: none;
    margin-bottom: 18px;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--input-shadow);
}
input::placeholder, textarea::placeholder {
    color: var(--input-placeholder);
}
input:focus, textarea:focus, select:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
}
input:disabled, textarea:disabled, select:disabled {
    background: var(--input-disabled-bg);
    color: var(--input-disabled-text);
    cursor: not-allowed;
}

/* 弹窗内的下拉选择框美化 */
.modal-card select,
#editModal select,
#editDbId {
    background: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: var(--input-border-width) solid var(--input-border) !important;
    border-radius: var(--input-border-radius) !important;
    padding: var(--input-padding-y) var(--input-padding-x) !important;
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}
.modal-card select option,
#editModal select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* 两栏布局 */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}
@media (max-width: 780px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

/* ========== 歌曲列表（修复横向滚动条） ========== */
.song-list {
    list-style: none;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;          /* 关键：隐藏水平溢出 */
    padding: 0;
    margin: 0;
}

.song-item {
    background: var(--list-item-bg);
    border-radius: var(--list-border-radius);
    margin-bottom: var(--list-item-gap);
    padding: var(--list-item-padding);
    border-left: 5px solid var(--primary-light);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-base);
    position: relative;
    overflow: hidden !important;  /* 避免内部伪元素溢出到卡片外部造成滚动条 */
}
.song-item:hover {
    background: var(--list-item-hover);
}
.song-item.selected-song {
    background: var(--list-item-selected);
    border-left-width: var(--selected-border-width);
}
.priority-vip { border-left-color: var(--priority-vip); }
.priority-king { border-left-color: var(--priority-king); }
.priority-kylin { border-left-color: var(--priority-kylin); }

.song-info-text {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    position: relative;
    z-index: 2;                 /* 确保文字在进度条上方 */
}

/* 优先级标签 */
.priority-tag {
    padding: var(--tag-padding);
    border-radius: var(--tag-border-radius);
    font-size: var(--tag-font-size);
    font-weight: var(--tag-font-weight);
}
.vip-tag { background: var(--priority-vip); color: white; }
.king-tag { background: var(--priority-king); color: var(--text-inverse); }
.kylin-tag { background: var(--priority-kylin); color: white; }
.normal-tag { background: var(--tag-bg); color: var(--tag-text); }

/* ========== 控制面板 ========== */
.control-panel {
    margin-top: 24px;
    padding: 18px;
    background: var(--bg-card);
    border-radius: 60px;
    display: none;
    border: 1px solid var(--border);
}
.priority-selector {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    padding: 4px 12px;
    border-radius: 40px;
    border: 1px solid var(--border);
}
.priority-selector select {
    width: auto;
    margin-bottom: 0;
    padding: 6px 12px;
}

/* ========== 数据库面板 ========== */
#dbPanelList { display: flex; flex-direction: column; gap: 4px; }
.db-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.db-checkbox:last-child { border-bottom: none; }
.db-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    cursor: pointer;
    margin-bottom: 0;
}
.db-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}
.db-checkbox span { flex: 1; font-size: 0.95rem; }

.loaded-data-container {
    margin-top: 16px;
    background: var(--bg-card);
    border-radius: 28px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}
.loaded-data-item {
    padding: 8px 12px;
    border-bottom: 1px dashed var(--border);
    font-family: var(--font-family-mono);
}
.result-item {
    background: var(--bg-card);
    border-radius: 28px;
    padding: 12px 18px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fuzzy-matches {
    background: var(--bg-card);
    border-radius: 28px;
    padding: 16px;
}

/* ========== Toast 通知 ========== */
.toast {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: var(--toast-bg);
    color: var(--toast-text);
    padding: var(--toast-padding);
    border-radius: 60px;
    z-index: 1100;
    border-left: 4px solid var(--toast-info-border);
    transform: translateY(-120%);
    transition: transform var(--transition-slow) ease;
    pointer-events: none;
    text-align: center;
    box-shadow: var(--toast-shadow);
}
.toast.show { transform: translateY(20px); }
.toast.success { border-left-color: var(--toast-success-border); }
.toast.error { border-left-color: var(--toast-error-border); }
.toast.warning { border-left-color: var(--toast-warning-border); }

/* 消息提示 */
.message {
    background: var(--message-success-bg);
    border: 1px solid var(--message-success-border);
    color: var(--message-success-text);
    padding: 10px 20px;
    border-radius: 40px;
    margin-bottom: 20px;
}
.error {
    background: var(--message-error-bg);
    border: 1px solid var(--message-error-border);
    color: var(--message-error-text);
    padding: 10px 20px;
    border-radius: 40px;
    margin-bottom: 20px;
}

/* 登录页 */
.login-container { max-width: 420px; margin: 0 auto; }
.login-card {
    background: var(--bg-card);
    border-radius: 48px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: var(--shadow-md);
}
.error-msg {
    background: var(--message-error-bg);
    border: 1px solid var(--message-error-border);
    border-radius: 60px;
    padding: 10px;
    margin-bottom: 20px;
    color: var(--message-error-text);
}
.empty-state { text-align: center; padding: 56px 20px; opacity: 0.7; }

/* ========== 模态框 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--modal-backdrop-bg);
    backdrop-filter: blur(var(--modal-backdrop-blur));
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal.active { display: flex; }
.modal-card {
    background: var(--modal-bg);
    border-radius: var(--modal-border-radius);
    padding: var(--modal-padding);
    width: 90%;
    max-width: 320px;
    text-align: center;
    border: 1px solid var(--modal-border);
    box-shadow: var(--modal-shadow);
    animation: modalFadeIn var(--modal-animation-duration) ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.announcement-card {
    max-width: 400px;
    text-align: left;
}
.announcement-card p {
    margin: 20px 0;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: var(--divider-width) solid var(--divider-color);
}

/* 歌曲操作栏 */
.song-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    animation: fadeIn var(--transition-fast) ease;
    position: relative;
    z-index: 2;
    overflow: visible;          /* 确保按钮可点击，不裁剪 */
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.action-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--btn-transition);
    text-align: center;
}
.action-edit { background: var(--btn-secondary-bg); color: white; }
.action-played { background: var(--btn-success-bg); color: white; }
.action-back { background: var(--btn-clear-bg); color: white; }
.action-play {
    background: var(--btn-warning-bg);
    color: var(--btn-warning-text);
}

.song-source {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    padding-left: 20px;
    position: relative;
    z-index: 2;
}
.song-time {
    margin-left: 6px;
    opacity: 0.8;
}

/* 解析按钮组 */
.parse-button-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.parse-btn {
    flex: 1;
    background: var(--btn-primary-bg);
    border: none;
    padding: 10px 4px;
    border-radius: 40px;
    font-weight: var(--btn-font-weight);
    color: var(--btn-primary-text);
    cursor: pointer;
    transition: var(--btn-transition);
    text-align: center;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.parse-btn-success { background: var(--btn-success-bg); }
.parse-btn-secondary { background: var(--btn-secondary-bg); }

/* 实时匹配容器 */
.live-match-results {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 8px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
}
.song-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}
.song-tag {
    background: var(--bg-card-hover);
    border-radius: 40px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition-base);
}
.song-tag:hover {
    background: var(--list-item-selected);
    border-color: var(--primary);
}
.song-tag-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}
.song-tag-add {
    background: var(--btn-success-bg);
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 12px;
    margin-left: 8px;
    cursor: pointer;
}

/* 在线用户 */
.online-users-top {
    width: 100%;
    margin-bottom: 8px;
}
.online-users-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--bg-card);
    padding: 6px 16px;
    border-radius: 40px;
    border: 1px solid var(--border);
    overflow-x: auto;
    white-space: nowrap;
}
.online-icon {
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.online-user-list {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
}
.online-user-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    flex-shrink: 0;
}
.online-avatar-mini {
    width: 1.4em;
    height: 1.4em;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--primary);
    flex-shrink: 0;
}
.source-avatar-mini {
    width: 1.2em;
    height: 1.2em;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--primary);
    vertical-align: middle;
    margin-right: 4px;
}

/* ========== 滚动条定制 ========== */
.song-list::-webkit-scrollbar,
.loaded-data-container::-webkit-scrollbar,
.song-tags-container::-webkit-scrollbar,
.online-users-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.song-list::-webkit-scrollbar-track,
.loaded-data-container::-webkit-scrollbar-track,
.song-tags-container::-webkit-scrollbar-track,
.online-users-scroll::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: var(--scrollbar-border-radius);
}
.song-list::-webkit-scrollbar-thumb,
.loaded-data-container::-webkit-scrollbar-thumb,
.song-tags-container::-webkit-scrollbar-thumb,
.online-users-scroll::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scrollbar-border-radius);
}
.song-list::-webkit-scrollbar-thumb:hover,
.loaded-data-container::-webkit-scrollbar-thumb:hover,
.song-tags-container::-webkit-scrollbar-thumb:hover,
.online-users-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* 搜索结果 */
#searchResults {
    display: block;
    overflow: visible !important;
    max-height: none !important;
}
#resultsList {
    max-height: 340px;
    overflow-y: auto !important;
    overflow-x: hidden;
    margin-top: 12px;
    padding-right: 6px;
}
#editLiveMatchResults {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 8px !important;
    margin-bottom: 12px;
}
#editLiveMatchResults .song-tags-container {
    max-height: 180px;
    overflow-y: auto;
}

/* ========== 响应式 ========== */
@media (max-width: 1145px) {
    .header {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 12px 16px;
        align-items: center;
    }
    .site-logo {
        grid-column: 1 / -1;
        grid-row: 1;
        text-align: center;
        width: 100%;
    }
    .header-nav-left {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
    }
    .header-right {
        grid-column: 2;
        grid-row: 2;
        justify-self: end;
        margin-left: 0;
    }
}
@media (max-width: 780px) {
    .header {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 12px 20px;
        border-radius: 40px;
    }
    .site-logo {
        font-size: 1.4rem;
        flex: 1;
        text-align: left;
    }
    .menu-toggle {
        display: block;
    }
    .header-nav-left,
    .nav-user-dropdown {
        display: none;
    }
    /* 移动端隐藏桌面主题折叠器 */
    .theme-folder {
        display: none;
    }
}
@media (max-width: 480px) {
    body { padding: 12px; }
    .site-logo { font-size: 1.2rem; }
    .glass-card { padding: 18px; }
    .btn { padding: 8px 16px; font-size: 0.9rem; }
    .parse-btn { padding: 10px 2px; font-size: 0.85rem; }
}

/* ========== 桌面端折叠主题列表 ========== */
.theme-folder {
    position: relative;
    display: flex;
    align-items: center;
}
.theme-folder-trigger {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 40px;
    display: flex;
    align-items: center;
}
.theme-folder-trigger:hover {
    background: var(--bg-card-hover);
}
.theme-folder-list {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 240px;
    max-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: var(--dropdown-border-radius);
    padding: var(--dropdown-padding);
    box-shadow: var(--dropdown-shadow);
    z-index: 1000;
}
.theme-folder-list.open {
    display: block;
}
.theme-folder-item {
    padding: 10px 16px;
    border-radius: 40px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}
.theme-folder-item:hover {
    background: var(--dropdown-item-hover);
}
.theme-folder-item.active {
    background: var(--primary);
    color: white;
}
.theme-group-title {
    padding: 8px 16px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
/* 终极强制修复 */
.side-menu,
.modal-card,
.announcement-card,
.user-dropdown-menu,
.toast {
    background: var(--bg-sidebar) !important;
}
.user-dropdown-menu {
    border-color: var(--dropdown-border) !important;
}
@media (max-width: 780px) {
    .header {
        position: relative;  /* 确保绝对定位的标题参照 header */
    }
    .header h1 {
        position: static !important;  /* 取消绝对定位 */
        transform: none !important;
        left: auto;
        margin: 0;
        font-size: 1.2rem;
    }
    .header .btn-secondary {
        /* 返回按钮保持左对齐即可 */
    }
}

/* =========================================
   在放功能样式（修复波形溢出与显示问题）
   ========================================= */
/* 强制歌曲卡片允许溢出，以便波形可见（但歌曲列表容器裁剪溢出） */
.song-item,
.song-item.playing,
.song-item.selected-song {
    border-radius: var(--list-border-radius) !important;
    position: relative !important;
    overflow: visible !important;       /* 关键！让波形不会被裁剪 */
}

/* 在放状态边框 */
.song-item.playing {
    border-color: var(--primary) !important;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
    z-index: 1;
}

/* 顶部进度条（使用主题变量） */
.song-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--progress-color, #0ef);
    border-radius: var(--list-border-radius) var(--list-border-radius) 0 0;
    width: 0%;
    transition: width 1s linear;
    z-index: 5;
}

/* ========== 波形系统（使用 ::after，确保可见并可通过类切换） ========== */
.song-item.playing::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
    display: none;                     /* 默认隐藏，由具体波形类激活 */
}

/* 流动条纹 */
.song-item.playing.wave-style-default::after {
    display: block;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 40px,
        rgba(139, 92, 246, 0.3) 40px,
        rgba(139, 92, 246, 0.3) 42px,
        transparent 42px,
        transparent 80px
    );
    background-size: 120px 100%;
    animation: waveFlow 2s linear infinite;
    opacity: 0.8;
}

/* 脉冲光点 */
.song-item.playing.wave-style-pulse::after {
    display: block;
    background: radial-gradient(circle at 50% 50%, var(--progress-color, #0ef) 0%, transparent 60%);
    animation: pulseWave 1.5s ease-in-out infinite;
    opacity: 0.45;
}

/* 流光扫描 */
.song-item.playing.wave-style-scan::after {
    display: block;
    background: linear-gradient(90deg, transparent 0%, var(--progress-color, #0ef) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: scanWave 2.5s linear infinite;
    opacity: 0.55;
}

/* 柔和呼吸 */
.song-item.playing.wave-style-breathe::after {
    display: block;
    background: var(--progress-color, #0ef);
    animation: breathe 2s ease-in-out infinite;
    opacity: 0.15;
}

/* 彩虹流动 */
.song-item.playing.wave-style-rainbow::after {
    display: block;
    background: linear-gradient(90deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0000);
    background-size: 400% 100%;
    animation: rainbowFlow 4s linear infinite;
    opacity: 0.35;
}

/* 闪烁边框 */
.song-item.playing.wave-style-glow::after {
    display: block;
    background: transparent;
    box-shadow: inset 0 0 20px var(--progress-color, #0ef);
    animation: glowPulse 1.5s ease-in-out infinite;
    opacity: 0.6;
}

/* 粒子飘散 */
.song-item.playing.wave-style-particles::after {
    display: block;
    background: radial-gradient(circle, var(--progress-color, #0ef) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: particles 2s linear infinite;
    opacity: 0.5;
}

/* 心跳脉冲 */
.song-item.playing.wave-style-heartbeat::after {
    display: block;
    background: radial-gradient(circle at 50% 50%, var(--progress-color, #0ef) 0%, transparent 60%);
    animation: heartbeat 0.8s ease-in-out infinite;
    opacity: 0.5;
}

/* 极光流动 */
.song-item.playing.wave-style-aurora::after {
    display: block;
    background: linear-gradient(
        45deg,
        #00ff88 0%,
        #00ffff 25%,
        #8844ff 50%,
        #ff00ff 75%,
        #00ff88 100%
    );
    background-size: 400% 400%;
    animation: aurora 6s ease infinite;
    opacity: 0.4;
}

@keyframes waveFlow {
    from { background-position-x: 0; }
    to { background-position-x: 120px; }
}
@keyframes pulseWave {
    0%, 100% { transform: scale(0.95); opacity: 0.45; }
    50% { transform: scale(1.05); opacity: 0.2; }
}
@keyframes scanWave {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}
@keyframes breathe {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.25; }
}
@keyframes rainbowFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}
@keyframes glowPulse {
    0%, 100% { box-shadow: inset 0 0 10px var(--progress-color, #0ef); }
    50% { box-shadow: inset 0 0 30px var(--progress-color, #0ef); }
}
@keyframes particles {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}
@keyframes heartbeat {
    0%, 100% { transform: scale(0.95); opacity: 0.3; }
    15% { transform: scale(1.1); opacity: 0.7; }
    30% { transform: scale(0.95); opacity: 0.3; }
    45% { transform: scale(1.05); opacity: 0.5; }
    60% { transform: scale(0.95); opacity: 0.3; }
}
@keyframes aurora {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 播放询问弹窗 */
.play-confirm-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.play-confirm-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px 28px;
    min-width: 280px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    position: relative;
}
.play-confirm-close {
    position: absolute;
    top: 10px; right: 14px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    line-height: 1;
}
.play-confirm-close:hover {
    color: var(--primary);
}
.play-confirm-title {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.play-confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.play-confirm-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 30px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    font-size: 0.9rem;
}
.play-confirm-btn.unplayed {
    background: var(--btn-warning-bg);
    color: var(--btn-warning-text);
}
.play-confirm-btn.played {
    background: var(--btn-success-bg);
    color: var(--btn-success-text);
}

/* ========== Sortable 拖拽样式（防止溢出） ========== */
.sortable-ghost {
    opacity: 0.5;
    background: var(--bg-card-hover) !important;
    overflow: hidden !important;
    max-width: 100%;
    box-sizing: border-box;
}
.sortable-chosen {
    cursor: grabbing;
    will-change: transform;
    overflow: hidden !important;
}
/* 全局搜索下拉列表 */
.global-search-wrapper {
    position: relative;
}
.global-search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: var(--shadow-md);
    margin-top: 4px;
    padding: 8px;
    display: none;
}
.global-search-results-dropdown .song-tag {
    margin-bottom: 8px;
}