/* 深綠、米白、暖色點綴；跟隨 iOS 字級（-apple-system-body）與深色模式 */
:root {
  --green: #1E5640; --green-soft: #E2EEE6; --cream: #F8F4EB; --card: #FFFFFF;
  --warm: #A85A1A; --warm-soft: #FAECDC; --muted: #5C625E; --text: #1B1F1D; --line: rgba(0,0,0,.08);
  --on-green: #FFFFFF;
  --tabbar-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --green: #7EC49E; --green-soft: #22362C; --cream: #121614; --card: #1E2421;
    --warm: #E8A660; --warm-soft: #3A2A1A; --muted: #AAB2AD; --text: #ECEFED; --line: rgba(255,255,255,.1);
    --on-green: #0E1A14;
  }
}
* { box-sizing: border-box; }
html { font: -apple-system-body; font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
@supports not (font: -apple-system-body) { html { font-size: 17px; } }
body { margin: 0; background: var(--cream); color: var(--text); line-height: 1.55; }
#app { max-width: 680px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
.boot { color: var(--muted); text-align: center; margin-top: 30vh; }
h1 { font-size: 1.9rem; margin: .2rem 0; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: 1.08rem; margin: 0 0 .25rem; }
p { margin: .35rem 0; }
a { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.warm { color: var(--warm); }
.green { color: var(--green); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 10px 0; }
.card.link { display: block; text-decoration: none; color: inherit; }
.card.soft-warm { background: var(--warm-soft); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; flex-wrap: nowrap; }
.stack > * + * { margin-top: 8px; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); color: var(--muted); white-space: nowrap; }
.badge.green { color: var(--green); } .badge.warm { color: var(--warm); }
button, .btn { font: inherit; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.primary, .btn.primary { background: var(--green); color: var(--on-green); border-color: transparent; font-weight: 600; }
button.danger { color: #C0392B; }
button.block, .btn.block { width: 100%; }
button.link { background: none; border: none; color: var(--green); padding: 4px 0; min-height: 0; }
button:disabled { opacity: .45; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btns > button { flex: 1 1 auto; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label.field { display: block; margin: 10px 0; }
label.field > span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
label.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv > :last-child { color: var(--muted); text-align: right; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chip { flex: none; border-radius: 999px; padding: 6px 14px; min-height: 36px; }
.chip.on { background: var(--green); color: var(--on-green); border-color: transparent; }
.timeline { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px; scroll-snap-type: x proximity; }
.timeline button { flex: none; flex-direction: column; gap: 4px; padding: 8px 10px; min-width: 64px; scroll-snap-align: center; }
.timeline button.on { background: var(--green-soft); font-weight: 700; }
.timeline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.timeline .dot.has { background: var(--green); }
.timeline button.past { color: var(--muted); }
.yearbar { display: flex; align-items: center; justify-content: space-between; }
.yearbar button { font-size: 1.4rem; min-width: 48px; }
.excerpt { border-left: 3px solid var(--green); padding-left: 10px; margin: 6px 0; }
.banner { border-radius: 12px; padding: 10px 14px; margin: 8px 0; background: var(--warm-soft); color: var(--text); }
.banner.ok { background: var(--green-soft); }
.sim { position: sticky; top: 0; z-index: 5; background: #7A3E00; color: #fff; text-align: center; font-size: .85rem; padding: 4px; border-radius: 8px; }
nav.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); z-index: 10; }
nav.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .78rem; }
nav.tabbar a .ico { font-size: 1.35rem; line-height: 1; }
nav.tabbar a.on { color: var(--green); font-weight: 700; }
.back { display: inline-block; margin-bottom: 6px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); background: var(--text); color: var(--cream); padding: 10px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 20; }
#toast.show { opacity: .95; }
.pdfwrap { background: var(--card); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.pdfwrap canvas { width: 100%; height: auto; display: block; }
details > summary { cursor: pointer; padding: 6px 0; color: var(--green); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; }
.pdftext { white-space: pre-wrap; font-size: 1.05rem; line-height: 1.8; }
.pdftext mark { background: #FFE58A; color: #1B1F1D; border-radius: 3px; padding: 0 2px; }
