/* 媒體／印譜（精簡） */
#media-root {
  position: absolute; inset: 0 0 50px; z-index: 1; height: auto; min-height: 0;
  display: flex; flex-direction: column;
  padding-bottom: 0; background: #f2f2f7;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}
/* 小螢幕的全高子頁規則會蓋過媒體頁為分頁列預留的下緣。 */
#app > #media-root { height: auto; min-height: 0; }
#media-root > .pt-nav { flex-shrink: 0; }
/* 照原型 .ch-feed：卡片自己留左右 16px；下面空出功德區 36px */
#media-feed {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0 44px;
}
/* 功德區、排行榜、捐款頁都放在 #app 裡，不用 fixed 蓋整個視窗 */
#app .md-merit { position: absolute; }
/* .pt-root button 的重設會把功德區洗成黑字透明；照線上補回 iOS 藍字、淺底、上框線 */
.pt-root button.md-merit {
  border: 0; border-top: 0.5px solid rgba(60, 60, 67, 0.29);
  background: rgba(249, 249, 249, 0.9); color: #007aff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif;
  font-size: 13px; font-weight: 500;
}
#media-root > .md-merit { bottom: 0; }
#media-rank.md-rank-screen { height: auto; }
#app .pt-page.md-has-merit .md-merit { bottom: 0; }
#media-rank[hidden], #media-donate[hidden], #media-leave[hidden] { display: none !important; }
#media-rank .rk-me { position: absolute; }
/* 捐款頁停在分頁列上面，清單自己捲；離開提示蓋到分頁列，跟原型 fixed 一樣 */
#app #media-donate {
  bottom: calc(50px + env(safe-area-inset-bottom)); height: auto;
  display: flex; flex-direction: column; overflow: visible;
}
#app #media-donate .ch-feed { flex: 1; min-height: 0; overflow: auto; }
#app #media-donate .ch-shade { position: absolute; inset: 0 0 calc(-50px - env(safe-area-inset-bottom)); }
#media-member .ch-shade.md-seal-shade { position: absolute; }
.md-album-card .md-row-end, .rk-preview .md-row-end { display: inline-flex; align-items: center; gap: 4px; }
.md-album-recent { display: flex; justify-content: center; gap: 28px; margin: 12px 0 4px; }
.md-album-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; }
.md-album-slot small { font-size: 12px; color: var(--label2); }
.md-seal-face {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 8px; background: #f6efe3; overflow: hidden;
  color: #a33a2a; font-size: 14px; font-weight: 700;
}
.md-seal-face img { width: 100%; height: 100%; object-fit: contain; }
.md-seal-empty {
  width: 56px; height: 56px; border-radius: 8px;
  box-shadow: inset 0 0 0 1px #c7c7cc; background: transparent;
}

#media-book {
  position: absolute; inset: 0 0 50px; z-index: 8;
  display: flex; flex-direction: column; background: #f2f2f7;
}
#media-book[hidden] { display: none !important; }
#media-book > .pt-nav { flex-shrink: 0; }
#media-book-body {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  -webkit-overflow-scrolling: touch; padding: 8px 0 28px;
}
.md-shelf-head { display: flex; flex-direction: column; align-items: center; margin: 12px 20px 8px; }
.md-shelf-head b { font-size: 22px; font-weight: 600; letter-spacing: 0.42em; margin-right: -0.42em; }
.md-shelf-zhuan { height: 64px; width: auto; display: block; }
.md-shelf-page { padding: 8px 16px 20px; }
.md-shelf-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 8px 0 12px;
}
.md-couplet {
  writing-mode: vertical-rl; font-size: 13px; letter-spacing: 0.2em; color: var(--label3);
}
.md-shelf { display: flex; gap: 14px; align-items: flex-end; }
.md-cover {
  width: 96px; height: 132px; border: 0; padding: 0; background: transparent; border-radius: 4px; overflow: hidden;
}
.md-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.md-shelf-caps {
  display: flex; justify-content: center; gap: 24px; margin-bottom: 8px;
  font-size: 13px; color: var(--ink); text-align: center;
}
.md-shelf-caps span { display: flex; flex-direction: column; gap: 2px; min-width: 72px; }
.md-shelf-caps small { font-size: 12px; color: var(--label3); }
.md-shelf-sum { margin: 4px 0 0; text-align: center; font-size: 13px; color: var(--label3); }

.md-vol-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 10px;
  padding: 12px 20px 28px;
}
.md-vol-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.md-vol-cell b { font-size: 12px; font-weight: 600; }
.md-vol-cell small { font-size: 11px; color: var(--label3); }
.md-vol-empty { margin: 40px 24px; text-align: center; font-size: 15px; color: var(--label3); }
.md-area-title {
  margin: 16px 20px 4px; font-size: 13px; font-weight: 600; color: var(--label3);
}

.md-almanac {
  box-sizing: border-box; margin: 8px 16px; padding: 12px 16px 14px;
  border-radius: 12px; background: #fff; text-align: left;
}
.md-almanac-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--label2); }
.md-almanac-head b { color: var(--label); font-weight: 600; }
.md-almanac-seg { margin: 10px 0 4px; }
.md-almanac-nav { display: flex; justify-content: space-between; align-items: center; height: 28px; margin-bottom: 6px; }
.md-almanac-nav button {
  min-width: 64px; height: 28px; padding: 0 2px; border: 0; background: none;
  color: var(--label2); font: inherit; font-size: 12px; cursor: pointer;
}
.md-almanac-nav button:first-child { text-align: left; }
.md-almanac-nav button:last-child { text-align: right; }
.md-almanac-nav .md-almanac-now { color: #8a5a2b; font-weight: 600; }
.md-almanac-nav .md-almanac-now:disabled { color: var(--label3); font-weight: 400; cursor: default; }
.md-almanac-views { display: grid; min-height: 300px; }
.md-almanac-panel { display: flex; grid-area: 1 / 1; min-width: 0; flex-direction: column; }
/* 覆寫全站 [hidden] 的 display，讓最長的曆注決定四頁共用高度。 */
.md-almanac-panel[hidden] { display: flex !important; visibility: hidden; }
.md-almanac-hero { display: flex; align-items: center; gap: 10px; min-height: 46px; }
.md-almanac-hero > img { flex: none; width: 30px; height: 45px; object-fit: contain; }
.md-almanac-hero > img.round { width: 40px; height: 40px; }
.md-almanac-hero > div { flex: 1; min-width: 0; }
.md-almanac-hero h3 {
  margin: 0; font-family: "Noto Serif TC", "Songti TC", ui-serif, serif; font-size: 20px; font-weight: 600;
  line-height: 26px; color: #6b4220; letter-spacing: 1px;
}
.md-almanac-hero h3 small { margin-left: 6px; font-family: inherit; font-size: 12px; font-weight: 400; color: var(--label2); letter-spacing: 0; }
.md-almanac-hero p { margin: 1px 0 0; overflow: hidden; color: var(--label2); font-size: 12px; line-height: 17px; text-overflow: ellipsis; white-space: nowrap; }
.md-almanac-hero aside { flex: none; color: var(--label2); font-size: 12px; line-height: 17px; text-align: right; }
.md-almanac-hero aside b { display: block; color: #b8432f; font-size: 13px; }
.md-almanac-rule { height: .5px; margin: 9px 0; flex: none; background: var(--sep); }
.md-almanac-panel > .md-almanac-rule { margin: 7px 0; }
.md-almanac-bar { display: flex; align-items: center; gap: 8px; margin-top: 9px; color: var(--label2); font-size: 11px; }
.md-almanac-bar > span { flex: none; white-space: nowrap; }
.md-almanac-bar > span:last-child b { color: var(--label); }
.md-almanac-bar > i { height: 3px; min-width: 6px; flex: 1; overflow: hidden; border-radius: 2px; background: var(--fill); }
.md-almanac-bar > i em { display: block; height: 100%; background: var(--label3); }
.md-almanac-kv { margin: 8px 0 0; }
.md-almanac-kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 0; font-size: 13px; line-height: 17px; }
.md-almanac-kv > div + div { border-top: .5px solid var(--sep); }
.md-almanac-kv dt { flex: none; color: var(--label2); }
.md-almanac-kv dd { margin: 0; text-align: right; }
.md-almanac-kv dd small { margin: 0 2px 0 7px; color: var(--label3); font-size: 11px; }
.md-almanac-cap { display: flex; justify-content: space-between; margin: auto 0 4px; color: var(--label3); font-size: 11px; }
.md-almanac-terms { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; }
.md-almanac-terms span { display: grid; height: 24px; place-items: center; border-radius: 5px; color: var(--label2); font-size: 10px; }
.md-almanac-terms span.future { color: var(--label3); }
.md-almanac-terms span.current,
.md-almanac-calendar .current,
.md-almanac-hours span.current { background: #f6f1e4; box-shadow: inset 0 0 0 1.5px #8a5a2b; color: #6b4220; font-weight: 700; }
.md-almanac-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 8px 0 2px; color: var(--label3); font-size: 11px; line-height: 16px; text-align: center; }
.md-almanac-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 1fr; flex: 1; gap: 1px 0; }
.md-almanac-calendar > span, .md-almanac-calendar > button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; margin: 0 2px; padding: 0;
  border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; cursor: pointer;
}
.md-almanac-calendar b { font-size: 16px; font-weight: 500; line-height: 20px; font-variant-numeric: tabular-nums; }
.md-almanac-calendar small { color: var(--label3); font-size: 10px; line-height: 13px; white-space: nowrap; }
.md-almanac-calendar .term small { color: #8a5a2b; font-weight: 600; }
.md-almanac-calendar .festival small, .md-almanac-calendar .month small { color: var(--label2); font-weight: 600; }
.md-almanac-calendar .current b, .md-almanac-calendar .current small { color: #6b4220; }
.md-almanac-calendar button.picked { background: #8a5a2b; box-shadow: none; }
.md-almanac-calendar button.picked.current { box-shadow: inset 0 0 0 1.5px #8a5a2b, inset 0 0 0 3px #f6f1e4; }
.md-almanac-calendar .picked b, .md-almanac-calendar .picked small { color: #fff; }
.md-almanac-month-foot { display: flex; justify-content: space-between; margin-top: 4px; color: var(--label3); font-size: 11px; line-height: 15px; }
.md-almanac-yj { display: flex; align-items: flex-start; gap: 10px; }
.md-almanac-yj + .md-almanac-yj { margin-top: 7px; }
.md-almanac-yj-note { display: block; margin: -3px 0 1px; color: var(--label3); font-size: 10px; line-height: 12px; text-align: right; }
.md-almanac-yj > i { display: grid; width: 20px; height: 20px; flex: none; place-items: center; border-radius: 4px; font-family: ui-serif, serif; font-size: 13px; font-style: normal; font-weight: 700; }
.md-almanac-yj > i.yi { color: #fff; background: #b8432f; }
.md-almanac-yj > i.ji { color: var(--label2); box-shadow: inset 0 0 0 1px var(--label2); }
.md-almanac-yj > span { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 13px; line-height: 20px; }
.md-almanac-yj em { font-style: normal; white-space: nowrap; }
.md-almanac-yj i.ji + span { color: var(--label2); }
.md-almanac-shens { margin: 5px 0 0 30px; color: var(--label3); font-size: 10px; line-height: 14px; }
.md-almanac-day-grid { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.md-almanac-day-grid > div + div { border-left: .5px solid var(--sep); }
.md-almanac-day-grid small { display: block; color: var(--label3); font-size: 11px; line-height: 15px; }
.md-almanac-day-grid b { display: block; font-size: 14px; line-height: 21px; }
.md-almanac-day-grid b em { margin-left: 3px; color: var(--label2); font-size: 11px; font-style: normal; font-weight: 400; }
.md-almanac-day-foot { margin: auto 0 0; color: var(--label3); font-size: 10px; line-height: 14px; }
.md-almanac-hours { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; flex: 1; gap: 4px; margin-top: 10px; }
.md-almanac-hours > span { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; background: #fafafa; }
.md-almanac-hours b { font-family: ui-serif, serif; font-size: 17px; line-height: 20px; }
.md-almanac-hours small { color: var(--label3); font-size: 10px; line-height: 13px; font-variant-numeric: tabular-nums; }
.md-almanac-hours i { margin-top: 1px; font-size: 11px; font-style: normal; line-height: 15px; }
.md-almanac-hours .lucky i { color: #b8432f; }
.md-almanac-hours .unlucky b, .md-almanac-hours .unlucky i { color: var(--label3); }
.md-almanac-hours .current b, .md-almanac-hours .current small { color: #6b4220; }
.md-almanac-hour-foot { margin: 8px 0 0; color: var(--label3); font-size: 10px; line-height: 14px; }
