:root {
  color-scheme: light;
  --ink: #102c31;
  --muted: #4b6367;
  --teal: #075f59;
  --teal-dark: #064640;
  --line: #d5e2de;
  --page: #f3f7f4;
  --tint: #e1f0e8;
  --white: #ffffff;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.65;
  scroll-behavior: smooth;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); }
[hidden] { display: none !important; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.22; }
p + p { margin-top: .65rem; }
a { color: var(--teal); text-underline-offset: .22em; }
button, select { font: inherit; }
button, select, .primary { border: 1px solid var(--line); border-radius: .55rem; }
button, select { color: var(--ink); background: var(--white); }
button { padding: .48rem .85rem; cursor: pointer; }
button:hover { border-color: var(--teal); }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid #a56112; outline-offset: 4px; }
.top {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem;
  position: sticky; top: 0; z-index: 3; min-height: 4.25rem;
  padding: .65rem max(1.15rem, calc((100vw - 1260px) / 2));
  background: #f9fcf9f5; border-bottom: 1px solid var(--line);
}
.top a { text-decoration: none; }
.brand { display: flex; align-items: center; gap: .65rem; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.mark { display: inline-block; width: 1.15rem; height: 1.15rem; transform: rotate(45deg); border: 2px solid; position: relative; border-radius: .18rem; }
.mark::after { content: ""; position: absolute; inset: .23rem; background: currentColor; border-radius: .09rem; }
.top nav { display: flex; justify-content: center; gap: clamp(.65rem, 2.1vw, 1.85rem); white-space: nowrap; }
.top nav a { font-size: .92rem; color: var(--muted); }
.top nav a[aria-current] { color: var(--teal); font-weight: 750; }
.top button { border-color: var(--teal); color: var(--teal); font-size: .92rem; white-space: nowrap; }
main { max-width: 1260px; padding: 0 2rem; margin: auto; }
.section { padding: clamp(3.3rem, 6.5vw, 6rem) 0; scroll-margin-top: 4.25rem; border-bottom: 1px solid var(--line); }
.hero { display: grid; grid-template-columns: .92fr 1.08fr; gap: 2.4rem; align-items: center; }
.eyebrow { color: var(--teal); font-size: .87rem; font-weight: 750; letter-spacing: .085em; }
.eyebrow span { margin: 0 .25rem; }
h1 { font-weight: 820; font-size: clamp(2.8rem, 5.3vw, 5.15rem); letter-spacing: -.07em; margin: .85rem 0 1.15rem; }
h1 em { color: var(--teal); font-style: normal; }
.lead { font-size: clamp(1rem, 1.45vw, 1.2rem); color: var(--muted); max-width: 33ch; }
.primary { display: inline-block; margin-top: 1.45rem; color: white; background: var(--teal-dark); text-decoration: none; padding: .62rem 1.1rem; font-weight: 700; }
.metrics { display: flex; gap: clamp(.65rem, 3vw, 2.3rem); margin: 1.8rem 0 0; }
.metrics div { border-left: 2px solid #acd2c1; padding-left: .7rem; }
.metrics dt { color: var(--muted); font-size: .87rem; }
.metrics dd { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 800; white-space: nowrap; }
.metrics small { font-size: .8rem; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 1.15rem; }
.hero-card { background: #ecf5ee; border-color: #c9dfd3; padding: clamp(1.1rem, 2.25vw, 2rem); }
h2 { font-size: clamp(1.65rem, 3.15vw, 2.75rem); letter-spacing: -.045em; }
h3 { font-size: 1.2rem; }
.hero-card h2 { font-size: clamp(1.35rem, 2.3vw, 1.85rem); margin: .52rem 0 .35rem; }
.muted, .chart-note, figcaption { color: var(--muted); }
.chart-note, figcaption { font-size: .9rem; }
.overview-bottom { grid-column: 1 / -1; display: grid; grid-template-columns: .9fr 1.1fr; gap: 2rem; align-items: center; padding-top: 1.35rem; border-top: 1px solid var(--line); }
.overview-bottom h2 { font-size: 1.42rem; margin-bottom: .4rem; }
.overview-bottom p { color: var(--muted); }
.group-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.tile { display: grid; text-align: left; line-height: 1.35; font-size: .94rem; white-space: nowrap; }
.tile small { color: var(--muted); font-size: .77rem; }
.section-intro { max-width: 52rem; margin-bottom: 1.5rem; }
.section-intro h2 { margin: .42rem 0 .64rem; }
.section-intro > p:last-child { color: var(--muted); }
.analysis-card, .appendix, .method-notes { padding: clamp(1rem, 2.7vw, 2rem); }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem 1.1rem; margin-bottom: .75rem; }
.toolbar label { display: grid; gap: .2rem; color: var(--muted); font-size: .92rem; }
select { appearance: none; padding: .45rem 1.9rem .45rem .65rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23075f59' stroke-width='1.7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .65rem center; max-width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .65rem 0; }
.chips label { border: 1px solid var(--line); border-radius: 2rem; padding: .2rem .58rem; font-size: .89rem; display: flex; gap: .35rem; align-items: center; }
input[type=checkbox] { accent-color: var(--teal); }
.figure-title { margin: .9rem 0 .35rem; font-size: clamp(1.06rem, 2vw, 1.3rem); }
.figure-image { display: block; margin: .3rem 0; }
figure figcaption { color: var(--ink); font-weight: 700; }
.section, .card, .hero-copy, .overview-bottom > *, .top nav { min-width: 0; }
.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; color: var(--muted); }
.chart text { fill: currentColor; }
.chart [role=button] { cursor: pointer; }
.chart [role=button]:focus, .chart [role=button]:hover { outline: none; }
.chart [role=button]:focus .chart-marker, .chart [role=button]:hover .chart-marker { stroke: var(--ink); stroke-width: 3; }
.chart [role=button]:focus-visible .chart-bar, .chart [role=button]:hover .chart-bar { stroke: var(--ink); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: .15rem 1rem; margin: .25rem .2rem .4rem; font-size: .88rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .32rem; }
.legend i { width: .68rem; height: .68rem; border-radius: 50%; display: inline-block; }
details { margin-top: .9rem; }
.analysis-card details { border-top: 1px solid var(--line); padding-top: .8rem; }
summary { cursor: pointer; color: var(--teal); font-weight: 750; }
details[open] > summary { margin-bottom: .75rem; }
.table-wrap { overflow: auto; margin: .65rem 0; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; font-variant-numeric: tabular-nums; text-align: left; white-space: nowrap; }
caption { text-align: left; color: var(--muted); padding: .15rem 0 .45rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
thead { background: #eaf3ec; }
tbody tr:nth-child(even) { background: #f7faf8; }
.source { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .72rem 0 .15rem; font-size: .92rem; }
.insight { margin-top: 1rem; background: var(--tint); border-left: 3px solid #308473; border-radius: .25rem .8rem .8rem .25rem; padding: 1rem 1.2rem; }
.insight strong { color: var(--teal-dark); }
.insight p { margin-top: .25rem; }
.case-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.case-figure, .case-card { padding: 1.25rem; }
figure img { width: 100%; height: auto; display: block; background: white; }
.case-card dl { margin: .7rem 0 0; font-variant-numeric: tabular-nums; }
.case-card dl div { display: flex; justify-content: space-between; gap: .6rem; border-top: 1px solid var(--line); padding: .44rem 0; }
.case-card dt { color: var(--muted); }
.case-card dd { margin: 0; text-align: right; font-weight: 700; }
.figure-pair, .method-grid { display: grid; gap: 1rem; }
.figure-pair { grid-template-columns: 1fr 1fr; }
.method-grid { grid-template-columns: repeat(3, 1fr); }
.method { padding: 1.2rem 1.25rem; }
.method h3 { margin: .5rem 0; }
.equation { white-space: nowrap; display: block; font-family: Georgia, serif; font-size: 1.05rem; margin: .18rem 0; }
.method-notes { margin-top: 1rem; }
.method-notes ul { margin-bottom: 0; }
.method-notes li + li { margin-top: .4rem; }
footer { max-width: 1260px; margin: auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; padding: 1.3rem 2rem; font-size: .88rem; color: var(--muted); }
.advanced-page { max-width: 1260px; margin: auto; padding: 2.2rem 2rem 4rem; }
.advanced-page h1 { font-size: 2.8rem; margin: .6rem 0; }
.advanced-page .eyebrow { margin-top: 1.1rem; }
.secondary-link { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: .5rem; font-size: .9rem; text-decoration: none; }
.heatmap-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1rem; }
.heatmap-scroll { overflow: auto; max-height: 72vh; margin: .75rem 0; position: relative; }
.heatmap-table { border-collapse: separate; border-spacing: 2px; width: auto; font-size: .9rem; }
.heatmap-table caption { position: sticky; left: 0; }
.heatmap-table td { padding: 0; border: 0; }
.heatmap-table th { background: #fff; border: 0; }
.heatmap-table thead th { position: sticky; top: 0; z-index: 1; vertical-align: bottom; padding: .5rem .15rem; }
.heatmap-table thead th span { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; max-height: 14rem; white-space: nowrap; }
.heatmap-table .heatmap-corner { left: 0; z-index: 2; }
.heatmap-table tbody th { position: sticky; left: 0; z-index: 1; min-width: 12rem; max-width: 24rem; white-space: normal; }
.heatmap-table td button { width: 3.5rem; height: 2.6rem; padding: .15rem; border-radius: .2rem; border: 0; font-size: .88rem; font-variant-numeric: tabular-nums; }
.heatmap-table td button:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.heatmap-legend { display: flex; gap: .55rem; align-items: center; font-size: .9rem; position: sticky; left: 0; background: white; padding: .4rem 0; }
.heatmap-gradient { display: inline-block; width: 10rem; height: .8rem; background: linear-gradient(90deg, #2a679e, #f8f8f8, #ac373b); }
.missing-key { color: var(--muted); margin-left: .5rem; }
.heatmap-cell { background: var(--page); border-radius: .5rem; padding: .8rem; margin: .5rem 0; }
.heatmap-cell:empty { display: none; }
.raw-variable { font: .82rem/1.5 ui-monospace, monospace; overflow-wrap: anywhere; color: var(--muted); margin-top: .3rem; }
.axis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.axis-grid fieldset { min-width: 0; border: 1px solid var(--line); border-radius: .7rem; padding: .8rem; }
.axis-grid legend { font-weight: 750; padding: 0 .4rem; }
.axis-search { display: grid; gap: .2rem; color: var(--muted); font-size: .9rem; }
.axis-search input { font: inherit; padding: .45rem .6rem; border-radius: .4rem; border: 1px solid var(--line); width: 100%; }
.axis-actions { display: flex; gap: .5rem; margin: .6rem 0; }
.axis-actions button { font-size: .87rem; padding: .3rem .6rem; }
.axis-options { max-height: 20rem; overflow: auto; }
.axis-category { margin-bottom: .8rem; }
.axis-category h3 { font-size: .9rem; color: var(--teal); margin: .4rem 0; }
.axis-category label { display: flex; gap: .5rem; align-items: start; padding: .22rem .2rem; font-size: .9rem; overflow-wrap: anywhere; }
.axis-category input { flex: none; margin-top: .35rem; }
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.model-toggle { display: inline-flex; align-items: center; gap: .5rem; margin: .4rem 0 .75rem; font-size: .92rem; color: var(--muted); }
.model-point { pointer-events: none; }
.extra-analysis { margin-top: 1.15rem; }
.analysis-heading { margin-bottom: .9rem; }
.analysis-heading h3 { margin-top: .3rem; }
.analysis-description { color: var(--muted); margin: .55rem 0 1rem; }
.ring-scroll, .trend-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.ring-wide-chart { min-width: 600px; }
.dynamic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.2rem 0; }
.dynamic-grid > div { min-width: 0; border: 1px solid var(--line); border-radius: .8rem; padding: 1rem; }
.dynamic-grid h4 { margin: 0 0 .7rem; font-size: 1rem; }
.metric-choice { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
.metric-choice select { min-width: 0; width: 100%; }
.stat-reading { font-size: 1.1rem; font-variant-numeric: tabular-nums; margin-top: .4rem; }
.cycle-interval { margin-top: .75rem; }
@media (max-width: 1100px) {
  .dynamic-grid { grid-template-columns: 1fr; gap: .8rem; }
  .dynamic-grid > div { padding: .75rem; }
}
@media (max-width: 790px) {
  .advanced-page { padding: 1.2rem 1rem 3rem; }
  .axis-grid { grid-template-columns: 1fr; }
  .heatmap-table tbody th { min-width: 9rem; max-width: 12rem; }
}
#present-bar { position: sticky; top: 4.25rem; z-index: 2; padding: .5rem 1rem; background: var(--tint); display: flex; align-items: center; justify-content: center; gap: .85rem; }
body.presenting .section { padding-top: 2rem; }
@media (max-width: 790px) {
  .hero, .overview-bottom, .case-grid, .method-grid { grid-template-columns: 1fr; }
  main { padding: 0 1rem; }
  .top { grid-template-columns: 1fr auto; gap: .4rem; }
  .top nav { grid-row: 2; grid-column: 1 / -1; justify-content: start; overflow-x: auto; }
  .section { scroll-margin-top: 6.2rem; }
  #present-bar { top: 5.9rem; }
}
@media (max-width: 600px) {
  main, .advanced-page { padding-inline: .75rem; }
  .section { padding-block: 2.6rem; }
  .hero { gap: 1.5rem; }
  .group-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-card, .analysis-card, .appendix { padding: .85rem; }
  .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .toolbar label, .toolbar select { min-width: 0; }
  .toolbar select { width: 100%; min-height: 44px; font-size: 1rem; }
  #dielectric .toolbar label:last-child, #structure .toolbar label:last-child,
  #timeseries .toolbar label:last-child { grid-column: 1 / -1; }
  .toolbar label:has(#sample-picker) { grid-column: 1 / -1; }
  .top nav a, .chips label, .secondary-link { min-height: 44px; align-content: center; }
  .mobile-heatmap button { min-height: 44px; }
  .mobile-heatmap .heatmap-table { width: 100%; table-layout: fixed; }
  .mobile-heatmap .heatmap-table th { white-space: normal; overflow-wrap: anywhere; }
  .mobile-heatmap .heatmap-table th:first-child { width: 30%; min-width: 0; padding-inline: .3rem; }
  .mobile-heatmap .heatmap-table thead th span { writing-mode: initial; transform: none; white-space: normal; display: block; }
  .mobile-heatmap .heatmap-table td button { width: 100%; }
  .heatmap-gradient { width: clamp(3rem, 26vw, 8rem); }
  .missing-key { margin-left: 0; }
  .full-theme, #adv-plot { border: 1px solid var(--line); border-radius: .35rem; }
  .equation { white-space: normal; overflow-wrap: anywhere; }
  .table-wrap { scrollbar-width: auto; }
}
@media (max-width: 420px) {
  .figure-pair { grid-template-columns: 1fr; }
  .metrics { gap: .65rem; }
}
@media (prefers-reduced-motion: reduce) { :root { scroll-behavior: auto; } }
@media print {
  .top, footer, #present-bar, .toolbar, .primary { display: none !important; }
  .section { break-inside: avoid; padding: 1rem 0; }
  body { background: white; }
}
.histogram { max-width: 33rem; }
.histogram .chart text { font-size: 12px; }
.distribution-panel { border-top: 1px solid var(--line); margin-top: 1rem; }
#data-detail > summary { scroll-margin-top: 7rem; }
