/* 引入 Google Fonts 的思源宋体和一种适合日期的西文字体 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;700&family=Playfair+Display:wght@700&display=swap');

:root {
    --font-serif: 'Playfair Display', serif;
    --font-cjk-serif: 'Noto Serif SC', serif;
    --background-color: #f8f8f8;
    --text-color: #1d1d1f;
    --text-color-secondary: #86868b;
    --container-bg: #ffffff;
    --active-bg: #1d1d1f;
    --active-text: #ffffff;
    --border-color: #eaeaea;
    --api-get-bg: #eef7ff;
    --api-get-text: #00529B;
}

body {
    font-family: var(--font-cjk-serif);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 520px;
    width: 100%;
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

.calendar-header {
    margin-bottom: 40px;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center; 
    margin-bottom: 25px;
}

/* 核心修改：将 input 伪装成 h1 纯文本 */
input.main-date {
    font-family: var(--font-cjk-serif), var(--font-serif);
    font-size: 2.2rem;
    font-weight: 500;
    margin: 0;
    cursor: pointer;
    transition: color 0.2s ease;
    /* 移除所有 input 默认样式 */
    border: none;
    background-color: transparent;
    outline: none;
    padding: 0;
    width: auto; /* 让宽度自适应内容 */
    color: var(--text-color); /* 继承颜色 */
    -webkit-appearance: none; /* 移除 iOS 上的默认样式 */
}
input.main-date:hover {
    color: var(--text-color-secondary);
}

.today-btn {
    font-size: 1.5rem; 
    font-weight: 700;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    position: relative;
    top: 2px;
}
.today-btn:hover {
    background-color: #f0f0f0;
    color: var(--text-color);
}

.week-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.week-arrow {
    color: #ccc;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.week-arrow svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}
.week-arrow:hover {
    background-color: #f0f0f0;
    color: var(--text-color);
}

.week-strip {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    text-align: center;
    flex-grow: 1;
    margin: 0 10px;
}

.day-cell {
    cursor: pointer;
    padding: 8px 0;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.day-cell .day-letter {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color-secondary);
}
.day-cell .day-number {
    font-size: 1rem;
    font-weight: 500;
    margin-top: 4px;
}
.day-cell.active {
    background-color: var(--active-bg);
    color: var(--active-text);
}
.day-cell.active .day-letter {
    color: var(--active-text);
}
.day-cell:not(.active):hover {
    background-color: #f0f0f0;
}

.content-main {
    min-height: 400px;
}

.image-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#calendar-image {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.message-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 20px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    color: #777;
    font-size: 1.5em; 
}
#message-text {
    font-weight: 500;
    color: #333;
}

.hidden {
    display: none;
}

footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.api-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0 0 15px 0;
}
.api-endpoint {
    margin-bottom: 12px;
}
.api-endpoint span {
    display: inline-block;
    background-color: var(--api-get-bg);
    color: var(--api-get-text);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 700;
    font-family: monospace;
    margin-right: 10px;
}
.api-endpoint code {
    font-family: monospace;
    font-size: 0.9em;
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
}
.api-endpoint p {
    font-size: 0.85em;
    color: #666;
    margin: 5px 0 0 0;
    padding-left: 55px;
}

.flatpickr-calendar {
    font-family: var(--font-cjk-serif);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border: none;
    border-radius: 6px;
}

/* --- 移动端优化样式 --- */
@media (max-width: 600px) {
    body {
        padding: 0;
    }
    .container {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
        padding: 25px 20px;
        box-sizing: border-box;
    }
    .header-top-row {
        margin-bottom: 20px;
    }
    input.main-date {
        font-size: 1.6rem;
    }
    .today-btn {
        font-size: 1.1rem;
        padding: 3px 8px;
    }
    .week-arrow {
        width: 36px;
        height: 36px;
    }
    .week-strip {
        gap: 5px;
        margin: 0 5px;
    }
    .api-endpoint p {
        padding-left: 0;
    }
    footer {
        margin-top: 30px;
    }
}