html {
    -webkit-text-size-adjust: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", 
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    color: #333;
    transition: background 1s ease;
}

/* 浅色渐变背景集合 */
body {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.gradient-1 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.gradient-2 { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.gradient-3 { background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%); }
.gradient-4 { background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); }
.gradient-5 { background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); }
.gradient-6 { background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%); }
.gradient-7 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.gradient-8 { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.gradient-9 { background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%); }
.gradient-10 { background: linear-gradient(135deg, #fdcbf1 0%, #e6dee9 100%); }
.gradient-11 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.gradient-12 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: #444;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(255,255,255,0.5);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    color: #666;
}

/* 今日歌词区域 - 长方形卡片 */
.today-section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 35px 40px;
    margin: 0 auto 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.5);
    width: 100%;
    max-width: 600px;
    min-height: 450px;
    aspect-ratio: 4/3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.today-label {
    display: none;
}

.today-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.calendar-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.today-title {
    font-size: 1.2rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.today-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    padding-bottom: 60px;
    perspective: 1200px;
    -webkit-perspective: 1200px;
}

.today-lyric {
    font-size: 1.8rem;
    line-height: 1.9;
    color: #333;
    font-style: italic;
    margin-top: 20px;
    padding: 0 20px;
}

.today-meta {
    position: absolute;
    bottom: 0;
    right: 0;
    text-align: right;
}

.today-meta-main {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 3px;
}

.today-meta-main .song {
    color: #667eea;
    font-weight: 600;
}

.today-meta-sub {
    font-size: 0.75rem;
    color: #999;
}

.today-loading {
    color: #888;
    padding: 40px;
}

.toggle-calendar-btn-container {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.toggle-btn:active {
    transform: translateY(0);
}

.today-empty {
    color: #888;
    padding: 40px;
    font-style: italic;
}

/* 日历区域 */
.calendar-section {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.5);
}

.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    color: #444;
}

.calendar-nav h2 {
    font-size: 1.5rem;
    min-width: 150px;
    text-align: center;
}

.calendar-nav button {
    background: rgba(255,255,255,0.8);
    border: none;
    color: #555;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.calendar-nav button:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.weekday-header {
    text-align: center;
    font-weight: bold;
    color: #666;
    padding: 10px;
    font-size: 0.9rem;
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.5);
    overflow: hidden;
    position: relative;
    -webkit-perspective: 1200px;
    perspective: 1200px;
}

.calendar-day:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.9);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.day-number {
    font-size: 1rem;
    font-weight: bold;
    color: #444;
}

.calendar-day.today .day-number {
    color: white;
}

.day-lyric {
    font-size: 0.78rem;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    margin-top: 4px;
}

.calendar-day.today .day-lyric {
    color: rgba(255,255,255,0.9);
}

.day-song-meta {
    margin-top: auto;
    padding-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.day-singer {
    font-size: 0.72rem;
    color: #888;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-song {
    font-size: 0.75rem;
    color: #555;
    font-weight: 600;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-day.today .day-singer {
    color: rgba(255,255,255,0.7);
}

.calendar-day.today .day-song {
    color: rgba(255,255,255,0.9);
}

/* 日历弹窗样式 */
.calendar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.calendar-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 12px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
    animation: calendarSlideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@keyframes calendarSlideIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.calendar-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: #999;
    z-index: 10;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-close:hover { color: #333; }

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover { color: #333; }

.lyric-text {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 20px;
    font-style: italic;
}

.song-info {
    color: #667eea;
    font-weight: 600;
    text-align: right;
    font-size: 1.1rem;
}

.composer-info {
    color: #888;
    text-align: right;
    font-size: 0.9rem;
    margin-top: 5px;
}

footer {
    text-align: center;
    color: #555;
    padding: 30px 0;
    opacity: 0.8;
}

@media (max-width: 768px) {
    header h1 { font-size: 1.8rem; }
    .today-lyric { font-size: 1.1rem; padding: 15px; }
    .today-meta {
        position: static;
        margin-top: 16px;
        text-align: right;
    }
    .today-content {
        padding-bottom: 0;
    }

    .today-section {
        aspect-ratio: unset;
        min-height: unset;
        height: auto;
        padding: 24px 20px;
    }

    .toggle-calendar-btn-container {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .calendar-modal {
        padding: 0;
        align-items: flex-end;
    }

    .calendar-modal-content {
        border-radius: 20px 20px 0 0;
        padding: 16px 10px 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
        max-height: 92vh;
        max-height: 92dvh;
        width: 100%;
    }

    .calendar-section { padding: 0; }
    .calendar-nav { margin-bottom: 10px; }
    .calendar-grid { gap: 3px; }
    .weekday-header { padding: 4px 2px; font-size: 0.75rem; }
    .calendar-day { padding: 3px; }
    .day-number { font-size: 0.72rem; }
    .day-lyric { display: none; }
    .day-song-meta { margin-top: auto; gap: 0; }
    .day-singer { display: none; }

    .day-song {
        font-size: 0.58rem;
        font-weight: 600;
        -webkit-line-clamp: 2;
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-align: left;
    }

    .calendar-day.today .day-song { color: rgba(255,255,255,0.95); }

    /* 移动端：让今日卡片随内容高度自动伸展 */
    .today-content {
        flex: none;
        height: auto;
        padding-bottom: 0;
    }
    .today-content .flip-card-inner {
        position: relative;
        inset: auto;
    }
    .today-content .flip-card-front {
        position: relative;
        inset: auto;
    }
    .today-content .flip-card-back {
        position: absolute;
        inset: 0;
        min-height: 100%;
    }

}

/* ===== 翻转卡片 ===== */
.flip-card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-radius: inherit;
}

.flip-card-inner.flipped { transform: rotateY(180deg); }

.flip-card-front,
.flip-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: inherit;
    overflow: hidden;
}

.flip-card-back { transform: rotateY(180deg); }

.today-content .flip-card-front {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.today-content .flip-card-back {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 20px 20px;
    background: rgba(255,255,255,0.85);
}

.today-brief-text {
    font-size: 1rem;
    line-height: 1.9;
    color: #444;
    flex: 1;
    overflow-y: auto;
    padding-top: 8px;
}

.today-brief-meta {
    text-align: right;
    padding-top: 16px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    margin-top: 12px;
}

.flip-hint {
    font-size: 0.72rem;
    color: #bbb;
    margin-top: 6px;
    display: block;
}

.calendar-day .flip-card-inner { border-radius: 11px; }

.calendar-day .flip-card-front {
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: inherit;
    border-radius: 11px;
}

.calendar-day .flip-card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 7px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.day-brief {
    font-size: 0.55rem;
    line-height: 1.45;
    color: rgba(255,255,255,0.92);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 7;
    -webkit-box-orient: vertical;
}

.day-back-song {
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
    flex-shrink: 0;
}

.calendar-day.today .flip-card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.back-today-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-right: 10px;
}

.back-today-btn:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-2px);
}

.day-nav {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex: 1 1 0;
    height: 0;
}

.day-nav .today-content {
    flex: 1 1 0;
    height: 100%;
}

.day-nav-btn {
    flex-shrink: 0;
    align-self: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.6);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    color: #555;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.day-nav-btn:hover {
    background: rgba(255,255,255,0.9);
    transform: scale(1.1);
}

.day-nav-btn:active { transform: scale(0.95); }
