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

body {
    background: #f4f5f7;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 顶部导航 ===== */
.top-bar {
    padding: 20px 40px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.row-1 {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 60px;
    width: auto;
    display: block;
}

.main-time {
    font-family: 'Inter', "Microsoft YaHei", sans-serif;
    font-weight: 900;
    font-size: 150px;
    color: #333;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -5px;
    display: inline-block;
    text-align: center;
    min-width: 650px;
}

.row-2 {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    overflow: hidden;
}

@media (max-width: 1200px) {
    .main-time {
        font-size: 100px;
        letter-spacing: -4px;
    }
}

.row-3 {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0;
}

.main-date {
    font-size: 18px;
    color: #555;
    font-weight: 500;
}

.row-4 {
    display: flex;
    justify-content: flex-end;
}

.city-buttons {
    display: flex;
    gap: 8px;
}

.city-buttons button {
    padding: 6px 14px;
    border: none;
    background: #eee;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    border-radius: 4px;
}

.city-buttons button.active {
    background: #64748b;
    color: #fff;
}

/* ===== 主体内容 ===== */
.content {
    flex: 1;
    display: flex;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

/* ===== 左侧面板 ===== */
.left-panel {
    flex: 0 0 320px;
    display: flex;
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
}

.timeline-container {
    flex: 1;
    position: relative;
    display: flex;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    flex-direction: row;
    background: #f1f5f9;
    /* 保持银灰背景 */
}

.fixed-tags {
    flex: 1;
    height: 100%;
    position: relative;
    z-index: 10;
    border-left: 1px solid #cbd5e1;
    background: #f1f5f9;
    overflow: hidden;
}

.tag-row {
    position: absolute;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 10px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 20;
}

.tag-item {
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.tag-item.highlight {
    color: #0369a1;
    border-color: #7dd3fc;
    background: #e0f2fe;
}

.scroll-viewport {
    flex: 0 0 90px;
    position: relative;
    background: linear-gradient(to right,
            transparent 45px,
            #e2e8f0 45px,
            #e2e8f0 46px,
            transparent 46px,
            transparent 95px,
            #e2e8f0 95px,
            #e2e8f0 96px,
            transparent 96px), #f1f5f9;
    overflow: hidden;
    cursor: grab;
    display: flex;
    touch-action: none;
}

.scroll-viewport:active {
    cursor: grabbing;
}

.scroll-track {
    position: absolute;
    width: 100%;
    top: 0;
    display: flex;
    height: 100%;
}

.track-column {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
}

.hours {
    width: 50px;
    left: 45px;
}

.dates {
    left: 0px;
    width: 45px;
}

.cell {
    height: 21px;
    line-height: 21px;
    text-align: center;
    font-size: 12px;
    position: absolute;
    width: 100%;
}

.d-cell {
    writing-mode: vertical-rl;
    color: #475569;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
    width: 100%;
    line-height: 1;
    padding-left: 10px;
    padding-right: 0;
}

.day-boundary {
    border-top: 1px solid #94a3b8;
    width: 100%;
}

.h-cell {
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

.h-cell.midnight {
    color: #0284c7;
    font-weight: bold;
    text-shadow: none;
}

/* 天数分隔线 */
.day-separator {
    position: absolute;
    left: -60px;
    width: 300px;
    height: 1px;
    background: #0284c7;
    box-shadow: none;
    z-index: 5;
    pointer-events: none;
}

/* ===== 右侧面板 (保持不变) ===== */
.right-panel {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.nav-controls-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.nav-select {
    padding: 4px 8px;
    border: 1px solid transparent;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    outline: none;
    cursor: pointer;
    text-align: center;
}

.nav-select:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.nav-arrow {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #555;
    font-family: Arial, sans-serif;
    padding-bottom: 2px;
    transition: all 0.2s;
}

.nav-arrow:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.btn-today-top {
    border: 1px solid #3b82f6;
    background: #fff;
    color: #3b82f6;
    padding: 6px 20px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-today-top:hover {
    background: #eff6ff;
}

.calendar-week-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 10px;
}

.calendar-week-header span {
    color: #888;
    font-size: 15px;
    padding-bottom: 10px;
}

.calendar-week-header .weekend {
    color: #666;
}

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

.day-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s;
}

.day-cell:hover {
    background: #f8fafc;
}

.day-num {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.day-lunar {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
}

.is-weekend .day-num {
    color: #ea580c;
}

.is-selected {
    border: 2.5px solid #3b82f6;
    background: #fff !important;
}

.is-holiday .day-lunar {
    color: #ef4444;
}

.calendar-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    font-size: 15px;
    color: #334155;
}

/* ================= 7. 设置弹窗与管理按钮 ================= */
.settings-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 12px;
    font-size: 13px;
    color: #555;
    transition: background 0.2s;
    font-weight: 600;

    text-decoration: none;
    display: inline-block;
}

.settings-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.close-modal {
    cursor: pointer;
    color: #999;
    font-size: 24px;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #f00;
}

.city-list-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.city-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}

.city-checkbox-label:hover {
    background: #f5f9ff;
    border-color: #bcd6ff;
}

.city-checkbox-label input {
    accent-color: #3b82f6;
    transform: scale(1.2);
}

.city-checkbox-label span {
    font-size: 14px;
    color: #444;
}

/* 24节气专用样式 */
.is-term .day-lunar {
    color: #16a34a;
    font-weight: bold;
}

/* 保持原有的节日红色 */
.is-holiday .day-lunar {
    color: #ef4444;
}

/* 农历月份显示 (初一) */
.is-lunar-month .day-lunar {
    color: #f97316;
    font-weight: bold;
}