/* ========== 万年历样式 ========== */
:root {
  --bg: #f4efe7;
  --card: #fffdf8;
  --ink: #3a322b;
  --ink-weak: #8d8277;
  --red: #b03a2e;
  --red-dark: #8c2b21;
  --red-soft: #fbeae6;
  --gold: #c9a227;
  --green: #2e7d4f;
  --green-soft: #e8f3ec;
  --line: #ece4d8;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(90, 60, 30, .06);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

/* ---------- 顶部 ---------- */
.site-header {
  background: linear-gradient(135deg, #7c241d 0%, #a83a2e 60%, #c0563f 100%);
  color: #fff;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  font-family: "STKaiti", "KaiTi", serif;
}
.brand h1 { font-size: 22px; letter-spacing: 2px; }
.brand-sub { font-size: 12px; opacity: .85; }
.today-line { font-size: 13.5px; opacity: .95; text-align: right; }
.today-line b { font-weight: 600; }

/* ---------- 容器 ---------- */
.container { max-width: 1200px; margin: 18px auto 0; padding: 0 20px; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.view-toggle {
  display: flex;
  background: #f0e9dd;
  border-radius: 8px;
  padding: 3px;
}
.view-toggle button {
  border: 0; background: transparent;
  padding: 6px 16px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-weak);
}
.view-toggle button.active { background: var(--red); color: #fff; font-weight: 600; }
.nav-group { display: flex; align-items: center; gap: 6px; }
.nav-group button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  width: 34px; height: 34px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.nav-group button:hover { border-color: var(--red); color: var(--red); }
.nav-group .today-btn { width: auto; padding: 0 14px; font-size: 14px; }
.picker-group { display: flex; align-items: center; gap: 4px; }
.picker-group select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.picker-unit { color: var(--ink-weak); font-size: 14px; }
.lunar-year-label {
  margin-left: auto;
  color: var(--red-dark);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 1px;
}

/* ---------- 倒计时条 ---------- */
.countdown-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 2px;
  margin-top: 12px;
  scrollbar-width: thin;
}
.countdown-strip .cd-item {
  flex: 0 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.countdown-strip .cd-item b { color: var(--red-dark); }
.countdown-strip .cd-item .cd-days { color: var(--gold); font-weight: 700; margin-left: 6px; }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  margin-top: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 月视图 ---------- */
.month-grid { padding: 14px; }
.weekday-row, .month-grid .days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.weekday-row {
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.weekday-row span {
  text-align: center;
  font-size: 13px;
  color: var(--ink-weak);
  padding: 4px 0;
}
.weekday-row span.we { color: var(--red); font-weight: 600; }
.day-cell {
  min-height: 76px;
  border-radius: 10px;
  padding: 6px 6px 4px;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background .12s, border-color .12s;
}
.day-cell:hover { background: #faf5ec; }
.day-cell.other-month { opacity: .35; }
.day-cell.other-month .day-lunar { color: var(--ink-weak); }
.day-cell .day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.day-num {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}
.day-cell.weekend .day-num { color: var(--red); }
.day-num.today-num {
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.day-cell.selected { border-color: var(--red); background: var(--red-soft); }
.day-lunar {
  font-size: 12px;
  color: var(--ink-weak);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-lunar.term { color: var(--green); font-weight: 600; }
.day-lunar.festival { color: var(--red-dark); font-weight: 600; }
.day-lunar.jieri { color: var(--red); font-weight: 700; }
.day-badge {
  font-size: 10px;
  border-radius: 4px;
  padding: 0 4px;
  line-height: 16px;
  flex: 0 0 auto;
}
.day-badge.rest { background: var(--red); color: #fff; }
.day-badge.work { background: #6b7280; color: #fff; }

/* ---------- 周视图 ---------- */
.week-grid { padding: 14px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-col {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.week-col:hover { border-color: var(--gold); }
.week-col.selected { border-color: var(--red); background: var(--red-soft); }
.week-col .wc-week { font-size: 12px; color: var(--ink-weak); }
.week-col .wc-week.we { color: var(--red); }
.week-col .wc-date { font-size: 24px; font-weight: 700; }
.week-col .wc-lunar { font-size: 12px; color: var(--ink-weak); }
.week-col .wc-lunar.term { color: var(--green); font-weight: 600; }
.week-col .wc-zhi { font-size: 12px; color: var(--red-dark); font-weight: 600; }
.week-col .wc-yi, .week-col .wc-ji { font-size: 11.5px; line-height: 1.5; }
.week-col .wc-yi b { color: var(--green); }
.week-col .wc-ji b { color: var(--red); }
.week-col .wc-holiday { font-size: 11px; }
.week-col .wc-holiday.rest { color: var(--red); font-weight: 700; }
.week-col .wc-holiday.work { color: #6b7280; }

/* ---------- 日视图 ---------- */
.day-view { padding: 20px; }
.day-view .dv-big { font-size: 28px; font-weight: 700; }
.day-view .dv-lunar { margin-top: 6px; color: var(--ink-weak); }

/* ---------- 详情面板 ---------- */
.detail-panel { display: flex; flex-direction: column; gap: 14px; }
.dp-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.dp-card h3 {
  font-size: 14px;
  color: var(--ink-weak);
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dp-card h3::before {
  content: '';
  width: 4px; height: 14px;
  background: var(--red);
  border-radius: 2px;
}
.big-date { font-size: 24px; font-weight: 700; }
.big-date .week { font-size: 15px; color: var(--ink-weak); font-weight: 400; margin-left: 8px; }
.today-chip {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.lunar-line { margin-top: 6px; font-size: 15px; color: var(--ink); }
.lunar-line .sub { color: var(--ink-weak); font-size: 13px; }
.chip-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  border-radius: 6px;
  padding: 2px 8px;
  border: 1px solid;
}
.chip.festival { color: var(--red-dark); border-color: #e5b8b0; background: var(--red-soft); }
.chip.term { color: var(--green); border-color: #bcd8c6; background: var(--green-soft); }
.chip.holiday-rest { color: #fff; background: var(--red); border-color: var(--red); }
.chip.holiday-work { color: #fff; background: #6b7280; border-color: #6b7280; }

/* 黄历 */
.zhi-shen-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.zhi-shen {
  font-size: 20px;
  font-weight: 700;
  color: var(--red-dark);
}
.zhi-shen-desc { font-size: 12.5px; color: var(--ink-weak); }
.yi-ji { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.yi-row, .ji-row { display: flex; gap: 8px; align-items: flex-start; }
.yi-row .label {
  background: var(--green-soft); color: var(--green);
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 9px;
  flex: 0 0 auto;
}
.ji-row .label {
  background: var(--red-soft); color: var(--red-dark);
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 9px;
  flex: 0 0 auto;
}
.yi-row .tags, .ji-row .tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 0 7px;
  line-height: 20px;
}
.dp-grid { display: grid; grid-template-columns: 64px 1fr; gap: 7px 10px; font-size: 13px; }
.dp-grid .k { color: var(--ink-weak); }
.dp-grid .v { color: var(--ink); }
.dp-grid .v b { color: var(--red-dark); }
.term-progress {
  font-size: 12.5px;
  color: var(--ink-weak);
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  max-width: 1200px;
  margin: 24px auto 30px;
  padding: 0 20px;
  color: var(--ink-weak);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

.hidden { display: none !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .detail-panel { flex-direction: row; flex-wrap: wrap; }
  .dp-card { flex: 1 1 300px; }
  .week-grid { grid-template-columns: repeat(7, minmax(96px, 1fr)); overflow-x: auto; }
  .today-line { text-align: left; }
}
@media (max-width: 560px) {
  .container { padding: 0 10px; }
  .day-cell { min-height: 60px; padding: 4px; }
  .day-num { font-size: 16px; }
  .day-num.today-num { width: 24px; height: 24px; font-size: 14px; }
  .day-lunar { font-size: 10.5px; }
  .lunar-year-label { margin-left: 0; width: 100%; }
}
