/* 亮點工具：深夜藍文字、綠色主色 */
:root {
  --bg: #F5F7F6;
  --panel: #FFFFFF;
  --ink: #0E1623;
  --muted: #4E5A69;
  --line: #DCE3E0;
  /* 主色綠：白字在上面、或當文字放在白底與淺綠底上，對比都要 ≥ 4.5:1（原本 #0C9F61 只有 3.4:1） */
  --accent: #077A4A;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3F5EC;
  --error: #B42318;
  --radius: 12px;
  /* 不載入網路字型（會阻斷畫面、拖慢手機首次顯示），直接用各系統內建的中文字型 */
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --pen: #1D4ED8;
  --print: #1F2933;
  --rule: #2B3440;
  --paper: #FFFFFF;
  --stamp: #EEF3FB;
  --omit: #C2410C;
  --rowh: 2.5rem;
  --print-font: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.6; }
.wrap {
  max-width: 920px;
  margin-inline: auto;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}

.site-header { border-bottom: 1px solid var(--line); background: var(--panel); }
.site-header .wrap { padding-block: 14px; }
.brand { display: inline-flex; }
.logo { height: 46px; width: auto; display: block; }

main { padding-block: 28px 48px; display: flex; flex-direction: column; gap: 20px; }
main h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.25; margin: 0; text-align: center; }
/* 先替工具區預留高度：WebAssembly 載入前下面的說明區塊就在畫面外，載入後不會被往下推（避免版面位移 CLS） */
main > #app { min-height: 75vh; }


/* 共用：分頁、表單、按鈕、頁尾 */
.tabs { display: flex; gap: 8px; padding: 6px; background: var(--panel); border: 2px solid var(--accent); border-radius: 14px; }
.tab {
  flex: 1; font: inherit; font-size: 1.0625rem; font-weight: 700; min-height: 48px; padding: 8px 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer;
}
.tab small { display: block; font-size: .8125rem; font-weight: 500; }
.tab.on { background: var(--accent); color: var(--accent-ink); }
.tab:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.block { display: flex; flex-direction: column; gap: 12px; }
.block-title { margin: 0; font-size: 1.5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.block-title small { font-size: .875rem; font-weight: 400; color: var(--muted); }
.block-title.center { justify-content: center; }
.fields { display: grid; gap: 12px 16px; }
.fields.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.fields.four { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.field label { display: block; font-size: .9375rem; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 1.25rem; min-height: 3.2rem; padding: 8px 12px;
  border: 2px solid var(--accent); border-radius: 10px; background: var(--panel); color: var(--ink);
}
.field input { text-align: right; font-variant-numeric: tabular-nums; }
.field input.left { text-align: left; }
.field select { font-size: 1.0625rem; }
.field input:focus, .field select:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[readonly] { background: var(--line); }
.error { margin: 0; color: var(--error); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.btn {
  font: inherit; font-size: 1.125rem; font-weight: 700; min-height: 52px; min-width: 12rem; padding: 10px 24px;
  border: 0; border-radius: 12px; cursor: pointer; color: #FFFFFF;
}
.btn.clear { background: #2F6FD0; }
.btn.link { background: var(--accent); }
.btn.shot { background: #0E1623; }

/* 工具頁的靜態說明（由 crates/page-content 產生）：導覽路徑、簡介、步驟、常見問題、相關工具 */
.crumb { margin: 0 0 -8px; font-size: .875rem; color: var(--muted); text-align: center; }
/* 連結加底線，不只靠顏色辨識 */
.crumb a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.page-info, .related { margin-top: 12px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.page-info h2, .related h2 { margin: 0 0 8px; font-size: 1.25rem; }
.page-info h3 { margin: 20px 0 6px; font-size: 1.0625rem; }
.page-info p { margin: 0; }
.page-info ol { margin: 0; padding-left: 1.5em; }
.page-info li + li { margin-top: 4px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { padding: 12px 4px; font-weight: 500; cursor: pointer; }
.faq summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.faq details p { padding: 0 4px 14px; color: var(--muted); }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.related a { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; color: var(--ink); text-decoration: none; border: 2px solid var(--line); border-radius: var(--radius); }
.related a:hover, .related a:focus-visible { border-color: var(--accent); outline: none; }
.related a span { color: var(--muted); font-size: .875rem; }
.related .all { margin: 14px 0 0; text-align: right; }
.related .all a { display: inline; padding: 0; border: 0; color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.site-footer .wrap { padding-block: 20px 28px; }
.site-footer p { margin: 0 0 4px; }
.small { font-size: .8125rem; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.site-footer a { color: var(--muted); }
