.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 5px 15px 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 18px;
}
.badge-dot { position: relative; width: 7px; height: 7px; border-radius: var(--r-circle); background: var(--sand); flex-shrink: 0; }
.badge-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: var(--r-circle);
  border: 1px solid var(--sand-ring);
  animation: fact-breathe 3.2s var(--ease) infinite;
}
@keyframes fact-breathe {
  0% { transform: scale(.6); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 11px;
  border: 1px solid var(--on-blue-line-strong);
  border-radius: var(--r-pill);
  background: var(--mask-clear);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.chip svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.facts-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; list-style: none; margin: 24px 0 0; padding: 0; }
.facts-row li { display: inline-flex; max-width: 100%; }
.fact-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.fact-pill strong { color: var(--text); }
.fact-pill a { color: var(--text); }
.protocol-row { display: flex; flex-wrap: wrap; gap: 8px; }
.protocol-row .chip { border-color: var(--border); background: var(--bg-panel-2); color: var(--text); font-family: var(--font-mono); }
.app-store-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  max-width: 100%;
  padding: 12px 26px;
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--surface-light);
  text-decoration: none;
  transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.app-store-button svg { width: 25px; height: 25px; fill: currentColor; }
.app-store-button small { display: block; font-size: 11px; line-height: 1.4; }
.app-store-button strong { display: block; font-size: 16px; line-height: 1.45; font-weight: var(--weight-medium); }
.app-store-button:hover, .app-store-button.is-hover { background: var(--accent-dark); color: var(--surface-light); border-color: var(--accent-dark); }
.app-store-button:active, .app-store-button.is-active { background: var(--ink); color: var(--surface-light); border-color: var(--periwinkle); }
.app-store-button.is-focus { outline: 2px solid var(--periwinkle); outline-offset: 3px; }
.app-store-button[aria-disabled="true"] { background: var(--bg-panel-2); color: var(--text-muted); border-color: var(--border); }

.tabs { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 40px; align-items: start; min-width: 0; }
.tabs > * { min-width: 0; }
.tabs [role="tablist"] { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; }
.tabs [role="tab"] {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 18px;
  border: 0;
  border-left: 2px solid var(--mask-clear);
  background: var(--mask-clear);
  color: var(--text-muted);
  font: inherit;
  font-size: 20px;
  font-weight: var(--weight-regular);
  line-height: 1.5;
  text-align: left;
}
.tabs [role="tab"]::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-circle); background: var(--sand); flex-shrink: 0; }
.tabs [role="tab"]:hover { color: var(--text); background: var(--bg-panel); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-left-color: var(--accent); }
.tab-panel {
  position: relative;
  min-width: 0;
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--bg-panel);
  color: var(--text);
  overflow-x: clip;
}
.tab-panel::before { content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 6px; border-radius: 0 0 var(--r-focus) var(--r-focus); background: var(--gradient-band); }
.tab-panel h3 { margin-top: 0; }
.tab-panel p { color: var(--text-muted); }
.tab-artifact { margin-top: 28px; }
.setting-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel-2); color: var(--text); }
.setting-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.setting-list li + li { border-top: 1px solid var(--border); }
.setting-list li::after { content: "›"; color: var(--text-muted); flex-shrink: 0; }

.toc {
  position: sticky;
  top: 16px;
  z-index: 15;
  margin-bottom: 40px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-panel);
  color: var(--text);
}
.toc ul { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; overflow-x: auto; overscroll-behavior-inline: contain; }
.toc li { flex-shrink: 0; }
.toc a { display: block; padding: 10px 16px; min-height: 44px; border-radius: var(--r-pill); text-decoration: none; color: var(--text-muted); white-space: nowrap; }
.toc a:hover, .toc a[aria-current="location"] { background: var(--bg-panel-2); color: var(--text); }
.toc--flow { position: static; }

.faq-list { display: grid; gap: 12px; }
.faq-item { min-width: 0; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); }
.faq-item summary { position: relative; padding: 22px 58px 22px 24px; min-height: 64px; list-style: none; cursor: pointer; font-size: 18px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 24px; top: 22px; color: var(--periwinkle-soft); line-height: 1.6; }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 0 24px 24px; color: var(--text-muted); }
.faq-answer p:first-child { margin-top: 0; }
.faq-answer p:last-child { margin-bottom: 0; }
.term-card { border-radius: var(--r-card); border: 1px solid var(--border); padding: 28px; background: var(--bg-panel); color: var(--text); }
.term-card dt { margin: 0 0 12px; color: var(--periwinkle-soft); font-family: var(--font-mono); font-size: 20px; }
.term-card dd { margin: 0; color: var(--text-muted); }
.term-category { font-size: 12px; color: var(--text-muted); }

.official-shot { width: min(100%, 280px); max-width: 280px; margin: 0 auto; padding: 0; flex-shrink: 0; }
.official-shot img { display: block; width: 100%; height: auto; border-radius: var(--r-shot); }
.official-shot { outline: 1px solid var(--border); outline-offset: 0; border-radius: var(--r-shot); }
.official-shot figcaption { padding-top: 12px; padding-bottom: 12px; font-size: 12px; line-height: 1.6; color: var(--text-muted); text-align: center; }
.shot-with-copy { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 48px; }
.shot-with-copy > * { min-width: 0; }

.device-card { display: flex; flex-direction: column; align-items: flex-start; padding: 32px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); }
.device-card > svg { width: 42px; height: 42px; fill: none; stroke: var(--periwinkle-soft); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.device-card h3 { margin: 24px 0 8px; }
.device-card p { margin: 0 0 24px; color: var(--text-muted); }
.device-card a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-top: auto; color: var(--periwinkle-soft); text-decoration: none; }
.device-card a:hover { text-decoration: underline; }

.article-card { display: flex; flex-direction: column; padding: 32px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); }
.article-card h3 { margin: 18px 0 12px; font-size: 22px; }
.article-card h3 a { text-decoration: none; }
.article-card h3 a:hover { color: var(--periwinkle-soft); }
.article-card p { margin: 0 0 24px; color: var(--text-muted); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 12px; color: var(--text-muted); }
.article-card .article-link { min-height: 44px; display: inline-flex; align-items: center; margin-top: auto; color: var(--periwinkle-soft); text-decoration: none; }
.callout { margin: 28px 0; padding: 24px 28px; border: 1px solid var(--border); border-left: 3px solid var(--periwinkle); border-radius: var(--r-card); background: var(--bg-panel-2); color: var(--text); }
.callout p { margin: 0; }
.callout p + p { margin-top: 12px; }
.callout-title { display: block; margin-bottom: 8px; font-weight: var(--weight-medium); color: var(--periwinkle-soft); }

.table-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--border); border-radius: var(--r-menu); }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-panel); color: var(--text); }
.data-table th, .data-table td, .prose table th, .prose table td, .article-body table th, .article-body table td {
  min-width: 7em;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}
.data-table th, .prose table th, .article-body table th { background: var(--bg-panel-2); color: var(--text); font-weight: var(--weight-medium); }
.data-table tr:last-child td { border-bottom: 0; }
.prose table, .article-body table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: var(--bg-panel);
  color: var(--text);
  overscroll-behavior-inline: contain;
}
.data-table code, .prose table code, .article-body table code { overflow-wrap: anywhere; }

.store-endcap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px; margin-top: 48px; padding: 28px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-panel); color: var(--text); }
.store-endcap > div { flex: 1 1 260px; min-width: 0; }
.store-endcap h2 { margin: 0 0 8px; font-size: 24px; }
.store-endcap p { margin: 0; color: var(--text-muted); }
.dl-fab {
  position: fixed;
  right: 24px;
  bottom: 20px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  max-width: calc(100% - 32px);
  padding: 10px 18px 10px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel-2);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: border-color var(--duration) var(--ease), background-color var(--duration) var(--ease);
}
.dl-fab:hover { border-color: var(--periwinkle); background: var(--bg-panel); color: var(--text); }
.dl-fab svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.preview-section { padding-top: 88px; padding-bottom: 24px; }
.preview-section:last-child { padding-bottom: 88px; }
.preview-label { margin: 0 0 16px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.preview-stack { display: grid; gap: 24px; }
.preview-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.preview-shot-placeholder { display: flex; align-items: center; justify-content: center; aspect-ratio: 750 / 1334; border-radius: var(--r-shot); background: var(--surface-light); color: var(--ink-soft); text-align: center; font-size: 13px; }
.palette-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.palette-item { min-width: 0; margin: 0; }
.palette-item figcaption { padding-top: 8px; color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.swatch { height: 64px; border: 1px solid var(--border); border-radius: var(--r-menu); }
.swatch-bg { background: var(--bg); }
.swatch-panel { background: var(--bg-panel); }
.swatch-panel-2 { background: var(--bg-panel-2); }
.swatch-border { background: var(--border); }
.swatch-accent { background: var(--accent); }
.swatch-accent-dark { background: var(--accent-dark); }
.swatch-accent-lift { background: var(--accent-lift); }
.swatch-periwinkle { background: var(--periwinkle); }
.swatch-periwinkle-soft { background: var(--periwinkle-soft); }
.swatch-text { background: var(--text); }
.swatch-muted { background: var(--text-muted); }
.swatch-success { background: var(--success); }
.swatch-sand { background: var(--sand); }
.swatch-sand-ink { background: var(--sand-ink); }
.swatch-error { background: var(--error); }
.swatch-light { background: var(--surface-light); }
.swatch-hover { background: var(--surface-hover); }
.swatch-ink { background: var(--ink); }
.swatch-ink-soft { background: var(--ink-soft); }
.swatch-ink-faint { background: var(--ink-faint); }
.swatch-rule-light { background: var(--rule-light); }
.swatch-hilite { background: var(--sheet-hilite); }
.swatch-tag-grey { background: var(--sheet-tag-grey); }
.swatch-blue-line { background: var(--on-blue-line); }
.swatch-blue-line-strong { background: var(--on-blue-line-strong); }
.swatch-blue-text { background: var(--on-blue-text); }
.swatch-blue-hover { background: var(--on-blue-hover); }
.swatch-sand-ring { background: var(--sand-ring); }
.swatch-veil { background: var(--veil); }
.swatch-mask-solid { background: var(--mask-solid); }
.swatch-mask-clear { background: var(--mask-clear); }
.swatch-word { background: var(--gradient-word); }
.swatch-band { background: var(--gradient-band); }
.swatch-field { background: var(--gradient-field); }
.preview-display { margin: 0; font-size: var(--size-display); line-height: 1.16; font-weight: var(--weight-regular); letter-spacing: var(--tracking-display); }
.preview-footer-placeholder { background: var(--surface-light); }

@media (max-width: 980px) {
  .tabs { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
  .tabs [role="tab"] { font-size: 18px; }
  .tab-panel { padding: 32px; }
}
@media (max-width: 768px) {
  .tabs { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .tabs [role="tablist"] { flex-direction: row; overflow-x: auto; overscroll-behavior-inline: contain; }
  .tabs [role="tab"] { width: auto; flex-shrink: 0; min-height: 48px; padding: 10px 14px; border-left: 0; border-bottom: 2px solid var(--mask-clear); font-size: 16px; white-space: nowrap; }
  .tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--accent); }
  .tab-panel { padding: 28px 24px; }
  .shot-with-copy { grid-template-columns: minmax(0, 1fr); }
  .official-shot { margin-inline: auto; }
  .dl-fab { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); font-size: 13px; }
  .device-card, .article-card, .term-card { padding: 24px; }
  .palette-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts-row { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .callout { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .badge-dot::after { animation: none; opacity: .6; transform: none; }
}