* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #f5f5f5;
    color: #333;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
    /* 修复iOS滚动问题 */
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    /* 防止水平滚动 */
    width: 100%;
    min-width: 0;
}

header {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    /* 修复iOS上的粘性定位问题 */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

h1 {
    color: #1db954;
    font-size: 24px;
    text-align: center;
    margin: 0;
    /* 防止标题过长导致布局问题 */
    word-break: break-word;
}

.main-content {
    padding: 15px 0 140px; /* 增加底部padding为播放器留出空间 */
}

.search-section {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.section-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.api-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    /* 防止API列表溢出 */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.api-list::-webkit-scrollbar {
    display: none;
}

.api-item {
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0; /* 防止压缩 */
    /* 改善触摸体验 */
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.api-item.active {
    background-color: #1db954;
    color: white;
    border-color: #1db954;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    /* 修复小屏幕上的布局问题 */
    flex-wrap: nowrap;
    align-items: stretch;
}

#search-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 25px;
    border: 1px solid #e0e0e0;
    font-size: 16px; /* iOS上防止缩放 */
    background-color: #f5f5f5;
    outline: none;
    /* 防止输入框在小屏幕上过窄 */
    min-width: 0;
    width: 100%;
}

#search-input:focus {
    border-color: #1db954;
    background-color: white;
}

button {
    padding: 12px 24px;
    background-color: #1db954;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    /* 改善触摸体验 */
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    /* 防止按钮文字换行 */
    flex-shrink: 0;
}

button:hover {
    background-color: #18a449;
}

button:active {
    transform: scale(0.95);
}

.settings-section {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.settings-toggle-title {
    font-size: 14px;
    color: #333;
}

.settings-toggle-icon {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s;
}

.settings-toggle.active .settings-toggle-icon {
    transform: rotate(180deg);
}

.settings-content {
    margin-top: 15px;
    display: none;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 14px;
    color: #666;
    flex: 1;
    /* 防止标签文字过长 */
    word-break: break-word;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #1db954;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.message {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 1000;
    animation: slideDown 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    /* 防止消息过宽 */
    max-width: calc(100vw - 30px);
    word-break: break-word;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.error-message {
    background-color: #ff4444;
    color: white;
}

.success-message {
    background-color: #4caf50;
    color: white;
}

.info-message {
    background-color: #2196f3;
    color: white;
}

.results-section {
    margin-top: 20px;
}

.loading, .no-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

.music-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.music-item {
    background-color: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    /* 防止内容溢出 */
    overflow: hidden;
}

.music-cover {
    width: 60px;
    height: 60px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    border-radius: 6px;
    flex-shrink: 0;
}

.music-info {
    flex: 1;
    min-width: 0; /* 关键：允许flex项目缩小到内容以下 */
    overflow: hidden;
}

.music-title {
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-artist {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-source {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
}

/* 音乐来源标签样式 */
.music-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.music-source-tag {
    background-color: #f0f0f0;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.music-source-tag.wangyi { background-color: #e74c3c; color: white; }
.music-source-tag.qishui { background-color: #3498db; color: white; }
.music-source-tag.kugou { background-color: #f39c12; color: white; }
.music-source-tag.kugou2 { background-color: #e67e22; color: white; }
.music-source-tag.kuwo { background-color: #16a085; color: white; }
.music-source-tag.migu { background-color: #9b59b6; color: white; }
.music-source-tag.juhe { background-color: #34495e; color: white; }

.music-actions {
    display: flex;
    gap: 6px; /* 减小间距 */
    margin-top: 10px;
    flex-wrap: wrap; /* 允许换行 */
}

.music-actions button {
    flex: 1;
    padding: 8px 12px; /* 减小padding */
    font-size: 13px;
    border-radius: 20px;
    min-width: 60px; /* 设置最小宽度 */
}

.music-actions .btn-add {
    background-color: #ff6b6b;
}

.music-actions .btn-download {
    background-color: #666;
}

/* 播放器样式 - 重点优化移动端 */
.player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    min-height: 0;
    width: 100%;
}

.player-info {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
}

.player-title {
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.player-artist {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
}

.player-nav-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    order: 1;
}

.player-nav-btn {
    padding: 6px 12px;
    background-color: #f0f0f0;
    color: #333;
    border-radius: 16px;
    font-size: 12px;
    min-width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.player-nav-btn:active {
    background-color: #e0e0e0;
}

audio {
    flex: 1;
    height: 32px;
    min-width: 120px;
    max-width: 100%;
    order: 2;
}

.player-download {
    padding: 6px 12px;
    background-color: #666;
    color: white;
    border-radius: 16px;
    font-size: 12px;
    flex-shrink: 0;
    min-width: 48px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 3;
}

/* 播放列表样式 */
.playlist-container {
    position: fixed;
    right: -100%;
    top: 0;
    bottom: 0;
    width: 100%;
    background-color: white;
    transition: right 0.3s;
    z-index: 999;
    display: flex;
    flex-direction: column;
    /* 修复iOS上的滚动问题 */
    -webkit-overflow-scrolling: touch;
}

.playlist-container.open {
    right: 0;
}

.playlist-header {
    padding: 15px;
    padding-top: calc(15px + env(safe-area-inset-top)); /* 适配刘海屏 */
    background-color: #1db954;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.playlist-header h3 {
    margin: 0;
    font-size: 18px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
}

.playlist-tabs {
    display: flex;
    background-color: #f5f5f5;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.playlist-tabs::-webkit-scrollbar {
    display: none;
}

.playlist-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    position: relative;
    flex-shrink: 0;
    touch-action: manipulation;
}

.playlist-tab.active {
    color: #1db954;
    background-color: white;
    border-bottom: 2px solid #1db954;
}

.playlist-tab-close {
    margin-left: 8px;
    font-size: 14px;
    color: #999;
}

.playlist-tab-add {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #1db954;
    flex-shrink: 0;
    touch-action: manipulation;
}

.playlist-controls {
    padding: 12px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.playlist-controls-row {
    display: flex;
    gap: 6px; /* 减小间距 */
    margin-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.playlist-controls-row::-webkit-scrollbar {
    display: none;
}

.playlist-controls-row:last-child {
    margin-bottom: 0;
}

.playlist-controls button {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 16px;
    flex-shrink: 0;
    white-space: nowrap;
}

.playlist-mode {
    display: flex;
    gap: 6px;
}

.mode-btn {
    padding: 6px 12px;
    font-size: 12px;
    background-color: #ddd;
    color: #666;
    border-radius: 16px;
}

.mode-btn.active {
    background-color: #1db954;
    color: white;
}

.playlist-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    padding-bottom: calc(120px + env(safe-area-inset-bottom)); /* 为播放器留出空间 */
    -webkit-overflow-scrolling: touch;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background-color: #f9f9f9;
    margin-bottom: 8px;
    border-radius: 8px;
    position: relative;
    /* 防止内容溢出 */
    overflow: hidden;
}

.playlist-item.playing {
    background-color: #e8f5e9;
    border-left: 3px solid #1db954;
}

.playlist-item.expired {
    opacity: 0.6;
}

.playlist-item.refresh-failed {
    background-color: #ffe8e8;
    border: 1px solid #ff4444;
}

.playlist-item.refresh-failed .playlist-item-title {
    color: #d32f2f;
}

.playlist-item.refresh-failed::after {
    content: '⚠️ 刷新失败';
    position: absolute;
    top: 2px;
    right: 8px;
    font-size: 10px;
    color: #ff4444;
    background-color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #ff4444;
}

.playlist-item.fallback-source {
    background-color: #fff4e6;
    border: 1px solid #ffa500;
}

.playlist-item.fallback-source::after {
    content: '🔄 备用音源';
    position: absolute;
    top: 2px;
    right: 8px;
    font-size: 10px;
    color: #ff8c00;
    background-color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #ffa500;
}

.playlist-item-info {
    flex: 1;
    margin-right: 10px;
    min-width: 0; /* 关键：允许缩小 */
}

.playlist-item-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-artist {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.playlist-item-btn {
    padding: 4px 10px;
    font-size: 11px;
    background-color: #1db954;
    color: white;
    border-radius: 12px;
    white-space: nowrap;
}

.playlist-item-btn.danger {
    background-color: #ff4444;
}

.playlist-item-btn.refresh {
    background-color: #4a90e2;
}

.playlist-toggle {
    position: fixed;
    right: 15px;
    bottom: calc(150px + env(safe-area-inset-bottom));
    background-color: #1db954;
    color: white;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 998;
    font-size: 24px;
    touch-action: manipulation;
}

.playlist-toggle:active {
    transform: scale(0.95);
}

.playlist-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    padding: 0 4px;
}

/* 对话框样式 */
.dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 2001;
    display: none;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.dialog.active {
    display: block;
}

.dialog h3 {
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
    word-break: break-word;
}

.dialog textarea {
    width: 100%;
    height: 200px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    resize: vertical;
    /* 防止在iOS上的缩放问题 */
    -webkit-appearance: none;
}

.dialog input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px; /* iOS上防止缩放 */
    margin-bottom: 15px;
    -webkit-appearance: none;
}

.dialog-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap; /* 允许按钮换行 */
}

.dialog-actions button {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
    flex-shrink: 0;
}

.dialog-selector {
    margin-bottom: 15px;
}

.dialog-selector label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.dialog-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background-color: white;
    -webkit-appearance: none;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
}

.overlay.active {
    display: block;
}

/* 日志样式优化 */
.log-container {
    background-color: #1e1e1e;
    color: #d4d4d4;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid #333;
    -webkit-overflow-scrolling: touch;
}

.log-entry {
    margin-bottom: 4px;
    padding: 2px 4px;
    border-radius: 2px;
    word-break: break-all;
}

.log-entry.info { color: #d4d4d4; }
.log-entry.success { color: #4ec9b0; background-color: rgba(78, 201, 176, 0.1); }
.log-entry.warning { color: #dcdcaa; background-color: rgba(220, 220, 170, 0.1); }
.log-entry.error { color: #f48771; background-color: rgba(244, 135, 113, 0.1); }
.log-entry.debug { color: #9cdcfe; font-style: italic; }
.log-entry.network { color: #c586c0; }

.log-timestamp {
    color: #858585;
    margin-right: 8px;
    font-size: 11px;
}

.log-level {
    font-weight: bold;
    margin-right: 8px;
    text-transform: uppercase;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 2px;
}

.log-level.info { background-color: #007acc; color: white; }
.log-level.success { background-color: #4ec9b0; color: white; }
.log-level.warning { background-color: #ce9178; color: white; }
.log-level.error { background-color: #f48771; color: white; }
.log-level.debug { background-color: #9cdcfe; color: black; }
.log-level.network { background-color: #c586c0; color: white; }

.log-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap; /* 允许换行 */
}

.log-controls label {
    font-size: 14px;
    color: #666;
}

.log-controls button {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 16px;
    background-color: #f0f0f0;
    color: #333;
}

#download-frame {
    display: none;
}

.download-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #1db954;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    z-index: 2000;
    display: none;
    word-break: break-word;
}

/* 动画 */
@keyframes addToPlaylistSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.add-success {
    animation: addToPlaylistSuccess 0.5s ease;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.refreshing {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* iPhone SE3及类似小屏幕的特殊优化 */
@media (max-width: 414px) {
    .container {
        padding: 0 12px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .search-box {
        gap: 8px;
    }
    
    button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .music-actions {
        gap: 4px;
    }
    
    .music-actions button {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 50px;
    }
    
    /* 播放器在小屏幕上的优化 */
    .player-container {
        padding: 10px;
        gap: 8px;
    }
    
    .player-controls {
        gap: 6px;
    }
    
    .player-nav-btn {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 32px;
        height: 28px;
    }
    
    .player-download {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 40px;
        height: 28px;
    }
    
    audio {
        min-width: 100px;
        height: 28px;
    }
}

/* 极小屏幕（iPhone SE等）的特殊处理 */
@media (max-width: 375px) {
    .player-container {
        padding: 8px;
        gap: 6px;
    }
    
    .player-controls {
        /* 在极小屏幕上使用换行布局 */
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    audio {
        /* 音频控件占满一行 */
        width: 100%;
        order: 1;
        flex: none;
        min-width: unset;
    }
    
    .player-nav-buttons {
        /* 导航按钮在第二行 */
        order: 2;
        flex-shrink: 0;
    }
    
    .player-download {
        /* 下载按钮在第二行 */
        order: 3;
        flex-shrink: 0;
    }
    
    .music-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .music-actions button {
        width: 100%;
        margin: 0;
    }
}

/* 针对iPhone SE 2020/2022 (375x667) 的特殊优化 */
@media (max-width: 375px) and (max-height: 667px) {
    .main-content {
        padding-bottom: 160px; /* 为播放器留出更多空间 */
    }
    
    .player-container {
        padding: 8px;
        gap: 4px;
    }
    
    .player-title {
        font-size: 14px;
        margin-bottom: 1px;
    }
    
    .player-artist {
        font-size: 12px;
    }
    
    .player-nav-btn {
        padding: 3px 6px;
        font-size: 10px;
        min-width: 28px;
        height: 24px;
    }
    
    .player-download {
        padding: 3px 6px;
        font-size: 10px;
        min-width: 36px;
        height: 24px;
    }
    
    audio {
        height: 24px;
    }
}

/* 桌面端样式 */
@media (min-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    header {
        padding: 20px 0;
    }
    
    h1 {
        font-size: 32px;
    }
    
    .main-content {
        padding: 30px 0 120px;
    }
    
    .search-section, .settings-section {
        padding: 25px;
    }
    
    .music-list {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 20px;
    }
    
    .music-item {
        flex-direction: column;
        padding: 0;
        overflow: hidden;
    }
    
    .music-cover {
        width: 100%;
        height: 180px;
        border-radius: 0;
    }
    
    .music-info {
        padding: 15px;
        width: 100%;
    }
    
    .music-actions {
        flex-direction: row;
        gap: 8px;
    }
    
    .playlist-container {
        width: 400px;
        right: -400px;
    }
    
    .player-container {
        padding: 15px 20px;
        flex-direction: row;
        gap: 20px;
    }
    
    .player-info {
        flex: 1;
        margin-bottom: 0;
    }
    
    .player-controls {
        width: auto;
        gap: 12px;
        flex-wrap: nowrap;
    }
    
    audio {
        width: 300px;
        min-width: 200px;
        order: unset;
    }
    
    .player-nav-btn, .player-download {
        padding: 8px 16px;
        font-size: 14px;
        height: 32px;
        order: unset;
    }
    
    .player-nav-buttons {
        order: unset;
    }
}

/* 针对横屏模式的优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .player-container {
        flex-direction: row;
        gap: 12px;
        padding: 8px 12px;
    }
    
    .player-info {
        flex: 1;
        margin-right: 12px;
    }
    
    .player-controls {
        flex-wrap: nowrap;
        width: auto;
    }
    
    audio {
        width: 200px;
        flex: none;
        order: unset;
    }
    
    .player-nav-buttons, .player-download {
        order: unset;
    }
}

/* 修复iOS Safari特有问题 */
@supports (-webkit-touch-callout: none) {
    .player-container {
        /* 修复iOS上position:fixed的问题 */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
    
    /* 修复iOS上100vh的问题 */
    body {
        min-height: -webkit-fill-available;
    }
    
    /* 修复iOS上的滚动问题 */
    .playlist-content,
    .log-container,
    .dialog {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 修复iOS上input的样式问题 */
    input,
    textarea,
    select {
        -webkit-appearance: none;
        border-radius: 0;
    }
    
    #search-input,
    .dialog input[type="text"] {
        border-radius: 25px;
    }
    
    .dialog textarea {
        border-radius: 8px;
    }
    
    /* 确保播放器控件在iOS上的正确对齐 */
    .player-controls {
        -webkit-box-align: center;
        -webkit-align-items: center;
    }
    
    audio {
        /* 修复iOS上audio控件的样式问题 */
        -webkit-appearance: none;
        appearance: none;
        background: #f0f0f0;
        border-radius: 4px;
    }
}