/* ============================================================
   安神AIGC · 万年历 / 二十四节气 样式
   ============================================================ */

.page-head { padding: 46px 0 22px; }
.page-head .eyebrow { margin-bottom: 10px; }
.page-head h1 {
  font-size: 32px;
  margin: 0 0 10px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-sub { color: var(--muted); font-size: 15px; max-width: 680px; margin: 0; line-height: 1.7; }

.cal-h2 {
  font-size: 22px;
  margin: 38px 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--cyan);
}

/* ---- 月历 + 详情布局 ---- */
.cal-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 22px;
  margin-top: 18px;
  align-items: start;
}
.cal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 40px -24px rgba(0,0,0,.6);
}
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.cal-nav { display: flex; gap: 8px; align-items: center; }
.cal-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s ease;
}
.cal-btn:hover { border-color: var(--border-strong); color: #fff; }
.cal-today { color: var(--cyan); font-weight: 600; }
.cal-selectors { display: flex; gap: 8px; }
.cal-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.cal-select:focus { outline: none; border-color: var(--border-strong); }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  padding: 4px 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1 / 0.86;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s ease;
  padding: 4px;
}
.cal-cell:hover { border-color: var(--border-strong); }
.cal-cell.outside { opacity: .38; }
.cal-cell .cal-solar { font-size: 15px; font-weight: 600; line-height: 1.1; }
.cal-cell .cal-lunar { font-size: 11px; color: var(--muted); line-height: 1.1; }
.cal-cell.has-term .cal-lunar { color: var(--violet); font-weight: 600; }
.cal-cell.has-fest .cal-lunar { color: #f0a23a; font-weight: 600; }
.cal-cell.is-today {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
}
.cal-cell.is-today .cal-solar { color: var(--cyan); }
.cal-cell.is-sel {
  border-color: var(--violet);
  box-shadow: inset 0 0 0 1px var(--violet);
}

/* ---- 当日详情 ---- */
.cal-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 40px -24px rgba(0,0,0,.6);
  position: sticky;
  top: 84px;
}
.detail-date { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.detail-solar { font-size: 20px; font-weight: 700; }
.detail-lunar { color: var(--muted); font-size: 15px; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.di-label { font-size: 12px; color: var(--faint); }
.di-val { font-size: 15px; font-weight: 600; color: var(--text); }
.detail-fests { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-fests-label { font-size: 12px; color: var(--faint); }
.fest-chip {
  background: rgba(240, 162, 58, 0.16);
  color: #f0a23a;
  border: 1px solid rgba(240, 162, 58, 0.4);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
}

/* ---- 农历→公历 ---- */
.cal-convert { margin-top: 30px; }
.cal-convert-tip { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.cal-convert-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cv-leap { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.cal-convert-result { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline; }
.cv-ok { font-size: 16px; }
.cv-ok b { color: var(--cyan); }
.cv-lunar { color: var(--muted); font-size: 14px; }
.cv-err { color: #ff7a7a; font-size: 14px; }

/* 双向转换 Tab */
.cv-tabs { display: inline-flex; gap: 6px; margin-bottom: 12px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.cv-tab {
  border: 0; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 7px 14px; border-radius: 9px; transition: all .16s ease;
}
.cv-tab:hover { color: var(--text); }
.cv-tab.active { background: var(--cyan); color: #04121a; }
.cv-panel { margin-top: 4px; }
.cv2-block { display: flex; flex-direction: column; gap: 4px; }
.cv-gz { color: var(--text); font-size: 14px; }
.cv-term { color: var(--emerald); font-size: 14px; }
.cv-conste { color: var(--muted); font-size: 14px; }

/* ---- 二十四节气盘 ---- */
.terms-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  align-items: start;
}
.terms-wheel-wrap { display: flex; justify-content: center; }
.terms-wheel { width: 100%; max-width: 380px; }
.wheel-svg { width: 100%; height: auto; }
.wheel-ring { fill: none; stroke: var(--border); stroke-width: 1; }
.wheel-ring-inner { stroke: var(--border-strong); opacity: .5; }
.wheel-season-spring { fill: rgba(63, 174, 107, 0.10); }
.wheel-season-summer { fill: rgba(224, 83, 61, 0.10); }
.wheel-season-autumn { fill: rgba(217, 154, 43, 0.10); }
.wheel-season-winter { fill: rgba(63, 142, 222, 0.10); }
.wheel-node { stroke: rgba(255,255,255,.7); stroke-width: 1.5; transition: r .15s ease; }
.wheel-node:hover { r: 16; }
.wheel-label { fill: var(--text); font-size: 13px; font-weight: 600; pointer-events: none; }
.wheel-season-label { fill: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: 1px; pointer-events: none; }
.wheel-center-title { fill: var(--muted); font-size: 15px; font-weight: 700; letter-spacing: 2px; }

.terms-side { display: flex; flex-direction: column; gap: 18px; }
.terms-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.td-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.td-dot { width: 12px; height: 12px; border-radius: 50%; }
.td-name { font-size: 22px; font-weight: 700; }
.td-season { font-size: 13px; color: var(--muted); }
.td-date { margin-top: 8px; color: var(--text); font-size: 15px; }
.td-note { margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.terms-song h3 { font-size: 16px; margin: 0 0 10px; }
.song-lines { display: flex; flex-direction: column; gap: 10px; }
.song-line {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--violet);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.song-text { font-size: 17px; font-weight: 600; letter-spacing: 3px; }
.song-terms { font-size: 12.5px; color: var(--muted); }

/* ---- 四季 · 孟仲季 ---- */
.seasons-intro { color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.7; }
.seasons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.season-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--sc);
  border-radius: 16px;
  padding: 16px;
}
.season-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700; margin-bottom: 12px;
}
.season-dot { width: 12px; height: 12px; border-radius: 50%; }
.season-group { padding: 10px 0; border-top: 1px solid var(--border); }
.season-group:first-of-type { border-top: none; }
.sg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sg-name { font-size: 15px; font-weight: 600; color: var(--sc); }
.sg-terms { font-size: 13px; color: var(--text); }
.sg-note { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }

/* ---- 响应式 ---- */
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-detail { position: static; }
  .terms-layout { grid-template-columns: 1fr; }
  .seasons-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .detail-grid { grid-template-columns: 1fr; }
  .seasons-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 26px; }
}

/* ---- 浅色主题适配 ---- */
html.theme-light .page-head h1 { color: var(--text); -webkit-background-clip: border-box; background: none; }
html.theme-light .cal-cell.outside { opacity: .5; }
html.theme-light .wheel-label { fill: var(--text); }
html.theme-light .wheel-center-title { fill: var(--muted); }

/* ---- 阴阳配色（干支字色） ---- */
.yang { color: #c0392b; }   /* 阳：朱红 */
.yin { color: #2b6ca3; }   /* 阴：靛蓝 */

/* ============================================================
   历法工具箱 · Tab 切换
   ============================================================ */
.lifa-tabs {
  display: flex;
  gap: 8px;
  margin: 26px 0 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.lifa-tab {
  position: relative;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  transition: all .18s ease;
}
.lifa-tab:hover { color: var(--text); border-color: var(--border-strong); }
.lifa-tab.active {
  color: #06121a;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border-color: transparent;
  box-shadow: 0 6px 22px -12px rgba(34, 211, 238, .8);
}
.lifa-tab.active::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}
.tab-panel[hidden] { display: none; }

/* ============================================================
   四柱八字
   ============================================================ */
.bazi-card, .shichen-card, .ganzhi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  margin-top: 18px;
  box-shadow: 0 10px 40px -24px rgba(0,0,0,.6);
}
.bazi-tip, .shichen-tip, .ganzhi-tip {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.7;
  margin: 0 0 18px;
}
.bazi-tip b, .shichen-tip b, .ganzhi-tip b { color: var(--text); }
.bazi-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.bazi-form .field { display: flex; flex-direction: column; gap: 5px; }
.bazi-form .field label { font-size: 13px; color: var(--faint); }
.bazi-form input[type="number"], .ganzhi-control input[type="number"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 15px;
  font-family: inherit;
  width: 88px;
}
.bazi-form select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.bazi-form input:focus, .ganzhi-control input:focus, .bazi-form select:focus { outline: none; border-color: var(--border-strong); }
.bazi-err { color: #ff7a7a; font-size: 14px; min-height: 18px; margin-top: 10px; }
.bazi-result { margin-top: 6px; }
.bazi-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.bz-pillar {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.bz-label { font-size: 13px; color: var(--faint); letter-spacing: 2px; }
.bz-gan, .bz-zhi {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid currentColor;
}
.bz-sub { font-size: 12.5px; color: var(--muted); }
.bazi-inline {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--cyan);
  margin: 4px 0 18px;
}
.bz-wxrow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.wx-chip {
  border: 1px solid;
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--surface-2);
}
.bz-algo {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--violet);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.9;
}
.bz-algo b { color: var(--text); }

/* ============================================================
   十二时辰
   ============================================================ */
.shichen-top {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}
.shichen-clock { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.shichen-clock svg { width: 100%; max-width: 320px; height: auto; }
.shichen-now {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 18px; font-size: 14.5px;
}
.shichen-now b { color: var(--cyan); font-size: 16px; }
.shichen-daybar h3 { font-size: 16px; margin: 0 0 12px; }
.dayrow { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.dayrow .t { width: 42px; flex: none; font-weight: 700; font-size: 14px; color: var(--text); }
.dayrow .bar {
  position: relative; flex: 1; height: 22px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.dayrow .fill { position: absolute; top: 0; bottom: 0; opacity: .8; }
.dayrow .txt { position: absolute; top: 0; bottom: 0; left: 0; display: flex; align-items: center; padding-left: 8px; font-size: 11.5px; color: #fff; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.shichen-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.sc-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  border-top: 3px solid var(--border-strong);
}
.sc-card.yang { border-top-color: #c0392b; }
.sc-card.yin { border-top-color: #2b6ca3; }
.sc-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.sc-zhi { font-size: 24px; font-weight: 800; }
.sc-card.yang .sc-zhi { color: #c0392b; }
.sc-card.yin .sc-zhi { color: #2b6ca3; }
.sc-name { font-size: 15px; font-weight: 600; }
.sc-time { margin-left: auto; font-size: 12px; color: var(--faint); }
.sc-aliases { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.sc-act { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ============================================================
   天干地支 · 六十甲子
   ============================================================ */
.ganzhi-control { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.ganzhi-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.ganzhi-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.ganzhi-legend .dot.yang { background: #c0392b; }
.ganzhi-legend .dot.yin { background: #2b6ca3; }
.ganzhi-chart-wrap { display: flex; justify-content: center; }
.ganzhi-chart-wrap svg { width: 100%; max-width: 460px; height: auto; }
.ganzhi-info {
  text-align: center; font-size: 15px; line-height: 1.8;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; margin: 16px 0;
}
.ganzhi-info b { color: var(--cyan); }
.ganzhi-table { margin-top: 8px; overflow-x: auto; }
.ganzhi-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ganzhi-table td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: center;
  background: var(--surface-2);
}
.ganzhi-table td:first-child { background: var(--surface); color: var(--faint); font-weight: 600; white-space: nowrap; }
.ganzhi-table b { font-size: 17px; letter-spacing: 4px; }

/* ---- 响应式（新增面板） ---- */
@media (max-width: 900px) {
  .shichen-top { grid-template-columns: 1fr; }
  .bazi-pillars { grid-template-columns: repeat(2, 1fr); }
  .shichen-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .bazi-pillars { grid-template-columns: 1fr 1fr; }
  .shichen-grid { grid-template-columns: 1fr; }
  .lifa-tab { padding: 9px 14px; font-size: 14px; }
}
html.theme-light .lifa-tab { color: var(--muted); }
html.theme-light .ganzhi-table td { background: var(--surface-2); }
