:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5f6b7a;
  --line: #e3e7ec;
  --accent: #1f6feb;
  --zh: #1f5fbf;
  --zh-soft: #e8f0fe;
  --en: #0f7a5e;
  --en-soft: #e3f5ef;
  --header-bg: #16324f;
  --header-text: #ffffff;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #171e26;
    --text: #e6ebf1;
    --muted: #9aa6b4;
    --line: #2a3440;
    --accent: #6ea8ff;
    --zh: #8ab4ff;
    --zh-soft: #1b2a40;
    --en: #5fd4ae;
    --en-soft: #15302a;
    --header-bg: #10263c;
    --header-text: #e6ebf1;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  line-height: 1.5;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
.site-header { background: var(--header-bg); color: var(--header-text); padding: 28px 0 24px; }
.site-header p { margin: 0; opacity: .85; font-size: 15px; }
.site-header .church { font-size: 17px; opacity: 1; font-weight: 600; }
.site-header h1 { margin: 10px 0 0; font-size: 28px; letter-spacing: .02em; }
.site-header h1 span { font-weight: 400; opacity: .85; }
main { padding-top: 8px; padding-bottom: 48px; }
h2 { font-size: 20px; margin: 28px 0 12px; }
h2 span { font-weight: 400; color: var(--muted); }
a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 最新週報 */
.latest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.latest-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.latest-card h3 { margin: 0 0 4px; font-size: 15px; color: var(--muted); font-weight: 600; }
.latest-date { margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; }
.latest-date time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.latest-card .entry { width: 100%; }

/* 目錄（年、月） */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  min-height: 52px; padding: 8px 16px 8px 44px; position: relative;
}
details > summary::before {
  content: ""; position: absolute; left: 18px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(-45deg); transition: transform .15s;
}
details[open] > summary::before { transform: translateY(-50%) rotate(45deg); }
.counts { font-size: 13px; color: var(--muted); font-weight: 400; }
.years { display: flex; flex-direction: column; gap: 8px; }
details.year { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.year > summary .title { font-size: 18px; font-weight: 700; }
details.year[open] > summary { border-bottom: 1px solid var(--line); }
.year-body { padding: 8px 12px 12px; }
.months { display: flex; flex-direction: column; gap: 6px; }
details.month { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
details.month > summary { min-height: 48px; }
details.month > summary .title { font-weight: 600; }
details.month > summary .en { font-weight: 400; color: var(--muted); font-size: 14px; }
details.month[open] > summary { border-bottom: 1px solid var(--line); }

/* 每週列：日期 | 中文堂 | English */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 0 0 10px 10px; }
.row {
  display: grid; grid-template-columns: 96px 1fr 1fr; gap: 8px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.date { display: flex; flex-direction: column; }
.date time { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.weekday { font-size: 12px; color: var(--muted); }
.cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.none { color: var(--muted); display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; }
.entry {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 6px 12px; border-radius: 10px; text-decoration: none;
  color: var(--zh); background: var(--zh-soft); font-weight: 600;
}
.entry[data-lang="english"] { color: var(--en); background: var(--en-soft); }
.entry:hover { filter: brightness(.96); }
.entry .label { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.entry .note { font-size: 12px; font-weight: 400; opacity: .8; }
.entry .ext { font-size: 11px; font-weight: 600; opacity: .75; letter-spacing: .04em; }

.status { color: var(--muted); margin: 8px 4px; }
.status.error { color: #c0392b; }
.status button { font: inherit; margin-left: 8px; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.back { margin: 16px 0 0; }
.back a { color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.year-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 24px; }

@media (max-width: 640px) {
  .site-header { padding: 20px 0 18px; }
  .site-header h1 { font-size: 24px; }
  .latest-grid { gap: 8px; }
  .latest-card { padding: 12px; }
  .latest-date { flex-direction: column; gap: 0; }
  .latest-date time { font-size: 17px; }
  .year-body { padding: 6px; }
  details > summary { padding-right: 12px; }
  .row { grid-template-columns: 1fr 1fr; padding: 10px; }
  .row .date { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; }
  .entry { padding: 6px 10px; }
}
