:root {
    --card-width: 90vw;
    --card-height: 160vw;
    --max-card-width: 360px;
    --max-card-height: 640px;
    --primary-color: #333;
    --secondary-color: #666;
    --background-color: #f4f4f4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-color);
    font-family: 'Arial', sans-serif;
}

.card-container {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
    max-width: var(--max-card-width);
    max-height: var(--max-card-height);
    margin: auto;
}

.card {
    width: 100%;
    height: 100%;
    border: 2px dashed var(--secondary-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    background-color: rgba(255,255,255,0.8);
    overflow: hidden;
    position: relative;
    min-height: var(--card-height);
    max-height: var(--card-height);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: rgba(255,255,255,0.5);
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.card-title {
    position: relative;
    font-size: 18px; 
    display: inline-block;
    padding: 5px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-right: 10px;
}

.card-title span {
    font-size: 0.5em; 
    display: inline-block;
    margin: 0 2px;
    transition: all 0.3s ease;
}

.card-title .word-wo {
    color: #ff6b6b; 
    transform: rotate(-5deg);
}

.card-title .word-wang {
    color: #4ecdc4; 
    transform: rotate(0deg);
}

.song-title {
    color: #333;
    font-size: 16px;
    text-align: center;
}

.card-title:hover span {
    transform: translateY(-5px);
}

.add-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--secondary-color);
    cursor: pointer;
}

.card-content {
    flex-grow: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    height: calc(100% - 100px);
    padding: 10px 0;
    width: 100%; 
}

.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.5;
    z-index: 1;
    transition: none;
}

.lyrics-display {
    z-index: 2;
    text-align: center;
    width: 100%; 
    height: 100%;
    overflow-y: auto;
    transition: all 0.3s ease;
    padding: 5px 5px; 
    -webkit-overflow-scrolling: touch;
    position: relative;
    touch-action: pan-y;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch; 
}

#lyrics-input::-webkit-scrollbar {
    width: 4px;
}

#lyrics-input::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 2px;
}

#lyrics-input::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 2px;
}

.lyrics-display .lyric-line:nth-child(n+100) {
    display: block; 
}

.lyrics-display::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.15));
    pointer-events: none;
}

.lyrics-display .lyric-line {
    margin: 2px 0;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 6.5px; /* 字体减小一倍 */
    line-height: 1.3;
    color: white;
    background-color: rgba(26, 35, 126, 0.1); /* 背景透明度最大 */
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    user-select: none;
    width: 100%;
    box-sizing: border-box;
    min-height: 26px;
    display: flex; 
    justify-content: flex-start; /* 未点击时靠左 */
    align-items: center; 
}

.lyrics-display .lyric-line:hover {
    background-color: rgba(26, 35, 126, 0.15); 
    transform: translateY(-2px);
}

.lyrics-display .lyric-line.active {
    font-size: 16px;
    background-color: rgba(0, 77, 64, 0.1); 
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: scale(1.01);
    min-height: 30px;
    text-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700, 0 0 30px #ffd700; 
    opacity: 0.8; 
    justify-content: center; /* 点击后靠中间 */
}

.lyrics-placeholder {
    color: white;
    opacity: 0.8;
    background-color: rgba(26, 35, 126, 0.1); 
    padding: 8px 15px;
    border-radius: 5px;
}

.card-footer {
    padding: 15px;
    background-color: rgba(255,255,255,0.5);
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.audio-progress {
    width: calc(100% * 1.5); 
    margin-right: 10px;
}

.time-display {
    white-space: nowrap;
    font-size: 12px;
    color: var(--secondary-color);
}

.dropdown-menu {
    position: absolute;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    display: none; 
    gap: 10px;
    background-color: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    display: flex; 
    bottom: 20px; 
}

.lyrics-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.lyrics-modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    text-align: center;
}

#lyrics-input {
    width: 100%;
    height: 300px; 
    resize: none;
    margin-bottom: 15px;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
    padding: 15px;
}

.lyrics-modal-actions {
    display: flex;
    justify-content: space-between;
}

.audio-controls .play-pause-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.current-time, .total-time {
    font-size: 12px;
}

@media screen and (min-width: 375px) {
    :root {
        --card-width: 85vw;
        --card-height: 150vw;
    }
}

@media screen and (min-width: 414px) {
    :root {
        --card-width: 80vw;
        --card-height: 142vw;
    }
}

@media screen and (min-width: 768px) {
    :root {
        --card-width: 50vw;
        --card-height: 90vw;
    }
    .lyrics-display .lyric-line {
        font-size: 7px;
    }
    
    .lyrics-display .lyric-line.active {
        font-size: 18px;
    }
}

@media screen and (min-width: 1024px) {
    :root {
        --card-width: 360px;
        --card-height: 640px;
    }
}

@media screen and (max-width: 375px) {
    .card-title {
        font-size: 16px;
    }
    
    .lyrics-display {
        font-size: 7px;
    }
}    
