.ruleview { position: relative; width: 86%; margin: 52px auto 0; text-align: left; }
.horizon {
  position: absolute;
  left: 50%;
  bottom: -130px;
  z-index: 0;
  width: 112%;
  height: 260px;
  border-radius: var(--r-circle);
  background: radial-gradient(50% 50% at 50% 50%, var(--accent-a50) 0%, var(--accent-a18) 42%, var(--clear) 72%);
  color: var(--text);
  filter: blur(22px);
  transform: translateX(-50%) scale(1);
  opacity: .75;
  animation: horizon-breathe 9s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes horizon-breathe {
  from { opacity: .62; transform: translateX(-50%) scale(.96); }
  to { opacity: 1; transform: translateX(-50%) scale(1.05); }
}
.shell {
  position: relative;
  z-index: 1;
  padding: 8px;
  background: var(--bg-panel);
  color: var(--text-soft);
  border: var(--line) solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-panel);
}
.shell::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--clear), var(--accent) 50%, var(--clear));
  opacity: .9;
  pointer-events: none;
}
.pane {
  border: var(--line) solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(0deg, var(--accent-a06) 0%, var(--clear) 42%), var(--bg-panel-2);
  color: var(--text-soft);
  box-shadow: var(--shadow-inner);
  overflow: hidden;
}
.pane-head { display: flex; align-items: center; height: 40px; padding-inline: 18px; border-bottom: var(--line) solid var(--border); font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); letter-spacing: .02em; }
.pane-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; padding: 14px; }
.pane-body > * { min-width: 0; }
.rules { margin: 0; padding: 0; list-style: none; font-family: var(--font-mono); font-size: 13.5px; overflow-x: auto; max-width: 100%; }
.rules li { position: relative; display: flex; align-items: center; gap: 18px; height: 32px; padding: 0 14px 0 12px; border-radius: var(--r-sm); white-space: nowrap; min-width: max-content; }
.rules code { font-family: inherit; font-size: inherit; overflow-wrap: normal; white-space: nowrap; }
.rules .ln { width: 14px; flex-shrink: 0; text-align: right; color: var(--text-faint); font-size: 12px; }
.rules .k { color: var(--text-soft); }
.rules .c { color: var(--text-faint); }
.rules .v { color: var(--text-value); }
.p-proxy { color: var(--accent); }
.p-direct { color: var(--text-muted); }
.p-reject { color: var(--warn); }
.rules li.is-hit { background: var(--accent-a08); color: var(--text-soft); }
.rules li.is-hit::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; border-radius: var(--r-sm); background: var(--accent); }
.rules li.is-hit .ln { color: var(--accent); }
.explain { padding: 16px 18px; background: var(--bg-panel-3); color: var(--text-soft); border: var(--line) solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-float); }
.explain-eyebrow { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.explain-key { margin-top: 8px; font-family: var(--font-mono); font-size: 14px; color: var(--text); line-height: 1.4; }
.explain p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.65; }
.kv { margin: 12px 0 0; padding: 0; list-style: none; border-top: var(--line) solid var(--border); }
.kv li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 28px; border-bottom: var(--line) solid var(--border); font-size: 12.5px; color: var(--text-muted); }
.kv li:last-child { border-bottom: 0; }
.kv code { font-size: 12.5px; color: var(--text-soft); }
.kv code.p-proxy { color: var(--accent); }

.feature-window { position: relative; isolation: isolate; padding: 8px; border: var(--line) solid var(--border); border-radius: var(--r-xl); background: var(--bg-panel); color: var(--text-soft); box-shadow: var(--shadow-panel); overflow: hidden; }
.feature-window::after { content: ""; position: absolute; inset: auto 12% -1px; height: 1px; background: linear-gradient(90deg, var(--clear), var(--accent-a50), var(--clear)); }
.tabs-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 8px; }
.tablist { display: flex; flex-direction: column; gap: 4px; padding: 12px; }
.tablist [role="tab"] {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: var(--line) solid var(--clear);
  border-radius: var(--r-sm);
  background: var(--clear);
  color: var(--text-muted);
  text-align: left;
  font-family: var(--font-mono);
  font-size: 13px;
}
.tablist [role="tab"]:hover { background: var(--bg-panel-2); color: var(--text); }
.tablist [role="tab"][aria-selected="true"] { border-color: var(--accent-a18); background: var(--accent-a06); color: var(--text); box-shadow: inset 12px 0 22px -20px var(--accent-a50); }
.tablist [role="tab"][aria-selected="true"]::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; border-radius: var(--r-sm); background: var(--accent); }
.tab-panel { min-width: 0; padding: 32px; border: var(--line) solid var(--border-strong); border-radius: var(--r-lg); background: var(--bg-panel-2); color: var(--text-soft); box-shadow: var(--shadow-inner); }
.tab-panel h3 { margin: 0 0 18px; font-size: 20px; color: var(--text); }
.tab-panel p { line-height: 1.9; }
.tab-panel pre { margin-bottom: 0; background: var(--bg-panel-3); color: var(--text-soft); }

.toc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; overflow-x: visible; margin-block: 32px 48px; padding: 8px; border: var(--line) solid var(--border); border-radius: var(--r-lg); background: var(--bg-panel); color: var(--text-muted); }
.toc a { flex-shrink: 0; display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; padding: 10px 16px; white-space: normal; overflow-wrap: anywhere; border-radius: var(--r-md); font-size: 14px; }
.toc a:hover, .toc a[aria-current="location"] { background: var(--bg-panel-2); color: var(--text); }
.toc--sticky { position: sticky; top: 16px; z-index: 20; }
.document-layout { min-width: 0; }

.faq-list { display: grid; gap: 12px; }
.faq-item { border: var(--line) solid var(--border); border-radius: var(--r-xl); background: var(--bg-panel); color: var(--text-soft); box-shadow: var(--shadow-inner); }
.faq-item summary { position: relative; list-style: none; cursor: pointer; padding: 22px 56px 22px 24px; font-weight: var(--weight-title); color: var(--text); overflow-wrap: break-word; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 24px; top: 21px; font-family: var(--font-mono); color: var(--text-muted); }
.faq-item[open] summary::after { content: "−"; color: var(--accent); }
.faq-answer { padding: 0 24px 24px; line-height: 1.85; }
.faq-answer > :last-child { margin-bottom: 0; }

.term-card { padding: 28px; border: var(--line) solid var(--border); border-radius: var(--r-xl); background: var(--bg-panel); color: var(--text-soft); box-shadow: var(--shadow-inner); }
.term-card h3 { font-family: var(--font-mono); font-size: 18px; color: var(--text); margin: 12px 0; overflow-wrap: anywhere; }
.term-card p { margin-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 4px 10px; border: var(--line) solid var(--border-strong); border-radius: var(--r-pill); background: var(--bg-panel-2); color: var(--text-soft); font-size: 12px; line-height: 20px; overflow-wrap: anywhere; }
.badge::before { content: ""; width: 5px; height: 5px; flex-shrink: 0; border-radius: var(--r-circle); background: var(--accent); }
.badge--success::before { background: var(--success); }
.badge--warn::before { background: var(--warn); }
.badge--error::before { background: var(--error); }
.fact-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 0; margin-block: 24px; list-style: none; }
.fact-row li { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; max-width: 100%; padding: 6px 12px; border: var(--line) solid var(--border); border-radius: var(--r-pill); background: var(--bg-panel); color: var(--text-soft); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.fact-row .fact-label { color: var(--text-muted); }

.appstore-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  max-width: 100%;
  padding: 10px 22px;
  border: var(--line) solid var(--hl-strong);
  border-radius: var(--r-md);
  background: var(--text);
  color: var(--btn-ink);
  box-shadow: inset 0 1px 0 var(--hl-strong), 0 10px 24px -12px var(--shade-deep);
  transition: transform var(--ease), box-shadow var(--ease);
}
.appstore-button svg { width: 25px; height: 29px; fill: currentColor; }
.appstore-button .store-label { display: block; text-align: left; line-height: 1.35; }
.appstore-button small { display: block; font-size: 11px; font-weight: var(--weight-normal); }
.appstore-button strong { display: block; font-size: 17px; font-weight: var(--weight-title); color: inherit; }
.appstore-button:hover { transform: translateY(-1px); box-shadow: 0 0 0 3px var(--accent-a18), 0 14px 32px -12px var(--shade-deep); }
.appstore-button:active { transform: translateY(1px); }

.shot-row { display: flex; justify-content: center; align-items: flex-start; gap: 32px; flex-wrap: wrap; }
.official-shot { width: min(100%, 280px); max-width: 280px; flex-shrink: 0; margin: 0; padding: 0; }
.official-shot img { display: block; width: 100%; height: auto; border-radius: var(--r-shot); }
.official-shot { border-radius: var(--r-shot); }
.official-shot img { outline: var(--line) solid var(--border); outline-offset: -1px; }
.official-shot figcaption { padding-top: 14px; color: var(--text-muted); text-align: center; font-size: 12px; line-height: 1.7; }
.shot-placeholder { display: grid; place-items: center; width: 100%; aspect-ratio: 750 / 1334; border: var(--line) solid var(--border-strong); border-radius: var(--r-shot); background: var(--bg-panel-2); color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; text-align: center; }

.device-card { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding: 32px; border: var(--line) solid var(--border); border-radius: var(--r-xl); background: var(--bg-panel); color: var(--text-soft); box-shadow: var(--shadow-float); }
.device-card > svg { width: 42px; height: 42px; stroke: var(--text-soft); fill: none; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.device-card h3 { margin: 0; color: var(--text); }
.device-card p { margin: 0; }
.device-card .text-link { margin-top: auto; }

.article-card { display: flex; flex-direction: column; gap: 16px; padding: 28px; border: var(--line) solid var(--border); border-radius: var(--r-xl); background: var(--bg-panel); color: var(--text-soft); box-shadow: var(--shadow-inner); transition: border-color var(--ease), transform var(--ease); }
.article-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.article-card h3 { margin: 0; font-size: 20px; color: var(--text); }
.article-card h3 a { display: inline-block; }
.article-card h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 5px; }
.article-card p { margin: 0; font-size: 14px; }
.article-card .badge { align-self: flex-start; }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--text-muted); font-size: 12px; }
.article-card > .text-link { margin-top: auto; align-self: flex-start; }

.callout { margin: 28px 0; padding: 22px 24px; border: var(--line) solid var(--border); border-left: 2px solid var(--accent); border-radius: var(--r-md); background: var(--bg-panel-2); color: var(--text-soft); box-shadow: var(--shadow-inner); }
.callout strong { color: var(--text); }
.callout p:last-child { margin-bottom: 0; }
.callout--warn { border-left-color: var(--warn); }

.table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; border: var(--line) solid var(--border); border-radius: var(--r-md); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.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: var(--line) solid var(--border);
  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-title); }
.data-table td, .prose table td, .article-body table td { background: var(--bg-panel); color: var(--text-soft); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table caption { padding: 14px 20px; color: var(--text-muted); text-align: left; }
.prose table, .article-body table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
  margin-block: 28px;
}
.data-table code, .prose table code, .article-body table code { overflow-wrap: anywhere; white-space: normal; }

.dl-fab {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: var(--floating-layer);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 40px);
  min-height: 56px;
  padding: 12px 18px;
  border: var(--line) solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--bg-panel-2);
  color: var(--text);
  box-shadow: var(--shadow-panel);
  font-size: 13px;
}
.dl-fab svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dl-fab small { display: block; color: var(--text-muted); font-size: 11px; }
.dl-fab:hover { border-color: var(--accent); }
.has-article-fab .site-footer { padding-bottom: 112px; }
.article-store-card { margin-top: 64px; padding: 28px; border: var(--line) solid var(--border-strong); border-radius: var(--r-xl); background: var(--bg-panel); color: var(--text-soft); box-shadow: var(--shadow-inner); }
.article-store-card h2 { margin-top: 0; font-size: 22px; }
.article-store-card .btn { margin-top: 4px; }

.preview-section { padding-top: var(--section-gap); padding-bottom: 0; }
.preview-section > h2 { margin-top: 0; margin-bottom: 36px; }
.preview-section:last-child { padding-bottom: var(--section-gap); }
.preview-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.palette-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.swatch { margin: 0; padding: 12px; border: var(--line) solid var(--border); border-radius: var(--r-md); background: var(--bg-panel); color: var(--text-soft); }
.swatch-sample { height: 56px; border: var(--line) solid var(--border-strong); border-radius: var(--r-sm); margin-bottom: 10px; background: var(--swatch-color); color: var(--text); }
.swatch code { font-size: 11px; }
.swatch-bg { --swatch-color: var(--bg); }
.swatch-panel { --swatch-color: var(--bg-panel); }
.swatch-panel2 { --swatch-color: var(--bg-panel-2); }
.swatch-panel3 { --swatch-color: var(--bg-panel-3); }
.swatch-border { --swatch-color: var(--border); }
.swatch-border-strong { --swatch-color: var(--border-strong); }
.swatch-accent { --swatch-color: var(--accent); }
.swatch-accent-dark { --swatch-color: var(--accent-dark); }
.swatch-a06 { --swatch-color: var(--accent-a06); }
.swatch-a08 { --swatch-color: var(--accent-a08); }
.swatch-a18 { --swatch-color: var(--accent-a18); }
.swatch-a32 { --swatch-color: var(--accent-a32); }
.swatch-a50 { --swatch-color: var(--accent-a50); }
.swatch-text { --swatch-color: var(--text); }
.swatch-soft { --swatch-color: var(--text-soft); }
.swatch-value { --swatch-color: var(--text-value); }
.swatch-muted { --swatch-color: var(--text-muted); }
.swatch-faint { --swatch-color: var(--text-faint); }
.swatch-success { --swatch-color: var(--success); }
.swatch-warn { --swatch-color: var(--warn); }
.swatch-error { --swatch-color: var(--error); }
.swatch-ink { --swatch-color: var(--btn-ink); }
.swatch-hl { --swatch-color: var(--hl); }
.swatch-hl-strong { --swatch-color: var(--hl-strong); }
.swatch-shade { --swatch-color: var(--shade); }
.swatch-deep { --swatch-color: var(--shade-deep); }
.swatch-clear { --swatch-color: var(--clear); }
.preview-display { margin: 0 0 24px; font-size: var(--size-h1); line-height: 1.2; font-weight: var(--weight-title); letter-spacing: var(--tracking-title); }
.preview-hover { transform: translateY(-1px); box-shadow: 0 0 0 3px var(--accent-a18); }
.preview-focus { outline: 2px solid var(--accent); outline-offset: 3px; }
.preview-active { transform: translateY(1px); }
.preview-mobile { display: none; }
.preview-mobile summary { list-style: none; }
.preview-mobile summary::-webkit-details-marker { display: none; }
.preview-mobile nav { position: absolute; left: var(--gutter); right: var(--gutter); top: calc(100% + 8px); padding: 16px; max-height: calc(100dvh - 104px); overflow-y: auto; background: var(--bg-panel); color: var(--text); border: var(--line) solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-panel); }
.preview-mobile nav a { display: flex; width: 100%; min-height: 48px; align-items: center; padding: 12px; }

@media (max-width: 1280px) {
  .preview-mobile { display: block; }
  .preview-mobile .menu-toggle { display: flex; }
}
@media (max-width: 900px) {
  .ruleview { width: 100%; }
  .pane-body { grid-template-columns: minmax(0, 1fr); }
  .explain { display: none; }
  .tabs-layout { grid-template-columns: minmax(0, 1fr); }
  .tablist { flex-direction: row; overflow-x: auto; max-width: 100%; overscroll-behavior-inline: contain; }
  .tablist [role="tab"] { flex-shrink: 0; width: auto; white-space: nowrap; border-radius: var(--r-pill); }
  .tablist [role="tab"][aria-selected="true"]::before { left: 0; }
  .tab-panel { background: var(--bg-panel-2); color: var(--text-soft); }
}
@media (max-width: 640px) {
  .rules { font-size: 12px; }
  .rules li { gap: 12px; }
  .tab-panel { padding: 22px 18px; }
  .device-card { padding: 24px; }
  .term-card, .article-card { padding: 24px; }
  .fact-row { flex-direction: row; gap: 8px; }
  .shot-row { flex-direction: column; align-items: center; }
  .official-shot { margin-inline: auto; }
  .palette-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .faq-item summary { padding-left: 20px; }
  .faq-answer { padding-inline: 20px; }
  .dl-fab { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  .horizon { animation: none; opacity: .85; transform: translateX(-50%) scale(1); }
}