: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: transparent;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: none;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
    min-height: 26px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
}

.lyrics-display .lyric-line span {
    display: inline-block;
    margin: 0 2px;
    transition: all 0.5s ease;
    position: relative;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* 隐藏除前两个字以外的所有字 */
.lyrics-display .lyric-line span:nth-child(n+3) {
    opacity: 0;
    transform: translateX(-20px);
    position: absolute;
}

/* 显示省略号 */
.lyrics-display .lyric-line::after {
    content: '...';
    color: rgba(255, 255, 255, 0.8);
    margin-left: 4px;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* 激活状态显示所有字 */
.lyrics-display .lyric-line.active {
    justify-content: center;
    background-color: rgba(0, 77, 64, 0.2);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.lyrics-display .lyric-line.active span:nth-child(n+3) {
    opacity: 1;
    transform: translateX(0);
    position: relative;
    text-shadow: 0 0 4px rgba(0,0,0,0.7);
}

/* 激活状态隐藏省略号 */
.lyrics-display .lyric-line.active::after {
    content: '';
}

/* 调整动画效果 */
.lyrics-display .lyric-line span {
    transition: all 0.5s ease;
}

.lyrics-display .lyric-line.active span {
    font-size: 16px;
}

/* 为每个字设置不同的动画 */
.lyrics-display .lyric-line.active span:nth-child(3n) {
    animation: float-1 2s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(3n+1) {
    animation: float-2 2.4s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(3n+2) {
    animation: float-3 2.8s ease-in-out infinite;
}

.lyrics-display .lyric-line:hover {
    background-color: rgba(26, 35, 126, 0.15);
    transform: translateY(-2px);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.lyrics-display .lyric-line:hover span {
    animation-duration: 1s !important;
}

.lyrics-placeholder {
    color: white;
    opacity: 0.9;
    background-color: transparent;
    padding: 8px 15px;
    border-radius: 5px;
    text-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.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;
    }
}

/* 增强浮动动画效果 */
@keyframes float-1 {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes float-2 {
    0%, 100% { transform: translateY(0) rotate(2deg); }
    50% { transform: translateY(-6px) rotate(-2deg); }
}

@keyframes float-3 {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

/* 添加翻转动画 */
@keyframes flip {
    0% { transform: perspective(400px) rotateY(0); }
    100% { transform: perspective(400px) rotateY(360deg); }
}

@keyframes flipBack {
    0% { transform: perspective(400px) rotateX(0); }
    100% { transform: perspective(400px) rotateX(360deg); }
}

/* 添加翻转类 */
.lyrics-display .lyric-line span.flip {
    animation: flip 1s ease-in-out infinite;
    transform-origin: center;
    display: inline-block;
}

.lyrics-display .lyric-line span.flipBack {
    animation: flipBack 1s ease-in-out infinite;
    transform-origin: center;
    display: inline-block;
}

.lyrics-display .lyric-line span:nth-child(3n) {
    animation: float-1 2.5s ease-in-out infinite;
    color: rgba(255, 217, 0, 0.9);
}

.lyrics-display .lyric-line span:nth-child(3n+1) {
    animation: float-2 3s ease-in-out infinite;
    color: rgba(76, 175, 80, 0.9);
}

.lyrics-display .lyric-line span:nth-child(3n+2) {
    animation: float-3 3.5s ease-in-out infinite;
    color: rgba(33, 150, 243, 0.9);
}

.lyrics-display .lyric-line.active span:nth-child(7n+1) {
    color: var(--color-1);
    text-shadow: 0 0 10px var(--color-1), 0 0 20px var(--color-1);
    animation: float-1 2s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(7n+2) {
    color: var(--color-2);
    text-shadow: 0 0 10px var(--color-2), 0 0 20px var(--color-2);
    animation: float-2 2.2s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(7n+3) {
    color: var(--color-3);
    text-shadow: 0 0 10px var(--color-3), 0 0 20px var(--color-3);
    animation: float-3 2.4s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(7n+4) {
    color: var(--color-4);
    text-shadow: 0 0 10px var(--color-4), 0 0 20px var(--color-4);
    animation: float-1 2.6s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(7n+5) {
    color: var(--color-5);
    text-shadow: 0 0 10px var(--color-5), 0 0 20px var(--color-5);
    animation: float-2 2.8s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(7n+6) {
    color: var(--color-6);
    text-shadow: 0 0 10px var(--color-6), 0 0 20px var(--color-6);
    animation: float-3 3s ease-in-out infinite;
}

.lyrics-display .lyric-line.active span:nth-child(7n) {
    color: var(--color-7);
    text-shadow: 0 0 10px var(--color-7), 0 0 20px var(--color-7);
    animation: float-1 3.2s ease-in-out infinite;
}

.lyrics-display .lyric-line:hover span {
    animation-duration: 1s !important;
}

/* 添加放大字的样式 */
.lyrics-display .lyric-line span.bigger {
    font-size: 24px;
    transform: translateY(-2px);
    transition: all 0.3s ease;
    font-weight: bold;
}

/* 修改激活行的基础字体大小 */
.lyrics-display .lyric-line.active span {
    font-size: 16px;
}    