/* ============================================================
   好日子查詢 ── 樣式
   風格：宣紙底、朱紅印章、宋體標題，台灣農民曆氣質
   ============================================================ */

/* ── 1. 變數與重置 ─────────────────────────────────────── */
:root {
  --paper:      #f6f1e6;
  --paper-2:    #fffdf7;
  --paper-3:    #fbf6ea;
  --ink:        #241f1b;
  --ink-2:      #554a40;
  --ink-3:      #8b7d6d;
  --line:       #e3d8c4;
  --line-2:     #efe7d6;
  --red:        #a8282d;
  --red-d:      #7c1a1f;
  --red-l:      #f7e7e4;
  --gold:       #a97f45;
  --gold-l:     #f7eedb;
  --green:      #3f6b57;
  --green-l:    #e7efe8;
  --shadow:     0 1px 2px rgba(60, 45, 30, .05), 0 8px 24px -12px rgba(60, 45, 30, .18);
  --shadow-lg:  0 2px 4px rgba(60, 45, 30, .06), 0 18px 40px -20px rgba(60, 45, 30, .3);
  --radius:     12px;
  --serif: "PingFang TC", "Noto Serif TC", "Songti TC", "Source Han Serif TC", "Microsoft JhengHei", serif;
  --sans:  "PingFang TC", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", sans-serif;
  --wrap: 1140px;
}

* { box-sizing: border-box; }

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

html, body { max-width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, .75), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(255, 255, 255, .55), transparent 38%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}
body.page-day  { background-image: radial-gradient(circle at 12% 6%, rgba(255,255,255,.8), transparent 45%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E"); }

img, svg { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  letter-spacing: .01em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 0px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--red); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ── 2. 頁首 ───────────────────────────────────────────── */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 246, 237, .92);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: 72px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-seal {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #bb3236, var(--red) 45%, var(--red-d));
  color: #fff6e6;
  font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(255, 246, 230, .35), 0 4px 10px -4px rgba(124, 26, 31, .55);
}
.brand-seal.small { width: 34px; height: 34px; flex-basis: 34px; font-size: 20px; border-radius: 6px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.brand-txt b { font-family: var(--serif); font-size: 20px; letter-spacing: .06em; }
.brand-txt i { font-style: normal; font-size: 12px; color: var(--ink-3); letter-spacing: .16em; }

.nav { display: flex; align-items: center; gap: 26px; font-size: 16px; }
.nav a { color: var(--ink-2); padding: 6px 0; position: relative; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px;
  background: var(--red); transition: right .25s ease;
}
.nav a:hover { color: var(--red); }
.nav a:hover::after { right: 0; }

.nav-toggle {
  display: none; width: 42px; height: 42px; border: 1px solid var(--line);
  background: var(--paper-2); border-radius: 8px; padding: 0; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--ink-2); border-radius: 2px; }

/* ── 3. 通用元件 ───────────────────────────────────────── */
.paper {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px; padding: 0 22px;
  background: linear-gradient(170deg, #b52f34, var(--red) 55%, var(--red-d));
  color: #fff8ec; border: 0; border-radius: 9px;
  font-family: var(--sans); font-size: 15px; font-weight: 500; letter-spacing: .04em;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 16px -10px rgba(124, 26, 31, .9);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); transform: translateY(-1px); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper-2); color: var(--ink-2); font-size: 14px;
  transition: all .18s ease;
}
.btn-ghost:hover { border-color: var(--red); color: var(--red); background: var(--red-l); }

.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 5px; background: var(--gold-l); color: #7a5a2d;
  font-size: 12.5px; letter-spacing: .04em;
}
.tag-jieqi { background: var(--green-l); color: #2f5646; }
.tag-good { background: var(--green-l); color: #2f5646; }
.tag-bad { background: #efe9e4; color: #6b5d52; }
.tag-universal { background: linear-gradient(120deg, #f6e3b8, #efd39b); color: #6d4c15; font-weight: 500; }

.chip {
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 14px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
  transition: all .16s ease;
}
.chip b { font-weight: 600; }
.chip i { font-style: normal; font-size: .82em; color: var(--ink-3); }
.chip em { font-style: normal; font-size: .74em; color: var(--ink-3); margin-left: 4px; }
.chip:hover { border-color: var(--red); color: var(--red); background: var(--red-l); }
.chip.is-today { border-color: var(--red); background: var(--red-l); }

.terms { display: flex; flex-wrap: wrap; gap: 6px; }
.term {
  display: inline-flex; align-items: center; height: 26px; padding: 0 9px;
  border-radius: 5px; font-size: 14px; letter-spacing: .02em;
  background: #f3ece0; color: var(--ink-2);
}
.term.yi { background: var(--red-l); color: var(--red-d); }
.term.ji { background: var(--green-l); color: #2f5646; }
.term.none { background: #f0ece5; color: var(--ink-3); }
.terms.big .term { height: 32px; padding: 0 12px; font-size: 15.5px; }

.none { color: var(--ink-3); font-size: 14px; }
.mini { font-size: 13px; color: var(--ink-3); margin-top: 10px; }

.seal-sm {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  background: var(--red); color: #fff6e6; border-radius: 5px;
  font-family: var(--serif); font-size: 15px; line-height: 1;
}
.seal-sm.dark { background: #4b5a4f; }
.seal-md {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  background: var(--red); color: #fff6e6; border-radius: 7px;
  font-family: var(--serif); font-size: 22px; line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(255, 246, 230, .3);
}
.seal-md.dark { background: #43554a; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; }
.dot.good, em.good { background: var(--green); }
.dot.bad, em.bad { background: #b08a6a; }
em.good, em.bad {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-left: 5px; font-style: normal; vertical-align: middle;
}

/* ── 4. Hero ───────────────────────────────────────────── */
.hero { padding: 20px 0 10px; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 20px; align-items: center;
}
.kicker {
  font-size: 13px; letter-spacing: .18em; color: var(--gold);
  margin: 0 0 14px; text-transform: none;
}
.hero h1 {
  font-size: clamp(30px, 4.2vw, 46px); line-height: 1.28; letter-spacing: .02em;
  margin: 0 0 18px;
}
.hero h1 span { color: var(--red); }
.lede { font-size: 16px; color: var(--ink-2); max-width: 34em; }

.hero-points { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 22px; font-size: 14px; color: var(--ink-2); }
.hero-points li { display: flex; align-items: baseline; gap: 6px; }
.hero-points b { font-family: var(--serif); font-size: 20px; color: var(--red); }

/* 今日卡 */
.today-card { padding: 24px 24px 20px; position: relative; overflow: hidden; }
.today-card::before {
  content: ""; position: absolute; inset: 0 0 auto auto; width: 120px; height: 120px;
  background: radial-gradient(circle at 100% 0, rgba(168, 40, 45, .07), transparent 70%);
}
.today-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.today-card, .today-card * { min-width: 0; }
.today-date { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.today-label {
  font-size: 11px; letter-spacing: .2em; color: #fff6e6; background: var(--red);
  padding: 3px 7px; border-radius: 4px;
}
.today-date strong {
  font-family: var(--serif); font-size: 42px; line-height: 1; letter-spacing: .01em;
  color: var(--ink);
}
.today-date strong small { font-size: 15px; margin: 0 4px 0 1px; color: var(--ink-2); font-weight: 500; }
.today-week { font-size: 13.5px; color: var(--ink-3); }
.today-lunar { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.lunar-md { font-family: var(--serif); font-size: 19px; color: var(--red-d); }
.lunar-year, .lunar-gz { font-size: 12.5px; color: var(--ink-3); }

.today-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.yi-ji { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 16px 0 14px; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.yi-ji .col { padding: 14px 0; }
.yi-ji .col + .col { border-left: 1px dashed var(--line); padding-left: 16px; }
.yi-ji .col:first-child { padding-right: 16px; }
.yi-ji h3 { margin-bottom: 8px; }

.today-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 14px; font-size: 13.5px; }
.today-meta div { display: flex; gap: 6px; }
.today-meta dt { color: var(--ink-3); }
.today-meta dd { margin: 0; color: var(--ink-2); }

/* ── 5. 快查表單 ───────────────────────────────────────── */
.quick {
  display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1fr) auto minmax(0, 1.15fr);
  align-items: end; gap: 18px;
  padding: 22px 24px; margin-top: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .6), rgba(255, 253, 247, .9)),
    var(--paper-2);
}
.quick-intro h2 { font-size: 19px; }
.qf-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-3); }
.quick-block { display: flex; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--ink-3); letter-spacing: .04em; }
.field input, .field select {
  height: 46px; width: 100%; min-width: 0; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  font-family: var(--sans); font-size: 15px; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid rgba(168, 40, 45, .25); border-color: var(--red); }
.quick-or { color: var(--ink-3); font-size: 13px; padding-bottom: 14px; }

/* ── 6. 區塊標題 ───────────────────────────────────────── */
.sect { padding: 20px 0 10px; }
.sec-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.sec-head::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 76px; height: 3px;
  background: var(--red); border-radius: 2px;
}
.sec-head h2 { font-size: clamp(21px, 2.4vw, 27px); }
.sec-sub { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); max-width: 62em; }
.sec-extra { flex: 0 0 auto; }
.link-more { font-size: 14px; color: var(--red); border-bottom: 1px solid rgba(168, 40, 45, .3); padding-bottom: 1px; }

/* ── 7. 熱門卡片 ───────────────────────────────────────── */
.hot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hot-card {
  display: flex; align-items: center; gap: 13px; padding: 16px 16px;
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease;
}
.hot-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #d8c8ac; }
.hot-icon {
  flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center;
  background: linear-gradient(150deg, #fbeedb, #f3e2c6);
  color: var(--red-d); border-radius: 10px;
  font-family: var(--serif); font-size: 22px;
  box-shadow: inset 0 0 0 1px rgba(169, 127, 69, .18);
}
.hot-body { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.hot-body b { font-family: var(--serif); font-size: 16.5px; }
.hot-body i { font-style: normal; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-arrow { margin-left: auto; color: var(--line); font-size: 15px; }
.hot-card:hover .hot-arrow { color: var(--red); }

/* ── 8. 月份導覽與每月區塊 ─────────────────────────────── */
.month-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.mchip {
  display: inline-flex; align-items: baseline; gap: 3px;
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper-2); font-size: 14px; color: var(--ink-2);
  transition: all .16s ease;
}
.mchip span { font-size: 14px; color: var(--ink-3); }
.mchip:hover { border-color: var(--red); color: var(--red); background: var(--red-l); }
.mchip.is-active { background: var(--red); border-color: var(--red); color: #fff8ec; }
.mchip.is-active span { color: rgba(255, 248, 236, .75); }

.month-blocks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.month-block { padding: 22px 24px 18px; scroll-margin-top: 90px; }
.mb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.mb-head h3 { font-size: 21px; }
.mb-head h3::before {
  content: ""; display: inline-block; width: 7px; height: 7px; background: var(--red);
  border-radius: 50%; margin-right: 9px; vertical-align: 4px;
}
.mb-more { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.mb-more:hover { color: var(--red); }

.rows { display: grid; gap: 2px; }
.row {
  display: grid; grid-template-columns: 6.6em 10.5em 1fr; align-items: baseline;
  gap: 12px; padding: 9px 0; border-top: 1px dashed var(--line-2);
}
.rows .row:first-child { border-top: 0; }
.row-name {
  font-family: var(--serif); font-size: 15.5px; color: var(--ink);
  border-bottom: 1px solid transparent; justify-self: start;
}
.row-name:hover { color: var(--red); border-bottom-color: rgba(168, 40, 45, .35); }
.row-alias { font-size: 12.5px; color: var(--ink-3); }
.row-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.row-universal { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.row-universal .row-name { color: #6d4c15; }
.row-universal .chip { border-color: #e6d3ab; background: #fdf6e7; }
.row-universal .chip:hover { border-color: var(--gold); color: #6d4c15; background: #f8ecd5; }

.mb-note { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-3); }

/* ── 9. 分類卡 ─────────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.cat-card {
  display: grid; grid-template-columns: 12.5em minmax(0, 1fr);
  gap: 8px 22px; align-items: start; padding: 18px 22px;
}
.cat-card header {
  padding: 2px 18px 2px 0; margin: 0;
  border-right: 1px dashed var(--line);
}
.cat-card h3 { font-size: 18px; }
.cat-card header p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.cat-count {
  display: inline-block; margin-top: 8px;
  font-size: 14px; color: var(--gold); background: var(--gold-l);
  padding: 1px 8px; border-radius: 999px;
}
.cat-list { display: flex; flex-wrap: wrap; align-items: baseline; }
.cat-list li { display: inline-flex; align-items: baseline; }
.cat-list li + li::before { content: "、"; color: var(--line); margin-right: 1px; }
.cat-list a { display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 2px; font-size: 14.5px; }
.cat-list b { font-family: var(--serif); font-weight: 600; flex: 0 0 auto; }
.cat-list span { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.cat-list a:hover b { color: var(--red); }

/* ── 10. 名詞解釋 ──────────────────────────────────────── */
.gloss { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.gloss-text { padding: 24px 26px; }
.gloss-text p { font-size: 15px; color: var(--ink-2); }
.gloss-text b { color: var(--red-d); font-weight: 600; }
.gloss-table { padding: 20px 22px; }
.gloss-table h3 { font-size: 17px; margin-bottom: 12px; }
.gods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gods li {
  border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px;
  display: flex; flex-direction: column; line-height: 1.4;
}
.gods b { font-family: var(--serif); font-size: 15px; }
.gods span { font-size: 14px; color: var(--ink-3); }
.gods li.is-good { background: var(--green-l); border-color: #cfe0d4; }
.gods li.is-bad { background: #f1ece4; }

.next-days { margin-top: 26px; }
.next-days h3 { font-size: 17px; margin-bottom: 12px; }
.next-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.next-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; transition: transform .16s ease, box-shadow .2s ease; }
.next-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.nd-date { font-family: var(--serif); font-size: 18px; }
.nd-date i { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.nd-lunar { font-size: 12.5px; color: var(--ink-3); }
.nd-god { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; }
.nd-yi { font-size: 13px; color: var(--red-d); background: var(--red-l); border-radius: 5px; padding: 3px 8px; margin-top: 4px; }

/* ── 11. 月曆 ─────────────────────────────────────────── */
.cal { padding: 14px 14px 10px; overflow: hidden; }
.cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head span { text-align: center; font-size: 12.5px; color: var(--ink-3); padding: 4px 0 8px; letter-spacing: .1em; }
.cal-head span.wk { color: var(--red); }
.cal-cell {
  position: relative; display: flex; flex-direction: column; gap: 1px;
  min-height: 82px; padding: 8px 9px;
  border: 1px solid var(--line-2); border-radius: 9px; background: #fff;
  transition: all .15s ease;
}
.cal-cell.is-empty { background: transparent; border-color: transparent; }
.cal-cell.is-weekend { background: #fdfaf3; }
.cal-cell:hover { border-color: var(--red); box-shadow: 0 6px 16px -12px rgba(124, 26, 31, .7); transform: translateY(-1px); }
.cal-cell .cd { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.cal-cell .cl { font-size: 14px; color: var(--ink-3); }
.cal-cell .cg { font-size: 14px; color: var(--ink-3); margin-top: auto; }
.cal-cell .cj { font-size: 14px; color: var(--green); margin-top: auto; font-weight: 500; }
.cal-cell.is-good { background: #f4f8f4; }
.cal-cell.is-good .cg { color: #3f6b57; }
.cal-cell.is-universal { border-color: #e3ca97; background: #fdf7e9; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--red); }
.cal-cell.is-mark { box-shadow: inset 0 0 0 2px var(--green); }
.cal-cell.is-today.is-mark { box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 4px var(--green-l); }
.cu {
  position: absolute; right: 7px; top: 7px;
  width: 18px; height: 18px; display: grid; place-items: center;
  background: linear-gradient(150deg, #f0d59d, #e3bf79); color: #6d4c15;
  font-family: var(--serif); font-size: 11px; border-radius: 4px;
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 4px 2px; font-size: 12px; color: var(--ink-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
.lg-good { background: #f4f8f4; }
.lg-universal { background: #fdf7e9; border-color: #e3ca97 !important; }
.lg-today { box-shadow: inset 0 0 0 2px var(--red); }
.lg-mark { box-shadow: inset 0 0 0 2px var(--green); }

/* ── 12. 內頁共用 ─────────────────────────────────────── */
.crumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ink-3); padding: 22px 0 0; }
.crumb a:hover { color: var(--red); }
.crumb .sep { color: var(--line); }

.page-head { padding: 14px 0 4px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 36px); margin-bottom: 10px; }
.page-head .lede { font-size: 15px; }
.page-head-nav { display: flex; gap: 10px; margin-top: 16px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 20px; }
.stat { display: flex; align-items: baseline; gap: 6px; }
.stat b { font-family: var(--serif); font-size: 30px; color: var(--red); line-height: 1; }
.stat span { font-size: 13px; color: var(--ink-3); }

.year-switch { display: inline-flex; gap: 4px; margin-top: 20px; padding: 4px; background: #efe8da; border-radius: 999px; }
.year-switch a { padding: 6px 16px; border-radius: 999px; font-size: 14px; color: var(--ink-2); }
.year-switch a.is-active { background: var(--paper-2); color: var(--red); box-shadow: var(--shadow); }

.year-tag {
  font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--gold);
  margin-left: 10px; vertical-align: 6px;
}

/* ── 13. 單月頁 ───────────────────────────────────────── */
.univ-strip { display: grid; grid-template-columns: 20em 1fr; gap: 18px; align-items: center; padding: 18px 22px; margin-top: 22px; background: linear-gradient(120deg, #fdf6e7, var(--paper-2)); }
.us-head h2 { font-size: 17px; }
.us-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.us-dates { display: flex; flex-wrap: wrap; gap: 7px; }
.cat-block { padding: 18px 22px 10px; margin-bottom: 14px; }
.cb-head { margin-bottom: 8px; }
.cb-head h3 { font-size: 17px; color: var(--red-d); }
.cb-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-3); }
.rows.compact .row { grid-template-columns: 7.5em 11em 1fr; }

/* ── 14. 事項頁 ───────────────────────────────────────── */
.year-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ym-block { padding: 16px 18px; }
.ym-block header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.ym-block h3 { font-size: 18px; }
.ym-count { font-size: 12.5px; color: var(--gold); background: var(--gold-l); padding: 2px 9px; border-radius: 999px; }
.ym-block.is-empty-block { background: rgba(255, 253, 247, .55); box-shadow: none; }
.ym-dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.date-card {
  display: flex; flex-direction: column; gap: 1px; padding: 9px 10px;
  border: 1px solid var(--line-2); border-radius: 9px; background: #fff;
  transition: all .16s ease;
}
.date-card:hover { border-color: var(--red); background: var(--red-l); transform: translateY(-2px); }
.dc-day { font-family: var(--serif); font-size: 17px; }
.dc-week { font-size: 14px; color: var(--ink-3); }
.dc-lunar { font-size: 14px; color: var(--ink-3); }
.dc-god { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; margin-top: 2px; }

.tips { padding: 22px 26px; }
.tips h3 { font-size: 18px; margin-bottom: 10px; }
.tips ol { counter-reset: t; display: grid; gap: 8px; }
.tips li { position: relative; padding-left: 30px; font-size: 14.5px; color: var(--ink-2); counter-increment: t; }
.tips li::before {
  content: counter(t); position: absolute; left: 0; top: 4px;
  width: 20px; height: 20px; display: grid; place-items: center;
  background: var(--red-l); color: var(--red-d); border-radius: 50%;
  font-size: 14px; font-family: var(--sans);
}
.tips b { color: var(--ink); }

.rel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.rel-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.rel-card b { font-family: var(--serif); font-size: 16px; }
.rel-card span { font-size: 12.5px; color: var(--ink-3); }
.rel-card:hover { border-color: var(--red); color: var(--red); }
.rel-card.is-accent { background: var(--red-l); border-color: #eccfca; }

/* ── 15. 單日黃曆 ─────────────────────────────────────── */
.day-head { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; padding: 26px 28px; margin-top: 18px; position: relative; overflow: hidden; }
.day-head h1 { font-size: clamp(46px, 7vw, 72px); line-height: 1; letter-spacing: -.01em; color: var(--ink); }
.day-head h1 small { font-size: 16px; font-family: var(--sans); font-weight: 500; color: var(--ink-2); margin: 0 10px 0 2px; vertical-align: 12px; }
.dh-solar { font-family: var(--serif); font-size: 17px; color: var(--ink-2); margin: 6px 0 0; }
.dh-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.dh-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.dh-lunar { border-left: 1px dashed var(--line); padding-left: 24px; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.dl-label { font-size: 12px; letter-spacing: .2em; color: var(--ink-3); }
.dh-lunar strong { font-family: var(--serif); font-size: 32px; line-height: 1.2; color: var(--red-d); }
.dl-line { font-size: 13px; color: var(--ink-3); }
.dl-badges { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.dl-badges b { color: var(--ink-2); font-weight: 600; }

.yiji-big { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.yb-col { padding: 24px 26px; }
.yb-col + .yb-col { border-left: 1px dashed var(--line); }
.yb-col h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; margin-bottom: 14px; }
.yb-yi { background: linear-gradient(180deg, rgba(247, 231, 228, .55), transparent 60%); }
.yb-ji { background: linear-gradient(180deg, rgba(231, 239, 232, .5), transparent 60%); }

.meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.meta-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.meta-card .mk { font-size: 14px; letter-spacing: .16em; color: var(--ink-3); }
.meta-card b { font-family: var(--serif); font-size: 19px; }
.meta-card i { font-style: normal; font-size: 12px; color: var(--ink-3); }

.god-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.god-box { padding: 16px 18px; }
.god-box h3 { font-size: 15.5px; margin-bottom: 8px; }
.god-box.good h3 { color: var(--green); }
.god-box.bad h3 { color: #8a5b3f; }
.pz { padding: 16px 18px; margin-top: 12px; }
.pz h3 { font-size: 15.5px; margin-bottom: 6px; color: var(--ink-2); }
.pz p { font-size: 14.5px; color: var(--ink-2); margin: 2px 0; }

.table-wrap { overflow-x: auto; padding: 4px; }
.time-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
.time-table thead th {
  text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12px;
  letter-spacing: .08em; padding: 12px 12px; border-bottom: 1px solid var(--line);
  background: var(--paper-3); white-space: nowrap;
}
.time-table tbody th, .time-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top;
  text-align: left; font-weight: 400;
}
.time-table tbody th { font-family: var(--serif); font-size: 14.5px; white-space: nowrap; }
.time-table tbody th em { font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-left: 3px; }
.time-table tr.is-good { background: rgba(231, 239, 232, .35); }
.time-table tr.is-bad { background: rgba(240, 233, 224, .35); }
.time-table .t-terms { color: var(--ink-2); font-size: 12.5px; max-width: 15em; }
.luck { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; font-size: 12px; color: #fff; }
.luck.good { background: var(--green); }
.luck.bad { background: #a98a6c; }
.nowrap { white-space: nowrap; }

.match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.match-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.match-card b { font-family: var(--serif); font-size: 15.5px; }
.match-card span { font-size: 12px; color: var(--ink-3); }
.match-card:hover { border-color: var(--red); color: var(--red); }
.none-box { padding: 22px; color: var(--ink-3); font-size: 14px; }
.day-foot-nav { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0 10px; }

.empty-box { padding: 48px 28px; text-align: center; margin: 40px auto; max-width: 620px; }
.empty-box h1 { font-size: 24px; margin-bottom: 10px; }
.empty-box p { color: var(--ink-3); margin-bottom: 20px; }

/* ── 16. 頁尾 ─────────────────────────────────────────── */
.site-foot { margin-top: 56px; border-top: 1px solid var(--line); background: rgba(255, 253, 247, .6); }
.foot-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; padding: 34px 22px 18px; }
.foot-brand { display: flex; gap: 14px; align-items: flex-start; }
.foot-brand b { font-family: var(--serif); font-size: 17px; }
.foot-brand p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); max-width: 34em; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; align-content: flex-start; justify-content: flex-end; font-size: 13.5px; color: var(--ink-2); }
.foot-copy {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px 22px; border-top: 1px solid var(--line-2);
  font-size: 12px; color: var(--ink-3);
}

/* ── 16.5 今日提點、時辰卡、月曆工具列 ───────────────── */
.tip-bar {
  background: rgba(255, 253, 247, .78);
  border-bottom: 1px solid var(--line-2);
}
.tip-inner {
  display: flex; align-items: center; gap: 12px;
  padding-top: 12px; padding-bottom: 12px;
}
.tip-label {
  flex: 0 0 auto; margin-top: 1px;
  font-size: 14px; letter-spacing: .14em; color: #fff6e6;
  background: var(--red); padding: 2px 8px; border-radius: 4px;
}
.tip-inner p { margin: 0; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }

.cal-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cal-toolbar .btn-ghost { font-size: 13.5px; padding: 7px 14px; }

.time-cards {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.tc { padding: 13px 14px 11px; display: flex; flex-direction: column; gap: 6px; }
.tc header { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.tc header b { font-family: var(--serif); font-size: 24px; line-height: 1; color: var(--ink); }
.tc-time { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tc-luck {
  margin-left: auto; font-style: normal; font-size: 10.5px; letter-spacing: .06em;
  color: #7a5a2d; background: linear-gradient(120deg, #f6e3b8, #efd39b);
  padding: 1px 6px; border-radius: 3px;
}
.tc.is-bad { background: #fdfcf9; }
.tc.is-bad header b { color: var(--ink-2); }
.tc-line { margin: 0; font-size: 12px; line-height: 1.65; color: var(--ink-2); }
.tc-line i {
  font-style: normal; display: inline-block; width: 16px; height: 16px;
  margin-right: 4px; text-align: center; line-height: 16px;
  font-size: 10.5px; border-radius: 3px; vertical-align: 1px;
}
.tc-line.yi i { background: var(--red-l); color: var(--red-d); }
.tc-line.ji i { background: var(--green-l); color: #2f5646; }
.tc-foot {
  margin: auto 0 0; padding-top: 6px; border-top: 1px dashed var(--line-2);
  font-size: 11px; color: var(--ink-3);
}

/* ── 17. 響應式 ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .time-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quick { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .quick-intro { grid-column: 1 / -1; }
  .quick-or { display: none; }
  .hot-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .gloss { grid-template-columns: 1fr; }
  .year-list { grid-template-columns: 1fr; }
  .rel-grid, .match-grid, .meta-grid { grid-template-columns: repeat(2, 1fr); }
  .day-head { grid-template-columns: 1fr; }
  .dh-lunar { border-left: 0; border-top: 1px dashed var(--line); padding: 16px 0 0; }
  .row, .rows.compact .row { grid-template-columns: 6.6em 1fr; }
  .row-dates { grid-column: 1 / -1; }
  .univ-strip { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 10px; }
  .head-inner { min-height: 64px; }
  .brand-txt i { display: none; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper-2); border-bottom: 1px solid var(--line);
    padding: 6px 16px 12px; display: none;
    box-shadow: var(--shadow);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 11px 0; border-bottom: 1px dashed var(--line-2); font-size: 15px; }
  .nav a::after { display: none; }
  .nav-toggle { display: flex; }
  .hero { padding: 20px 0 6px; }
  .hero h1 { font-size: 28px; }
  .today-date strong { font-size: 34px; }
  .quick { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .quick-block { flex-direction: column; align-items: stretch; }
  .hot-grid, .cat-grid, .next-grid, .god-pair, .yiji-big, .rel-grid, .match-grid { grid-template-columns: minmax(0, 1fr); }
  .time-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tip-inner { flex-direction: column; gap: 6px; }
  .cal-toolbar { justify-content: space-between; }
  .cal-toolbar .btn-ghost { flex: 1 1 auto; justify-content: center; font-size: 12.5px; padding: 7px 8px; }
  .cat-card { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 16px; }
  .cat-card header { border-right: 0; padding: 0 0 8px; border-bottom: 1px solid var(--line-2); }
  .cat-list span { white-space: normal; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .cal-cell { min-height: 62px; padding: 6px; }
  .cal-cell .cd { font-size: 16px; }
  .cal-cell .cl, .cal-cell .cg, .cal-cell .cj { font-size: 10px; }
  .cu { width: 14px; height: 14px; font-size: 9px; right: 4px; top: 4px; }
  .day-head { padding: 20px; }
  .yiji-big .yb-col + .yb-col { border-left: 0; border-top: 1px dashed var(--line); }
  .month-block { padding: 18px 16px 14px; }
  .mb-head h3 { font-size: 18px; }
  .foot-inner { grid-template-columns: 1fr; }
  .foot-links { justify-content: flex-start; }
  .sec-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .sec-extra { align-self: flex-start; }
  .gods { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .site-head, .site-foot, .quick, .month-nav, .day-foot-nav, .cal-legend { display: none; }
  body { background: #fff; }
  .paper { box-shadow: none; }
}
