/* 字型全站使用 LINE Seed（emfont 載入，在 index.html 引入）：JP 優先，缺字由 TW 補上 */
:root {
  --paper: #FFFFFF;
  --surface: #F2F2F2;
  --ink: #111111;
  --mist: #6B6B6B;
  --accent: #000000;
  --line: rgba(0, 0, 0, .14);
  --title: "LINESeedJP", "LINESeedTW", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --display: "LINESeedJP", "LINESeedTW", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --sans: "LINESeedJP", "LINESeedTW", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --latin: "LINESeedJP", "LINESeedTW", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
  --max: 1120px;
  --read: 820px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { background: var(--paper); color-scheme: light; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.8 var(--sans);
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.skip { position: absolute; left: -999px; top: 8px; z-index: 30; background: var(--ink); color: var(--paper); padding: 6px 14px; }
.skip:focus { left: 8px; }
main { flex: 1; position: relative; z-index: 0; outline: none; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: .3em; transition: color .15s, text-decoration-color .15s; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }
.latin { font-family: var(--latin); font-weight: 300; letter-spacing: .32em; text-transform: uppercase; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: calc(var(--read) + var(--gutter) * 2); }

/* 導覽 */
.nav {
  position: sticky; top: 0; z-index: 5;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(1.5) blur(18px); backdrop-filter: saturate(1.5) blur(18px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  height: 56px; display: flex; align-items: center; gap: 28px;
}
.nav a { text-decoration: none; }
.brand { flex: none; display: flex; align-items: baseline; gap: 12px; font: 500 17px/1 var(--display); letter-spacing: .12em; }
.brand small { font: 300 10px/1 var(--latin); letter-spacing: .32em; text-transform: uppercase; color: var(--mist); }
#tabs { margin-left: auto; min-width: 0; display: flex; gap: clamp(18px, 2.6vw, 32px); white-space: nowrap; align-self: stretch; }
#tabs > a, .menu > button {
  flex: none; display: flex; align-items: center; font-size: 14px; letter-spacing: .1em; color: var(--mist);
  box-shadow: inset 0 -1px 0 transparent; transition: color .15s, box-shadow .15s;
}
#tabs > a:hover, .menu > button:hover, .menu.open > button { color: var(--ink); }
#tabs > a[aria-current], .menu > button.has-current { color: var(--ink); box-shadow: inset 0 -1px 0 var(--accent); }
#tabs > a:focus-visible, .menu > button:focus-visible { outline-offset: -3px; }
/* 下拉選單：自訂的選單群組，以及放不下時自動出現的「更多」 */
.menu { position: relative; flex: none; display: flex; }
.menu > button { font-family: inherit; background: none; border: 0; padding: 0; cursor: pointer; gap: 6px; }
.menu > button::after { content: ""; width: 6px; height: 6px; margin-top: -3px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); transition: transform .2s var(--ease); }
.menu.open > button::after { transform: translateY(3px) rotate(225deg); }
.menu-list {
  display: none; position: absolute; left: -14px; top: calc(100% + 6px); z-index: 6;
  min-width: 190px; max-width: min(320px, calc(100vw - 32px)); max-height: min(70vh, 480px); overflow-y: auto;
  padding: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .5); white-space: normal;
}
.menu:last-child .menu-list, .menu.more .menu-list { left: auto; right: -8px; }
.menu.open .menu-list { display: block; animation: fade .15s ease-out; }
.menu-list a { display: block; padding: 9px 14px; border-radius: 8px; font-size: 14px; letter-spacing: .06em; color: var(--mist); overflow-wrap: anywhere; }
.menu-list a.sub { padding-left: 26px; }
.menu-list a:hover { background: var(--surface); color: var(--ink); }
.menu-list a[aria-current] { color: var(--ink); font-weight: 500; }
.menu-label { padding: 10px 14px 4px; font-size: 12px; letter-spacing: .1em; color: var(--mist); }

/* 首頁 */
.hero {
  position: relative;
  min-height: min(76vh, 720px);
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(72px, 12vw, 150px) 0;
}
.hero-text { position: relative; z-index: 1; width: 100%; }
.hero .latin { display: block; font-size: clamp(11px, 1.2vw, 13px); color: var(--accent); margin-bottom: clamp(18px, 2.4vw, 30px); }
.hero h1 {
  margin: 0 0 0 -.04em;
  font: 300 clamp(52px, 11.5vw, 140px)/1.1 var(--title);
  letter-spacing: .06em;
  overflow-wrap: anywhere;
}
.hero h1 img { display: block; width: auto; height: auto; max-width: min(100%, 760px); max-height: 42vh; }
.hero-tag { margin: clamp(20px, 2.6vw, 34px) 0 0; max-width: 30em; font-size: clamp(16px, 1.5vw, 19px); color: var(--mist); }
.lede { padding-top: clamp(48px, 7vw, 96px); padding-bottom: clamp(40px, 6vw, 80px); }
.lede p { margin: 0 0 1.1em; max-width: 40em; font-size: 15px; line-height: 1.95; color: var(--mist); }
.lede.has-next { padding-bottom: 20px; }
.lg-wrap { padding-bottom: clamp(40px, 6vw, 80px); }
.lg-wrap.solo { padding-top: clamp(48px, 7vw, 96px); }
.linkgroups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 32px clamp(32px, 5vw, 64px); padding-top: 28px; border-top: 1px solid var(--line); }
.lg-wrap.solo .linkgroups { padding-top: 0; border-top: 0; }
.linkgroups h2 { margin: 0 0 8px; font: 500 13px/1.6 var(--display); letter-spacing: .12em; color: var(--ink); }
.linkgroups p { margin: 0 0 .7em; max-width: 40em; font-size: 14px; line-height: 1.9; color: var(--mist); }
.linkgroups .links { margin-top: 12px; }
.linkgroups > div > :last-child { margin-bottom: 0; }
.linkgroups a { text-decoration-color: var(--line); }
.links { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 28px; font-size: 14px; color: var(--mist); }
.links a:hover { color: var(--ink); }

.home-sec { padding-bottom: clamp(56px, 8vw, 110px); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 20px; }
.sec-head h2 { margin: 0; font: 500 22px/1.4 var(--display); letter-spacing: .1em; }
.sec-head a { font-size: 13px; color: var(--mist); letter-spacing: .08em; white-space: nowrap; }
.sec-head a:hover { color: var(--ink); }

.page-head { padding-top: clamp(48px, 7vw, 96px); padding-bottom: clamp(28px, 4vw, 48px); }
.page-head h1 { margin: 0; font: 300 clamp(36px, 5.6vw, 60px)/1.3 var(--title); letter-spacing: .08em; }
.page-head p { margin: .8em 0 0; max-width: 40em; color: var(--mist); }
.page-head h1 .tag {
  display: inline-block; vertical-align: middle; margin-left: 8px; padding: 2px 12px; border-radius: 99px;
  font: 400 12px/1.6 var(--sans); letter-spacing: .06em; color: var(--mist); background: var(--surface);
}
.page-head h1 .tag:first-of-type { margin-left: 16px; }
.page-head .desc { margin-top: 1.2em; }
.page-head .links { margin-top: 16px; }
.page-head .desc p { margin: 0 0 .9em; font-size: 14.5px; line-height: 1.9; }
.empty { margin: 0; padding: 32px 0 96px; color: var(--mist); }
.draft {
  display: inline-block; vertical-align: middle; margin-left: 10px; padding: 3px 8px; border-radius: 99px;
  font: 400 11px/1.3 var(--sans); letter-spacing: .1em; color: var(--paper); background: var(--accent);
}
.meta { font-size: 13px; color: var(--mist); letter-spacing: .06em; font-variant-numeric: tabular-nums; }

/* 畫廊 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 26px; }
.chips button {
  font: inherit; font-size: 13px; letter-spacing: .08em; color: var(--mist);
  background: none; border: 1px solid var(--line); border-radius: 99px; padding: 3px 16px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.chips button:hover { color: var(--ink); border-color: var(--mist); }
.chips button[aria-pressed="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
/* 文章標籤：方塊相連成一條，只有兩端圓角；排序像分頁籤一樣貼在列表上緣 */
.chips.seg { gap: 0; padding-bottom: 40px; }
.chips.seg button { position: relative; margin: 0 -1px -1px 0; border-radius: 0; padding: 6px 18px; }
.chips.seg button:hover, .chips.seg button[aria-pressed="true"] { z-index: 1; }
.chips.seg button:first-child { border-radius: 8px 0 0 8px; }
.chips.seg button:last-child { border-radius: 0 8px 8px 0; }
.listhead { display: flex; }
.listhead .sort { font: inherit; font-size: 12px; letter-spacing: .08em; color: var(--ink); background: none; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 5px 14px; cursor: pointer; transition: background .15s; }
.listhead .sort:hover { background: var(--surface); }

.grid { --rowh: 260px; display: flex; flex-wrap: wrap; gap: 12px; padding-bottom: clamp(56px, 8vw, 110px); }
.grid::after { content: ""; flex-grow: 1e4; }
.grid.few { --rowh: 220px; padding-bottom: 0; }
.cell {
  position: relative; display: block; overflow: hidden; background: var(--surface); border-radius: 6px;
  flex-grow: calc(var(--r) * 100); flex-basis: calc(var(--r) * var(--rowh));
  aspect-ratio: var(--r);
}
.cell img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.cell span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 10px;
  font-size: 13px; letter-spacing: .08em; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  opacity: 0; transition: opacity .25s;
}
.cell:focus-visible span { opacity: 1; }
@media (hover: hover) {
  .cell:hover img { transform: scale(1.03); }
  .cell:hover span { opacity: 1; }
}

/* 放大檢視維持深藍底，讓圖片比較清楚 */
#lightbox {
  --surface: #262626; --mist: #A8A8A8; --line: rgba(255, 255, 255, .24);
  position: fixed; inset: 0; z-index: 10; background: rgba(10, 10, 10, .96); color: #F2F2F2;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: clamp(16px, 3vw, 40px); gap: 18px;
  animation: fade .2s ease-out;
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; outline: none;   /* 蓋掉 dialog 預設的置中小視窗 */
}
#lightbox:not([open]) { display: none; }
@keyframes fade { from { opacity: 0; } }
.lb-img { min-height: 0; display: flex; align-items: center; justify-content: center; }
.lb-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lb-cap { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; max-width: var(--max); width: 100%; margin: 0 auto; }
.lb-cap h2 { margin: 0; font: 500 19px/1.5 var(--display); letter-spacing: .06em; }
.lb-cap p { margin: 4px 0 0; font-size: 14px; color: var(--mist); max-width: 46em; line-height: 1.7; }
.lb-ctl { display: flex; gap: 6px; flex: none; }
.lb-ctl a {
  width: 42px; height: 42px; display: grid; place-items: center; text-decoration: none;
  border: 1px solid var(--line); border-radius: 50%; font-size: 15px; transition: border-color .15s, background .15s;
}
.lb-ctl a:hover { border-color: var(--mist); background: var(--surface); }

/* 目錄分頁 */
.back.up { display: inline-block; margin-bottom: 14px; }
.toc { list-style: none; margin: 0 0 clamp(32px, 5vw, 56px); padding: 0; }
.toc li { border-top: 1px solid var(--line); }
.toc li:last-child { border-bottom: 1px solid var(--line); }
.toc a { display: grid; grid-template-columns: 3em minmax(0, 1fr); align-items: baseline; gap: 4px 12px; padding: clamp(16px, 2.2vw, 26px) 0; text-decoration: none; }
.toc .no { font: 300 13px/1 var(--latin); letter-spacing: .1em; color: var(--mist); }
.toc .name { font: 300 clamp(22px, 3vw, 34px)/1.35 var(--title); letter-spacing: .06em; transition: color .15s; }
.toc .sub { grid-column: 2; font-size: 14px; line-height: 1.6; color: var(--mist); }
@media (hover: hover) { .toc a:hover .name { color: var(--mist); } }

/* 角色區 */
.cast { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 22px 18px; padding-bottom: clamp(32px, 5vw, 56px); }
.cast button { width: 112px; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; text-align: center; }
.tile { position: relative; display: block; overflow: hidden; aspect-ratio: 1; border-radius: 14px; background: var(--surface); }
.tile img { position: absolute; max-width: none; }
.cname { display: block; margin: 9px -6px 0; font-size: 13px; line-height: 1.5; color: var(--mist); word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; transition: color .15s; }   /* 名字借用左右的空隙，長名字少換一行 */
@media (hover: hover) { .cast button:hover .cname { color: var(--ink); } }
#cast {
  border: 0; padding: 0; border-radius: 16px; background: var(--paper); color: var(--ink); overflow: hidden;
  width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  height: min(860px, calc(100vh - 32px));   /* 固定大小，切換差分時視窗不會跟著圖片變大變小 */
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6);
}
#cast[open] { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); animation: fade .2s ease-out; }
#cast.solo { width: min(560px, calc(100vw - 32px)); }
#cast.solo[open] { grid-template-columns: 1fr; }
#cast::backdrop { background: rgba(0, 0, 0, .55); }
#cast figure { margin: 0; min-height: 0; background: var(--surface); display: flex; align-items: center; justify-content: center; }
#cast figure img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cast-text { padding: clamp(24px, 4vw, 44px); padding-right: clamp(28px, 4vw, 52px); overflow-y: auto; max-height: calc(100vh - 32px); }
.cast-text h2 { margin: 0 0 .8em; font: 500 clamp(21px, 2.6vw, 27px)/1.4 var(--display); letter-spacing: .04em; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.cast-text h2:has(+ .aka) { margin-bottom: .15em; }
.cast-text .aka { margin: 0 0 1.4em; color: var(--mist); font-size: 14px; letter-spacing: .1em; }
.cast-text p { margin: 0 0 1em; font-size: 15px; line-height: 1.95; }
/* Markdown（角色設定） */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md .ln { display: block; text-indent: 2em; }   /* 角色介紹：每一行開頭空兩格 */
.md h3, .md h4, .md h5 { margin: 1.6em 0 .5em; font-weight: 500; line-height: 1.5; letter-spacing: .04em; color: var(--ink); }
.md h3 { font-size: 1.25em; }
.md h4 { font-size: 1.08em; color: var(--accent); }
.md h5 { font-size: 1em; color: var(--accent); }
.md ul, .md ol { margin: 0 0 1em; padding-left: 1.4em; }
.md li::marker { color: var(--mist); }
.md blockquote { margin: 0 0 1em; padding-left: 18px; border-left: 2px solid var(--accent); color: var(--mist); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 1.6em 0; }
.md a { text-decoration-color: var(--accent); }
.md a:hover { color: var(--accent); }
.md table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: .95em; }
.md th, .md td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { font-weight: 500; }
.md td:first-child { color: var(--mist); white-space: nowrap; }
#cast .close {
  position: absolute; top: 10px; right: 10px; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .9); color: var(--ink); font-size: 14px; cursor: pointer;
}
#cast .close:hover { border-color: var(--mist); }

/* 文章列表 */
.posts { list-style: none; margin: 0; padding: 0 0 clamp(56px, 8vw, 110px); }
.posts.few { padding-bottom: 0; }
.posts li { border-top: 1px solid var(--line); }
.posts li:last-child { border-bottom: 1px solid var(--line); }
.posts a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 26px 0; text-decoration: none; }
.posts h3 { margin: 0; font: 400 clamp(18px, 1.9vw, 22px)/1.5 var(--title); letter-spacing: .03em; transition: color .15s; }
.posts .meta { margin-bottom: 6px; }
.posts .sub { margin-top: 2px; font-size: 14px; letter-spacing: .03em; color: var(--mist); }
.posts p { margin: 6px 0 0; max-width: 40em; font-size: 15px; color: var(--mist); line-height: 1.75; }
.posts .thumb { width: 168px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; background: var(--surface); display: block; }
.pages { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 32px; }
.pages button { min-width: 36px; height: 36px; padding: 0 8px; font: inherit; font-size: 13px; color: var(--mist); background: none; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.pages button:hover { color: var(--ink); border-color: var(--mist); }
.pages button[aria-current] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.posts:has(+ .pages) { padding-bottom: 0; }
.posts + .pages { padding-bottom: clamp(56px, 8vw, 110px); }
.tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 12px; color: var(--mist); background: var(--surface); border-radius: 99px; padding: 1px 11px; }
@media (hover: hover) { .posts a:hover h3 { color: var(--mist); } }

/* 文章 */
.article { padding-top: clamp(40px, 6vw, 80px); padding-bottom: clamp(64px, 9vw, 120px); }
.back { font-size: 13px; color: var(--mist); letter-spacing: .08em; text-decoration: none; }
.back:hover { color: var(--ink); }
.article h1 { margin: 1em 0 .4em; font: 300 clamp(28px, 4.4vw, 44px)/1.45 var(--title); letter-spacing: .03em; }
.article .cover { display: block; width: 100%; height: auto; margin: 32px 0 0; border-radius: 6px; background: var(--surface); }
.prose { margin-top: 40px; font-size: clamp(16px, 1.4vw, 17.5px); line-height: 2; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.5em; }
.prose.indent > p { text-indent: 2em; }
.prose h2 { margin: 2.2em 0 .7em; font: 500 1.4em/1.5 var(--display); letter-spacing: .03em; }
.prose h3 { margin: 2em 0 .6em; font: 500 1em/1.6 var(--sans); letter-spacing: .08em; color: var(--accent); }
.prose blockquote { margin: 1.8em 0; padding: 0 0 0 22px; border-left: 2px solid var(--accent); color: var(--mist); }
.prose ul, .prose ol { margin: 0 0 1.5em; padding-left: 1.5em; }
.prose li::marker { color: var(--mist); }
.prose img { display: block; height: auto; margin: 2.2em auto; border-radius: 4px; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 3em 30%; }
.prose a { text-decoration-color: var(--accent); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.5em; font-size: .95em; }
.prose th, .prose td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 500; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: clamp(48px, 7vw, 80px); padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: block; text-decoration: none; min-width: 0; }
.pager .next { text-align: right; }
.pager small { display: block; font-size: 13px; color: var(--mist); letter-spacing: .08em; }
.pager span { display: block; margin-top: 6px; font: 300 16px/1.6 var(--title); letter-spacing: .03em; overflow-wrap: anywhere; transition: color .15s; }
.pager a:hover span { color: var(--mist); }

/* 頁尾 */
.foot {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: var(--max); width: 100%; margin: 0 auto; padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--mist); letter-spacing: .08em;
}
.foot .latin { font-size: 10px; }

@media (max-width: 720px) {
  .brand small { display: none; }
  .nav-in { gap: 20px; }
  .grid { --rowh: 150px; gap: 8px; }
  .grid.few { --rowh: 130px; }
  .posts a { gap: 16px; padding: 22px 0; align-items: start; }
  .posts .thumb { width: 92px; aspect-ratio: 1; margin-top: 6px; }
  .lb-cap { flex-direction: column; align-items: flex-start; gap: 12px; }
  .cast { gap: 18px 14px; }
  .cast button { width: 88px; }
  #cast[open] { grid-template-columns: 1fr; overflow-y: auto; }
  #cast:not(.solo) figure { height: 58vh; }
  .cast-text { max-height: none; overflow: visible; }
}
/* 回到最上方 */
#toTop {
  position: fixed; right: clamp(16px, 2.2vw, 28px); bottom: clamp(16px, 2.2vw, 28px); z-index: 7; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); font: inherit; font-size: 17px; line-height: 1; cursor: pointer;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s, border-color .15s;
}
#toTop.on { opacity: 1; visibility: visible; }
#toTop:hover { border-color: var(--mist); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 文章最後：回到這篇文章所屬的總覽頁 */
.back-list { display: table; margin: clamp(40px, 6vw, 64px) auto 0; padding: 10px 28px; border: 1px solid var(--line); font-size: 14px; letter-spacing: .1em; text-decoration: none; color: inherit; transition: border-color .15s; }
.back-list:hover { border-color: var(--ink); }

/* 暴雷：||文字|| 蓋成色塊，點一下才顯示；>! 開頭的整段收在「點一下展開」裡 */
.spoiler { padding: 0 .2em; border-radius: 3px; background: var(--ink); color: transparent; cursor: pointer; user-select: none; transition: background .2s, color .2s; }
.spoiler:not(.shown) * { visibility: hidden; }
.spoiler.shown { background: color-mix(in srgb, var(--ink) 8%, transparent); color: inherit; cursor: auto; user-select: auto; }
.spoil { margin: 0 0 1em; padding: 6px 14px; border: 1px dashed var(--line); }
.spoil > summary { cursor: pointer; color: var(--mist); font-size: .92em; }
.spoil[open] > summary { margin-bottom: .6em; }

/* 讀音：<ruby>文字<rt>讀音</rt></ruby>，讀音小字平均分散在文字上方 */
ruby { ruby-align: space-around; }
rt { font-size: .5em; letter-spacing: .1em; color: var(--mist); }

/* 表格：每一欄平分寬度，欄數相同的表格上下對齊，不會因為內容長短錯開；太長的字會在格子裡換行 */
.prose table, .md table { table-layout: fixed; }
.prose th, .prose td, .md th, .md td { overflow-wrap: anywhere; }
.md td:first-child { white-space: normal; }

/* 章節列：同一個分頁（影集、作品）的全部文章。寬螢幕固定在文章左邊的留白；窄的時候收成左下角的按鈕，點了從左邊滑出 */
.chapters {
  position: fixed; top: 57px; bottom: 0; left: 0; z-index: 8; width: min(300px, 84vw); overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 20px 32px; background: var(--paper); border-right: 1px solid var(--line); box-shadow: 12px 0 40px -24px rgba(0, 0, 0, .3);
  transform: translateX(-100%); visibility: hidden; transition: transform .3s var(--chap-ease, ease), visibility .3s;
}
.chapters.open { transform: none; visibility: visible; }
.chapters ol { list-style: none; margin: 0; padding: 0; }
.chapters a { display: block; padding: 7px 12px; border-left: 1px solid var(--line); font-size: 14px; line-height: 1.6; color: var(--mist); text-decoration: none; overflow-wrap: anywhere; transition: color .15s, border-color .15s; }
.chapters a small { display: block; font-size: 11px; letter-spacing: .12em; }
.chapters a:hover { color: var(--ink); }
.chapters a[aria-current] { color: var(--ink); border-left: 2px solid var(--accent); padding-left: 11px; font-weight: 700; }
.chap-btn {
  position: fixed; left: 16px; bottom: 16px; z-index: 7; height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; letter-spacing: .1em; cursor: pointer; box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .3);
}
.chap-btn[aria-expanded="true"] { border-color: var(--accent); }
/* 左邊的留白放得下時，章節列直接固定在那裡 */
@media (min-width: 1300px) {
  .article .chapters { width: calc((100vw - var(--read)) / 2 - 64px); max-width: 280px; padding: 40px 0 40px 32px; background: none; border: 0; box-shadow: none; transform: none; visibility: visible; transition: none; }
  .article .chap-btn { display: none; }
}
@media (prefers-reduced-motion: reduce) { .chapters { transition: none; } }
