* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    -o-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-primary);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    background: #121212; /* 添加一个暗色背景作为最终备用 */
    will-change: opacity, transform;
    transform: translateZ(0);
}

/* 背景遮罩 - 默认透明 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    transition: opacity var(--transition-normal), backdrop-filter var(--transition-normal);
    z-index: -1;
    will-change: opacity, backdrop-filter;
    transform: translateZ(0);
}

/* 搜索框聚焦时的背景效果 */
body.search-focused::before {
    background: var(--bg-overlay);
    backdrop-filter: var(--glass-blur);
}

.main-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* 时钟样式 */
.clock {
    margin: 80px 0 60px;
    text-align: center;
}

.time {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 5rem;
    font-weight: 500; /* 调整字体粗细为500 */
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    letter-spacing: 5px; /* 增加字母间距，使数字更加清晰 */
    line-height: 1.3; /* 略微增加行高 */
    animation: fadeInDown 0.8s cubic-bezier(0.19, 1, 0.22, 1) 0.2s forwards;
    user-select: none;
    -webkit-user-select: none;
}


@media screen and (max-width: 768px) {
    .time {
        font-size: 110px;
    }
}

/* 搜索区域 */
.search-area {
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    transition: all var(--transition-normal);
}

.search-box {
    width: 100%;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255,0.3);
    backdrop-filter: blur(1000000px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 4px;
    transition: all var(--transition-normal);
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

/* 搜索框聚焦时，缩小时钟 */
body.search-focused .time {
    font-size: 80px;
    margin-bottom: -30px;
    opacity: 0.7;
}

.search-icon {
    color: var(--text-tertiary);
    font-size: 20px;
    margin-left: 20px;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.search-btn {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* 水波纹效果 */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

/* 音质选择器 */
.quality-selector {
    margin: 0 auto;
    width: 100%;
    max-width: 580px; /* Match search box width */
    overflow-x: auto;
    padding: 8px 0 12px;
    box-sizing: border-box;
}

.quality-buttons {
    display: flex;
    gap: 6px;
    padding: 0 16px;
    scrollbar-width: none; /* Firefox */
    justify-content: center; /* Center the buttons */
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    font-family: 'DouyinSansBold', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.quality-buttons::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.quality-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px) saturate(1800%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quality-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(160px) saturate(200%);
    -webkit-backdrop-filter: blur(16px) saturate(200%);
    border-color: rgba(255, 255, 255, 0.3);
}

.quality-btn.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.8), rgba(var(--primary-rgb), 0.95));
    color: white;
    border-color: rgba(255, 255, 255, 3);
    box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.1);
    backdrop-filter: blur(200px) saturate(2000%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
    transform: translateY(-1px);
}

.quality-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.3);
}

/* Add a subtle glow effect on active state */
.quality-btn.active::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.7), transparent 60%);
    z-index: -1;
    opacity: 0.5;
}

.quality-btn i {
    font-size: 16px;
}

.quality-btn.active {
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* 励志语录 */
.quote-container {
    margin-top: 170px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(102px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    text-align: center;
    width: 600px;
    height: 120px; /* 固定高度 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.3s ease, transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    cursor: pointer;
    overflow: hidden; /* 防止内容溢出 */
}

.quote-container:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.quote-container:active {
    transform: translateY(-2px) scale(0.99);
    transition: transform 0.1s;
}

.quote-icon {
    display: none;
}

.quote-text {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 800;
    font-style: italic;
    max-height: 60px; /* 限制最大高度 */
    overflow: hidden; /* 防止溢出 */
    text-overflow: ellipsis; /* 溢出显示省略号 */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制显示行数 */
    -webkit-box-orient: vertical;
    font-family: 'DouyinSansBold', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.quote-author {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 800;
    font-family: 'DouyinSansBold', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.quote-container:hover .quote-text {
    color: white;
}

.quote-container:hover .quote-author {
    color: rgba(255, 255, 255, 1);
}

/* 搜索结果 */
.results {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    display: none;
    font-size: 15px;
    letter-spacing: 0.3px;
    background: var(--glass-effect-medium);
    backdrop-filter: blur(8px);
}

.error-message {
    text-align: center;
    padding: 16px 24px;
    background: rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    color: #FF3B30;
    margin: 20px 0;
    display: none;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 15px;
    letter-spacing: 0.3px;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    max-width: 80%;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-color);
    padding: 2px;
    box-sizing: border-box;
    display: inline-block;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    padding: 2px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #4ecdc4, #ff6b6b);
    background-size: 400% 400%;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: flow 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes flow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Animation for dynamic island effect */
@keyframes toastIn {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    to {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.song-card {
    background: var(--glass-effect-light);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    cursor: pointer;
}

.song-card:hover {
    transform: translateY(-4px);
    border-color: rgba(96, 165, 250, 0.3);
    background: var(--glass-effect-medium);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.song-info {
    flex: 1;
}

.song-controls {
    display: flex;
    gap: 12px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.song-card:hover .song-controls {
    opacity: 1;
}

/* 按钮交互 */
.play-btn, .download-btn, .quality-btn, .search-btn {
    position: relative;
    overflow: hidden;
}

.play-btn:active, .download-btn:active, .quality-btn:active, .search-btn:active {
    transform: scale(0.95);
}

/* 涟漪效果 */
.play-btn::after, .download-btn::after, .quality-btn::after, .search-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.play-btn:active::after, .download-btn:active::after, 
.quality-btn:active::after, .search-btn:active::after {
    animation: ripple 0.5s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.song-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.singer-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.play-btn, .download-btn {
    padding: 8px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.play-btn {
    background: var(--accent-gradient);
    color: white;
    flex: 1;
}

.download-btn {
    background: var(--glass-effect-light);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.4);
}

.download-btn:hover {
    background: var(--glass-effect-medium);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* 页面容器 */
.page-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* 主页 */
.home-page,
.results-page {
    width: 100%;
    height: 100%;
    position: absolute;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-page {
    left: 0;
    transform: translateX(0);
}

.results-page {
    left: 0;
    transform: translateX(100%);
}

.show-results .home-page {
    transform: translateX(-15%);  /* 主页不完全移出 */
    opacity: 0.8;
}

.show-results .results-page {
    transform: translateX(0);
}

/* 搜索结果页头部 */
.results-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.back-btn:hover {
    background: var(--bg-card-hover);
    transform: scale(1.05);
}

/* 音质选择器样式 */
.quality-select {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-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='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quality-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

/* 暗色模式下的下拉箭头颜色 */
[data-theme="dark"] .quality-select {
    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='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.quality-select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 149, 255, 0.1);
}

.quality-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 149, 255, 0.2);
}

/* 暗色模式下的选择器样式 */
@media (prefers-color-scheme: dark) {
    .quality-select {
        background-color: var(--bg-card);
        color: var(--text-primary);
    }
    
    .quality-select option {
        background-color: var(--bg-primary);
        color: var(--text-primary);
    }
}

.search-term {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 500;
}

/* 搜索结果容器 */
.results-container {
    height: calc(100vh - 81px);
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 0;
}

/* 左侧列表 */
.results-list {
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--glass-border);
}

/* 右侧播放器和歌词 */
.player-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lyrics-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
}

/* 搜索结果卡片 */
.song-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.song-card:hover {
    transform: translateX(4px);
    background: var(--bg-card-hover);
    border-color: var(--primary-color);
}

.song-card.active {
    background: var(--gradient-primary);
    border: none;
}

.song-card.active .song-name,
.song-card.active .singer-name {
    color: white;
}

/* 修改输入框本身的样式 */
#searchInput {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 16px;
    padding: 12px 15px;
    outline: none; /* 移除输入时的黑色轮廓线 */
} 