/* Layout: centered, generous whitespace, large type, few borders. Palette and surfaces: see :root. */
@font-face {
  font-family: "Iansui";
  /* served by kautian-mirror on the same origin; elsewhere (local preview) the system font is used */
  src: local("Iansui Regular"), local("Iansui-Regular"), url("/kautian-mirror/fonts/iansui_regular.woff2") format("woff2");
  font-display: swap;
  /* CJK only: the font's combining tone marks misplace, so Tâi-lô stays in the system font */
  unicode-range: U+3000-303F, U+3100-312F, U+31A0-31BF, U+3400-4DBF, U+4E00-9FFF,
    U+F900-FAFF, U+FF00-FFEF, U+20000-2FFFF;
}

/* settings-panel typefaces, also served by kautian-mirror; a browser fetches one only once it is in use */
@font-face {
  font-family: "jf-openhuninn";
  src: local("jf-openhuninn-2.1"), url("/kautian-mirror/fonts/jf-openhuninn-2.1.ttf") format("truetype");
  font-display: swap;
  unicode-range: U+3000-303F, U+3100-312F, U+31A0-31BF, U+3400-4DBF, U+4E00-9FFF,
    U+F900-FAFF, U+FF00-FFEF, U+20000-2FFFF;
}
@font-face {
  font-family: "GenYoMin2 TW";
  src: local("GenYoMin2 TW R"), local("GenYoMin2TW-R"), url("/kautian-mirror/fonts/genyomin2tw_r.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+3000-303F, U+3100-312F, U+31A0-31BF, U+3400-4DBF, U+4E00-9FFF,
    U+F900-FAFF, U+FF00-FFEF, U+20000-2FFFF;
}
@font-face {
  font-family: "GenYoGothic2 TW";
  src: local("GenYoGothic2 TW R"), local("GenYoGothic2TW-R"), url("/kautian-mirror/fonts/genyogothic2tw_r.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+3000-303F, U+3100-312F, U+31A0-31BF, U+3400-4DBF, U+4E00-9FFF,
    U+F900-FAFF, U+FF00-FFEF, U+20000-2FFFF;
}

:root {
  color-scheme: light dark;
  /* after culturedcode.com/things: a white page with a soft top wash, grey-blue text, Things' own blues
     (links #2576eb / dark #649fff; filled buttons #4f91fb, hover #649fff, pressed #3c84f3), white surfaces lifted by layered
     shadows instead of borders, a yellow highlighter and blue hairline-ruled list headings; the
     dark mode is a graphite one */
  --bg: light-dark(#ffffff, #1b1c1f);
  /* the top of the page, fading into --bg (body background) */
  --wash: light-dark(#fcfdfe, #232428);
  /* white like the page, BBC style, parted from it by a gridline (--chart-grid) on the wide screen */
  --sidebar-bg: light-dark(#ffffff, #222326);
  --card: light-dark(#ffffff, #26272b);
  --text: light-dark(#44474b, #e2e2e4);
  --heading: light-dark(#222222, #f2f2f3);
  --secondary: light-dark(#55606e, #8f9096);
  --border: light-dark(#d9dce0, #3a3b40);
  --field: light-dark(#ffffff, #2c2d31);
  --hairline: light-dark(#e3e6ea, #34353a);
  --hover: light-dark(#f3f5f7, #303136);
  --bubble-shadow: light-dark(rgba(0, 28, 70, 0.09), rgba(0, 0, 0, 0.45));
  /* from the BBC News chart palette (bbc/bbplot): its blue, the same in both themes (3.3:1 on the
     dark card, enough for a bar), which every tag bubble tints with (strengths below) and the charts
     fill with, and the form tips tint with */
  --hue-blue: #1380a1;
  /* the charts' lines, after bbplot: grey gridlines (#cbcbcb), a dark baseline at zero (#333333),
     and the light grey (#dddddd) for bars that are context, not the point */
  --chart-grid: light-dark(#cbcbcb, #45464c);
  --chart-baseline: light-dark(#333333, #c8c9cc);
  --chart-context: light-dark(#dddddd, #4a4b50);
  --tint: 18%;
  --tint-hover: 28%;
  --tint-word: 34%;
  --tint-word-hover: 52%;
  --surface-shadow: 0 1px 2px light-dark(rgba(0, 28, 70, 0.07), rgba(0, 0, 0, 0.4)), 0 2px 12px light-dark(rgba(0, 28, 70, 0.07), rgba(0, 0, 0, 0.25));
  --surface-shadow-hover: 0 2px 4px light-dark(rgba(0, 28, 70, 0.09), rgba(0, 0, 0, 0.45)), 0 8px 28px light-dark(rgba(0, 28, 70, 0.11), rgba(0, 0, 0, 0.35));
  --menu-shadow: 0 2px 4px light-dark(rgba(0, 28, 70, 0.08), rgba(0, 0, 0, 0.4)), 0 12px 34px light-dark(rgba(0, 28, 70, 0.14), rgba(0, 0, 0, 0.5));
  --accent: light-dark(#2576eb, #649fff);
  --ring: light-dark(rgba(92, 156, 245, 0.2), rgba(100, 159, 255, 0.3));
  --highlight: light-dark(rgba(255, 214, 3, 0.38), rgba(255, 214, 3, 0.22));
  --danger: light-dark(#c4262e, #ff7b7b);
  --system-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica,
    "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  --font: var(--system-font);
  --measure: 980px;
  /* the announcement bar: a dark slate in both themes, a step lighter on the dark page */
  --announce-bg: light-dark(#2b3240, #323a4a);
  --announce-height: 9rem;
  /* the homepage's wider column, for the bubble map */
  --measure-wide: 1400px;
  --sidebar-width: 18.75rem;
  /* the collapsed sidebar's » strip on wide screens */
  --sidebar-strip: 30px;
  /* corner radii: boxes (cards, text inputs, popovers), rows inside a box (box radius minus its 6px
     padding, so the corners stay concentric), everything tapped (buttons, choice pills, icon
     buttons: rounded rectangles after culturedcode.com/things), and switches (round) */
  --radius: 12px;
  --radius-inner: 6px;
  --radius-control: 7px;
  --radius-round: 999px;
  /* buttons after culturedcode.com/things: a soft fill (choice pills), the accent fill (the main
     action, a picked pill), and ghost buttons with no fill until hovered; each one lightens on
     hover and darkens and shrinks a little while pressed */
  --button-soft: light-dark(#e6e9ed, #313237);
  --button-soft-hover: light-dark(#dde1e6, #3a3b41);
  --button-soft-active: light-dark(#d3d8de, #45464c);
  --button-soft-text: light-dark(rgba(0, 8, 19, 0.74), rgba(255, 255, 255, 0.82));
  --button-strong: #4f91fb;
  --button-strong-hover: #649fff;
  --button-strong-active: #3c84f3;
  --ghost-hover: light-dark(rgba(4, 15, 26, 0.05), rgba(255, 255, 255, 0.08));
  --ghost-active: light-dark(rgba(4, 15, 26, 0.1), rgba(255, 255, 255, 0.14));
  --button-lift: 0 2px 4px rgba(0, 0, 0, 0.05);
  --button-press: scale(0.98);
  /* motion: every animation time comes from these (slowed 2026-11-26 to read more naturally,
     within Apple / Material ranges): feedback for hover and press, ui for fades and small moves,
     panel for the sidebar, reveal for a section or title coming in, grow for chart bars */
  --duration-feedback: 0.22s;
  --duration-ui: 0.32s;
  --duration-panel: 0.42s;
  --duration-reveal: 0.9s;
  --duration-grow: 1.1s;
  --ease-emphasized: cubic-bezier(0.2, 0.7, 0.2, 1);
  --button-transition: background var(--duration-feedback) ease-out, color var(--duration-feedback) ease-out, box-shadow var(--duration-feedback) ease-out, transform var(--duration-feedback) ease-out;
}

/* --- display settings (site/settings.js sets these <html> attributes) --- */
/* follows the system theme unless 外觀 pins one ("auto" pins none) */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
/* light-dark() takes colours only, so the bubble tints follow the theme here: dark when 外觀 says so,
   or when it follows a dark system */
:root[data-theme="dark"] { --tint: 30%; --tint-hover: 42%; --tint-word: 38%; --tint-word-hover: 55%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --tint: 30%; --tint-hover: 42%; --tint-word: 38%; --tint-word-hover: 55%; }
}
:root[data-font="iansui"] { --font: "Iansui", var(--system-font); }
:root[data-font="openhuninn"] { --font: "jf-openhuninn", var(--system-font); }
:root[data-font="genyomin"] { --font: "GenYoMin2 TW", var(--system-font); }
:root[data-font="genyogothic"] { --font: "GenYoGothic2 TW", var(--system-font); }
/* off by default: shown only once the reader turns 白話字 / 方音符號 on (or kautian-mirror stored "on") */
:root:not([data-poj="on"]) .poj, :root:not([data-tps="on"]) .tps { display: none; }
/* 台羅 is on unless turned off; off, the bubbles' Hanji move down to the centre their Tâi-lô shared
   (site/tag-map.js sets them 0.3em / 0.32em above it) */
:root[data-tl="off"] :is(.tl, .tag-tl, .word-tl) { display: none; }
:root[data-tl="off"] .tag-hanji { transform: translateY(0.3em); }
:root[data-tl="off"] .word-hanji { transform: translateY(0.32em); }

* { box-sizing: border-box; }
/* author display rules must not undo the hidden attribute */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* a light wash at the top fading into the page grey; scrolls with the page, takes no space */
  background: linear-gradient(var(--wash), var(--bg) 36rem) no-repeat, var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* a filled mark (the GitHub logo) instead of a line icon */
.icon.icon-brand { fill: currentColor; stroke: none; }
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }


/* top-aligned, not vertically centered: content arriving below (cards, form errors) must not move
   the title */
main { flex: 1; width: 100%; max-width: calc(var(--measure) + 3rem); margin: 0 auto; padding: 3rem 1.5rem 3rem; }

/* --- page head --- */
.hero { padding: 0 0 2.5rem; text-align: center; }
.hero h1 { margin: 0; color: var(--heading); font-size: 3.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.hero h1:focus { outline: none; }
/* a subpage's 「‹ 轉去頭頁」 (page.js backButton) takes a fixed row above the title; the homepage, which has
   none, leaves the same row empty, so every page's title sits at the same height */
.back-link { display: inline-flex; align-items: center; gap: 0.125rem; height: 1.75rem; margin: 0 0 1rem; padding: 0 0.375rem 0 0.125rem; border: 0; border-radius: var(--radius-inner); background: none; color: var(--accent); font: inherit; font-size: 1.0625rem; cursor: pointer; transition: var(--button-transition); }
.back-link:hover { background: var(--ghost-hover); text-decoration: none; }
.back-link:active { transform: var(--button-press); }
.back-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.back-link .icon { font-size: 1.125rem; }
main > .hero:first-child { margin-top: 2.75rem; }
.hero p { max-width: 30rem; margin: 1rem auto 0; color: var(--secondary); font-size: 1.375rem; line-height: 1.45; }

/* --- existing words: popover under the active word, floating over the form --- */
.matches { position: absolute; top: calc(100% + 8px); left: 0; right: calc(36px + 0.75rem); z-index: 10; max-height: min(420px, 60vh); overflow-y: auto; padding: 0.375rem; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--card); box-shadow: var(--menu-shadow); }
.results { list-style: none; margin: 0; padding: 0; }
.results li { position: relative; padding: 0.5rem 0.75rem; border-radius: var(--radius-inner); transition: background var(--duration-feedback); }
/* note-list rows: hairlines between, hidden next to the hovered row */
.results li + li::before { content: ""; position: absolute; top: 0; left: 0.75rem; right: 0.75rem; height: 1px; background: var(--hairline); }
/* the row under the mouse, and the row picked with the arrow keys (.active, menuKeys) */
.results li:hover::before, .results li:hover + li::before, .results li.active::before, .results li.active + li::before { opacity: 0; }
.results li:hover, .results li.active { background: var(--hover); }
.result-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
/* a search result row is a link to the word's cards; it fills the row and keeps the row's colours */
.result-link { display: block; margin: -0.5rem -0.75rem; padding: 0.5rem 0.75rem; color: inherit; }
.result-link:hover { text-decoration: none; }
.result-hanji { overflow-wrap: anywhere; }
/* a tag row of the search box: #label in the words' size and colour */
.result-hanji.tag { color: inherit; font-size: inherit; }
.result-tl, .result-head .poj, .result-head .tps { color: var(--secondary); font-size: 0.9375rem; overflow-wrap: anywhere; }
/* the exact match is marked as with a highlighter pen */
.exact .result-hanji { padding: 0 0.125em; border-radius: 3px; background: linear-gradient(transparent 45%, var(--highlight) 45%); color: var(--heading); font-weight: 600; }
/* --- the search box (the 揣詞 page, search-box.js): icon, input and the "/" hint in .search-field, the
   menu under the whole box --- */
.search { position: relative; }
.search-field { position: relative; }
.search-field > .icon { position: absolute; left: 0.75rem; top: 50%; font-size: 1rem; color: var(--secondary); transform: translateY(-50%); pointer-events: none; }
.search input::-webkit-search-cancel-button { display: none; }
/* the "/" shortcut (app.js): a hint over the empty box, gone once something is typed; touch screens
   have no key to press, so they never show it */
.search-hint { position: absolute; left: 2.25rem; top: 50%; transform: translateY(-50%); color: var(--secondary); font-size: 0.875rem; pointer-events: none; }
.search-hint kbd { display: inline-block; min-width: 1.25rem; padding: 0 0.3rem; border: 1px solid var(--border); border-radius: 5px; font: 0.8125rem/1.4 var(--system-font); text-align: center; }
.search input:not(:placeholder-shown) ~ .search-hint { display: none; }
@media not ((hover: hover) and (pointer: fine)) {
  .search-hint { display: none; }
}

/* #tag links (the bubble map's fallback, a card's foot): wrap onto more lines rather than scroll
   sideways */
.tags { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
/* tags read as plain #name text, no box; a card's byline joins names by 、 */
.tag { color: var(--secondary); font-size: 0.9375rem; transition: color var(--duration-feedback); }
.tag::before { content: "#"; color: var(--accent); opacity: 0.75; }
.tag:hover, .person:hover { color: var(--accent); text-decoration: none; }
.tag:focus-visible, .person:focus-visible { outline: none; border-radius: var(--radius-inner); box-shadow: 0 0 0 3px var(--ring); }
.person { color: var(--text); transition: color var(--duration-feedback); }
/* read aloud, never drawn */
.unseen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; white-space: nowrap; }

/* --- tag bubbles (homepage, site/tag-map.js): a box of fixed proportions the map draws into, so
   nothing below moves when it arrives or zooms. Every tag the BBC blue (--hue-blue), a soft tint on a
   white circle on the card shadow, its words a deeper tint, the name dark; hover
   deepens the tint and the shadow. Zoomed in, the other tags dim, the name gives way to the words,
   and the bar under the box (its height kept while empty) offers 全部標籤 --- */
/* the homepage's main view: the map fills what the window leaves under the title (svh, so a phone's
   address bar showing or hiding never redraws it), in a column wider than the other pages' */
.tag-map { height: clamp(26rem, calc(100svh - 15.5rem - var(--announce-height)), 58rem); }
main[data-page="home"] { max-width: calc(var(--measure-wide) + 3rem); }
main[data-page="home"] .hero { padding-bottom: 1rem; animation: rise-in 0.7s var(--ease-emphasized) both; }
/* the homepage's title and lead fade up as the page opens (the bubbles enter in site/tag-map.js);
   transform and opacity only, so nothing around them moves */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
}
/* the zoom moves the whole <svg> by a CSS transform (site/tag-map.js), so the box clips it */
.tag-map { overflow: hidden; }
.tag-map-svg { transform-origin: 0 0; }
/* a moving view scales one compositor layer instead of repainting every frame (site/tag-map.js) */
.tag-map-svg.moving { will-change: transform; }
/* while it moves, any fade would repaint that whole layer every frame: words, names and dimming
   change at once instead, and fade only once the view rests */
.tag-map-svg.moving :is(.tag-bubble, .tag-name, .word-bubble.shown text) { transition: none; }
/* the map can be dragged with the mouse (site/tag-map.js): the box clips, the drawing itself does
   not, so what a drag brings in is already there */
.tag-map-svg { cursor: grab; }
.tag-map-svg.panning { cursor: grabbing; }
.tag-map-svg { display: block; width: 100%; height: 100%; overflow: visible; user-select: none; -webkit-user-select: none; }
/* the tags are one series, so every bubble takes the one blue, BBC style */
.tag-bubble { --hue: var(--hue-blue); }
.tag-circle { fill: color-mix(in srgb, var(--hue) var(--tint), var(--card)); cursor: pointer; transition: fill var(--duration-ui); }
.tag-bubble:hover .tag-circle { fill: color-mix(in srgb, var(--hue) var(--tint-hover), var(--card)); }
/* the card shadow, as a soft radial gradient under each circle (site/tag-map.js): a CSS
   drop-shadow filter re-rasterised on every frame the bubbles move halved the frame rate */
.tag-shadow { opacity: 0.75; pointer-events: none; transition: opacity var(--duration-ui); }
.tag-bubble:hover .tag-shadow { opacity: 1; }
.bubble-shadow-solid { stop-color: var(--bubble-shadow); }
.bubble-shadow-clear { stop-color: var(--bubble-shadow); stop-opacity: 0; }
.tag-circle:focus { outline: none; }
.tag-circle:focus-visible { stroke: var(--accent); stroke-width: 3; }
.tag-bubble { transition: opacity var(--duration-ui) ease-out; }
/* while a tag is open, the closed ones dim */
.tag-map-svg.has-open .tag-bubble:not(.open) { opacity: 0.35; }
.tag-map-svg text { text-anchor: middle; dominant-baseline: central; pointer-events: none; }
/* the name (and its Tâi-lô, lighter) over the word haze; the halo takes the circle's own tint, so it
   reads as the circle, not a white box */
.tag-name { transition: opacity var(--duration-ui); }
.tag-name text { paint-order: stroke; stroke: color-mix(in srgb, var(--hue) var(--tint), var(--card)); stroke-width: 4px; stroke-linejoin: round; transition: stroke var(--duration-ui); }
.tag-hanji { fill: var(--heading); font-weight: 600; }
.tag-tl { fill: var(--secondary); font-family: var(--system-font); }
.tag-bubble:hover .tag-name text { stroke: color-mix(in srgb, var(--hue) var(--tint-hover), var(--card)); }
/* an open tag's words replace its name */
.tag-bubble.open .tag-name { opacity: 0; }
/* the words: dots (a tint) until large enough to read, then links; they take clicks in an open tag */
.tag-words { pointer-events: none; }
.tag-bubble.open .tag-words { pointer-events: auto; }
.word-dot { fill: color-mix(in srgb, var(--hue) var(--tint-word), var(--card)); transition: fill var(--duration-feedback); }
/* out of the layout (display: none, not just transparent) until shown (site/tag-map.js
   detailControls), so only the words in view are laid out; a shown word fades and swells in */
.word-bubble text { display: none; transform-box: fill-box; transform-origin: center; }
.word-hanji { fill: var(--heading); }
.word-tl { fill: var(--secondary); font-family: var(--system-font); }
.word-bubble.shown text { display: inline; opacity: 1; transform: none; transition: opacity var(--duration-ui) ease-out, transform var(--duration-ui) var(--ease-emphasized); }
@starting-style {
  .word-bubble.shown text { opacity: 0; transform: scale(0.6); }
}
@media (prefers-reduced-motion: reduce) {
  .word-bubble.shown text { transition: none; }
}
.word-bubble:hover .word-dot, .word-bubble:focus-visible .word-dot { fill: color-mix(in srgb, var(--hue) var(--tint-word-hover), var(--card)); }
/* a word is marked by its bubble, not the site's link underline */
.word-bubble:hover { text-decoration: none; }
.word-bubble:focus { outline: none; }
.word-bubble:focus-visible .word-dot { stroke: var(--accent); stroke-width: 1.5; }
.tag-map-bar { display: flex; align-items: center; justify-content: space-between; min-height: 2.5rem; margin-top: 0.5rem; }
.tag-map-bar[data-empty="true"] > * { visibility: hidden; }
.tag-map-back { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.5rem; border: 0; border-radius: var(--radius-control); background: none; color: var(--accent); font: inherit; font-size: 0.9375rem; cursor: pointer; transition: var(--button-transition); }
.tag-map-back { margin-left: -0.5rem; }
.tag-map-back:hover { background: var(--ghost-hover); text-decoration: none; }
.tag-map-back:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.tag-map-back .icon { font-size: 1rem; }
/* the zoomed tag's page, at the bar's other end */
.tag-map-all { margin-right: -0.5rem; padding: 0.25rem 0.5rem; border-radius: var(--radius-control); font-size: 0.9375rem; transition: var(--button-transition); }
.tag-map-all:hover { background: var(--ghost-hover); text-decoration: none; }
.tag-map-all:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
/* --- the homepage's statistics (site/story.js), a scrolling story under the bubble map: each section
   a large centred title over one chart. A section rises in when it
   scrolls into view; its bars grow from the left (scaleX: compositor only, nothing reflows), its
   columns from the floor, one after another --- */
.story { max-width: var(--measure); margin: 4rem auto 0; }
.story-section { padding: 3.5rem 0; border-top: 1px solid var(--hairline); opacity: 0; transform: translateY(24px); transition: opacity var(--duration-reveal) ease-out, transform var(--duration-reveal) ease-out; }
.story-section.is-shown { opacity: 1; transform: none; }
.story-title { margin: 0 0 2.5rem; color: var(--heading); font-size: 2.25rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; text-align: center; }
/* big numbers */
.story-numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin: 0; }
/* centred under the centred title */
.story-number { display: flex; flex-direction: column-reverse; align-items: center; gap: 0.25rem; text-align: center; }
.story-number dd { margin: 0; color: var(--heading); font-size: 3rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.story-number dt { color: var(--secondary); font-size: 0.9375rem; }
/* ranked bars: label, track, count */
/* rows touch (no gap), so each track's gridlines join the next row's into one unbroken line */
.story-bars { display: grid; margin: 0; padding: 0; list-style: none; }
.story-bar { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 4.5rem; align-items: center; gap: 1rem; min-height: 2rem; font-size: 0.9375rem; }
.story-bar-label { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
a.story-bar-label:hover, .story-bar-label a:hover { color: var(--accent); text-decoration: none; }
.story-bar-label a { color: var(--text); }
/* the track spans the row's full height: a vertical gridline every quarter, the baseline on its left;
   the bar itself square-ended, BBC style */
.story-bar-track { display: flex; align-items: center; align-self: stretch; border-left: 2px solid var(--chart-baseline); background: linear-gradient(to right, transparent calc(100% - 1px), var(--chart-grid) calc(100% - 1px)) 0 0 / 25% 100%; }
.story-bar-fill { display: block; width: 100%; height: 1rem; background: var(--bar); transform: scaleX(0); transform-origin: left; transition: transform var(--duration-grow) var(--ease-emphasized) calc(var(--i) * 35ms), opacity var(--duration-feedback); }
.is-shown .story-bar-fill { transform: scaleX(var(--share)); }
.story-bar-count { color: var(--secondary); text-align: right; font-variant-numeric: tabular-nums; }
.story-pairs .story-bar { grid-template-columns: 12rem minmax(0, 1fr) 4.5rem; }
/* the word-length columns */
.story-columns { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); align-items: end; height: 16rem; margin: 0; padding: 0; list-style: none; }
.story-column { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0.375rem; height: 100%; text-align: center; font-size: 0.875rem; }
.story-column-count { color: var(--secondary); font-variant-numeric: tabular-nums; }
/* columns touch like a histogram's, a white seam between (inset 1px); gridlines every quarter, the
   baseline under them */
.story-column-track { position: relative; border-bottom: 2px solid var(--chart-baseline); background: linear-gradient(to bottom, var(--chart-grid) 1px, transparent 1px) 0 0 / 100% 25%; }
.story-column-fill { position: absolute; inset: 0 1px; background: var(--bar); transform: scaleY(0); transform-origin: bottom; transition: transform var(--duration-grow) var(--ease-emphasized) calc(var(--i) * 60ms), opacity var(--duration-feedback); }
.is-shown .story-column-fill { transform: scaleY(var(--share)); }
.story-column-label { color: var(--text); white-space: nowrap; }
/* the contributors' pictures (GitHub or the grey default): round, centred rows, each fading up in turn */
.story-faces { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.story-faces > li { opacity: 0; transform: translateY(8px); transition: opacity var(--duration-ui) ease-out calc(var(--i) * 40ms), transform var(--duration-ui) ease-out calc(var(--i) * 40ms); }
.is-shown .story-faces > li { opacity: 1; transform: none; }
.story-face { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; width: 7rem; color: var(--text); font-size: 0.875rem; }
.story-face img, .story-face-default { width: 64px; height: 64px; border-radius: 50%; background: var(--chart-context); box-shadow: var(--surface-shadow); transition: transform var(--duration-feedback); }
.story-face:hover { color: var(--accent); text-decoration: none; }
.story-face-default { fill: var(--secondary); }
.story-face-default > * { opacity: 0.55; }
.story-face:hover img, .story-face:hover .story-face-default { transform: scale(1.06); }
.story-face:focus-visible { outline: none; }
.story-face:focus-visible img, .story-face:focus-visible .story-face-default { box-shadow: 0 0 0 3px var(--ring); }
.story-face-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 734px) {
  .story-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-number dd { font-size: 2.25rem; }
  .story-title { margin-bottom: 1.75rem; font-size: 1.75rem; }
  .story-bar, .story-pairs .story-bar { grid-template-columns: 6.5rem minmax(0, 1fr) 3.5rem; gap: 0.625rem; }
  .story-columns { height: 12rem; }
}


/* the charts' tooltip (site/story.js hoverTips): a small card that follows the pointer, a swatch of
   the row's colour by its title, the figure large, its shares under it; the hovered row's chart
   fades its other rows */
.story-tip { position: fixed; top: 0; left: 0; z-index: 40; min-width: 9rem; padding: 0.625rem 0.875rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--menu-shadow); pointer-events: none; opacity: 0; transition: opacity var(--duration-feedback); }
.story-tip.is-visible { opacity: 1; }
.story-tip p { margin: 0; white-space: nowrap; }
.story-tip-title { display: flex; align-items: center; gap: 0.375rem; color: var(--heading); font-size: 0.9375rem; font-weight: 600; }
.story-tip-title::before { content: ""; flex: none; width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--swatch); }
.story-tip-tl { color: var(--secondary); font-family: var(--system-font); font-size: 0.8125rem; font-weight: 400; }
.story-tip-value { margin-top: 0.25rem !important; color: var(--heading); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.story-tip-line { color: var(--secondary); font-size: 0.8125rem; }
/* the fade (transition on the fills above) is quick and undelayed, unlike the staggered growth */
.has-hover > :not(.is-hover) :is(.story-bar-fill, .story-column-fill) { opacity: 0.35; }
/* colour only, so the label keeps its width */
.has-hover > .is-hover :is(.story-bar-label, .story-bar-label a, .story-column-label) { color: var(--accent); }
.story-column:focus { outline: none; }
.story-column:focus-visible .story-column-fill { box-shadow: 0 0 0 3px var(--ring); }

/* a word bubble's card (cards.js openWordTip): a floating panel beside the bubble, holding the word's
   cards without their own shadow */
.tag-map-section { position: relative; }
/* the ＋ / − zoom buttons, stacked at the map's upper right */
.tag-map-zoom { position: absolute; top: 0.75rem; right: 0.75rem; z-index: 20; display: grid; gap: 0.25rem; }
.tag-map-zoom-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius-inner); background: var(--card); color: var(--secondary); box-shadow: var(--surface-shadow); cursor: pointer; transition: var(--button-transition); }
.tag-map-zoom-button:hover { color: var(--text); background: var(--hover); }
.tag-map-zoom-button:active { transform: var(--button-press); }
.tag-map-zoom-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.tag-map-zoom-button .icon { font-size: 1.125rem; }
.word-tip { position: absolute; z-index: 25; width: min(22rem, 100%); max-height: 100%; overflow-y: auto; padding: 0.25rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--menu-shadow); animation: tip-in var(--duration-feedback) ease-out; }
.word-tip:focus { outline: none; }
.word-tip .word-card, .word-tip .word-card:hover { box-shadow: none; }
.word-tip .word-card + .word-card { border-top: 1px solid var(--hairline); border-radius: 0; }
.word-tip-note { margin: 0; padding: 1rem 1.25rem; color: var(--secondary); }
@keyframes tip-in {
  from { opacity: 0; transform: scale(0.97); }
}
@media (max-width: 734px) {
  .tag-map { height: clamp(24rem, calc(100svh - 11.5rem - var(--announce-height)), 44rem); }
}

/* --- form --- */
input[type="text"], input[type="search"], textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color var(--duration-ui), background var(--duration-ui), box-shadow var(--duration-ui);
  -webkit-appearance: none;
  appearance: none;
}
textarea { min-height: 8rem; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 4px var(--ring); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input::placeholder, textarea::placeholder { color: var(--secondary); opacity: 0.7; }
.romanized { font-family: var(--system-font); }

.form { display: grid; gap: 2rem; }
.field { display: grid; gap: 0.5rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend, .field > .field-label { padding: 0; color: var(--text); font-weight: 600; }
.field .error { color: var(--danger); font-size: 0.875rem; }
.field-hint { margin: -0.25rem 0 0.25rem; color: var(--secondary); font-size: 0.875rem; }
/* the form's own fields (not the word rows inside their box) are lifted by a shadow, with no border
   until focused or invalid */
.field > input, .field > textarea { border-color: transparent; box-shadow: var(--surface-shadow); }
.field > input:focus, .field > textarea:focus { border-color: var(--accent); box-shadow: var(--surface-shadow), 0 0 0 4px var(--ring); }
.field > input[aria-invalid="true"], .field > textarea[aria-invalid="true"] { border-color: var(--danger); }


/* the form's pair lists (詞條, 例句), each in a white box: one numbered row
   each, number + Hanji/Japanese + Tâi-lô + remove. --word-number and --word-gap (number column,
   grid gap) line up the rows, their error lines and the popover */
.form-box { --word-number: 1.25rem; --word-gap: 0.75rem; padding: 1.25rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--surface-shadow); }
.words { display: grid; gap: 0.75rem; counter-reset: word; }
.word-fields { position: relative; display: grid; grid-template-columns: var(--word-number) 1fr 1fr 36px; gap: var(--word-gap); align-items: center; }
.words .word-fields::before { counter-increment: word; content: counter(word); color: var(--secondary); font-size: 0.875rem; text-align: right; font-variant-numeric: tabular-nums; }
.word .error { margin-top: 0.375rem; padding-left: calc(var(--word-number) + var(--word-gap)); }
.word .matches { left: calc(var(--word-number) + var(--word-gap)); }
.icon-button .icon-add, .word-slot .icon-button .icon-remove { display: none; }
.word-slot .icon-button .icon-add { display: block; }
/* the slot row below the words: faint and dashed until the caret enters it */
.word-slot:not(:focus-within) input { border-style: dashed; background: transparent; }
.word-slot:not(:focus-within) .word-fields::before { opacity: 0.5; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius-inner); background: none; color: var(--secondary); cursor: pointer; transition: var(--button-transition); }
.icon-button:hover { background: var(--ghost-hover); color: var(--text); }
.icon-button:active { background: var(--ghost-active); transform: var(--button-press); }
.icon-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.icon-button .icon { font-size: 1.125rem; }


/* multiple choice: pills */
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* pill geometry, shared by the ＋ pill and the input it turns into so all three are the same height */
.pills label, .pill-add, input.pill-input { padding: 0.4375rem 0.875rem; border-radius: var(--radius-control); }
/* soft fill; picked, the accent fill. The 1px transparent border keeps a picked pill the same size */
.pills label { display: inline-flex; align-items: center; gap: 0.375rem; border: 1px solid transparent; background: var(--button-soft); color: var(--button-soft-text); cursor: pointer; transition: var(--button-transition); }
.pills label:hover { background: var(--button-soft-hover); box-shadow: var(--button-lift); }
.pills label:active { background: var(--button-soft-active); transform: var(--button-press); }
.pills label:has(input:checked) { background: var(--button-strong); color: #fff; }
.pills label:has(input:checked):hover { background: var(--button-strong-hover); }
.pills label:has(input:checked):active { background: var(--button-strong-active); }
.pills label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }

/* the real inputs stay focusable but invisible; the label is the control */
.pills label input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }


.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0 1.25rem;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--button-strong);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: var(--button-transition);
}
.button:hover { background: var(--button-strong-hover); box-shadow: var(--button-lift); }
.button:active { background: var(--button-strong-active); transform: var(--button-press); }
.button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
/* disabled (提交 while a submission is being sent): grey, flat, no hover or press */
.button:disabled, .button:disabled:hover, .button:disabled:active { background: var(--button-soft); color: var(--secondary); box-shadow: none; transform: none; cursor: not-allowed; }
/* a button whose label changes: the hidden sizer and the label share one grid cell, so the button
   keeps the sizer's width */
.button-steady { display: inline-grid; justify-items: center; }
.button-steady > * { grid-area: 1 / 1; }
.button-sizer { visibility: hidden; }
/* 家己加標籤: the ＋ pill after the tags, and the input that floats under it, over the page */
.tag-add { position: relative; display: inline-flex; }
.pill-add { display: inline-flex; align-items: center; justify-content: center; min-width: 2.5rem; border: 1px dashed var(--border); background: none; color: var(--secondary); font: inherit; cursor: pointer; transition: var(--button-transition); }
/* a zero-width line of text gives the ＋ pill the same height as a word pill */
.pill-add::after { content: "\200b"; }
.pill-add:hover, .pill-add[aria-expanded="true"] { background: var(--ghost-hover); color: var(--text); }
.pill-add:active { background: var(--ghost-active); transform: var(--button-press); }
.pill-add:focus-visible, .card-attest:focus-visible, .card-add:focus-visible, .text-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.pill-add .icon { font-size: 1rem; }
/* opens leftward (.align-end) when it would leave the column; the base text input's 48px floor
   would make it taller than a pill */
input.pill-input { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; width: 10rem; min-height: 0; background: var(--card); box-shadow: var(--menu-shadow); }
input.pill-input.align-end { left: auto; right: 0; }
.form-notice { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; color: var(--secondary); font-size: 0.9375rem; }
.submitted { display: grid; justify-items: start; gap: 1rem; }
.submitted p { margin: 0; }
/* 我的提交 (site/mine-page.js): the words in review, then the collected ones, each a white row */
.mine { display: grid; gap: 2rem; }
.mine-signin { display: grid; justify-items: center; gap: 1rem; text-align: center; }
.mine-signin p { margin: 0; color: var(--secondary); }
.mine-heading { margin: 0 0 0.75rem; color: var(--heading); font-size: 1.125rem; }
.mine-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.mine-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; padding: 0.875rem 1.25rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--surface-shadow); }
.mine-word { color: var(--heading); font-size: 1.125rem; font-weight: 600; }
.mine-tl { color: var(--secondary); font-size: 0.9375rem; }
.mine-actions { display: flex; margin: -0.5rem -0.75rem -0.5rem auto; }
/* the form's tips: a box in the tag bubbles' blue at their tint, under the title */
.submit-tips { margin: -1rem 0 2rem; padding: 0.875rem 1.125rem; border-radius: var(--radius); background: color-mix(in srgb, var(--hue-blue) var(--tint), var(--card)); color: var(--heading); }
.submit-tips ol { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.375rem; }



@media (max-width: 734px) {
  .hero { padding: 0 0 2rem; }
  .hero h1 { font-size: 2.5rem; }
  .hero p { font-size: 1.125rem; }
}

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

/* --- sidebar (after kautian-mirror): docked on wide screens, a popover drawer on
   narrow ones (site/sidebar.js) --- */
.corner-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius-inner); background: none; color: var(--secondary); cursor: pointer; transition: var(--button-transition); }
.corner-button:hover { background: var(--ghost-hover); color: var(--text); }
.corner-button:active { background: var(--ghost-active); transform: var(--button-press); }
.corner-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.corner-button svg { width: 18px; height: 18px; }
/* kept out of the top bar: a floating button at the window's lower left (where Things keeps its
   sidebar's toolbar), on the card surface so it stays legible over whatever scrolls beneath */
.corner-button.sidebar-toggle { position: fixed; bottom: 1rem; left: 1rem; z-index: 20; width: 40px; height: 40px; border-radius: var(--radius-control); background: var(--card); box-shadow: var(--surface-shadow); color: var(--secondary); }
.corner-button.sidebar-toggle:hover { background: var(--card); box-shadow: var(--surface-shadow-hover); color: var(--text); }
.corner-button.sidebar-toggle:active { background: var(--hover); }
.corner-button.sidebar-toggle:focus-visible { box-shadow: var(--surface-shadow), 0 0 0 3px var(--ring); }
.sidebar-toggle .icon-chevrons, .sidebar-collapse { display: none; }

.sidebar {
  inset: 0 auto 0 0;
  width: min(var(--sidebar-width), 85vw);
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1rem 1.5rem 1.5rem;
  overflow-y: auto;
  border: 0;
  background: var(--sidebar-bg);
  color: var(--text);
  box-shadow: var(--menu-shadow);
  transform: translateX(-100%);
  transition: transform var(--duration-panel) ease, overlay var(--duration-panel) allow-discrete, display var(--duration-panel) allow-discrete;
}
/* a column, so the footer sits at its foot */
.sidebar:popover-open { display: flex; flex-direction: column; transform: none; }
@starting-style { .sidebar:popover-open { transform: translateX(-100%); } }
.sidebar::backdrop { background: rgba(0, 0, 0, 0.3); }
.sidebar-close { display: flex; justify-content: flex-end; margin: -0.25rem -0.5rem 0 0; }
/* social links at the homepage's foot (after taigikeyboard.tw/web), on the announcement bar's dark
   slate so the page closes as it opens; the icons light up the way the bar's outlined pills do.
   Other pages leave them out */
.site-footer { padding: 2rem 1.5rem; background: var(--announce-bg); }
body:not(:has(> main[data-page="home"])) .site-footer { display: none; }
.social-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.social-links a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius-control); color: rgba(255, 255, 255, 0.85); transition: var(--button-transition); }
.social-links a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; text-decoration: none; }
.social-links a:active { background: rgba(255, 255, 255, 0.2); transform: var(--button-press); }
.social-links a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.social-links svg { flex: none; width: 22px; height: 22px; }
/* the copyright and the official readings' licences under the icons, quieter than the bar's announcement */
.site-legal { margin: 1rem 0 0; color: rgba(255, 255, 255, 0.65); font-size: 0.875rem; text-align: center; }
.site-legal a { color: inherit; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 0.2em; }
.site-legal a:hover { color: #fff; text-decoration-color: #fff; }
.site-legal a:focus-visible { outline: none; border-radius: var(--radius-inner); box-shadow: 0 0 0 3px var(--ring); }
@media (min-width: 50rem) {
  /* docked, collapsed by default (index.html): slid out and hidden (its controls leave the tab order); display: flex overrides the closed popover's display: none so it can slide */
  .sidebar { position: fixed; display: flex; flex-direction: column; padding-top: 1.5rem; padding-bottom: 0; border-right: 1px solid var(--chart-grid); box-shadow: none; visibility: hidden; transition: transform var(--duration-panel) ease, visibility var(--duration-panel); }
  .sidebar-close { display: none; }
  body { transition: padding-left var(--duration-panel) ease; }
  :root[data-sidebar="open"] .sidebar { transform: none; visibility: visible; }
  :root[data-sidebar="open"] body { padding-left: calc(var(--sidebar-width) + 1.5rem); }
  /* after docusaurus.io: open, a full-width « bar held at the sidebar's foot (margin-top auto);
     collapsed, a slim strip down the window's left edge, all of it a » button, and the page starts
     beside it */
  .sidebar-collapse { position: sticky; bottom: 0; display: flex; flex: none; align-items: center; justify-content: center; height: 40px; margin: auto -1.5rem 0; padding: 0; border: 0; border-top: 1px solid var(--hairline); background: var(--sidebar-bg); color: var(--secondary); cursor: pointer; transition: var(--button-transition); }
  .sidebar-collapse:hover { background: var(--button-soft); color: var(--text); }
  .sidebar-collapse:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--ring); }
  .sidebar-collapse svg { width: 18px; height: 18px; }
  .corner-button.sidebar-toggle { inset: 0 auto 0 0; width: var(--sidebar-strip); height: auto; border-right: 1px solid var(--hairline); border-radius: 0; background: transparent; box-shadow: none; }
  .corner-button.sidebar-toggle:hover, .corner-button.sidebar-toggle:active { background: var(--ghost-hover); box-shadow: none; transform: none; }
  .corner-button.sidebar-toggle:focus-visible { box-shadow: inset 0 0 0 3px var(--ring); }
  .sidebar-toggle .icon-panel { display: none; }
  .sidebar-toggle .icon-chevrons { display: block; }
  :root[data-sidebar="open"] .sidebar-toggle { display: none; }
  body { padding-left: var(--sidebar-strip); }
}

/* settings rows: label left, control right, hairlines between */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 2.75rem; font-size: 0.9375rem; }
.setting + .setting { border-top: 1px solid var(--hairline); }
.settings-heading { margin-top: 1.25rem; padding-bottom: 0.25rem; color: var(--secondary); font-size: 0.8125rem; }
.setting select {
  padding: 0.25rem 1.125rem 0.25rem 0.25rem;
  border: 0;
  border-radius: var(--radius-inner);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 4l2.5 2.5L7.5 4' fill='none' stroke='%2355606e' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right center / 10px no-repeat;
  color: var(--secondary);
  font: inherit;
  text-align: right;
  cursor: pointer;
  transition: var(--button-transition);
  -webkit-appearance: none;
  appearance: none;
}
.setting select:hover { background-color: var(--ghost-hover); color: var(--text); }
.setting select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
/* iOS-style switch */
.setting input[type="checkbox"] { position: relative; flex: none; width: 44px; height: 26px; margin: 0; border-radius: var(--radius-round); background: var(--border); cursor: pointer; transition: background var(--duration-ui); -webkit-appearance: none; appearance: none; }
.setting input[type="checkbox"]::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform var(--duration-ui); }
.setting input[type="checkbox"]:checked { background: var(--button-strong); }
.setting input[type="checkbox"]:checked::before { transform: translateX(18px); }
.setting input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* --- card pages (#/tag/…, #/word/…): a grid of word cards, more added on scroll --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
/* lifted by a shadow, no border; hover deepens the shadow (nothing moves) */
.word-card { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.5rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--surface-shadow); transition: box-shadow var(--duration-ui) ease-out; }
.word-card:hover { box-shadow: var(--surface-shadow-hover); }
.card-hanji { color: var(--heading); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: anywhere; }
.card-hanji:hover { color: var(--accent); text-decoration: none; }
/* the card's first line and its 複製詞目 / 分享連結 buttons, pulled up into the card's corner; the
   line keeps its own width (only the word is a link) and wraps before the buttons */
.card-head { display: flex; align-items: flex-start; gap: 0.5rem; }
.card-head > :first-child { min-width: 0; margin-right: auto; }
.card-actions { display: flex; flex: none; gap: 0.125rem; margin: -0.25rem -0.75rem 0 0; }
.card-readings { display: flex; flex-wrap: wrap; gap: 0.125rem 0.75rem; margin: 0; }
.card-readings .poj, .card-readings .tps { color: var(--secondary); font-size: 0.9375rem; }
.reading-hanji { color: var(--heading); font-weight: 600; }
.card-details { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; margin: 0.25rem 0 0; font-size: 0.9375rem; }
.card-details dt { color: var(--secondary); }
.card-details dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
/* the card's foot, held at the bottom: tags left, contributor byline right (wraps to its own line,
   still right-aligned, when the tags fill the row); line-height 1.5rem keeps each link a 24px target */
.card-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin-top: auto; padding-top: 0.5rem; font-size: 0.875rem; line-height: 1.5rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0 0.75rem; }
.card-tags .tag { font-size: inherit; }
.card-credit { margin: 0 0 0 auto; color: var(--secondary); text-align: right; }
.card-credit .person, .card-credit .card-source { color: var(--secondary); }
.card-credit .card-source:hover { color: var(--accent); text-decoration: none; }
/* a headword card's readings: one section each, a hairline between; the last one grows, so the
   card's foot still sits at the bottom of an equal-height grid cell */
.card-reading { display: flex; flex-direction: column; gap: 0.5rem; }
.card-reading:last-of-type { flex: 1; }
.card-reading + .card-reading { padding-top: 1rem; border-top: 1px solid var(--hairline); }
/* 我遮嘛按呢講: a small soft pill under its reading; 加一个讀音: a quiet text link at the card's end */
.card-attest { align-self: flex-start; padding: 0.25rem 0.75rem; border-radius: var(--radius-control); background: var(--button-soft); color: var(--button-soft-text); font-size: 0.875rem; transition: var(--button-transition); }
.card-attest:hover { background: var(--button-soft-hover); text-decoration: none; }
.card-attest:active { background: var(--button-soft-active); transform: var(--button-press); }
.card-add { display: inline-flex; align-items: center; gap: 0.25rem; align-self: flex-start; margin: 0.25rem 0 0 -0.5rem; padding: 0.25rem 0.5rem; border-radius: var(--radius-inner); color: var(--secondary); font-size: 0.875rem; transition: var(--button-transition); }
.card-add:hover { background: var(--ghost-hover); color: var(--text); text-decoration: none; }
.card-provenance { white-space: nowrap; }
/* the word page's discussion, under its card, in the card's column */
.discussion { width: min(100%, 36rem); margin: 2.5rem auto 0; }
.discussion h2 { margin: 0 0 1rem; color: var(--heading); font-size: 1.25rem; }
.discussion .empty { text-align: left; }
.comments { display: grid; gap: 1rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.comments:empty { display: none; }
.comment { padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--surface-shadow); }
.comment-meta { margin: 0 0 0.25rem; color: var(--secondary); font-size: 0.875rem; }
.comment-meta a { color: var(--secondary); }
.comment-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.comment-github { display: inline-block; margin-bottom: 1rem; font-size: 0.875rem; }
.comment-form { display: grid; gap: 0.75rem; margin-bottom: 1.5rem; }
.discussion > .button { margin-bottom: 1.5rem; }
.comment-form textarea { min-height: 6rem; }
/* a question (the form with a title) has more to say than a comment */
.comment-form:has(> input[name="title"]) textarea { min-height: 10rem; }
/* 問問題 (site/questions-page.js): the list of questions, one card each, and a question's own page */
/* after culturedcode.com/things/support (maintainer 2026-11-30): each question a tinted link card
   with a faint chevron, lifting a pixel on hover; the 問問題 pages' fields filled, borderless */
.questions { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.questions:empty { display: none; }
.question-link { position: relative; display: block; padding: 0.875rem 2.5rem 0.875rem 1.125rem; border: 1px solid light-dark(rgba(0, 28, 70, 0.06), rgba(255, 255, 255, 0.06)); border-radius: var(--radius); background: light-dark(rgba(0, 52, 126, 0.04), rgba(255, 255, 255, 0.04)); color: var(--text); line-height: 1.3; transition: background var(--duration-ui), border-color var(--duration-ui), box-shadow 0.12s ease-out, transform 0.12s ease-out; }
.question-link::after { content: ""; position: absolute; top: 50%; right: 1.125rem; width: 0.5rem; height: 0.5rem; border-top: 2px solid currentColor; border-right: 2px solid currentColor; opacity: 0.25; transform: translateY(-50%) rotate(45deg); }
.question-link:hover { border-color: light-dark(#dde9ff, rgba(100, 159, 255, 0.25)); background: light-dark(#ebf1ff, rgba(100, 159, 255, 0.12)); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.06); text-decoration: none; transform: translateY(-1px); }
.question-link:active { background: light-dark(#e2ebff, rgba(100, 159, 255, 0.18)); transform: none; }
.question-title { display: block; margin-bottom: 0.125rem; color: var(--heading); font-weight: 700; overflow-wrap: anywhere; }
.question-meta { display: block; color: var(--secondary); font-size: 0.875rem; }
main[data-page^="question"] .comment-form :is(input, textarea) { border-color: transparent; background: light-dark(rgba(0, 29, 71, 0.06), rgba(255, 255, 255, 0.06)); }
main[data-page^="question"] .comment-form :is(input, textarea):focus { border-color: var(--accent); background: var(--card); }
.question-page { width: min(100%, 36rem); margin: 0 auto; }
.question-heading { margin: 0 0 1rem; color: var(--heading); font-size: 1.5rem; overflow-wrap: anywhere; }
.question-page .discussion { margin-top: 2rem; }
.empty { color: var(--secondary); text-align: center; }
/* 修改's 詞目 field: a search for another reading to join, its results as text buttons */
.join-results { margin: 0.25rem 0 0; padding: 0; list-style: none; }
.join-results:empty { display: none; }
.text-button { padding: 0.125rem 0; border: 0; border-radius: var(--radius-inner); background: none; color: var(--accent); font: inherit; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
/* a word page holds a card or two: one centred column instead of a sparse grid */
.cards-word { grid-template-columns: minmax(0, 36rem); justify-content: center; }

/* --- the announcement bar across the top: a slim dark strip (after the banner on culturedcode.com/
   things) with the announcement and the 提交新詞 / 揣詞 buttons centred;
   part of the page, so it scrolls away with it. Every page's title starts below it at the same
   height, so switching pages never moves it --- */
.topbar { container: topbar / inline-size; background: var(--announce-bg); }
/* two layouts, by the bar's own width (the open sidebar narrows it): stacked, the site name on its
   own row above the announcement; wide (the container queries below), the name in the left column.
   The side columns are then equally wide, so the announcement stays centred */
.topbar-inner { display: grid; grid-template-columns: minmax(var(--brand-column, 0px), 1fr) auto minmax(var(--brand-column, 0px), 1fr); grid-template-areas: var(--topbar-areas, "brand brand brand" ". announce greeting"); align-items: center; gap: 1rem; min-height: var(--announce-height); padding: 1.75rem 1.5rem; }
.topbar a:focus-visible { outline: none; border-radius: var(--radius-inner); box-shadow: 0 0 0 3px var(--ring); }
/* the site name, the way back to the homepage; wraps when stacked on a narrow phone */
.topbar-brand { grid-area: brand; justify-self: center; color: #fff; font-size: 1.5rem; font-weight: 700; text-align: center; text-decoration: none; }
.topbar-brand:hover { text-decoration: none; opacity: 0.85; }
.announce { grid-area: announce; display: flex; align-items: center; gap: 0.875rem; margin: 0; font-size: 1.0625rem; }
.announce-text { max-width: 50rem; color: rgba(255, 255, 255, 0.85); line-height: 1.6; }
/* two paragraphs: what the site is, then the invitation (next to the button) */
.announce-text > span { display: block; }
.announce-text > span + span { margin-top: 0.375rem; }
.announce-cta { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.375rem 0.875rem 0.375rem 0.625rem; border-radius: var(--radius-control); background: var(--button-strong); color: #fff; font-weight: 600; white-space: nowrap; transition: var(--button-transition); }
.announce-cta svg { width: 1rem; height: 1rem; }
.announce-cta:hover { background: var(--button-strong-hover); text-decoration: none; }
.announce-cta:active { background: var(--button-strong-active); transform: var(--button-press); }
.topbar a.announce-cta:focus-visible { border-radius: var(--radius-control); }
/* the ways to the 揣詞 and 我貢獻 ê 詞 pages: the same pill, outlined, so 提交新詞 stays the main
   call; every button stays on every page */
.announce-outline { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); background: transparent; }
.announce-outline:hover { background: rgba(255, 255, 255, 0.12); }
.announce-outline:active { background: rgba(255, 255, 255, 0.2); }
/* the right end of the bar: 你好！ @login and 登出 once signed in (site/app.js); in its own column,
   so the centred announcement and buttons never move when it appears */
.account-greeting { grid-area: greeting; justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 0.25rem 0.75rem; margin: 0; font-size: 1rem; color: rgba(255, 255, 255, 0.85); text-align: right; overflow-wrap: anywhere; }
.link-button { padding: 0; border: 0; background: none; color: #fff; font: inherit; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.45); text-underline-offset: 0.2em; cursor: pointer; transition: text-decoration-color var(--duration-feedback); }
.link-button:hover { text-decoration-color: #fff; }
.link-button:focus-visible { outline: none; border-radius: var(--radius-inner); box-shadow: 0 0 0 3px var(--ring); }
.link-button:disabled { opacity: 0.6; cursor: default; }
/* under the 揣詞 page's box: the way to 問問題 (its menu floats over it) */
.search-ask { max-width: 36rem; margin: 1rem auto 0; color: var(--secondary); text-align: center; }
/* the 揣詞 page's box: as wide as a reading line under the title, its menu exactly as wide */
main > .search { max-width: 36rem; margin: 0 auto; }
/* the box matches the form's fields: the 12px radius, white, lifted by the surface shadow */
main > .search input[type="search"] { padding-left: 2.5rem; border-color: transparent; background: var(--card); box-shadow: var(--surface-shadow); }
main > .search input[type="search"]:focus { border-color: var(--accent); box-shadow: var(--surface-shadow), 0 0 0 4px var(--ring); }
main > .search .search-field > .icon { left: 1rem; }
main > .search .search-hint { left: 2.5rem; }
main > .search > .matches { left: 0; right: 0; }
/* the wide bar, per language: the name's column fits the name (台語 12rem, ja 24rem, en 26rem), and
   the bar must hold both side columns plus the announcement at full width (about 82rem) */
@container topbar (min-width: 113rem) {
  .topbar-inner:lang(nan) { --brand-column: 13rem; --topbar-areas: "brand announce greeting"; }
}
@container topbar (min-width: 137rem) {
  .topbar-inner:lang(ja) { --brand-column: 25rem; --topbar-areas: "brand announce greeting"; }
}
@container topbar (min-width: 141rem) {
  .topbar-inner:lang(en) { --brand-column: 27rem; --topbar-areas: "brand announce greeting"; }
}
/* the stacked bar is a row taller; the tag map's height allows for it (an estimate by the window,
   which the bar's width tracks) */
@media (max-width: 113rem) {
  :root { --announce-height: 11.75rem; }
}
/* a phone: tighter; the announcement's words give way, the button stays */
@media (max-width: 40rem) {
  .topbar-inner { gap: 0.75rem; padding: 1rem; }
  .announce-text { display: none; }
  /* four buttons may not fit one line on a narrow phone */
  .announce { flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
}

