/* =========================================================
   moonland.ai 說明中心
   版面：頂部列 ＋ 可收合左側目錄 ＋ 置中的內文欄與本頁目錄
   以 logo 的黑底、白字與螢光綠「N」為主視覺；預設深色
   ========================================================= */

:root {
  /* 深色（預設）：照平台的顏色設定（2026-11-06 使用者從平台 :root 複製，lab() 換算成色號）
     平台名稱：background #09090b、card／sidebar #18181b、secondary／accent #27272a、
     foreground #fafafa、muted-foreground #9f9fa9、border 白 10%、input 白 15%、primary #2bfd82、coin #c27aff */
  --bg: #09090b;
  --surface: #18181b;
  --raised: #27272a;
  --hover: #27272a;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.15);
  --fg: #fafafa;
  --fg-2: #d4d4d8;             /* 平台 chart-1，介於主文字與灰字之間 */
  --muted: #9f9fa9;
  --brand: #00ff6a;            /* logo 的綠（logo 圖檔的顏色，不改） */
  /* 文字用的綠：平台 primary #2bfd82 在黑底上太亮、讀起來吃力（使用者 2026-11-06），改用同色系較柔和的綠 */
  --brand-ic: #4ade80;         /* 圖示、標記、強調字 */
  --accent: #4ade80;           /* 連結 */
  --accent-ink: #86efac;       /* 綠底上的文字 */
  --accent-soft: rgba(74, 222, 128, 0.1);
  --accent-line: rgba(74, 222, 128, 0.35);
  --warn-soft: rgba(255, 185, 0, 0.12);   /* 平台 warning #ffb900 */
  --warn-ink: #ffc933;
  --warn-line: rgba(255, 185, 0, 0.4);
  /* 登月幣：和平台的月亮標籤一樣，字用 coin #c27aff，底用 coin 的 15% 透明、沒有外框
     （平台的 coin-foreground #350e53 是「實心紫底上的字」，這裡用不到） */
  --coin-soft: rgba(194, 122, 255, 0.15);
  --coin-ink: #c27aff;
  --coin-line: transparent;
  --shot: #141416;
  --overlay: rgba(0, 0, 0, 0.6);
  --logo-on-dark: inline-block;
  --logo-on-light: none;
  color-scheme: dark;

  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif;
  --display: 'Zilla Slab', 'Noto Serif TC', 'Songti TC', serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --top-h: 60px;
  --side-w: 288px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7f6;
    --surface: #ffffff;
    --raised: #f0f3f1;
    --hover: #eef2f0;
    --line: #e1e7e3;
    --line-strong: #cdd6d1;
    --fg: #111613;
    --fg-2: #3b4641;
    --muted: #66726c;
    --brand: #00ff6a;
    --brand-ic: #00964a;
    --accent: #00803d;
    --accent-ink: #05592e;
    --accent-soft: #e2f7ea;
    --accent-line: #9ddcb9;
    --warn-soft: #fdf3df;
    --warn-ink: #7a4c06;
    --warn-line: #e8c27a;
    --coin-soft: #f1ebff;
    --coin-ink: #5a34b0;
    --coin-line: #c6b2f3;
    --shot: #eef2f0;
    --overlay: rgba(10, 13, 11, 0.4);
    --logo-on-dark: none;
    --logo-on-light: inline-block;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --raised: #f0f3f1;
  --hover: #eef2f0;
  --line: #e1e7e3;
  --line-strong: #cdd6d1;
  --fg: #111613;
  --fg-2: #3b4641;
  --muted: #66726c;
  --brand: #00ff6a;
  --brand-ic: #00964a;
  --accent: #00803d;
  --accent-ink: #05592e;
  --accent-soft: #e2f7ea;
  --accent-line: #9ddcb9;
  --warn-soft: #fdf3df;
  --warn-ink: #7a4c06;
  --warn-line: #e8c27a;
  --coin-soft: #f1ebff;
  --coin-ink: #5a34b0;
  --coin-line: #c6b2f3;
  --shot: #eef2f0;
  --overlay: rgba(10, 13, 11, 0.4);
  --logo-on-dark: none;
  --logo-on-light: inline-block;
  color-scheme: light;
}

/* ---------- 基礎 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 24px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* 字體大小：所有字級都用 rem，改這裡就會整站一起放大 */
html[data-fs="1"] { font-size: 115%; }
html[data-fs="2"] { font-size: 130%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.8 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand-ic); outline-offset: 2px; border-radius: 6px; }
kbd { font-family: var(--mono); font-size: 0.6875rem; }

.ic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic.sm { width: 14px; height: 14px; vertical-align: -2px; }

.skip {
  position: absolute; left: 12px; top: 10px; z-index: 50; transform: translateY(-200%);
  background: var(--brand); color: #04140a; padding: 8px 14px; border-radius: 8px; font-weight: 500;
}
.skip:focus { transform: none; }

/* ---------- 頂部列 ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 12px;
  padding-inline: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px;
  border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--fg-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn.sm { width: 32px; height: 32px; }
.nav-btn .m-only { display: none; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); margin-left: 4px; flex: none; }  /* 不被擠小，空間不夠時改由搜尋框縮短 */
.logo { height: 21px; width: auto; object-fit: contain; object-position: left center; }  /* 窄螢幕被擠時等比縮小，不壓扁 */
.logo-on-dark { display: var(--logo-on-dark); }
.logo-on-light { display: var(--logo-on-light); }
.brand-sub {
  font-size: 0.875rem; color: var(--muted); line-height: 1.1;
  padding-left: 12px; border-left: 1px solid var(--line-strong);
  white-space: nowrap;
}

.search-pill {
  flex: 0 1 440px; min-width: 0; margin-inline: auto;
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--raised); color: var(--muted);
  font: inherit; font-size: 0.875rem; cursor: pointer; text-align: left;
}
.search-pill:hover { border-color: var(--line-strong); color: var(--fg-2); }
.search-pill .sp-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-pill kbd { border: 1px solid var(--line-strong); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
@media (max-width: 1080px) { .search-pill kbd { display: none; } }  /* 版頭變窄時讓位給搜尋文字 */
[data-icon] { display: inline-grid; place-items: center; }

.top-links { display: flex; gap: 18px; font-size: 0.875rem; margin-right: 4px; flex: none; }
/* 英文版：英文字先用系統的西文字型（中文字型裡的引號、撇號是全形，英文用起來會多出空隙） */
html:lang(en) { --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif; }
.lang-btn { width: auto; min-width: 38px; padding-inline: 8px; font: 600 0.8125rem/1 var(--sans); letter-spacing: .02em; }
.lang-row { width: 100%; margin-top: 8px; border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; display: none; }
.lang-row:hover { background: var(--hover); color: var(--fg); }
.top-links a { color: var(--fg-2); text-decoration: none; white-space: nowrap; }
.top-links a:hover { color: var(--fg); }

/* ---------- 版面骨架 ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.nav-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
.nav-collapsed .side { display: none; }

.page {
  display: grid;
  grid-template-columns: minmax(0, 46rem) 13rem;
  justify-content: center;
  column-gap: 56px;
  padding: 40px clamp(16px, 4vw, 56px) 96px;
  min-width: 0;
}
.is-home .page { grid-template-columns: minmax(0, 66rem); }
.is-home .toc { display: none; }
.content { min-width: 0; outline: none; }

/* ---------- 左側目錄 ---------- */
.side {
  position: sticky; top: var(--top-h);
  height: calc(100vh - var(--top-h));
  height: calc(100dvh - var(--top-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 12px 28px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color .2s;
}
.side:hover { scrollbar-color: var(--line-strong) transparent; }
.side::-webkit-scrollbar { width: 10px; }
.side::-webkit-scrollbar-track { background: transparent; }
.side::-webkit-scrollbar-thumb { background: transparent; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.side:hover::-webkit-scrollbar-thumb { background-color: var(--line-strong); }

.nav-sec { margin-top: 20px; }
.nav-sec-label {
  font-size: 0.75rem; font-weight: 500; letter-spacing: .1em;
  color: var(--muted); padding: 0 10px 6px;
}
.nav-row {
  display: flex; align-items: center; gap: 11px;
  min-height: 38px; padding: 0 10px;
  border-radius: 10px;
  color: var(--fg-2); text-decoration: none;
  font-size: 0.9062rem; line-height: 1.4;
}
.nav-row .ic { color: var(--muted); transition: color .15s; }
a.nav-row:hover, .cat-row:hover { background: var(--hover); color: var(--fg); }
a.nav-row:hover .ic, .cat-row:hover .cat-link .ic { color: var(--fg-2); }
a.nav-row[aria-current="page"], .cat-row.cur {
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 500;
}
a.nav-row[aria-current="page"] .ic, .cat-row.cur .cat-link .ic, .cat-row.in .cat-link .ic { color: var(--brand-ic); }
.cat-row.in { color: var(--fg); }

.lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-row { padding: 0 4px 0 10px; }
.cat-link {
  display: flex; align-items: center; gap: 11px;
  flex: 1; min-width: 0; align-self: stretch;
  color: inherit; text-decoration: none;
}
.cat-toggle {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer;
}
.cat-toggle:hover { background: var(--line); color: var(--fg); }
.chev { width: 16px; height: 16px; transition: transform .2s ease; }
.nav-cat.open .cat-toggle .chev { transform: rotate(90deg); }

.nav-children {
  display: grid; grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows .22s ease, visibility .22s;
}
.nav-cat.open > .nav-children { grid-template-rows: 1fr; visibility: visible; }
.nav-children-in {
  min-height: 0; overflow: hidden;
  margin-left: 19px; padding-left: 12px;
  border-left: 1px solid var(--line);
}
.nav-children-in > :first-child { margin-top: 4px; }
.nav-children-in > :last-child { margin-bottom: 8px; }
.sub-label {
  font-size: 0.7188rem; letter-spacing: .08em; color: var(--muted);
  padding: 10px 8px 2px;
}
.nav-child {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; margin: 1px 0;
  border-radius: 8px;
  font-size: 0.8438rem; line-height: 1.5;
  color: var(--muted); text-decoration: none;
}
.nav-child span:first-child { flex: 1; min-width: 0; }
.nav-child:hover { color: var(--fg); background: var(--hover); }
.nav-child[aria-current="page"] { color: var(--accent-ink); font-weight: 500; background: var(--accent-soft); }
.nav-child[aria-current="page"]::before {
  content: ""; position: absolute; left: -13px; top: 7px; bottom: 7px;
  width: 2px; border-radius: 2px; background: var(--brand-ic);
}

.tag {
  flex: none; font-size: 0.6875rem; line-height: 1; font-weight: 500;
  padding: 4px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
  white-space: nowrap;
}

.side-foot {
  margin: 28px 4px 0; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 14px;
  font-size: 0.8125rem; line-height: 1.7; color: var(--muted);
}
.side-foot b { display: block; color: var(--fg); font-weight: 500; font-size: 0.875rem; margin-bottom: 2px; }
.side-foot a { color: var(--fg-2); }

.scrim { display: none; }

/* ---------- 本頁目錄 ---------- */
.toc { position: sticky; top: calc(var(--top-h) + 40px); align-self: start; font-size: 0.8125rem; }
.toc-label { color: var(--muted); font-size: 0.75rem; letter-spacing: .1em; margin-bottom: 10px; }
.toc a {
  display: block; padding: 5px 0 5px 14px;
  border-left: 1px solid var(--line);
  color: var(--muted); text-decoration: none; line-height: 1.5;
}
.toc a:hover { color: var(--fg); }
.toc a.on { color: var(--accent-ink); border-left-color: var(--brand-ic); }

/* ---------- 內文 ---------- */
.crumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8125rem; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb .sep { opacity: .5; }

.content h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.9rem, 3.4vw, 2.4rem); line-height: 1.3;
  letter-spacing: .01em; margin: 0 0 .4em;
  text-wrap: balance;
}
.content h2 {
  font-size: 1.35rem; font-weight: 700; line-height: 1.4;
  margin: 2.4em 0 .7em; text-wrap: balance;
}
.content h3 { font-size: 1.1rem; margin: 1.8em 0 .5em; }
.content p, .content li { color: var(--fg-2); }
.content strong { color: var(--fg); }
.content .gap { height: 1.75em; }
.lead { font-size: 1.0625rem; color: var(--fg-2); max-width: 40rem; }

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; line-height: 1.6; padding: 2px 10px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  color: var(--muted); white-space: nowrap;
}
.chip.brand { border-color: transparent; background: var(--accent-soft); color: var(--accent-ink); }
.chip.todo { border-color: transparent; background: var(--warn-soft); color: var(--warn-ink); }
/* 付費（登月幣）：紫色，比一般標籤醒目 */
.chip.paid, .tag.paid { border: 1px solid var(--coin-line); background: var(--coin-soft); color: var(--coin-ink); font-weight: 700; }
.sub-label.paid { color: var(--coin-ink); font-weight: 700; }
/* {{最常用}}：放在標題或表格的模型名稱後面；低調的小字，不用底色和外框 */
.chip.pick { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 0.75rem; font-weight: 500; line-height: 1; letter-spacing: 0; white-space: nowrap; vertical-align: 0.1em; }
.chip.pick::before { content: "★"; margin-right: 2px; color: var(--brand-ic); }

.callout {
  margin: 1.4em 0; padding: 14px 18px;
  border: 1px solid var(--accent-line); border-radius: 14px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 0.9375rem; line-height: 1.75;
}
.callout b { display: block; margin-bottom: 2px; }
.callout a { color: inherit; font-weight: 500; }
.callout.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-ink); }

ol.steps { list-style: none; padding: 0; margin: 1.2em 0; counter-reset: s; }
ol.steps > li {
  counter-increment: s; position: relative;
  padding: 2px 0 1.4em 48px; margin-left: 16px;
  border-left: 1px solid var(--line);
}
ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.steps > li::before {
  content: counter(s);
  position: absolute; left: -17px; top: 0;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--fg); font-size: 0.875rem; font-weight: 500; line-height: 1;
  font-variant-numeric: tabular-nums;
}

.shot {
  display: grid; place-items: center; text-align: center;
  margin: .8em 0 0; padding: 10px; max-width: 100%;
  border: 1px dashed var(--line-strong); border-radius: 14px;
  background: var(--shot); color: var(--muted); font-size: 0.8125rem;
}
.shot strong { display: block; color: var(--accent-ink); font-weight: 500; font-size: 0.875rem; }

.tbl { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--line); border-radius: 14px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th { background: var(--raised); color: var(--muted); font-weight: 500; font-size: 0.8125rem; white-space: nowrap; }
.tbl td { color: var(--fg-2); }
.num { font-family: var(--mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }

.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.figs figure { margin: 0; }
.figs figcaption { font-size: 0.8125rem; color: var(--muted); margin-top: 6px; }

/* 卡片 */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 1em 0; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--fg); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.card .tile {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--brand-ic);
}
.card .tile .ic { width: 20px; height: 20px; }
.card b { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card span.d { font-size: 0.875rem; color: var(--muted); line-height: 1.65; }
.card .card-t { display: flex; flex-direction: column; }
/* 有縮圖的卡片：圖在上方，圖示縮小放在標題左邊 */
.card.has-thumb { padding-top: 0; overflow: hidden; }
.card .thumb {
  display: block; margin: 0 -18px 12px; aspect-ratio: 16 / 9;
  position: relative; overflow: hidden; flex: none; background: var(--accent-soft); border-bottom: 1px solid var(--line);
}
.card .thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transition: transform .3s; }
.card.has-thumb:hover .thumb img { transform: scale(1.04); }
.card.has-thumb .card-t { flex-direction: row; align-items: center; gap: 10px; }
.card.has-thumb .tile { width: 30px; height: 30px; border-radius: 9px; margin: 0; flex: none; }
.card.has-thumb .tile .ic { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) { .card .thumb img { transition: none; } }

/* 分類頁的文章清單 */
.cat-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.cat-head h1 { margin: 0; }
.cat-icon {
  width: 52px; height: 52px; border-radius: 16px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--brand-ic);
}
.cat-icon .ic { width: 26px; height: 26px; }
.list { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  color: var(--fg); text-decoration: none;
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--hover); }
.list-row .list-t { flex: 1; min-width: 0; }
.list-row .chev { color: var(--muted); }

/* 首頁 */
.hero { padding: 16px 0 12px; }
.eyebrow { font-size: 0.8125rem; letter-spacing: .14em; color: var(--muted); }
.hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.25rem) !important;
  line-height: 1.22 !important; max-width: 15em; margin: .35em 0 .45em !important;
}
.hero h1 em { font-style: normal; color: var(--brand-ic); }
.hero h1 .seg { display: inline-block; }
.hero p { font-size: 1.0625rem; max-width: 34rem; margin: 0; }
.hero-search {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 580px; height: 56px; margin-top: 28px; padding: 0 12px 0 18px;
  border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: 1rem; text-align: left; cursor: pointer;
}
.hero-search:hover { border-color: var(--accent-line); }
.hero-search .sp-text { flex: 1; }
.hero-search kbd { border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 7px; }
.popular { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: 0.8125rem; color: var(--muted); }
.popular a {
  padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--fg-2); text-decoration: none;
}
.popular a:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head a { font-size: 0.875rem; text-decoration: none; white-space: nowrap; }

/* 上一篇／下一篇、回饋 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pager a {
  display: block; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: 14px;
  color: var(--fg); text-decoration: none; font-size: 0.9375rem;
}
.pager a:hover { border-color: var(--accent-line); }
.pager a small { display: block; color: var(--muted); font-size: 0.75rem; }
.pager a.next { grid-column: 2; text-align: right; }
.feedback {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 0.875rem; color: var(--muted);
}
.feedback button {
  font: inherit; font-size: 0.8125rem; cursor: pointer;
  padding: 4px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: none; color: var(--fg-2);
}
.feedback button[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }
.fb-thanks a { color: var(--accent); }

/* 意見回饋表單 */
.fb-form { display: grid; gap: 22px; max-width: 40rem; margin-top: 8px; }
.fb-field { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.fb-field legend, .fb-label { font-weight: 500; color: var(--fg); padding: 0; margin-bottom: 8px; }
.fb-label { margin-bottom: 0; }
.fb-label small, .fb-field legend small { font-weight: 400; color: var(--muted); font-size: 0.8125rem; margin-left: 8px; }
.fb-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fb-type { position: relative; display: block; cursor: pointer; }
.fb-type input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.fb-type span {
  display: block; height: 100%; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface);
}
.fb-type b { display: block; font-weight: 500; color: var(--fg); }
.fb-type small { display: block; color: var(--muted); font-size: 0.8125rem; margin-top: 2px; }
.fb-type:hover span { border-color: var(--accent-line); }
.fb-type input:checked + span { border-color: var(--accent-line); background: var(--accent-soft); }
.fb-type input:checked + span b { color: var(--accent-ink); }
.fb-type input:focus-visible + span { outline: 2px solid var(--brand-ic); outline-offset: 2px; }
.fb-form select, .fb-form textarea, .fb-form input:not([type="radio"]) {
  width: 100%; font: inherit; font-size: 1rem; color: var(--fg);
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
}
.fb-form textarea { resize: vertical; min-height: 8rem; line-height: 1.6; }
.fb-form select:focus, .fb-form textarea:focus, .fb-form input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.fb-count { justify-self: end; color: var(--muted); font-size: 0.75rem; }
.fb-error { margin: -8px 0 0; color: var(--warn-ink); font-size: 0.875rem; }
.fb-error:empty { display: none; }
.fb-error[data-for] { margin: 0; font-weight: 500; }
.fb-field.invalid .fb-type span, .fb-field.invalid textarea { border-color: var(--warn-line); }
.fb-field.invalid legend, .fb-field.invalid .fb-label { color: var(--warn-ink); }
.fb-submit, .fb-again {
  justify-self: start; font: inherit; font-weight: 500; cursor: pointer;
  padding: 10px 22px; border: 0; border-radius: 10px; background: var(--brand); color: #04140a;
}
.fb-submit:disabled { opacity: 0.6; cursor: default; }
.fb-done {
  display: flex; gap: 14px; max-width: 40rem; margin-top: 8px; padding: 20px;
  border: 1px solid var(--accent-line); border-radius: 14px; background: var(--accent-soft);
}
.fb-done:focus { outline: none; }
.fb-done > .ic { flex: none; width: 1.5rem; height: 1.5rem; color: var(--brand-ic); }
.fb-done b { color: var(--fg); }
.fb-done p { margin: 6px 0 0; color: var(--fg-2); }
.fb-done .fb-preview { font-size: 0.875rem; color: var(--muted); }
.fb-done .fb-again { margin-top: 14px; }

/* 回到頂端 */
.to-top {
  position: fixed; right: 88px; bottom: 28px; z-index: 30;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: var(--surface); color: var(--fg-2); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--fg); border-color: var(--accent-line); }
.to-top .ic { width: 20px; height: 20px; }

details.qa { border: 1px solid var(--line); border-radius: 14px; margin: 10px 0; background: var(--surface); }
details.qa summary { cursor: pointer; padding: 14px 18px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after { content: "+"; color: var(--muted); font-size: 1.125rem; line-height: 1.4; }
details.qa[open] summary::after { content: "−"; }
details.qa > div { padding: 0 18px 14px; color: var(--fg-2); font-size: 0.9375rem; }

/* ---------- 搜尋 ---------- */
dialog.search {
  width: min(620px, calc(100vw - 32px)); max-height: 72vh;
  margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--surface); color: var(--fg);
  overflow: hidden;
}
dialog.search[open] { display: flex; flex-direction: column; }
dialog.search::backdrop { background: var(--overlay); }
.search-head { display: flex; align-items: center; gap: 10px; padding: 0 10px 0 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-head input {
  flex: 1; min-width: 0; height: 56px; border: 0; outline: none;
  background: transparent; color: var(--fg); font: inherit; font-size: 1rem;
}
.search-head input::-webkit-search-cancel-button { display: none; }
#results { overflow-y: auto; padding: 8px; }
#results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--fg); text-decoration: none; }
#results a small { display: block; color: var(--muted); font-size: 0.75rem; }
#results a.sel { background: var(--accent-soft); }
#results a.sel small { color: var(--accent-ink); }
#results p { margin: 0; padding: 14px 12px; color: var(--muted); font-size: 0.875rem; }
.search-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); }

/* ---------- 斷點 ---------- */
/* 本頁目錄按鈕：只在看不到右側目錄的窄螢幕出現 */
.toc-btn { display: none; }
@media (max-width: 1240px) {
  .page { grid-template-columns: minmax(0, 46rem); }
  .toc { display: none; }
  .toc-btn:not([hidden]) {
    position: fixed; right: 28px; bottom: 90px; z-index: 31;
    display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 1px solid var(--line-strong); border-radius: 50%;
    background: var(--surface); color: var(--fg-2); cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  }
  .toc-btn .ic { width: 20px; height: 20px; }
  .toc-open .toc-btn { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
  .toc-open .toc {
    display: block; position: fixed; top: auto; right: 24px; bottom: 144px; z-index: 31;
    width: min(320px, calc(100vw - 32px)); max-height: min(60vh, 480px); overflow-y: auto;
    padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 14px;
    background: var(--surface); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28); font-size: 0.875rem;
  }
  .toc-open .toc a { padding: 8px 0 8px 14px; }
  .is-home .toc-btn { display: none !important; }
}
@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .nav-btn .d-only { display: none; }
  .nav-btn .m-only { display: block; }
  .shell, .nav-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .side, .nav-collapsed .side {
    display: block;
    position: fixed; top: var(--top-h); left: 0; bottom: 0; z-index: 25;
    width: min(86vw, 320px); height: auto;
    transform: translateX(-102%);
    transition: transform .24s ease;
    scrollbar-color: var(--line-strong) transparent;
  }
  .drawer-open .side { transform: none; }
  .drawer-open .scrim { display: block; position: fixed; inset: var(--top-h) 0 0 0; z-index: 20; background: var(--overlay); }
  .top-links, .brand-sub, .lang-btn { display: none; }
  .side .lang-row { display: flex; }
  .search-pill { flex: none; width: 38px; height: 38px; padding: 0; justify-content: center; margin-left: auto; margin-right: 0; border-color: transparent; background: none; }
  .search-pill .sp-text, .search-pill kbd { display: none; }
  .page { padding-top: 28px; }
}
@media (max-width: 620px) {
  .grid, .grid.c2 { grid-template-columns: minmax(0, 1fr); }
  .fb-types { grid-template-columns: minmax(0, 1fr); }
  .fb-submit { justify-self: stretch; }
  .to-top { right: 74px; bottom: 18px; }
  .toc-btn:not([hidden]) { right: 18px; bottom: 76px; }
  .toc-open .toc { right: 16px; bottom: 128px; }
  .jiji-btn { right: 16px; bottom: 16px; width: 48px; height: 48px; }
  .jiji { right: 16px; bottom: 74px; }
}
@media (max-width: 520px) {
  .logo { height: 18px; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: auto; }
  .hero-search kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 文章內容元件 ---------- */
.lead { margin-bottom: 1.6em; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: .9em 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: .8em 0; }
.prose li { margin: .25em 0; color: var(--fg-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose h3 { font-size: 1.1rem; margin: 1.9em 0 .5em; }
.prose h4 { font-size: 1rem; margin: 1.6em 0 .4em; color: var(--fg-2); }
.prose a, .callout a { text-decoration: underline; text-decoration-color: var(--accent-line); }
.prose a:hover { text-decoration-color: currentColor; }
.callout > p:first-of-type { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout.tip { }
.callout.note { border-color: var(--line-strong); background: var(--raised); color: var(--fg-2); }
.callout.note b { color: var(--fg); }
.callout ul { margin: .3em 0; padding-left: 1.2em; }
.callout li { color: inherit; }

/* 圖片、影片、音訊 */
.fig { margin: 1.1em 0; }
.fig img, .fig video {
  display: block; width: 100%; height: auto; max-width: 100%;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--shot);
}
.fig img { cursor: zoom-in; min-height: 60px; }
.fig video { max-height: 70vh; background: #000; }
.fig figcaption { font-size: 0.8125rem; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.fig.audio audio { width: 100%; height: 40px; }
/* 3D 模型：載入前是按鈕，載入後換成可轉動的 model-viewer */
.fig.model3d .m3d-load, .fig.model3d model-viewer { display: flex; width: 100%; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: var(--shot); }
.fig.model3d .m3d-load { flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; font: inherit; color: var(--fg-2); cursor: pointer; }
.fig.model3d .m3d-load:hover { border-color: var(--line-strong); color: var(--fg); }
.fig.model3d .m3d-load:disabled { cursor: progress; }
.fig.model3d .m3d-ic { width: 40px; height: 40px; color: var(--brand-ic); }
.fig.model3d .m3d-t { font-size: 0.9375rem; font-weight: 600; }
.fig.model3d .m3d-s { font-size: 0.8125rem; color: var(--muted); }
.fig.model3d model-viewer { height: auto; --poster-color: transparent; }
.fig.model3d.failed::after { content: "3D 模型暫時無法載入"; display: block; font-size: 0.8125rem; color: var(--warn-ink); margin-top: 6px; }
.fig.embed iframe { display: block; width: 100%; aspect-ratio: 3 / 4.6; border: 1px solid var(--line); border-radius: 12px; background: var(--shot); }
.fig.failed img { min-height: 120px; opacity: .25; }
.fig.failed::after { content: "圖片暫時無法載入"; display: block; font-size: 0.8125rem; color: var(--warn-ink); margin-top: 6px; }
/* 前後比較：底層是修改後（右），上層修改前（左）依 --x 裁切；分隔線在圖上，明暗模式都用同一個亮綠 */
.cmp { margin: 1.1em auto; max-width: calc(80vh * var(--ar)); } /* 整張圖都要在畫面內，太高就縮小 */
.cmp-view {
  --x: 50%; --cmp: #00ff66;
  position: relative; overflow: hidden; width: 100%; aspect-ratio: var(--ar);
  border-radius: 12px; border: 1px solid var(--line); background: var(--shot);
  cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.cmp-view img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  pointer-events: none; -webkit-user-drag: none;
}
.cmp-view .cmp-a { clip-path: inset(0 calc(100% - var(--x)) 0 0); }
.cmp-tag {
  position: absolute; top: 10px; z-index: 2; max-width: calc(50% - 16px);
  padding: 2px 10px; border-radius: 999px;
  background: rgba(12, 13, 15, .62); border: 1px solid rgba(255, 255, 255, .14); color: #f4f4f6;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 0.75rem; line-height: 1.5; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.cmp-tag.l { left: 10px; }
.cmp-tag.r { right: 10px; }
.cmp-line { position: absolute; top: 0; bottom: 0; left: var(--x); z-index: 3; width: 0; }
.cmp-line::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px;
  background: var(--cmp); box-shadow: 0 0 12px rgba(0, 255, 102, .4), 0 0 2px var(--cmp);
}
.cmp-knob {
  position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--cmp); color: #0c0d0f; box-shadow: 0 0 16px rgba(0, 255, 102, .35);
}
.cmp-knob .ic { width: 18px; height: 18px; stroke-width: 2.5; }
.cmp-knob:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cmp-view.drag .cmp-knob { box-shadow: 0 0 0 4px rgba(0, 255, 102, .25), 0 0 16px rgba(0, 255, 102, .5); }
.cmp-p { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cmp-p > summary {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  cursor: pointer; list-style: none; font-size: 0.8125rem; font-weight: 500; color: var(--accent);
}
.cmp-p > summary::-webkit-details-marker { display: none; }
.cmp-p > summary::before { content: "▸"; font-size: 0.6875rem; transition: transform .15s; }
.cmp-p[open] > summary::before { transform: rotate(90deg); }
.cmp-p .prompt { margin: 0 8px 8px; }
.cmp-p .prompt pre { padding: 10px 12px 6px; font-size: 0.8125rem; line-height: 1.65; max-height: 40vh; overflow: auto; }
.cmp-p .prompt .copy { position: static; margin: 0 0 8px 12px; }
.media-missing { padding: 12px; border: 1px dashed var(--warn-line); border-radius: 10px; color: var(--warn-ink); font-size: 0.8125rem; }

/* 並排 */
.row { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 14px; margin: 1.1em 0; align-items: start; }
.row .cell > .fig:first-child, .row .cell > .cmp:first-child { margin-top: 0; }
.row .cell > :last-child { margin-bottom: 0; }
.row .cell p { font-size: 0.9062rem; }
.row .prompt pre { font-size: 0.8125rem; }
@media (max-width: 620px) {
  .row { grid-template-columns: minmax(0, 1fr); }
  .row[style*="--n:3"] .fig figcaption, .row[style*="--n:2"] .fig figcaption { margin-top: 4px; }
}

/* 提示詞框 */
.prompt {
  position: relative; margin: .8em 0;
  border: 1px solid var(--line-strong); border-left: 3px solid var(--brand-ic); border-radius: 0 12px 12px 0;
  background: var(--raised);
}
.prompt pre {
  margin: 0; padding: 12px 84px 12px 16px;
  font-family: var(--sans); font-size: 0.9375rem; line-height: 1.75; color: var(--fg);
  white-space: pre-wrap; word-break: break-word;
}
.prompt .copy {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  font: inherit; font-size: 0.75rem; cursor: pointer;
}
.prompt .copy .ic { width: 14px; height: 14px; }
.prompt .copy:hover { color: var(--fg); border-color: var(--accent-line); }
.prompt .copy.done { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }

/* 步驟內的內容 */
ol.steps > li > .step-t { font-weight: 700; color: var(--fg); margin-bottom: .25em; }
ol.steps > li > .fig:first-of-type, ol.steps > li > .row { margin-top: .6em; }
ol.steps > li p { margin: .5em 0; }
ol.steps > li > :last-child { margin-bottom: 0; }

/* 收合段落 */
details.more { border: 1px solid var(--line); border-radius: 12px; margin: .8em 0; background: var(--surface); }
details.more > summary { cursor: pointer; padding: 10px 16px; font-weight: 500; color: var(--fg-2); list-style: none; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > div { padding: 0 12px 12px; }
details.more .prompt { margin: 0; }
details.qa > div > :first-child { margin-top: 0; }
details.qa > div > :last-child { margin-bottom: 0; }
details.qa > div p { margin: .5em 0; }

/* 清單列中的說明 */
.list-row .list-t b { display: block; font-weight: 500; }
.list-row .list-t small { display: block; color: var(--muted); font-size: 0.8125rem; line-height: 1.6; margin-top: 2px; }

.source { margin-top: 3em; font-size: 0.8125rem; color: var(--muted); }
.source a { color: var(--muted); }
.chip .ic.sm { width: 13px; height: 13px; }

/* 搜尋結果摘要 */
#results .snip { display: block; font-size: 0.8125rem; color: var(--fg-2); margin-top: 2px; line-height: 1.6; }
#results mark { background: var(--accent-soft); color: var(--accent-ink); border-radius: 3px; padding: 0 2px; }

/* 放大檢視 */
dialog.zoom { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 94vh; overflow: visible; }
dialog.zoom::backdrop { background: rgba(0, 0, 0, .85); }
dialog.zoom img { display: block; max-width: 96vw; max-height: 94vh; width: auto; height: auto; border-radius: 10px; cursor: zoom-out; }

/* ---------- 字體大小選單 ---------- */
.fs-pop {
  position: fixed; z-index: 45; top: calc(var(--top-h) - 4px); right: 12px;
  width: 248px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
  font-size: 16px; /* 選單本身不跟著放大，避免超出畫面 */
}
.fs-pop .fs-title { font-size: 13px; color: var(--muted); letter-spacing: .08em; margin: 0 0 10px; }
.fs-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fs-opts button {
  display: grid; place-items: center; gap: 2px;
  min-height: 72px; padding: 8px 4px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: none; color: var(--fg-2); font: inherit; cursor: pointer;
}
.fs-opts button b { font-weight: 700; line-height: 1.2; color: var(--fg); }
.fs-opts button small { font-size: 12px; color: var(--muted); }
.fs-opts button:hover { background: var(--hover); }
.fs-opts button[aria-pressed="true"] { border-color: var(--brand-ic); background: var(--accent-soft); }
.fs-opts button[aria-pressed="true"] small { color: var(--accent-ink); }
.fs-btn-txt { font: 600 15px/1 var(--sans); letter-spacing: -.02em; }
.fs-btn-txt small { font-size: 11px; }

/* 語言切換：桌機在頂部列，手機改放在目錄最下面 */

/* ---------- 手機 ---------- */
@media (hover: none) {
  .search-foot, kbd { display: none !important; }
}
@media (max-width: 900px) {
  .icon-btn { width: 42px; height: 42px; }
  .nav-row { min-height: 44px; }
  .nav-child { padding: 10px 8px; }
  .cat-toggle { width: 40px; height: 40px; }
}
@media (max-width: 620px) {
  /* 表格改成一列一張卡片，避免欄位被擠到一行兩三個字 */
  .tbl { overflow: visible; border: 0; background: none; }
  .tbl table, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr {
    margin: 0 0 10px; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--raised);
  }
  .tbl td { padding: 2px 0; border: 0; }
  .tbl td:first-child { font-weight: 700; color: var(--fg); padding-bottom: 6px; }
  .tbl td + td::before {
    content: attr(data-label); display: block;
    font-size: .8rem; color: var(--muted); line-height: 1.6; margin-top: 6px;
  }
  .tbl td[data-label=""]::before { display: none; }
  /* 只有圖片的並排維持兩欄，點圖可放大 */
  .row.media { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .row.media[style*="--n:1"] { grid-template-columns: minmax(0, 1fr); }
}

/* 「聯絡我們」頁的寫信表單（script.js 的 mailForm） */
.mail-box { margin-top: 0; }
.mail-box > p { color: var(--fg-2); }
.fb-done .mail-copy {
  display: block; width: 100%; box-sizing: border-box; margin-top: 10px; padding: 10px 12px;
  font: inherit; font-size: 0.875rem; line-height: 1.6; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; resize: vertical;
}
@media (max-width: 620px) { .card .thumb { aspect-ratio: 2 / 1; } }

/* ---------- 吉吉：小黑貓嚮導（script.js） ---------- */
.jiji-btn {
  position: fixed; right: 24px; bottom: 24px; z-index: 32;
  display: grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border: 2px solid var(--line-strong); border-radius: 50%; cursor: pointer;
  background: #f6efe2; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  transition: transform .15s, border-color .15s;
}
.jiji-btn:hover, .jiji-open .jiji-btn { border-color: var(--accent); transform: translateY(-2px); }
.jiji-btn .jiji-cat { width: 74%; height: 74%; }
.jiji {
  position: fixed; right: 24px; bottom: 88px; z-index: 33;
  width: min(360px, calc(100vw - 32px)); max-height: min(72vh, 580px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3); overflow: hidden;
}
.jiji[hidden] { display: none; }
/* 第一次來的問卷：畫面中間的視窗 */
.jiji-back { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); }
.jiji-back[hidden] { display: none; }
.jiji.center {
  z-index: 41; left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px)); max-height: min(86vh, 640px); border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); animation: jiji-pop .22s ease-out;
}
.jiji.center .jiji-head { padding: 16px 14px 14px 18px; }
.jiji.center .jiji-ava { width: 52px; height: 52px; }
.jiji.center .jiji-head b { font-size: 1.125rem; }
.jiji.center .jiji-body { padding: 18px; gap: 14px; font-size: 1rem; }
@keyframes jiji-pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%); } }
@media (prefers-reduced-motion: reduce) { .jiji.center { animation: none; } }
.jiji-modal .jiji-btn { z-index: 42; }
.jiji-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-bottom: 1px solid var(--line); }
.jiji-head > span:nth-child(2) { flex: 1; display: grid; line-height: 1.35; }
.jiji-head small { font-size: 0.75rem; color: var(--muted); }
.jiji-ava { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #f6efe2; }
.jiji-ava .jiji-cat { width: 78%; height: 78%; }
.jiji-body { padding: 14px; overflow-y: auto; display: grid; gap: 12px; font-size: 0.9375rem; }
.jiji-say { padding: 10px 12px; border-radius: 4px 14px 14px 14px; background: var(--accent-soft); color: var(--fg); line-height: 1.65; }
.jiji-say small { display: block; margin-top: 4px; font-size: 0.8125rem; color: var(--fg-2); }
.jiji-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.jiji-opts.col { display: grid; }
.jiji-opt {
  font: inherit; font-size: 0.875rem; text-align: left; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--fg);
}
.jiji-opt:hover { border-color: var(--accent-line); }
.jiji-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.jiji-other { display: grid; gap: 4px; font-size: 0.8125rem; color: var(--fg-2); }
.jiji-other input { font: inherit; font-size: 0.9375rem; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--fg); }
.jiji-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.jiji-sp { flex: 1; }
.jiji-main, .jiji-ghost { font: inherit; font-size: 0.875rem; padding: 7px 14px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.jiji-main { border: 0; background: var(--brand); color: #04140a; font-weight: 600; }
.jiji-ghost { border: 1px solid transparent; background: none; color: var(--fg-2); }
.jiji-ghost:hover { color: var(--fg); background: var(--hover); }
.jiji-prog { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.jiji-prog span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.jiji-links { display: grid; gap: 6px; }
.jiji-link {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--fg); text-decoration: none;
}
.jiji-link:hover { border-color: var(--accent-line); background: var(--hover); }
.jiji-link b { font-weight: 600; }
.jiji-link small { grid-column: 1; font-size: 0.8125rem; color: var(--muted); }
.jiji-link .chev { grid-row: 1 / span 2; grid-column: 2; color: var(--muted); }
@media print { .jiji, .jiji-btn { display: none !important; } }
