* { 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;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container { max-width: 900px; margin: 0 auto; }

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

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

.subtitle { font-size: 1.1rem; opacity: 0.9; }

.calendar-wrapper {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.nav-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.current-date { text-align: center; }

#yearMonth {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.lunar-year {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.today-btn-wrapper {
    text-align: center;
    margin-bottom: 15px;
}

.today-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.today-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(17, 153, 142, 0.4);
}

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

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

.weekday:first-child, .weekday:last-child { color: #e74c3c; }

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

.day {
    aspect-ratio: 1;
    border-radius: 12px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #f8f9fa;
    position: relative;
    min-height: 75px;
}

.day:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.day-number {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.day-lunar {
    font-size: 0.7rem;
    color: #888;
    margin-top: 2px;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-lunar.highlight {
    color: #e74c3c;
    font-weight: bold;
}

.day-other-month { opacity: 0.4; }

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

.day-today .day-number,
.day-today .day-lunar {
    color: white;
}

.day-holiday {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.day-holiday .day-lunar {
    color: #c0392b;
    font-weight: bold;
}

.day-workday {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border: 2px solid #e74c3c;
}

.day-workday::after {
    content: '班';
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e74c3c;
    color: white;
    font-size: 0.55rem;
    padding: 1px 3px;
    border-radius: 3px;
}

.day-weekend {
    background: #ffebee;
}

.day-weekend .day-number {
    color: #e74c3c;
}

.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 25px;
    padding: 15px;
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #555;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.holiday { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.dot.workday { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); border: 2px solid #e74c3c; }
.dot.weekend { background: #ffebee; }
.dot.today { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.dot.term { background: #27ae60; }

footer {
    text-align: center;
    margin-top: 30px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

footer a { color: white; text-decoration: none; }
footer a:hover { text-decoration: underline; }

.update-time {
    margin-top: 5px;
    opacity: 0.7;
    font-size: 0.8rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: modalSlide 0.3s ease;
}

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

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.close:hover { color: #333; }

.modal-date {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.modal-lunar {
    color: #666;
    margin-bottom: 8px;
    font-size: 1rem;
}

.modal-animal {
    color: #888;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.modal-term {
    color: #27ae60;
    font-weight: bold;
    margin-bottom: 8px;
}

.modal-festival {
    color: #e74c3c;
    font-weight: bold;
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    body { padding: 10px; }
    header { margin-bottom: 15px; }
    header h1 { font-size: 1.5rem; margin-bottom: 5px; }
    .subtitle { font-size: 0.9rem; }
    
    .calendar-wrapper { 
        padding: 12px; 
        border-radius: 15px;
    }
    
    .calendar-header { margin-bottom: 12px; }
    .nav-btn { 
        width: 36px; 
        height: 36px; 
        font-size: 1rem;
    }
    #yearMonth { font-size: 1.3rem; }
    .lunar-year { font-size: 0.75rem; }
    
    .today-btn-wrapper { margin-bottom: 10px; }
    .today-btn { 
        padding: 6px 16px; 
        font-size: 0.85rem;
    }
    
    .weekdays, .calendar { gap: 4px; }
    .weekday { 
        font-size: 0.75rem; 
        padding: 4px 2px;
    }
    
    .day { 
        aspect-ratio: auto;
        min-height: 52px;
        height: 52px;
        padding: 3px 2px;
        border-radius: 8px;
    }
    
    .day-number { 
        font-size: 0.85rem;
        line-height: 1.2;
    }
    
    .day-lunar { 
        font-size: 0.6rem;
        margin-top: 1px;
        line-height: 1.1;
    }
    
    .day-workday::after {
        font-size: 0.5rem;
        padding: 0 2px;
        top: 1px;
        right: 1px;
    }
    
    .legend { 
        gap: 8px; 
        padding: 10px;
        margin-top: 15px;
    }
    .legend-item { 
        font-size: 0.7rem;
        gap: 4px;
    }
    .dot {
        width: 10px;
        height: 10px;
    }
    
    footer { 
        margin-top: 20px; 
        font-size: 0.8rem;
    }
    .update-time { font-size: 0.7rem; }
    
    .modal-content {
        margin: 20% auto;
        padding: 20px;
        width: 95%;
    }
    .modal-date { font-size: 1.1rem; }
    .close {
        font-size: 24px;
        right: 10px;
        top: 10px;
    }
}
