.badge,.fact,.proto {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  border: 1px solid var(--border); border-radius: var(--r-pill);
  background: var(--bg); color: var(--text); font-size: var(--fs-sm);
  padding: 5px 12px; overflow-wrap: anywhere;
}
.badge { min-height: 32px; font-weight: var(--weight-medium); box-shadow: var(--shadow-hair); }
.badge__dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: var(--r-pill); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.badge__sep { color: var(--text-muted); }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fact { background: var(--bg-panel); color: var(--text-muted); font-size: var(--fs-xs); }
.fact strong { color: var(--text); font-weight: var(--weight-semibold); }
.proto { font-family: var(--font-mono); font-size: var(--fs-xs); min-height: 28px; padding: 3px 11px; }
.app-store {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px;
  padding: 10px 20px; border: 1px solid var(--text); border-radius: var(--r-btn);
  background: var(--text); color: var(--on-dark); text-decoration: none; box-shadow: var(--shadow-btn);
  transition: background-color var(--duration),transform var(--duration);
}
.app-store svg { width: 26px; height: 28px; }
.app-store__copy { display: block; }
.app-store__eyebrow { display: block; font-size: var(--fs-xs); line-height: 1.25; }
.app-store__name { display: block; font-size: var(--fs-body); font-weight: var(--weight-semibold); line-height: 1.5; }
.app-store:hover { background: var(--accent-dark); color: var(--on-dark); border-color: var(--accent-dark); transform: translateY(-1px); }
.app-store:active { transform: none; }
.store-followup { padding: var(--space-8); border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-6); }
.store-followup p { margin-bottom: 0; max-width: 42em; }
.tabs { min-width: 0; }
.tab-grid[role="tablist"] {
  display: grid; grid-template-columns: repeat(5,minmax(0,1fr));
  border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  position: relative; isolation: isolate;
}
.tab-grid::before,.tab-grid::after { content: ""; position: absolute; top: 0; bottom: 0; width: 12px; pointer-events: none; z-index: 1; }
.tab-grid::before { left: 0; background: linear-gradient(90deg,var(--bg),var(--bg-clear)); }
.tab-grid::after { right: 0; background: linear-gradient(270deg,var(--bg),var(--bg-clear)); }
.tab-grid [role="tab"] {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-width: 0; min-height: 122px; padding: 18px 10px;
  border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--bg); color: var(--text-muted); font-size: var(--fs-ui);
  position: relative; overflow-wrap: anywhere;
}
.tab-grid [role="tab"] svg { width: 27px; height: 27px; }
.tab-grid [role="tab"]:hover { background: var(--bg-panel); color: var(--text); }
.tab-grid [role="tab"][aria-selected="true"] { background: var(--accent-wash); color: var(--accent-dark); }
.tab-grid [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; bottom: 0; inset-inline: 0; height: 2px; background: var(--accent); }
.tab-panel { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: var(--space-12); padding: var(--space-10); background: var(--bg-panel); color: var(--text); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-card) var(--r-card); }
.tab-panel h3 { margin-top: 0; }
.tab-panel pre { margin: 0; background: var(--bg); color: var(--text); }
.chapter-toc { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: var(--space-4) var(--space-5); border: 1px solid var(--border); border-radius: var(--r-inner); background: var(--bg); color: var(--text); }
.chapter-toc a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-muted); text-decoration: none; }
.chapter-toc a:hover,.chapter-toc a[aria-current] { color: var(--accent-dark); }
.chapter-toc--sticky { position: sticky; top: var(--space-3); z-index: 8; }
.faq-item { border-bottom: 1px solid var(--border); background: var(--bg); color: var(--text); }
.faq-item summary { position: relative; padding: 24px 36px 24px 0; cursor: pointer; font-weight: var(--weight-semibold); list-style: none; min-height: 48px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 8px; top: 24px; color: var(--accent-dark); }
.faq-item[open] summary::after { content: "−"; }
.faq-item__answer { padding-bottom: var(--space-6); max-width: 66em; color: var(--text-muted); }
.faq-item__answer p:last-child { margin-bottom: 0; }
.term-card { border: 1px solid var(--border); border-radius: var(--r-card); padding: var(--space-8); background: var(--bg); color: var(--text); box-shadow: var(--shadow-hair); }
.term-card__word { font-family: var(--font-mono); font-size: var(--fs-subtitle); margin-top: 0; }
.term-card__category { color: var(--accent-dark); font-size: var(--fs-xs); }
.official-shot { width: min(100%,280px); margin: 0 auto; flex-shrink: 0; }
.official-shot img { display: block; width: 100%; height: auto; border-radius: var(--r-shot); }
.official-shot img { outline: 1px solid var(--border); outline-offset: -1px; }
.official-shot figcaption { margin-top: var(--space-3); color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.6; }
.shot-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,280px); gap: var(--space-12); align-items: start; }
.device-card {
  display: grid; grid-template-columns: 48px minmax(0,1fr); gap: var(--space-5);
  border: 1px solid var(--border); padding: var(--space-8); border-radius: var(--r-card);
  background: var(--bg); color: var(--text); text-decoration: none; box-shadow: var(--shadow-hair);
}
.device-card:hover { border-color: var(--accent); box-shadow: var(--shadow-float); }
.device-card > svg { width: 44px; height: 54px; color: var(--text-muted); }
.device-card h3 { margin: 0 0 var(--space-2); }
.device-card p { color: var(--text-muted); margin-bottom: var(--space-4); }
.device-card__link { color: var(--accent-dark); font-weight: var(--weight-semibold); }
.article-card { display: flex; flex-direction: column; align-items: start; padding: var(--space-8); border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg); color: var(--text); box-shadow: var(--shadow-hair); }
.article-card__meta { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: var(--fs-xs); color: var(--text-muted); }
.article-card h3 { margin-block: var(--space-5) var(--space-4); }
.article-card h3 a { text-decoration: none; }
.article-card h3 a:hover { color: var(--accent-dark); }
.article-card p { color: var(--text-muted); }
.article-card__link { margin-top: auto; color: var(--accent-dark); }
.callout { margin: var(--space-6) 0; padding: var(--space-6); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-inner); background: var(--accent-wash); color: var(--text); }
.callout p:last-child { margin-bottom: 0; }
.callout--warning { border-left-color: var(--warn); background: var(--bg-panel); color: var(--text); }
.callout__label { display: block; font-size: var(--fs-sm); font-weight: var(--weight-semibold); color: var(--accent-dark); margin-bottom: var(--space-2); }
.table-scroll { overflow-x: auto; max-width: 100%; min-width: 0; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--r-inner); }
.data-table { border-collapse: collapse; width: 100%; font-size: var(--fs-ui); }
.data-table th,.data-table td,.prose table th,.prose table td {
  min-width: 7em; padding: 16px 20px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border); overflow-wrap: normal; word-break: normal;
}
.data-table th,.prose table th { background: var(--bg-panel); color: var(--text); font-weight: var(--weight-semibold); }
.data-table td,.prose table td { background: var(--bg); color: var(--text); }
.prose table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; min-width: 0; border-collapse: collapse; }
.data-table code,.prose table code { overflow-wrap: anywhere; }
.dl-fab {
  position: fixed; bottom: max(24px,env(safe-area-inset-bottom)); right: max(24px,env(safe-area-inset-right));
  z-index: 25; display: inline-flex; align-items: center; gap: 12px; max-width: calc(100% - 40px);
  min-height: 56px; padding: 12px 18px; border: 1px solid var(--border); border-radius: var(--r-inner);
  background: var(--bg); color: var(--text); text-decoration: none; box-shadow: var(--shadow-float); font-size: var(--fs-ui);
}
.dl-fab svg { width: 22px; height: 22px; color: var(--accent-dark); }
.dl-fab:hover { border-color: var(--accent); }
.hero { background: var(--bg); color: var(--text); }
.hero__grid {
  max-width: var(--wrap); min-height: 772px; margin-inline: auto; padding: 8px var(--gutter) 0;
  display: grid; grid-template-columns: minmax(0,46fr) minmax(0,54fr); gap: 48px; align-items: center;
}
.copy { position: relative; z-index: 4; }
.headline { margin: 26px 0 0; font-size: var(--fs-h1); line-height: var(--leading-title); font-weight: var(--weight-display); }
.headline__latin { display: block; letter-spacing: var(--tracking-latin); }
.headline__cjk { display: block; letter-spacing: var(--tracking-cjk); }
.headline__hue { background: linear-gradient(100deg,var(--accent),var(--accent-2)); color: var(--accent-dark); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.lede { margin: 22px 0 0; max-width: 31em; color: var(--text-muted); font-size: var(--fs-lede); line-height: 1.78; }
.lede strong { color: var(--text); font-weight: var(--weight-semibold); }
.cta { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }
.devices { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; font-size: var(--fs-sm); color: var(--text-muted); }
.device { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); text-decoration: none; }
.device:hover { color: var(--text); }
.device svg { width: 18px; height: 18px; }
.store-pill { border: 1px solid var(--border); border-radius: var(--r-pill); padding: 2px 10px; background: var(--bg-panel); color: var(--text); font-size: var(--fs-xs); font-weight: var(--weight-semibold); }
.protocols { margin-top: 28px; padding-top: 20px; max-width: 470px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.protocols__label { margin-right: 6px; font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--weight-semibold); }
.stage { position: relative; height: 640px; margin: 0; }
.stage::before {
  content: ""; position: absolute; top: -60px; right: -220px; bottom: -40px; left: -20px;
  background-image: linear-gradient(var(--grid-line) 1px,var(--bg-clear) 1px),linear-gradient(90deg,var(--grid-line) 1px,var(--bg-clear) 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 58% 58% at 42% 44%,var(--text) 28%,var(--bg-clear) 76%);
  -webkit-mask-image: radial-gradient(ellipse 58% 58% at 42% 44%,var(--text) 28%,var(--bg-clear) 76%);
}
.stage::after { content: ""; position: absolute; left: -20px; right: -220px; bottom: -2px; height: 46%; z-index: 2; pointer-events: none; background: linear-gradient(180deg,var(--bg-clear),var(--bg) 78%); }
.plate { position: absolute; top: 48px; left: 0; z-index: 1; width: 800px; height: 560px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg); color: var(--text); box-shadow: var(--shadow-sheet); overflow: hidden; }
.plate__tabs { height: 52px; padding: 0 24px 0 192px; display: flex; align-items: stretch; gap: 28px; border-bottom: 1px solid var(--border); font: var(--fs-sm) var(--font-mono); }
.plate__tab { position: relative; display: flex; align-items: center; color: var(--text-muted); white-space: nowrap; }
.plate__tab--on { color: var(--text); font-weight: var(--weight-semibold); }
.plate__tab--on::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: var(--r-pill); }
.plate__body { display: grid; grid-template-columns: 168px minmax(0,1fr); height: calc(100% - 52px); }
.outline { padding: 22px 18px 0 20px; background: var(--bg-panel); color: var(--text-muted); border-right: 1px solid var(--border); }
.outline__title { margin: 0 0 12px; font-size: var(--fs-xs); font-weight: var(--weight-semibold); letter-spacing: .06em; }
.outline__list { list-style: none; margin: 0; padding-left: 18px; position: relative; }
.outline__list::before { content: ""; position: absolute; left: 3px; top: 12px; bottom: 12px; width: 1px; background: var(--border); }
.outline__item { position: relative; font: var(--fs-xs)/30px var(--font-mono); }
.outline__item::before { content: ""; position: absolute; left: -18px; top: 11px; width: 7px; height: 7px; background: var(--bg); border: 1px solid var(--sep); border-radius: var(--r-pill); }
.outline__item--on { color: var(--text); font-weight: var(--weight-semibold); }
.outline__item--on::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.outline__sub { list-style: none; padding-left: 12px; margin-bottom: 4px; border-left: 1px solid var(--border); font: var(--fs-xs)/26px var(--font-body); }
.code { position: relative; padding-top: 18px; font-family: var(--font-mono); }
.code__head { padding: 0 24px 12px 70px; font-size: var(--fs-sm); line-height: 22px; }
.code__section,.code__comment { display: block; }
.code__section { color: var(--accent-dark); font-weight: var(--weight-semibold); }
.code__comment { color: var(--text-muted); }
.rules { position: relative; }
.rules__scan { position: absolute; inset: 0 0 auto; height: var(--row-h); background: var(--accent-wash); color: var(--text); border-left: 2px solid var(--accent); }
.rules__list { list-style: none; margin: 0; padding: 0; }
.rule { position: relative; height: var(--row-h); display: flex; align-items: center; padding-left: 24px; border-bottom: 1px solid var(--grid-line); font-size: var(--fs-sm); white-space: nowrap; }
.rule__no { width: 28px; flex-shrink: 0; margin-right: 18px; text-align: right; font-size: var(--fs-xs); color: var(--text-muted); }
.rule__type { font-weight: var(--weight-medium); }
.rule__arg { color: var(--text-muted); }
.pol { display: inline-flex; align-items: center; justify-content: center; height: 22px; padding: 0 8px; border-radius: var(--r-chip); font: var(--weight-semibold) var(--fs-xs)/1 var(--font-mono); }
.pol--proxy { background: var(--accent); color: var(--on-dark); }
.pol--direct { background: var(--text-muted); color: var(--on-dark); }
.pol--reject { background: var(--bg); color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.matched { position: absolute; top: 8px; left: 474px; height: 26px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-tag); background: var(--bg); color: var(--text-muted); box-shadow: var(--shadow-float); font-size: var(--fs-xs); white-space: nowrap; }
.matched__dot { width: 6px; height: 6px; background: var(--success); border-radius: var(--r-pill); }
.matched__word { color: var(--success-ink); font-weight: var(--weight-semibold); }
.matched__pol { color: var(--accent-dark); font-weight: var(--weight-bold); }
.request { position: absolute; top: 16px; left: -36px; z-index: 3; min-height: 42px; display: inline-flex; align-items: center; gap: 9px; padding: 8px 15px 8px 12px; border: 1px solid var(--border); border-radius: var(--r-inner); background: var(--bg); color: var(--text); box-shadow: var(--shadow-float); font: var(--fs-xs) var(--font-mono); }
.request__icon { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-chip); background: var(--accent-wash); color: var(--accent-dark); }
.request__icon svg { width: 13px; height: 13px; }
.request__key { color: var(--text-muted); }
.request__val { font-weight: var(--weight-semibold); }
.legend { position: absolute; right: 8px; bottom: 8px; z-index: 3; width: 304px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); box-shadow: var(--shadow-float); }
.legend__head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 6px 10px; }
.legend__title { font-size: var(--fs-sm); font-weight: var(--weight-semibold); }
.legend__en { font: var(--fs-xs) var(--font-mono); color: var(--text-muted); }
.legend__group { list-style: none; margin: 0; padding: 0; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-inner); }
.legend__row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 12px; }
.legend__row + .legend__row::before { content: ""; position: absolute; top: 0; left: 82px; right: 0; height: 1px; background: var(--border); }
.legend__row .pol { min-width: 58px; }
.legend__desc { flex: 1; font-size: var(--fs-sm); }
.legend__chevron { color: var(--text-muted); }
.next { padding-top: 18px; padding-bottom: 64px; text-align: center; background: var(--bg); color: var(--text); }
.next__tag { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 5px 14px; max-width: calc(100% - var(--gutter) * 2); border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg-panel); color: var(--text-muted); font-size: var(--fs-xs); }
.next__tag b { color: var(--text); }
.pipeline { position: relative; min-height: 240px; display: flex; justify-content: space-between; align-items: center; padding-inline: 40px; overflow: clip; }
.pipeline__art { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--border); }
.pipe-stop--light { stop-color: var(--bg-panel); }
.pipe-stop--dark { stop-color: var(--sep); }
.pipe-path { fill: none; stroke: url(#match-pipe); stroke-width: 22; stroke-linecap: round; }
.pipe-highlight { fill: none; stroke: var(--bg-panel2); stroke-width: 3; stroke-linecap: round; }
.pipeline__station { position: relative; padding: 18px 28px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-inner); box-shadow: var(--shadow-float); font-weight: var(--weight-semibold); }
.pipeline__tags { position: absolute; inset-inline: 0; bottom: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stage--animated .rules__scan { animation: matching-read var(--scan-duration) var(--ease) infinite; }
.stage--animated .matched { animation: matching-found var(--scan-duration) var(--ease) infinite; }
@keyframes matching-read {
  0%,8% { opacity: 0; transform: translateY(0); }
  13%,85% { opacity: 1; transform: translateY(0); }
  95%,100% { opacity: 0; transform: translateY(0); }
}
@keyframes matching-found {
  0%,13% { opacity: 0; transform: translateX(-6px); }
  20%,85% { opacity: 1; transform: translateX(0); }
  95%,100% { opacity: 0; transform: translateX(0); }
}
.palette { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: var(--space-4); }
.swatch { border: 1px solid var(--border); border-radius: var(--r-inner); padding: var(--space-3); background: var(--bg); color: var(--text); font-size: var(--fs-xs); }
.swatch__fill { height: 64px; border-radius: var(--r-chip); margin-bottom: var(--space-2); border: 1px solid var(--border); }
.swatch--bg .swatch__fill { background: var(--bg); }
.swatch--panel .swatch__fill { background: var(--bg-panel); }
.swatch--panel2 .swatch__fill { background: var(--bg-panel2); }
.swatch--border .swatch__fill { background: var(--border); }
.swatch--grid .swatch__fill { background: var(--grid-line); }
.swatch--sep .swatch__fill { background: var(--sep); }
.swatch--accent .swatch__fill { background: var(--accent); }
.swatch--accent2 .swatch__fill { background: var(--accent-2); }
.swatch--dark .swatch__fill { background: var(--accent-dark); }
.swatch--wash .swatch__fill { background: var(--accent-wash); }
.swatch--ring .swatch__fill { background: var(--accent-ring); }
.swatch--text .swatch__fill { background: var(--text); }
.swatch--muted .swatch__fill { background: var(--text-muted); }
.swatch--faint .swatch__fill { background: var(--text-faint); }
.swatch--success .swatch__fill { background: var(--success); }
.swatch--successink .swatch__fill { background: var(--success-ink); }
.swatch--warn .swatch__fill { background: var(--warn); }
.swatch--warnink .swatch__fill { background: var(--warn-ink); }
.swatch--error .swatch__fill { background: var(--error); }
.swatch--veil .swatch__fill { background: var(--veil); }
.swatch--clear .swatch__fill { background: var(--bg-clear); }
.shot-placeholder { aspect-ratio: 750 / 1334; display: grid; align-content: center; text-align: center; padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--r-shot); background: var(--bg-panel2); color: var(--text-muted); font-size: var(--fs-sm); }
.preview-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.btn--hover-sample { background: var(--accent-dark); color: var(--on-dark); border-color: var(--accent-dark); }
.btn--focus-sample { outline: 2px solid var(--accent-dark); outline-offset: 4px; }
@media (max-width: 1060px) {
  .hero__grid { grid-template-columns: minmax(0,1fr); gap: 24px; padding-top: 40px; }
  .stage { height: 600px; }
  .request { left: 0; }
  .tab-panel { gap: var(--space-6); padding: var(--space-6); }
}
@media (max-width: 768px) {
  .tab-panel,.shot-layout { grid-template-columns: minmax(0,1fr); }
  .tab-grid[role="tablist"] { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .palette { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .official-shot { width: min(100%,280px); }
  .facts { justify-content: center; }
}
@media (max-width: 640px) {
  .lede { font-size: var(--fs-brand); }
  .stage { height: 540px; }
  .plate { width: 640px; }
  .plate__tabs { padding-left: 20px; gap: 20px; }
  .plate__body { grid-template-columns: minmax(0,1fr); }
  .outline { display: none; }
  .legend { right: 0; width: min(280px,100%); }
  .device-card { padding: var(--space-6); grid-template-columns: 36px minmax(0,1fr); gap: var(--space-4); }
  .device-card > svg { width: 32px; }
  .dl-fab { right: 20px; bottom: max(16px,env(safe-area-inset-bottom)); }
  .pipeline { min-height: 210px; padding-inline: 8px; }
  .pipeline__station { padding: 12px 15px; font-size: var(--fs-sm); }
  .pipeline__tags .proto { font-size: var(--fs-xs); padding-inline: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .stage--animated .rules__scan,.stage--animated .matched { opacity: 1; transform: none; }
  .app-store:hover { transform: none; }
}