/* =========================================================
   MayRen — 全站共用樣式｜「刻度」設計語言（定義見 docs/DESIGN.md）
   三個原則：
   1. 粉紅問、藍色答：May 粉紅＝你輸入與選擇的；Ren 藍＝我們算出來的答案與連結。
   2. 刻度：髮絲細線、平面、不靠陰影；每頁頂端一把由粉到藍的「尺」。浮層才有陰影。
   3. 數字是主角：等寬數字、粗體、緊字距；其餘都退後。
   圖示全部自製（common.js 的 IC 與下方 --i-*），不使用表情符號或圖示字型。
   ========================================================= */

/* ---------- 1. 設計變數（亮色 / 暗色） ---------- */
:root {
  /* 墨、紙、線 */
  --c-bg: #f6f7f9;
  --c-surface: #ffffff;
  --c-surface-2: #eef0f4;
  --c-text: #12161f;
  --c-text-soft: #414a5c;
  --c-muted: #5d6679;
  --c-border: #dadfe7;      /* 分隔用的髮絲線 */
  --c-line: #858ea2;        /* 可操作元件的外框：對底色 ≥ 3:1（WCAG 1.4.11） */
  /* May 粉紅：你的輸入、選擇、主要按鈕 */
  --c-may: #db2777;
  --c-may-strong: #be185d;  /* 文字與實心底色用，對白 6:1 */
  --c-may-soft: #fdeaf3;
  --c-on-may: #ffffff;
  /* Ren 藍：答案、連結 */
  --c-ren: #0b63ce;
  --c-ren-strong: #0952ab;
  --c-ren-soft: #e6f0fe;
  --c-primary: #0b63ce;
  --c-primary-hover: #0952ab;
  --c-primary-soft: #e6f0fe;
  --c-highlight: #0a4fa6;
  /* 狀態 */
  --c-accent: #0a7a53;
  --c-accent-soft: #e2f5ec;
  --c-warn: #a34a06;
  --c-warn-soft: #fff3de;
  --c-danger: #b91c1c;
  --c-danger-soft: #fdeaea;
  --c-focus: #12161f;
  /* 形狀：6 / 10 / 14，膠囊只給可切換的小標籤 */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --ctl-h: 48px;
  --shadow-sm: none;
  --shadow-md: 0 10px 30px -10px rgba(18, 22, 31, .28);
  --shadow-pop: 0 18px 50px -12px rgba(18, 22, 31, .35), 0 0 0 1px rgba(18, 22, 31, .06);
  --header-h: 52px;
  --maxw: 1120px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* 遮罩圖示（與 common.js 的 IC 同一套路徑） */
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5.5M12 7.6v.2'/%3E%3C/svg%3E");
  --i-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.8 19.5h18.4z'/%3E%3Cpath d='M12 10v4.5M12 17.2v.2'/%3E%3C/svg%3E");
  --i-danger: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.5 3.5h7l5 5v7l-5 5h-7l-5-5v-7z'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E");
  --i-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='m8 12.3 2.8 2.8L16 9.5'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --i-target: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3'/%3E%3C/svg%3E");
  --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.3-4.3'/%3E%3C/svg%3E");
  --i-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='2'/%3E%3Cpath d='M4 10h16M8 3v4M16 3v4'/%3E%3C/svg%3E");
  --i-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --i-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E");
  /* 尺：每 8px 一短刻、每 40px 一長刻 */
  --ruler: repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 8px) left bottom / 100% 45% no-repeat,
           repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 40px) left bottom / 100% 100% no-repeat;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0d1117;
    --c-surface: #151b24;
    --c-surface-2: #1d2531;
    --c-text: #e8edf5;
    --c-text-soft: #b8c1d1;
    --c-muted: #98a3b8;
    --c-border: #2a3443;
    --c-line: #6f7b91;
    --c-may: #f472b6;
    --c-may-strong: #f472b6;
    --c-may-soft: #3a1529;
    --c-on-may: #2a0a1a;
    --c-ren: #5aa2ff;
    --c-ren-strong: #7fb7ff;
    --c-ren-soft: #14294a;
    --c-primary: #5aa2ff;
    --c-primary-hover: #7fb7ff;
    --c-primary-soft: #14294a;
    --c-highlight: #cfe3ff;
    --c-accent: #3ccf95;
    --c-accent-soft: #123326;
    --c-warn: #f0b056;
    --c-warn-soft: #382911;
    --c-danger: #ff7a7f;
    --c-danger-soft: #3b1a1c;
    --c-focus: #e8edf5;
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .6);
    --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
    color-scheme: dark;
  }
}

/* ---------- 2. 基礎 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.is-tool-page { scroll-padding-top: calc(var(--top-h, 46px) + var(--dock-h, 0px) + 10px); }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.75;
  color: var(--c-text); background: var(--c-bg); overflow-x: hidden;
  font-variant-numeric: tabular-nums;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--c-primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--c-primary-hover); }
h1, h2, h3, h4 { line-height: 1.3; margin: 1.6em 0 .6em; color: var(--c-text); font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4.4vw, 2.2rem); margin-top: .2em; letter-spacing: -.02em; }
h2 { font-size: clamp(1.22rem, 3vw, 1.45rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: .35em; }
hr { border: 0; border-top: 1px solid var(--c-border); margin: 2rem 0; }
code, .num { font-family: var(--font-num); }
kbd { font: 700 .74rem/1 var(--font-num); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text-soft); }
[hidden] { display: none !important; }

/* 焦點：一律是「墨色 2px 外框」，亮暗模式都對得上，不跟粉藍混在一起 */
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
main:focus { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 8px; top: -80px; z-index: 2000; background: var(--c-text); color: var(--c-bg);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 8px; color: var(--c-bg); }

/* 圖示與字鍵 */
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.glyph {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-weight: 800; font-size: 1.08rem; line-height: 1; letter-spacing: -.02em; white-space: nowrap;
  color: var(--c-text); background: var(--c-surface-2); border: 1px solid var(--c-border);
  transition: background .2s, color .2s, border-color .2s;
}
.glyph[data-n="2"] { font-size: .92rem; }
.glyph[data-n="3"] { font-size: .7rem; letter-spacing: -.03em; }
a:hover > .glyph, a.is-active > .glyph, a:focus-visible > .glyph { color: #fff; border-color: transparent; background: linear-gradient(135deg, #be185d, #0b63ce); }
.ruler { display: block; height: 7px; background: linear-gradient(90deg, var(--c-may), var(--c-ren)); -webkit-mask: var(--ruler); mask: var(--ruler); }

/* ---------- 3. 版面容器 ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
main { display: block; padding: 20px 0 48px; }

/* ---------- 4. 頁首（由 common.js 注入；工具頁沒有頁首） ---------- */
#site-header { min-height: var(--header-h); }
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--c-bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--c-border);
}
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 5px; background: linear-gradient(90deg, var(--c-may), var(--c-ren)); -webkit-mask: var(--ruler); mask: var(--ruler); opacity: .7; pointer-events: none; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; font-weight: 800; font-size: 1rem; color: var(--c-text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--c-text); opacity: .8; }
.brand-logo { width: 26px; height: 26px; flex: none; }
.brand .may, .may { color: var(--c-may-strong); }
.brand .ren, .ren { color: var(--c-ren); }
.site-nav ul { list-style: none; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; }
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 8px; min-height: 36px;
  font-size: .86rem; font-weight: 600; line-height: 1.4; color: var(--c-text-soft); text-decoration: none; transition: color .2s;
}
.site-nav a:hover, .site-nav a.is-cur, .site-nav a[aria-current="page"] { color: var(--c-text); }
.site-nav a[aria-current="page"] { font-weight: 800; box-shadow: inset 0 -2px 0 var(--c-may); border-radius: 0; }
.site-nav .nav-sub, .site-nav .nav-more { display: none; }
.nav-icon, .nav-toggle {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  color: var(--c-text-soft); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.nav-icon:hover, .nav-toggle:hover { color: var(--c-text); background: var(--c-surface-2); }
.nav-icon .ic { width: 20px; height: 20px; }
.nav-toggle { display: none; position: relative; }
.nav-toggle span { position: absolute; left: 13px; right: 13px; height: 1.75px; border-radius: 2px; background: currentColor; transition: transform .3s var(--ease); }
.nav-toggle span:first-child { transform: translateY(-3.5px); }
.nav-toggle span:last-child { transform: translateY(3.5px); }
.nav-toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }
@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  html.nav-open { overflow: hidden; }
  .site-nav {
    position: absolute; left: 0; right: 0; top: 100%; height: calc(100dvh - var(--header-h));
    background: var(--c-bg); overflow-y: auto; visibility: hidden; opacity: 0; transition: opacity .25s, visibility 0s .25s;
  }
  .site-nav.is-open { visibility: visible; opacity: 1; transition: opacity .25s; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 16px 28px 40px; }
  .site-nav .nav-sub, .site-nav .nav-more { display: block; }
  .site-nav a { display: flex; padding: 10px 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; color: var(--c-text); border-radius: 0; }
  .site-nav .nav-more a { font-size: 1.25rem; padding: 8px 0; }
  .site-nav a.is-cur, .site-nav a[aria-current="page"] { color: var(--c-may-strong); box-shadow: none; }
  .site-nav .nav-sub a { font-size: 1.02rem; font-weight: 600; color: var(--c-text-soft); padding: 8px 0; }
  .site-nav li:not(.nav-sub) + .nav-sub { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--c-border); }
}

/* ---------- 5. 麵包屑（一般頁面）與工具頁頂列 ---------- */
.breadcrumb { font-size: .84rem; color: var(--c-muted); margin: 4px 0; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: "/"; margin: 0 6px 0 2px; color: var(--c-border); }
.breadcrumb a { color: var(--c-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-text); text-decoration: underline; }

/* 工具頁：沒有網站頁首，只有一條很輕的頂列（小字標誌＋「全部工具」），下緣是一把尺 */
.tool-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -8px -16px 14px; padding: 2px 16px 9px; font-size: .82rem; line-height: 1.4; background: var(--c-bg); }
.tool-top::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 7px; background: linear-gradient(90deg, var(--c-may), var(--c-ren)); -webkit-mask: var(--ruler); mask: var(--ruler); opacity: .8; }
.tool-top a { text-decoration: none; }
.tool-home { font-weight: 800; font-size: .92rem; padding: 6px 0; min-height: 36px; display: inline-flex; align-items: center; }
.tool-home:hover { opacity: .75; }
.tool-all {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px 4px 10px; border-radius: 999px; font-weight: 700;
  color: var(--c-text-soft); border: 1px solid var(--c-line); background: var(--c-surface); transition: color .2s, border-color .2s;
}
.tool-all:hover, .tool-all:focus-visible { color: var(--c-text); border-color: var(--c-text); }

.page-intro { color: var(--c-text-soft); font-size: 1.02rem; max-width: 760px; }
.updated { position: relative; display: inline-block; font-size: .82rem; line-height: 1.55; color: var(--c-muted); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-xs); padding: 5px 12px 5px 32px; margin: 0 0 14px; max-width: 100%; }
.updated::before { content: ""; position: absolute; left: 10px; top: 8px; width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--i-calendar) center / contain no-repeat; mask: var(--i-calendar) center / contain no-repeat; }
.updated time { font-weight: 700; color: var(--c-text); }

/* ---------- 6. 卡片與工具版面 ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.tool-layout > .card + .card { margin-top: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.tool-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; margin-top: 16px; }
.tool-layout > * { min-width: 0; }
/* 粉紅問、藍色答：輸入卡頂端粉紅線，結果卡頂端藍線 */
.tool-layout > .card:first-child { border-top: 3px solid var(--c-may); }
.tool-layout > #result, .tool-layout > .card:first-child + .card { border-top: 3px solid var(--c-ren); }
/* 橫放的手機：兩欄較窄，數字格改兩欄才不會斷行 */
@media (min-width: 640px) and (max-width: 899px) and (max-height: 520px) { .stat-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 桌機、橫放的手機：左輸入、右結果 */
@media (min-width: 900px), (min-width: 640px) and (max-height: 520px) {
  .tool-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; }
  .tool-layout > .is-sticky { position: sticky; top: calc(var(--top-h, 46px) + 10px); }
}

/* ---------- 7. 表單 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; min-width: 0; position: relative; }
.field > label, .field > .label { font-weight: 700; font-size: .92rem; margin-bottom: 6px; color: var(--c-text); }
.field .hint { font-size: .8rem; color: var(--c-muted); margin-top: 6px; line-height: 1.5; }
.input-wrap { position: relative; display: flex; align-items: stretch; }
.input-wrap .unit {
  display: inline-flex; align-items: center; padding: 0 12px; font-size: .88rem; font-weight: 600;
  color: var(--c-text-soft); background: var(--c-surface-2); border: 1px solid var(--c-line);
  border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: nowrap;
}
.input-wrap .unit-pre { border-left: 1px solid var(--c-line); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-wrap input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-wrap .unit-pre + input { border-top-left-radius: 0; border-bottom-left-radius: 0; }

input[type="text"], input[type="number"], input[type="email"], input[type="search"], input[type="url"], input[type="tel"], input[type="password"], select, textarea, .mr-select-btn, .mr-field {
  width: 100%; min-width: 0; font: inherit; font-size: 16px; /* 16px 避免 iOS 自動放大 */
  color: var(--c-text); background: var(--c-surface);
  border: 1px solid var(--c-line); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: var(--ctl-h); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
::placeholder { color: var(--c-muted); opacity: 1; }
input:focus, select:focus, textarea:focus, .mr-select-btn:focus-visible, .mr-select-btn[aria-expanded="true"], .mr-field:focus-within {
  outline: none; border-color: var(--c-may-strong); box-shadow: 0 0 0 1px var(--c-may-strong), 0 0 0 4px var(--c-may-soft);
}
input.is-invalid, select.is-invalid, textarea.is-invalid, .mr-select-btn.is-invalid, .mr-field:has(.is-invalid) { border-color: var(--c-danger); box-shadow: 0 0 0 1px var(--c-danger), 0 0 0 4px var(--c-danger-soft); }
.field-error { position: relative; color: var(--c-danger); font-size: .84rem; margin-top: 6px; font-weight: 700; padding-left: 22px; line-height: 1.45; }
.field-error::before { content: ""; position: absolute; left: 0; top: 2px; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--i-warn) center / contain no-repeat; mask: var(--i-warn) center / contain no-repeat; }
.field-error:empty { display: none; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="file"] { font: inherit; font-size: .9rem; color: var(--c-text-soft); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; margin-right: 12px; padding: 9px 16px; min-height: 40px; cursor: pointer;
  color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-sm);
}
input[type="file"]::file-selector-button:hover { border-color: var(--c-text); }

/* 核取方塊與單選：自己畫 */
input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0 8px 0 0; flex: none;
  display: inline-grid; place-content: center; vertical-align: -5px; cursor: pointer;
  background: var(--c-surface); border: 1.5px solid var(--c-line); border-radius: var(--radius-xs); transition: background .15s, border-color .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 14px; height: 14px; background: var(--c-on-may); -webkit-mask: var(--i-check) center / contain no-repeat; mask: var(--i-check) center / contain no-repeat; transform: scale(0); transition: transform .12s var(--ease); }
input[type="radio"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c-on-may); transform: scale(0); transition: transform .12s var(--ease); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--c-may-strong); border-color: var(--c-may-strong); box-shadow: none; }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; border-color: var(--c-line); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }

/* 快速填入膠囊 */
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-chip {
  font: inherit; font-size: .84rem; font-weight: 600; line-height: 1; cursor: pointer;
  padding: 8px 12px; min-height: 34px; border-radius: 999px;
  border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-soft);
  transition: background .15s, border-color .15s, color .15s;
}
.quick-chip:hover { border-color: var(--c-text); color: var(--c-text); }
.quick-chip.is-on { border-color: var(--c-may-strong); background: var(--c-may-soft); color: var(--c-may-strong); font-weight: 800; }

/* 分段選擇：一條軌道，選中的那格浮起來並帶粉紅框 */
.segmented { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: var(--radius-sm); background: var(--c-surface-2); border: 1px solid var(--c-border); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; border: 0; }
.segmented label {
  flex: 1 1 auto; text-align: center; padding: 8px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: .92rem;
  color: var(--c-text-soft); background: transparent; min-height: 40px; border: 0;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s, box-shadow .15s;
}
.segmented label:hover { color: var(--c-text); }
.segmented input:checked + label { background: var(--c-surface); color: var(--c-may-strong); font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--c-may-strong); }
.segmented input:focus-visible + label { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.segmented input:disabled + label { opacity: .5; cursor: not-allowed; }

.fieldset { border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 14px; margin: 0; min-width: 0; }
.fieldset legend { font-weight: 800; font-size: .9rem; padding: 0 6px; color: var(--c-text-soft); }
.is-hidden { display: none !important; }

/* ---------- 8. 按鈕 ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 800; font-size: 1rem; line-height: 1.3; cursor: pointer;
  padding: 11px 20px; min-height: var(--ctl-h); border-radius: var(--radius-sm);
  border: 1px solid transparent; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--c-may-strong); color: var(--c-on-may); flex: 1 1 160px; }
.btn-primary:hover { background: color-mix(in srgb, var(--c-may-strong) 86%, #000); color: var(--c-on-may); }
.btn-ghost { background: var(--c-surface); color: var(--c-text); border-color: var(--c-line); }
.btn-ghost:hover { border-color: var(--c-text); color: var(--c-text); }
.btn-sm { min-height: 40px; padding: 7px 13px; font-size: .88rem; font-weight: 700; }
.btn .ic { width: 18px; height: 18px; }

/* ---------- 9. 計算結果 ---------- */
.result-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; text-align: center; color: var(--c-muted); padding: 36px 16px; border: 1px dashed var(--c-line); border-radius: var(--radius); }
.result-empty.is-hidden { display: none; }
.demo-go { font: inherit; font-size: .88rem; font-weight: 700; color: var(--c-ren); background: none; border: 0; padding: 4px 6px; min-height: 32px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.demo-go:hover { color: var(--c-ren-strong); }
.result-more { display: none; }
/* 手機、直式平板：結果固定在頂列下方（上面看答案、下面輸入），只露主要數字，明細按了才展開 */
@media screen and (max-width: 899px) and (min-height: 521px) {
  .is-tool-page main > .container { display: flex; flex-direction: column; }
  .is-tool-page main > .container > * { flex: none; }
  .is-tool-page main > .container > .tool-layout ~ * { order: 2; }
  .is-tool-page main > .container > .page-intro, .is-tool-page main > .container > .updated { order: 1; }
  .is-tool-page main > .container > .page-intro { margin: 16px 0 10px; font-size: .92rem; }
  .is-tool-page main > .container > .updated { align-self: flex-start; }
  .is-tool-page main > .container > h1 { font-size: 1.25rem; margin: 0 0 10px; }
  .is-tool-page .tool-layout { margin-top: 0; gap: 12px; }
  .tool-layout > #result { order: -1; position: sticky; top: var(--top-h, 46px); z-index: 20; padding: 8px 10px 4px; }
  .tool-layout > #result:has(> .result-empty:not(.is-hidden)), .tool-layout > #result.is-open { padding-bottom: 10px; }
  .tool-layout > #result.is-open { position: static; }
  .tool-layout > #result > h2 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  /* 收合時只留主要數字；標了 data-dock 的區塊（文字工具的輸出、QR 圖）也留著 */
  .tool-layout > #result:not(.is-open) { max-height: 52vh; overflow-y: auto; overscroll-behavior: contain; }
  #result:not(.is-open) > #result-body > :not(.result-hero):not([data-dock]) { display: none; }
  #result.has-out:not(.is-open) .result-hero .sub { display: none; }
  #result.has-out:not(.is-open) .result-hero .value { font-size: 1.3rem; }
  #result:not(.is-open) textarea[data-dock] { display: block; width: 100%; height: 5.6em; min-height: 0; margin-top: 6px; }
  #result:not(.is-open) .qr-box[data-dock] { max-width: 150px; margin: 0 auto 6px; padding: 6px; }
  #result:not(.is-open) .result-hero { margin: 0; padding: 6px 12px 11px; }
  #result:not(.is-open) .result-hero .label { font-size: .8rem; }
  #result:not(.is-open) .result-hero .value { font-size: clamp(1.5rem, 6.4vw, 2rem); }
  #result:not(.is-open) .result-hero .sub { font-size: .8rem; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #result .result-empty { padding: 12px; font-size: .9rem; }
  #result-body:not(.is-hidden) ~ .result-more {
    display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 30px; margin-top: 4px; padding: 2px 8px;
    font: inherit; font-size: .84rem; font-weight: 700; color: var(--c-ren); background: none; border: 0; cursor: pointer;
  }
  .result-more[aria-expanded="true"] .ic { rotate: 180deg; }
  #result.is-open > .result-more { margin-top: 12px; border-top: 1px solid var(--c-border); border-radius: 0; }
}
.result-hero {
  position: relative; background: var(--c-ren-soft); border: 1px solid color-mix(in srgb, var(--c-ren) 28%, transparent);
  border-radius: var(--radius-sm); padding: 18px 20px 20px; margin-bottom: 14px; overflow: hidden;
}
.result-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--c-ren); -webkit-mask: var(--ruler); mask: var(--ruler); opacity: .35; }
@keyframes mr-flash { 0% { background: color-mix(in srgb, var(--c-ren) 24%, var(--c-surface)); } 100% { background: var(--c-ren-soft); } }
.result-hero.is-updated { animation: mr-flash .6s ease-out; }
.result-hero .label { font-size: .88rem; font-weight: 700; color: var(--c-text-soft); }
.result-hero .value {
  font-size: clamp(2.1rem, 8vw, 2.9rem); font-weight: 800; color: var(--c-highlight);
  line-height: 1.15; letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.result-hero .value small { font-size: .42em; font-weight: 700; margin-left: 4px; letter-spacing: 0; }
.result-hero .sub { font-size: .9rem; color: var(--c-text-soft); margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .stat-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 11px 14px; min-width: 0; }
.stat .k { font-size: .8rem; color: var(--c-muted); font-weight: 600; }
.stat .v { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .v small { font-size: .72em; font-weight: 600; color: var(--c-text-soft); margin-left: 2px; letter-spacing: 0; }
.stat.good .v { color: var(--c-accent); }
.stat.bad .v { color: var(--c-danger); }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-border); }

/* 提示框：左邊是自製圖示，不靠顏色單獨傳達（圖示形狀也不同） */
.notice {
  position: relative; border-radius: var(--radius-sm); padding: 12px 14px 12px 42px; font-size: .92rem; margin: 14px 0;
  background: var(--c-ren-soft); border: 1px solid color-mix(in srgb, var(--c-ren) 28%, transparent); color: var(--c-text);
}
.notice::before { content: ""; position: absolute; left: 13px; top: 14px; width: 19px; height: 19px; background: var(--c-ren); -webkit-mask: var(--i-info) center / contain no-repeat; mask: var(--i-info) center / contain no-repeat; }
.notice.warn { background: var(--c-warn-soft); border-color: color-mix(in srgb, var(--c-warn) 35%, transparent); }
.notice.warn::before { background: var(--c-warn); -webkit-mask-image: var(--i-warn); mask-image: var(--i-warn); }
.notice.danger { background: var(--c-danger-soft); border-color: color-mix(in srgb, var(--c-danger) 35%, transparent); }
.notice.danger::before { background: var(--c-danger); -webkit-mask-image: var(--i-danger); mask-image: var(--i-danger); }
.notice.good { background: var(--c-accent-soft); border-color: color-mix(in srgb, var(--c-accent) 35%, transparent); }
.notice.good::before { background: var(--c-accent); -webkit-mask-image: var(--i-ok); mask-image: var(--i-ok); }
.notice p:last-child { margin-bottom: 0; }

.chart-wrap { margin-top: 16px; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 16px; font-size: .84rem; color: var(--c-text-soft); margin-top: 6px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- 10. 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px 0 18px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.table-wrap:focus-visible { outline-offset: 1px; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--c-surface); }
caption { caption-side: top; text-align: left; font-weight: 800; padding: 10px 12px; color: var(--c-text-soft); background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
thead th { background: var(--c-surface-2); font-weight: 800; font-size: .86rem; white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll { max-height: 440px; overflow-y: auto; }

/* ---------- 11. 廣告版位（只用自動廣告；容器預設隱藏） ---------- */
.ad-slot { display: none; }
.ads-on .ad-slot { display: block; margin: 20px auto; min-height: 100px; width: 100%; text-align: center; overflow: hidden; }
.ads-on .ad-slot::before { content: "廣告"; display: block; font-size: .72rem; color: var(--c-muted); letter-spacing: .1em; margin-bottom: 4px; }
.ads-debug .ad-slot {
  background: repeating-linear-gradient(45deg, var(--c-surface-2), var(--c-surface-2) 10px, var(--c-surface) 10px, var(--c-surface) 20px);
  border: 1px dashed var(--c-border); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--c-muted); font-size: .85rem;
}
.ads-debug .ad-slot::after { content: attr(data-slot-name); }
.ad-slot-top { min-height: 90px; }

/* ---------- 12. 文章內容 ---------- */
.prose { max-width: 820px; }
.prose h2 { padding-top: 1em; border-top: 1px solid var(--c-border); }
.prose h2:first-child { border-top: 0; padding-top: 0; }
.formula {
  background: var(--c-surface); border: 1px solid var(--c-border); border-left: 3px solid var(--c-ren); border-radius: var(--radius-xs); padding: 12px 16px;
  font-family: var(--font-num); font-size: .9rem; overflow-x: auto; white-space: pre-wrap; line-height: 1.7;
}
.toc { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 12px 18px; margin: 16px 0; font-size: .92rem; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; }
.faq details { border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); margin-bottom: 8px; overflow: hidden; }
.faq summary { cursor: pointer; padding: 14px 46px 14px 16px; font-weight: 700; position: relative; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; background: var(--c-muted); -webkit-mask: var(--i-down) center / contain no-repeat; mask: var(--i-down) center / contain no-repeat; transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details[open] summary { border-bottom: 1px solid var(--c-border); }
.faq summary:focus-visible { outline-offset: -2px; border-radius: var(--radius-sm); }
.faq .faq-a { padding: 12px 16px 4px; color: var(--c-text-soft); }

/* 工具清單（全部工具頁、404） */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 16px 0; }
@media (min-width: 640px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tool-card {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; row-gap: 1px; align-items: center; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--c-surface); border: 1px solid var(--c-border);
  text-decoration: none; color: var(--c-text); transition: border-color .15s;
}
.tool-card:hover, .tool-card:focus-visible { border-color: var(--c-text); color: var(--c-text); }
.tool-card .glyph { grid-row: 1 / 3; }
.tool-card h3, .tool-card h4 { margin: 0; font-size: 1rem; font-weight: 700; grid-column: 2; line-height: 1.35; }
.tool-card p { margin: 0; font-size: .82rem; line-height: 1.45; color: var(--c-muted); grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card[hidden] { display: none; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.pill-row li { margin: 0; font-size: .85rem; padding: 4px 12px; border-radius: 999px; background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text-soft); }

/* 工具頁底部「你可能也用得到」 */
.related-h { font-size: 1rem; color: var(--c-text-soft); margin-top: 28px; }
.related-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; }
.related-chips li { margin: 0; }
.related-chips a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px 4px 4px; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600;
  color: var(--c-text); text-decoration: none; background: var(--c-surface); border: 1px solid var(--c-border); transition: border-color .2s;
}
.related-chips a:hover { border-color: var(--c-text); }
.related-chips .glyph { width: 30px; height: 30px; border-radius: 7px; font-size: .9rem; }
.related-chips .glyph[data-n="2"] { font-size: .76rem; }
.related-chips .glyph[data-n="3"] { font-size: .58rem; }
.related-chips a.more { color: var(--c-ren); background: transparent; border-color: transparent; font-weight: 700; padding-left: 8px; gap: 4px; }
.related-chips a.more:hover { text-decoration: underline; }

/* ---------- 13. 頁尾 ---------- */
.site-footer { border-top: 1px solid var(--c-border); padding: 22px 0 28px; margin-top: 24px; font-size: .8rem; line-height: 1.65; color: var(--c-muted); background: var(--c-surface); }
.footer-note { margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--c-border); }
.footer-slogan { display: block; margin-bottom: 4px; font-size: .92rem; font-weight: 800; color: var(--c-text); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.footer-bottom .may, .footer-bottom .ren { font-weight: 800; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0; margin: 0 -8px; padding: 0; list-style: none; }
.footer-links li { margin: 0; }
.footer-links a { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 8px; }
.site-footer a { color: var(--c-text-soft); text-decoration: none; }
.site-footer a:hover { color: var(--c-text); text-decoration: underline; }
@media (max-width: 639px) { .footer-bottom { flex-direction: column-reverse; align-items: flex-start; } }

/* ---------- 14. Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--c-text); color: var(--c-bg); padding: 10px 18px; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 600;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 1500;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* 下載離線版之後的贊助提示：底部小卡，髮絲線、不加陰影 */
.nudge {
  position: fixed; left: 50%; bottom: 20px; z-index: 1500; width: min(440px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 16px;
  background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-text); border-radius: var(--radius);
  transform: translate(-50%, 20px); opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s, visibility 0s .2s;
}
.nudge.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .2s, transform .2s; }
.nudge p { flex: 1; margin: 0; font-size: .9rem; line-height: 1.5; color: var(--c-text-soft); }
.nudge p strong { display: block; color: var(--c-text); }
.nudge .btn { flex: 0 0 auto; }
.nudge-x { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--c-muted); cursor: pointer; }
.nudge-x:hover { color: var(--c-text); }
.nudge.is-steps { align-items: flex-start; }
.nudge-body { flex: 1; min-width: 0; outline: 0; }
.nudge-steps { margin: 6px 0 2px; padding-left: 1.4em; font-size: .9rem; line-height: 1.55; color: var(--c-text); }
.nudge-steps li { margin: 4px 0; }
.nudge-steps li::marker { font-weight: 800; color: var(--c-may-strong); }
.footer-links button { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 8px; border: 0; background: none; font: inherit; color: var(--c-text-soft); cursor: pointer; }
.footer-links button:hover { color: var(--c-text); text-decoration: underline; }

.contact-iframe { width: 100%; min-height: 1100px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); display: block; }
@media (max-width: 640px) { .contact-iframe { min-height: 1300px; } }

/* ---------- 15. 工具頁：說明區收合 ---------- */
.guide { position: relative; margin-top: 32px; }
.guide-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.guide-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; }
.guide-head::after { content: ""; flex: 1; height: 7px; background: linear-gradient(90deg, var(--c-may), var(--c-ren)); -webkit-mask: var(--ruler); mask: var(--ruler); opacity: .6; }
.guide.is-collapsed > article { max-height: 340px; overflow: hidden; position: relative; }
.guide.is-collapsed > article::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 140px; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--c-bg) 88%); }
.guide-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px auto 0; min-height: 44px; padding: 8px 20px;
  font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; border-radius: var(--radius-sm);
  color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-line);
}
.guide-toggle:hover { border-color: var(--c-text); }
.guide.is-collapsed .guide-toggle { margin-top: -18px; position: relative; }

/* ---------- 16. 工具頁：新手教學 ---------- */
.has-tour { display: flex; align-items: center; gap: 8px; }
.tour-btn {
  margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; min-height: 34px;
  font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; white-space: nowrap; letter-spacing: 0;
  padding: 5px 12px 5px 9px; border-radius: 999px; color: var(--c-text-soft); background: var(--c-surface); border: 1px solid var(--c-border);
}
.tour-btn:hover { color: var(--c-text); border-color: var(--c-text); }
.tour-shield { position: fixed; inset: 0; z-index: 1000; }
.tour-spot { position: fixed; z-index: 1001; pointer-events: none; border-radius: var(--radius); box-shadow: 0 0 0 2px var(--c-may), 0 0 0 9999px rgba(10, 14, 22, .62); transition: left .25s, top .25s, width .25s, height .25s; }
.tour-pop { position: fixed; z-index: 1002; padding: 16px 18px 14px; border-radius: var(--radius); background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-pop); transition: top .25s, left .25s; }
.tour-pop h3 { margin: 2px 0 4px; font-size: 1.05rem; }
.tour-pop p { margin: 0; font-size: .92rem; color: var(--c-text-soft); line-height: 1.6; }
.tour-step { font-size: .76rem; font-weight: 800; letter-spacing: .06em; color: var(--c-may-strong); }
.tour-btns { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.tour-btns .btn-primary { flex: 0 0 auto; }
.tour-skip { margin-right: auto; font: inherit; font-size: .86rem; color: var(--c-muted); background: none; border: 0; cursor: pointer; padding: 8px 2px; min-height: 40px; }
.tour-skip:hover { color: var(--c-text); text-decoration: underline; }
.tour-prompt {
  position: fixed; z-index: 90; left: 50%; bottom: 18px; transform: translate(-50%, 140%); opacity: 0; width: max-content;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: var(--radius); max-width: calc(100vw - 24px);
  background: var(--c-surface); box-shadow: var(--shadow-pop); font-size: .92rem; font-weight: 700; transition: transform .4s var(--ease), opacity .3s;
}
.tour-prompt.show { transform: translate(-50%, 0); opacity: 1; }
.tour-prompt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-prompt .btn { flex: 0 0 auto; }
.tour-x, .mr-x { flex: 0 0 auto; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--c-text-soft); cursor: pointer; }
.tour-x:hover, .mr-x:hover { background: var(--c-surface-2); color: var(--c-text); }
@media (max-width: 420px) { .tour-prompt { font-size: .84rem; padding-left: 12px; gap: 6px; } }

/* 適用範圍 */
.scope { margin: 18px 0 6px; padding: 14px 16px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); font-size: .92rem; line-height: 1.65; }
.scope-title { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 8px; }
.scope-title::before { content: ""; width: 18px; height: 18px; flex: none; background: var(--c-ren); -webkit-mask: var(--i-target) center / contain no-repeat; mask: var(--i-target) center / contain no-repeat; }
.scope ul { margin: 0 0 8px; padding: 0; list-style: none; }
.scope li { position: relative; margin: 4px 0; padding-left: 26px; }
.scope li::before { content: ""; position: absolute; left: 0; top: .28em; width: 17px; height: 17px; background: var(--c-accent); -webkit-mask: var(--i-ok) center / contain no-repeat; mask: var(--i-ok) center / contain no-repeat; }
.scope li.scope-off::before { background: var(--c-warn); -webkit-mask-image: var(--i-warn); mask-image: var(--i-warn); }
.scope p { position: relative; margin: 0; padding-left: 26px; color: var(--c-muted); }
.scope p::before { content: ""; position: absolute; left: 0; top: .28em; width: 17px; height: 17px; background: currentColor; -webkit-mask: var(--i-search) center / contain no-repeat; mask: var(--i-search) center / contain no-repeat; }
.scope a { font-weight: 700; overflow-wrap: anywhere; }

/* ---------- 17. 工具頁：版本膠囊、舊版／離線版橫幅 ---------- */
.ver { position: relative; display: inline-block; vertical-align: middle; font-size: 1rem; line-height: 1; letter-spacing: 0; font-weight: 700; }
.ver-btn {
  display: inline-flex; align-items: center; gap: 2px; min-height: 30px; padding: 4px 6px 4px 10px; cursor: pointer;
  font: 700 .74rem/1 var(--font-num); color: var(--c-muted); background: transparent;
  border: 1px solid var(--c-border); border-radius: var(--radius-xs); position: relative; top: -3px;
}
.ver-btn:hover, .ver-btn[aria-expanded="true"] { border-color: var(--c-text); color: var(--c-text); }
.ver-btn .ic { width: 14px; height: 14px; }
.ver-menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: min(290px, calc(100vw - 32px)); padding: 8px;
  background: var(--c-surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
  font-size: .9rem; font-weight: 400; line-height: 1.5; color: var(--c-text);
}
.ver-head { margin: 4px 6px 6px; font-size: .75rem; font-weight: 800; color: var(--c-muted); }
.ver-menu ul { list-style: none; margin: 0; padding: 0; }
.ver-menu li { margin: 0; }
.ver-menu li a, .ver-dl {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 7px 10px;
  border-radius: 8px; color: var(--c-text); text-decoration: none; font: inherit; font-weight: 700; text-align: left; background: none; border: 0; cursor: pointer;
}
.ver-menu li a:hover, .ver-dl:hover { background: var(--c-surface-2); }
.ver-menu li a[aria-current="page"] { color: var(--c-may-strong); }
.ver-menu small { font-size: .76rem; font-weight: 600; color: var(--c-muted); }
.ver-none { padding: 4px 10px 6px; font-size: .82rem; color: var(--c-muted); }
.ver-dl { flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 6px; border-top: 1px solid var(--c-border); border-radius: 0 0 8px 8px; padding-top: 10px; }
.ver-dl span { display: inline-flex; align-items: center; gap: 6px; }
.ver-note { margin: 8px 6px 4px; font-size: .76rem; color: var(--c-muted); }
.ver-banner { margin: 4px 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .9rem; line-height: 1.6; background: var(--c-ren-soft); border: 1px solid color-mix(in srgb, var(--c-ren) 30%, transparent); }
.ver-banner.is-archive { background: var(--c-warn-soft); border-color: color-mix(in srgb, var(--c-warn) 35%, transparent); }
.ver-banner a { font-weight: 800; margin-left: 4px; white-space: nowrap; }
.print-meta, .print-inputs { display: none; }

/* ---------- 18. 全部工具頁 /tools/ ---------- */
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  min-height: 40px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-soft);
  transition: background .2s, color .2s, border-color .2s;
}
.cat-chip b { font-weight: 700; color: var(--c-muted); font-size: .8rem; }
.cat-chip:hover { border-color: var(--c-text); color: var(--c-text); }
.cat-chip[aria-pressed="true"] { color: var(--c-may-strong); border-color: var(--c-may-strong); background: var(--c-may-soft); font-weight: 800; }
.cat-chip[aria-pressed="true"] b { color: inherit; }
.home-cat { margin-top: 30px; scroll-margin-top: calc(var(--header-h) + 8px); }
.home-cat[hidden] { display: none; }
.home-cat-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding-bottom: 8px; border-bottom: 1px solid var(--c-border); }
.home-cat-head .ico { display: inline-grid; color: var(--c-may-strong); }
.home-cat-head .ico .ic { width: 22px; height: 22px; }
.home-cat-head h3 { margin: 0; font-size: 1.15rem; }
.home-cat-head p { margin: 0 0 0 auto; font-size: .84rem; color: var(--c-muted); }
.home-cat .tool-grid { margin-top: 12px; }
@media (min-width: 1100px) { .home-cat .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .home-cat-head p { flex-basis: 100%; margin-left: 0; font-size: .8rem; }
  .home-cat .tool-grid { gap: 8px; }
}
.tool-search { position: relative; margin-top: 16px; max-width: 560px; }
.tool-search .ic { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--c-muted); pointer-events: none; }
.tool-search input { min-height: 52px; padding: 12px 48px 12px 44px; font-size: 1rem; }
.tool-search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.tool-search input:focus ~ kbd, .tool-search input:not(:placeholder-shown) ~ kbd { display: none; }
@media (hover: none) { .tool-search kbd { display: none; } }
/* 找工具：搜尋列＋隨機、最近用過、情境、搜尋結果、直接回答 */
.find { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.find .tool-search { flex: 1 1 280px; margin-top: 0; }
.find-rand, .mr-pal-rand {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-soft);
}
.find-rand:hover, .mr-pal-rand:hover { border-color: var(--c-text); color: var(--c-text); }
.find-rand .ic, .mr-pal-rand .ic { width: 18px; height: 18px; }
.find-rand:hover .ic { rotate: 180deg; transition: rotate .4s; }
.mr-pal-rand { min-height: 32px; padding: 4px 12px; font-size: .8rem; margin-left: auto; }
.find-row { display: flex; align-items: center; gap: 6px 10px; margin-top: 12px; min-width: 0; }
.find-row[hidden] { display: none; }
.find-label { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 800; color: var(--c-muted); letter-spacing: .04em; }
.find-label .ic { width: 16px; height: 16px; }
.find-row .related-chips { margin: 0; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.find-row .related-chips::-webkit-scrollbar { display: none; }
.find-row .related-chips li { flex: none; }
.scene-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; flex: 1 1 auto; min-width: 0; scrollbar-width: none; }
.scene-chips::-webkit-scrollbar { display: none; }
.scene-chip { border-style: dashed; }
/* 用滑鼠的裝置：沒有捲軸的橫向捲動不直覺（要按住 Shift 滾輪才捲得動），膠囊改成自動換行、一次全部看到；觸控裝置維持左右滑 */
@media (hover: hover) and (pointer: fine) {
  .cat-chips, .scene-chips, .find-row .related-chips { flex-wrap: wrap; overflow-x: visible; }
  .find-row { align-items: flex-start; }
  .find-row .find-label { min-height: 40px; }
}
.scene-chip[aria-pressed="true"] { border-style: solid; }
.find-clear, .link-btn { flex: none; font: inherit; font-size: .82rem; color: var(--c-ren); background: none; border: 0; padding: 6px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }
.link-btn { font-size: inherit; padding: 0 2px; min-height: 0; }
.find-results { margin-top: 26px; }
.find-results[hidden], .find-answer[hidden] { display: none; }
.find-h { margin: 0; padding-bottom: 8px; font-size: 1.15rem; border-bottom: 1px solid var(--c-border); }
.find-results .tool-grid { margin-top: 12px; }
@media (min-width: 1100px) { .find-results .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tool-card mark, .mr-pal-t mark { background: var(--c-may-soft); color: var(--c-may-strong); border-radius: 3px; padding: 0 1px; font-weight: inherit; }
.answer {
  display: grid; gap: 2px; margin-top: 12px; padding: 16px 18px; border: 1px solid var(--c-ren); border-radius: var(--radius);
  background: var(--c-surface); color: var(--c-text); text-decoration: none;
}
.answer:hover { color: var(--c-text); border-color: var(--c-text); }
.answer-k { font-size: .76rem; font-weight: 800; letter-spacing: .06em; color: var(--c-ren); }
.answer b { font-size: clamp(1.3rem, 4.5vw, 1.9rem); font-weight: 900; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.answer small { display: inline-flex; align-items: center; gap: 2px; font-size: .86rem; color: var(--c-ren); }
.answer small .ic { width: 16px; height: 16px; }
.mr-pal-ans { border: 1px solid var(--c-ren); margin: 6px 0; }
.mr-pal-foot a { white-space: nowrap; }
@media (max-width: 639px) { .mr-pal-foot span { display: none; } .mr-pal-rand { margin-left: 0; } }
@media (max-width: 639px) {
  .find-rand { flex: 1 1 100%; justify-content: center; }
  .find-row { flex-wrap: wrap; }
  .find-row .find-label { flex-basis: auto; }
  .find-row .related-chips, .scene-chips { flex-basis: 100%; margin: 0 -16px; padding: 2px 16px; }
  .find-row[data-recent] { position: relative; }
  .find-row[data-recent] .find-clear { order: 1; margin-left: auto; }
  .find-row[data-recent] .related-chips { order: 2; }
}
@media (prefers-reduced-motion: reduce) { .find-rand:hover .ic { rotate: none; transition: none; } }
.tool-search-empty { margin: 28px 0 0; padding: 28px 16px; text-align: center; color: var(--c-text-soft); border: 1px dashed var(--c-line); border-radius: var(--radius); }

/* ---------- 19. 自製選擇器 ---------- */
/* 原生控制項留在 DOM 當值的來源，但看不到、Tab 不到 */
.mr-native {
  position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; min-width: 0 !important;
  padding: 0 !important; margin: 0 !important; border: 0 !important; opacity: 0 !important; overflow: hidden !important;
  clip-path: inset(50%) !important; pointer-events: none !important;
}
.mr-select { position: relative; width: 100%; min-width: 0; }
.mr-select-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.mr-select-btn .ic { color: var(--c-muted); width: 18px; height: 18px; transition: transform .2s var(--ease); }
.mr-select-btn[aria-expanded="true"] .ic { transform: rotate(180deg); }
.mr-select-btn:disabled { opacity: .55; cursor: not-allowed; }
.mr-select-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-select.is-unit { width: auto; flex: none; }
.mr-select.is-unit .mr-select-btn { height: 100%; background: var(--c-surface-2); font-size: .9rem; font-weight: 600; color: var(--c-text-soft); }
.input-wrap > .mr-select.is-unit:last-child .mr-select-btn { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.unit .mr-select.is-unit .mr-select-btn { border: 0; background: transparent; padding: 0 2px; min-height: 0; box-shadow: none; }
.unit .mr-select.is-unit .mr-select-btn:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }

.mr-field { display: flex; align-items: stretch; padding: 0; overflow: hidden; }
.mr-field .mr-field-in { flex: 1 1 auto; width: auto; min-width: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; min-height: 46px; padding: 10px 4px 10px 12px; }
.mr-field .mr-field-in:focus { box-shadow: none; }
.mr-field-wd { display: inline-flex; align-items: center; padding: 0 8px 0 2px; font-size: .8rem; font-weight: 600; color: var(--c-muted); white-space: nowrap; }
.mr-field-btn { flex: none; width: 46px; display: inline-grid; place-items: center; border: 0; border-left: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text-soft); cursor: pointer; }
.mr-field-btn:hover, .mr-field-btn[aria-expanded="true"] { color: var(--c-may-strong); }
.mr-field-btn:focus-visible { outline-offset: -3px; border-radius: 8px; }
.mr-field-btn .ic { width: 20px; height: 20px; }
.mr-field:has(:disabled) { opacity: .55; }
.mr-dt { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; }
@media (max-width: 380px) { .mr-dt { grid-template-columns: 1fr; } }

/* 浮層 */
.mr-backdrop { position: fixed; inset: 0; z-index: 1090; background: rgba(10, 14, 22, .5); animation: mr-fade .18s ease-out; }
html.mr-lock { overflow: hidden; }
.mr-pop {
  position: fixed; z-index: 1100; left: 0; top: 0; overflow: auto; overscroll-behavior: contain;
  background: var(--c-surface); color: var(--c-text); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
  animation: mr-pop .14s var(--ease); max-width: calc(100vw - 16px);
}
.mr-pop.is-sheet { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-width: none; max-height: 86dvh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: mr-sheet .26s var(--ease); }
.mr-pop.is-center { left: 50%; top: 10vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); max-height: 78vh; animation: mr-fade .16s ease-out; }
@keyframes mr-fade { from { opacity: 0; } }
@keyframes mr-pop { from { opacity: 0; transform: translateY(-4px); } }
@keyframes mr-sheet { from { transform: translateY(100%); } }
.mr-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 18px; font-size: 1rem; }
.mr-listwrap, .mr-palette { display: flex; flex-direction: column; overflow: hidden; }
.mr-list { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 6px; }
.mr-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 8px 10px 8px 12px; border-radius: 7px; cursor: pointer; font-size: .96rem; }
.mr-opt .ic { visibility: hidden; color: var(--c-may-strong); stroke-width: 2.4; }
.mr-opt.is-active { background: var(--c-surface-2); }
.mr-opt[aria-selected="true"] { font-weight: 800; color: var(--c-may-strong); }
.mr-opt[aria-selected="true"] .ic { visibility: visible; }
.mr-opt[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.mr-group { display: flex; align-items: center; gap: 6px; padding: 12px 12px 4px; font-size: .76rem; font-weight: 800; color: var(--c-muted); letter-spacing: .04em; }
.is-sheet .mr-opt { min-height: 48px; font-size: 1rem; }

/* 月曆 */
.mr-cal { width: 328px; padding: 10px 12px 12px; }
.mr-cal.is-sheet, .mr-clock.is-sheet, .mr-colorpop.is-sheet { width: 100%; padding-left: 16px; padding-right: 16px; }
.mr-cal-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.mr-cal-title { flex: 1; white-space: nowrap; display: inline-flex; align-items: baseline; justify-content: center; gap: 8px; min-height: 40px; padding: 4px 8px; font: inherit; color: var(--c-text); background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.mr-cal-title:hover { background: var(--c-surface-2); }
.mr-cal-title b { font-size: 1.02rem; font-weight: 800; }
.mr-cal-title small { font-size: .76rem; color: var(--c-muted); font-weight: 600; }
.mr-cal-title .ic { align-self: center; width: 16px; height: 16px; color: var(--c-muted); }
.mr-nav { flex: none; min-width: 40px; height: 40px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--c-text-soft); border-radius: var(--radius-sm); cursor: pointer; }
.mr-nav .ic + .ic { margin-left: -12px; }
.mr-nav:hover { background: var(--c-surface-2); color: var(--c-text); }
.mr-grid { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 2px; background: none; font-size: .92rem; }
.mr-grid th, .mr-grid td { padding: 0; border: 0; text-align: center; background: none !important; position: static; }
.mr-grid thead th { font-size: .76rem; font-weight: 700; color: var(--c-muted); height: 28px; }
.mr-grid .is-wk { color: var(--c-may-strong); }
.mr-day { width: 100%; height: 40px; padding: 0; font: inherit; font-weight: 600; color: var(--c-text); background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.mr-day:hover { background: var(--c-surface-2); }
.mr-day.is-out { color: var(--c-muted); font-weight: 400; }
.mr-day.is-today { box-shadow: inset 0 0 0 1.5px var(--c-ren); color: var(--c-ren); font-weight: 800; }
.mr-day.is-sel { background: var(--c-may-strong); color: var(--c-on-may); font-weight: 800; box-shadow: none; }
.mr-day:disabled { opacity: .3; cursor: not-allowed; }
.is-sheet .mr-day { height: 46px; }
.mr-cal-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.mr-cal-foot .btn-primary { flex: 0 0 auto; margin-left: auto; }
.mr-year { display: flex; align-items: center; justify-content: center; gap: 2px; margin-top: 4px; }
.mr-year-in input { width: 5.4em; text-align: center; font-weight: 800; font-size: 1.1rem; min-height: 44px; }
.mr-roc { margin: 6px 0 10px; text-align: center; font-size: .82rem; color: var(--c-muted); }
.mr-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mr-month, .mr-tick { min-height: 44px; font: inherit; font-weight: 600; color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-sm); cursor: pointer; }
.mr-month:hover, .mr-tick:hover { border-color: var(--c-text); }
.mr-month.is-sel, .mr-tick.is-sel { background: var(--c-may-strong); border-color: var(--c-may-strong); color: var(--c-on-may); font-weight: 800; }
/* 時間 */
.mr-clock { width: 328px; padding: 0 12px 12px; }
.mr-clock .mr-pop-head, .mr-colorpop .mr-pop-head { padding-left: 4px; padding-right: 0; }
.mr-clock-k { display: flex; align-items: baseline; gap: 8px; margin: 6px 2px; font-size: .82rem; font-weight: 800; }
.mr-clock-k small { font-weight: 600; color: var(--c-muted); }
.mr-hours, .mr-mins { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.mr-tick { min-height: 40px; font-size: .9rem; }
/* 顏色 */
.mr-color-btn { flex: none; width: 52px; min-height: var(--ctl-h); padding: 5px; border: 1px solid var(--c-line); border-radius: var(--radius-sm); background: var(--c-surface); cursor: pointer; }
.mr-color-chip { display: block; width: 100%; height: 100%; min-height: 28px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .45); }
.mr-colorpop { width: 300px; padding: 0 14px 14px; }
.mr-color-now { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.mr-color-now .mr-color-chip { width: 56px; height: 40px; flex: none; }
.mr-color-now output { font: 800 1.1rem var(--font-num); }
.mr-slider { display: grid; grid-template-columns: 4.2em 1fr; align-items: center; gap: 8px; margin: 8px 0; font-size: .84rem; font-weight: 700; color: var(--c-text-soft); }
.mr-slider input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; padding: 0; min-height: 0; border: 0; background: transparent; cursor: pointer; }
.mr-slider input[type="range"]::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: var(--track, var(--c-surface-2)); box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .4); }
.mr-slider input[type="range"]::-moz-range-track { height: 12px; border-radius: 999px; background: var(--track, var(--c-surface-2)); box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .4); }
.mr-slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid #12161f; }
.mr-slider input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #12161f; }
.mr-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 12px; }
.mr-swatch { height: 36px; border-radius: 8px; border: 0; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .45); cursor: pointer; }

/* 工具快速切換 */
.mr-palette.is-sheet { height: 90dvh; }
.mr-pal-top { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--c-border); }
.mr-pal-top > .ic { width: 20px; height: 20px; color: var(--c-muted); }
.mr-pal-top input { flex: 1; border: 0; background: transparent; box-shadow: none !important; padding: 8px 0; font-size: 1.05rem; min-height: 44px; }
.mr-pal-list { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 8px 8px; }
.mr-pal-item { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--c-text); text-decoration: none; }
.mr-pal-item.is-active, .mr-pal-item:focus-visible { background: var(--c-surface-2); color: var(--c-text); }
.mr-pal-item .glyph { width: 36px; height: 36px; }
.mr-pal-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.mr-pal-t b { font-size: .96rem; font-weight: 700; }
.mr-pal-t small { font-size: .8rem; color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-pal-item[aria-current="page"]::after { content: "目前頁面"; margin-left: auto; flex: none; font-size: .72rem; font-weight: 700; color: var(--c-may-strong); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; }
.mr-pal-none { margin: 0; padding: 32px 16px; text-align: center; color: var(--c-text-soft); }
.mr-pal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 8px 14px; border-top: 1px solid var(--c-border); font-size: .78rem; color: var(--c-muted); }
.mr-pal-foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; text-decoration: none; min-height: 32px; }
@media (hover: none) { .mr-pal-foot span { display: none; } .mr-pal-foot { justify-content: flex-end; } }

/* ---------- 20. 動態、對比與列印 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .notice::before, .scope li::before, .scope p::before, .scope-title::before, .updated::before, .field-error::before, .faq summary::after { background: CanvasText; forced-color-adjust: none; }
  input[type="checkbox"]:checked, input[type="radio"]:checked, .mr-day.is-sel, .mr-month.is-sel, .mr-tick.is-sel { background: Highlight; forced-color-adjust: none; }
  .tool-top::after, .site-header::after, .guide-head::after, .result-hero::after { display: none; }
  .segmented input:checked + label, .quick-chip.is-on, .cat-chip[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}
@media print {
  .site-header, .site-footer, .ad-slot, .btn-row, .result-actions, .nav-toggle, .toast, .nudge, .skip-link, .mr-pop, .mr-backdrop,
  .tour-btn, .tour-prompt, .result-more, .demo-go, #tc-toast, .guide-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; }
  .tool-layout { grid-template-columns: 1fr; }
  .guide.is-collapsed > article { max-height: none; overflow: visible; }
  .guide.is-collapsed > article::after { display: none; }
  .scope { break-inside: avoid; }
  .tool-top, .is-tool-page .page-intro, .is-tool-page .tool-form, .is-tool-page .guide, .is-tool-page .scope,
  .is-tool-page main section[aria-labelledby="related-title"], .ver-btn svg, .ver-menu, .ver-banner a { display: none !important; }
  .ver-btn { border: 0; padding: 0; color: #555; }
  .is-tool-page #result { border: 0; padding: 0; position: static !important; }
  .print-meta { display: block; font-size: 9.5pt; color: #444; border-bottom: 1px solid #bbb; padding-bottom: 8px; margin-bottom: 12px; }
  .print-inputs { display: block; margin-bottom: 14px; break-inside: avoid; }
  .print-inputs h3 { font-size: 11pt; margin: 0 0 6px; }
  .print-inputs table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .print-inputs th, .print-inputs td { border: 1px solid #ccc; padding: 4px 8px; text-align: left; vertical-align: top; }
  .print-inputs tr.grp th { width: auto; background: #e6ecf7; }
  .print-inputs th { width: 42%; background: #f4f4f4; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .is-tool-page .result-hero, .is-tool-page .stat-grid, .is-tool-page table tr { break-inside: avoid; }
}
.mr-slider input[type="range"]:focus { box-shadow: none; border: 0; }
.mr-slider input[type="range"]:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: 999px; }
