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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
        sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

.container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 32px;
    max-width: 900px;
    width: 100%;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 0;
}

.year-select,
.month-select {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 4px 18px 4px 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    font-family: inherit;
    line-height: 1.2;
    text-align: center;
    text-align-last: center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 10px 6px;
}

.year-select:hover,
.month-select:hover {
    background-color: #f0f0f0;
}

.year-select:focus,
.month-select:focus {
    outline: none;
    background-color: #e8e8e8;
}

.year-select {
    width: 110px;
}

.month-select {
    width: 75px;
}

.nav-btn {
    text-decoration: none;
    font-size: 24px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f5f5f5;
    color: #666;
    transition: all 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.nav-btn:hover {
    background: #e8e8e8;
    color: #333;
}

.today-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: #1890ff;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
    flex-shrink: 0;
    margin-left: auto;
    line-height: 1.15;
    gap: 1px;
}

.today-btn-top,
.today-btn-bottom {
    font-size: 14px;
    font-weight: 700;
}

.today-btn:hover {
    background: #40a9ff;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

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

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.holiday-dot {
    background: #ff4d4f;
}

.workday-dot {
    background: #faad14;
}

.term-dot {
    background: #52c41a;
}

.lunar-dot {
    background: #999;
}

.today-dot {
    background: #1890ff;
    border: 2px solid #1890ff;
}

.calendar {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.calendar thead th {
    padding: 12px 8px;
    font-size: 17px;
    font-weight: 700;
    color: #444;
    border-bottom: 2px solid #f0f0f0;
    text-align: center;
}

.calendar thead th.weekend {
    color: #ff4d4f;
}

.calendar tbody td {
    border: 1px solid #f0f0f0;
    vertical-align: middle;
    text-align: center;
    padding: 4px;
    height: 100px;
    width: calc(100% / 7);
    position: relative;
    transition: background 0.15s;
}

.calendar tbody td.empty {
    background: #fafafa;
}

.day-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 2px;
    position: relative;
}

.rest-tag {
    position: absolute;
    top: 0;
    right: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #ff4d4f;
    line-height: 1;
}

.day-number {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.lunar-label {
    font-size: 11px;
    color: #999;
    font-weight: 400;
    line-height: 1.2;
}

.holiday-label {
    font-size: 11px;
    color: #ff4d4f;
    font-weight: 700;
    line-height: 1.2;
}

.workday-label {
    font-size: 11px;
    color: #faad14;
    font-weight: 600;
    line-height: 1.2;
}

.term-label {
    font-size: 11px;
    color: #52c41a;
    font-weight: 600;
    line-height: 1.2;
}

.day.other-month {
    background: #fafafa;
}

.day.other-month .day-number {
    color: #ccc;
    font-weight: 400;
}

.day.other-month .holiday-label {
    opacity: 0.5;
}

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

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

.day.other-month .rest-tag {
    opacity: 0.5;
}

.day.other-month:hover {
    background: #f0f0f0;
}

.day.holiday {
    background: #fff1f0;
}

.day.holiday .day-number {
    color: #ff4d4f;
}

.day.workday {
    background: #fffbe6;
}

.day.workday.weekend {
    background: #fff;
}

.day.workday.weekend .day-number {
    color: #faad14;
}

.day.workday .day-number {
    color: #faad14;
}

.day.weekend {
    background: #fff5f5;
}

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

.day.today {
    background: #e6f7ff;
    box-shadow: inset 0 0 0 2px #1890ff;
    border-radius: 4px;
}

.day.today .day-number {
    color: #1890ff;
}

.day:hover {
    background: #f5f5f5;
}

.day.holiday:hover {
    background: #ffe7e6;
}

.day.today:hover {
    background: #d6f0ff;
}

@media (max-width: 600px) {
    .container {
        padding: 16px;
    }

    .header {
        gap: 6px;
    }

    .year-select,
    .month-select {
        font-size: 16px;
        padding: 2px 14px 2px 4px;
    }

    .year-select {
        width: 85px;
    }

    .month-select {
        width: 60px;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .today-btn {
        width: 42px;
        height: 42px;
        border-radius: 6px;
        gap: 0;
    }

    .today-btn-top,
    .today-btn-bottom {
        font-size: 13px;
    }

    .calendar tbody td {
        height: 70px;
        padding: 2px;
    }

    .day-content {
        gap: 1px;
    }

    .day-number {
        font-size: 18px;
    }

    .lunar-label {
        font-size: 9px;
    }

    .rest-tag {
        font-size: 9px;
        right: 1px;
    }

    .holiday-label,
    .workday-label,
    .term-label {
        font-size: 9px;
    }

    .legend {
        gap: 12px;
        font-size: 12px;
    }
}
