/* sl-atlas — explainable PQC at three depths.
   Single stylesheet. No build step. Dark + light. WCAG-AA. Mobile-first. */

/* -------- design tokens -------- */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-prose: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 14px;

  --shadow-1: 0 1px 0 rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.05);
  --shadow-2: 0 1px 0 rgba(0,0,0,.06), 0 6px 24px rgba(0,0,0,.08);

  --ease: cubic-bezier(.2,.7,.2,1);

  /* WCAG: minimum touch target 44x44 */
  --tap-min: 44px;
}

:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-2: #0f152a;
  --bg-3: #18213f;
  --panel: #121a33;
  --text: #f1f3f9;         /* AA on --bg: ~16.5:1 */
  --text-soft: #d4d8e4;    /* AA on --bg: ~12:1 */
  --muted: #a3acc2;        /* AA on --bg: ~7.5:1 (used for body too) */
  --border: #25305a;
  --border-strong: #3a4878;
  --accent: #ffc163;       /* AA on --bg-2: ~11:1; carries amber lab vibe */
  --accent-soft: rgba(255,193,99,.16);
  --accent-strong: #ffd28a;
  --link: #9fbcff;         /* AA on --bg: ~7.3:1 */
  --good: #74e4a8;
  --bad:  #ff9b9b;
  --code-bg: #0b1226;
  --code-text: #ffdc92;    /* AA on --code-bg: ~12:1 */
  --selection: rgba(255,193,99,.32);
  --ring: rgba(255,193,99,.55);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfaf6;
  --bg-2: #ffffff;
  --bg-3: #f1ecdf;
  --panel: #ffffff;
  --text: #0c0f17;
  --text-soft: #1f2330;
  --muted: #4b5566;        /* AA on --bg: ~7.3:1 */
  --border: #e2dccc;
  --border-strong: #b9b09a;
  --accent: #92400e;       /* AA on --bg-2: ~7.8:1 */
  --accent-soft: rgba(146,64,14,.10);
  --accent-strong: #7c2d12;
  --link: #1d4ed8;
  --good: #166534;
  --bad: #9b1c1c;
  --code-bg: #f4efe1;
  --code-text: #5a2d00;
  --selection: rgba(146,64,14,.20);
  --ring: rgba(146,64,14,.55);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) { color-scheme: light; }
}

/* -------- reset / base -------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

::selection { background: var(--selection); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

kbd {
  font-family: var(--font-mono);
  font-size: .75rem;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-soft);
}

/* utility: visually hidden but readable by screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #1a1300; padding: 10px 14px;
  border-radius: 0 0 var(--radius) 0; font-weight: 700;
  z-index: 100;
}
.skip-link:focus, .skip-link:focus-visible { left: 0; outline: none; }

/* -------- header -------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(140%) blur(6px);
}

.brand-link {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); text-decoration: none;
  padding: 4px;
  margin: -4px;
  border-radius: var(--radius-sm);
}
.brand-link:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 1.02rem; }
.brand-tag { font-size: .78rem; color: var(--muted); margin-top: 2px; }

.site-nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  display: inline-flex; align-items: center;
  min-height: var(--tap-min);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: .92rem;
}
.nav-link:hover { background: var(--bg-3); text-decoration: none; color: var(--text); }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap-min); height: var(--tap-min);
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.icon-button:hover { background: var(--bg-3); color: var(--text); border-color: var(--border-strong); }

.icon-sun { display: none; }
.icon-moon { display: inline; }
[data-theme="light"] .icon-sun { display: inline; }
[data-theme="light"] .icon-moon { display: none; }

/* -------- intro disclosure (first-time visitors) -------- */
.atlas-intro {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
  box-sizing: border-box;
}
.atlas-intro > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  cursor: pointer;
  list-style: none;
  font-size: .92rem;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.atlas-intro > summary::-webkit-details-marker { display: none; }
.atlas-intro > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: .8rem;
  transition: transform .15s var(--ease);
  display: inline-block;
}
.atlas-intro[open] > summary::before { transform: rotate(90deg); }
.atlas-intro > summary:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}
.atlas-intro-title { font-weight: 700; color: var(--text); }
.atlas-intro-tag {
  color: var(--muted);
  font-size: .82rem;
  font-family: var(--font-mono);
}
.atlas-intro-body {
  margin: 12px 0 0;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  font-size: .95rem;
  line-height: 1.55;
  color: var(--text-soft);
}
.atlas-intro-body p { margin: 0 0 12px; }
.atlas-intro-body p:last-child { margin-bottom: 0; }
.atlas-intro-body strong { color: var(--text); }
.atlas-intro-list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.atlas-intro-list li {
  padding: 10px 12px;
  border-left: 2px solid var(--border-strong);
  background: var(--bg-3);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.atlas-intro-body .pill-block { vertical-align: 1px; }
.atlas-intro-cta {
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  margin-top: 14px !important;
  font-style: italic;
  color: var(--muted);
}

/* -------- layout -------- */
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px;
  flex: 1;
}

/* -------- sidebar -------- */
.sidebar {
  position: sticky; top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow: auto;
  padding-right: 4px;
}
.sidebar-section + .sidebar-section { margin-top: 28px; }

.sidebar-heading {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 700;
}
.sidebar-hint {
  margin: -4px 0 10px;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--muted);
}
.sidebar-hint .pill-block { vertical-align: 1px; }

.concept-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.concept-link {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  min-height: var(--tap-min);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: .95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.concept-link:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.concept-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--border-strong);
  font-weight: 600;
}
.concept-link[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--accent);
}
.concept-link .grade {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
}
.concept-link.is-active .grade { color: var(--accent); }

.sidebar-blocked { opacity: 1; }
.concept-blocked {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-soft);
  font-size: .92rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.pill-block {
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  padding: 2px 7px;
  background: var(--bad);
  color: #310a0a;
  border-radius: 999px;
}
[data-theme="light"] .pill-block { color: #fff; }

.sidebar-shortcuts {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}
.sidebar-shortcuts h3 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 700;
}
.sidebar-shortcuts dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  font-size: .82rem;
  color: var(--text-soft);
  align-items: center;
}
.sidebar-shortcuts dt { display: flex; gap: 4px; flex-wrap: wrap; }
.sidebar-shortcuts dd { margin: 0; color: var(--muted); }

/* -------- concept article -------- */
.concept { min-width: 0; }
.concept:focus-visible { outline: none; }

.concept-header {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.concept-eyebrow {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.concept-title {
  font-family: var(--font-ui);
  font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.4rem);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1.15;
}
.concept-subtitle {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(.95rem, .9rem + .3vw, 1.08rem);
  font-style: italic;
}

/* tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  margin: 22px 0 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
}
.tab {
  min-height: var(--tap-min);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: .94rem;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.tab .tab-num {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  line-height: 1.4;
}
.tab:hover { color: var(--text); background: var(--bg-3); }
.tab[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--border-strong);
  font-weight: 600;
}
.tab[aria-selected="true"] .tab-num { color: var(--accent); border-color: var(--accent); }

/* view body */
.view {
  font-family: var(--font-prose);
  font-size: clamp(1rem, .96rem + .2vw, 1.1rem);
  line-height: 1.75;
  color: var(--text-soft);
  max-width: 72ch;
}
.view p { margin: 0 0 1em; }
.view p:last-child { margin-bottom: 0; }
.view code, .view .ref {
  font-family: var(--font-mono);
  font-size: .92em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.view strong { color: var(--text); font-weight: 700; }

/* compare mode */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.compare-col {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.compare-col h3 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  margin: 0 0 10px;
  font-weight: 700;
}
.compare-col .view { font-size: .98rem; line-height: 1.65; }

/* meta panel */
.meta {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.meta-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.meta-card h4 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 700;
}
.meta-card p { margin: 0; color: var(--text-soft); font-size: .92rem; }
.meta-card a { color: var(--link); }
.meta-card .badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: .86rem;
  color: var(--text);
}
.meta-card .badge .letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .82rem;
  background: var(--accent);
  color: #1a1300;
}
.meta-card .badge.grade-A .letter { background: var(--good); color: #052e16; }
.meta-card .badge.grade-B .letter { background: var(--accent); color: #1a1300; }
.meta-card .badge.grade-C .letter { background: #d97706; color: #1a1300; }
.meta-card .badge.grade-D .letter { background: var(--bad); color: #310a0a; }

.related-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.related-list li { display: inline-flex; }
.related-pill {
  display: inline-flex; align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  background: var(--bg-3);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  cursor: pointer;
}
.related-pill:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; border-color: var(--border-strong); }

/* -------- interactive: LWE matrix -------- */
.interactive {
  margin: 28px 0 8px;
  padding: 22px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.interactive-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.interactive-title {
  margin: 0;
  font-size: 1.04rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.interactive-title .pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
}
.interactive-controls { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  min-height: var(--tap-min);
  padding: 8px 14px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: .9rem;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn[aria-pressed="true"] {
  background: var(--accent);
  color: #1a1300;
  border-color: var(--accent);
  font-weight: 600;
}

/* equation row */
.equation-figure { margin: 0; }
.equation-scroll {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px;
  /* fade out scroll edges to hint there's more */
  mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}
@supports not (mask-image: linear-gradient(#000, #000)) {
  .equation-scroll { mask-image: none; }
}
.equation {
  display: flex; align-items: center; justify-content: flex-start;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: .92rem;
  width: max-content;
  padding: 8px 16px;
}
.equation .op {
  font-family: var(--font-prose);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--muted);
  user-select: none;
}
.equation .label {
  display: block;
  font-family: var(--font-prose);
  font-style: italic;
  color: var(--muted);
  font-size: .92rem;
  text-align: center;
  margin-top: 6px;
}

.matrix, .vector {
  display: inline-grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  position: relative;
}
.matrix::before, .vector::before, .matrix::after, .vector::after {
  content: "";
  position: absolute; top: 4px; bottom: 4px;
  width: 6px;
  border: 1px solid var(--text-soft);
}
.matrix::before, .vector::before { left: 2px; border-right: none; }
.matrix::after, .vector::after  { right: 2px; border-left: none; }

.cell {
  min-width: 28px;
  padding: 2px 6px;
  text-align: center;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.cell.noise { color: var(--accent); font-weight: 600; }
.cell.noise.zero { color: var(--muted); opacity: .5; font-weight: 400; }
.cell.secret { color: var(--text); font-weight: 600; }

/* attack visualization — row-level highlighting on A and b */
.cell.row-used {
  background: rgba(159, 188, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(159, 188, 255, .35);
}
.cell.row-ok {
  background: rgba(116, 228, 168, .14);
  box-shadow: inset 0 0 0 1px rgba(116, 228, 168, .40);
}
.cell.row-fail {
  background: rgba(255, 155, 155, .14);
  box-shadow: inset 0 0 0 1px rgba(255, 155, 155, .40);
}
[data-theme="light"] .cell.row-used {
  background: rgba(29, 78, 216, .10);
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, .35);
}
[data-theme="light"] .cell.row-ok {
  background: rgba(22, 101, 52, .10);
  box-shadow: inset 0 0 0 1px rgba(22, 101, 52, .35);
}
[data-theme="light"] .cell.row-fail {
  background: rgba(155, 28, 28, .10);
  box-shadow: inset 0 0 0 1px rgba(155, 28, 28, .35);
}

/* preset selector */
.lwe-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.preset-btn {
  flex: 1 1 auto;
  min-height: var(--tap-min);
  padding: 6px 12px;
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: .9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.1;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.preset-btn:hover { background: var(--bg-2); color: var(--text); }
.preset-btn[aria-checked="true"] {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--border-strong);
  font-weight: 600;
}
.preset-spec {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
}
.preset-btn[aria-checked="true"] .preset-spec { color: var(--accent); }
.preset-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.preset-hint {
  margin: 0 0 14px;
  font-family: var(--font-prose);
  font-style: italic;
  color: var(--muted);
  font-size: .9rem;
}

/* custom controls panel */
.custom-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 14px;
  margin: 0 0 14px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.custom-field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--text-soft); }
.custom-field small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.custom-field input,
.custom-field select {
  min-height: var(--tap-min);
  padding: 6px 10px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .92rem;
}
.custom-field input:focus,
.custom-field select:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
.custom-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .82rem;
  color: var(--muted);
  font-family: var(--font-prose);
  font-style: italic;
  line-height: 1.5;
}

/* primary controls row */
.lwe-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.control-cluster {
  display: inline-flex;
  gap: 4px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.btn-attack {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
.btn-attack:hover {
  background: var(--accent);
  color: #1a1300;
}
.btn-ghost {
  background: transparent;
  border-style: dashed;
}

/* noise distribution sparkbar */
.noise-dist {
  margin: 14px 0 6px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.noise-dist-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-family: var(--font-prose);
}
.noise-dist-head code { font-family: var(--font-mono); color: var(--code-text); }
.noise-dist-scale { font-family: var(--font-mono); font-size: .78rem; }
.noise-bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 12px;
}
.noise-bar-item {
  display: grid;
  grid-template-columns: 28px 1fr 24px;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: .82rem;
}
.noise-bar-label { color: var(--muted); }
.noise-bar-track {
  position: relative;
  display: block;
  height: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.noise-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block;
  border-radius: 999px;
}
.noise-bar-fill.noise-bar-pos  { left: 50%; background: var(--accent); }
.noise-bar-fill.noise-bar-neg  { right: 50%; background: var(--accent-strong); }
.noise-bar-fill.noise-bar-zero { left: 50%; background: var(--muted); width: 2px !important; opacity: .35; }
.noise-bar-value { color: var(--text-soft); text-align: right; }

.noise-dist-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
}
.noise-dist-summary code {
  font-family: var(--font-mono);
  color: var(--code-text);
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.noise-dist-summary strong { color: var(--text); }

/* attack result panel */
.attack-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg);
}
.attack-result.attack-win {
  background: rgba(116, 228, 168, .10);
  border-color: rgba(116, 228, 168, .50);
}
.attack-result.attack-lose {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.attack-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}
.attack-label {
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .78rem;
}
.attack-win  .attack-label { color: var(--good); }
.attack-lose .attack-label { color: var(--accent); }
[data-theme="light"] .attack-win  .attack-label { color: #14532d; }
[data-theme="light"] .attack-lose .attack-label { color: var(--accent-strong); }
.attack-subscript {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
}
.attack-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.attack-tag {
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  min-width: 76px;
}
.attack-vector {
  font-family: var(--font-mono);
  font-size: .92rem;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  word-break: break-all;
}
.vec-cell {
  display: inline-block;
  padding: 0 3px;
  border-radius: 3px;
  border: 1px solid transparent;
}
.vec-cell-match { /* default look — no extra emphasis */ }
.vec-cell-diff {
  color: var(--bad);
  border-color: rgba(255, 155, 155, .45);
  background: rgba(255, 155, 155, .12);
  font-weight: 600;
}
[data-theme="light"] .vec-cell-diff {
  color: #7f1d1d;
  border-color: rgba(155, 28, 28, .45);
  background: rgba(155, 28, 28, .10);
}
.vec-sep { color: var(--muted); }
.diff-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}
.diff-badge-ok  { color: var(--good); background: rgba(116, 228, 168, .14); border-color: rgba(116, 228, 168, .45); }
.diff-badge-bad { color: var(--bad);  background: rgba(255, 155, 155, .14); border-color: rgba(255, 155, 155, .45); }
[data-theme="light"] .diff-badge-ok  { color: #14532d; background: rgba(22, 101, 52, .10); border-color: rgba(22, 101, 52, .35); }
[data-theme="light"] .diff-badge-bad { color: #7f1d1d; background: rgba(155, 28, 28, .10); border-color: rgba(155, 28, 28, .35); }
.attack-row-verify { margin-top: 4px; }
.verify-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  flex: 1 1 auto;
}
.verify-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
}
.verify-pill.ok   { background: rgba(116, 228, 168, .25); color: var(--good); border-color: rgba(116, 228, 168, .55); }
.verify-pill.fail { background: rgba(255, 155, 155, .20); color: var(--bad);  border-color: rgba(255, 155, 155, .50); }
[data-theme="light"] .verify-pill.ok   { color: #14532d; background: rgba(22, 101, 52, .14); border-color: rgba(22, 101, 52, .40); }
[data-theme="light"] .verify-pill.fail { color: #7f1d1d; background: rgba(155, 28, 28, .12);  border-color: rgba(155, 28, 28, .35); }
.verify-summary {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--muted);
}
.attack-explain {
  margin: 10px 0 0;
  font-family: var(--font-prose);
  font-size: .92rem;
  line-height: 1.55;
  color: var(--text-soft);
}
.row-used-dot {
  display: inline-block;
  width: 10px; height: 10px;
  background: rgba(159, 188, 255, .55);
  border: 1px solid rgba(159, 188, 255, .85);
  border-radius: 2px;
  vertical-align: -1px;
  margin: 0 2px;
}
[data-theme="light"] .row-used-dot {
  background: rgba(29, 78, 216, .25);
  border-color: rgba(29, 78, 216, .65);
}

/* -------- interactive: Encoding (1-D bitwise modular) -------- */
.enc-interactive { /* inherits from .interactive */ }
.enc-lead {
  margin: 0 0 14px;
  font-family: var(--font-prose);
  color: var(--text-soft);
  font-size: .98rem;
  line-height: 1.55;
}
.enc-controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: flex-end;
}
.enc-control-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.enc-control-group legend {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  padding: 0;
  margin-bottom: 4px;
}
.enc-segmented {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.enc-segmented .preset-btn {
  min-width: 36px;
  padding: 6px 10px;
  font-size: .9rem;
  line-height: 1.1;
  flex: 0 0 auto;
}

/* Z_q ring (rendered as a horizontal grid; semantically a ring via the
   decoding-region coloring + caption legend) */
.enc-ring-figure {
  margin: 0 0 14px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.enc-ring {
  display: grid;
  gap: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  background: var(--border);
}
.enc-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text);
  background: var(--bg-2);
}
.enc-cell.region-0 { background: rgba(116, 228, 168, .14); }
.enc-cell.region-1 { background: rgba(159, 188, 255, .14); }
.enc-cell.region-tie {
  background: var(--bg-3);
  color: var(--muted);
}
.enc-cell.region-edge {
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.enc-cell.code-0::before,
.enc-cell.code-1::before {
  content: "";
  position: absolute;
  top: 2px; right: 2px;
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1px solid var(--text);
}
.enc-cell.code-0::before { background: var(--good); }
.enc-cell.code-1::before { background: var(--link); }
.enc-cell.received {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}
.enc-cell.received::after {
  content: "▼";
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  font-size: 12px;
  text-shadow: 0 1px 0 var(--bg);
}
[data-theme="light"] .enc-cell.region-0 { background: rgba(22, 101, 52, .10); }
[data-theme="light"] .enc-cell.region-1 { background: rgba(29, 78, 216, .10); }

.enc-ring-caption {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--font-prose);
  font-style: italic;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.6;
}
.enc-ring-caption code { font-style: normal; }
.legend-chip {
  display: inline-block;
  width: 12px; height: 12px;
  vertical-align: -2px;
  margin-right: 4px;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
}
.legend-region-0 { background: rgba(116, 228, 168, .55); }
.legend-region-1 { background: rgba(159, 188, 255, .55); }
.legend-code {
  background: var(--bg);
  position: relative;
}
.legend-code::after {
  content: "";
  display: block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--good);
  margin: 2px 0 0 5px;
}
.legend-received { background: var(--accent); }

/* outcome lines */
.enc-outcome {
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: .9rem;
}
.enc-outcome.enc-ok  { background: rgba(116, 228, 168, .08); border-color: rgba(116, 228, 168, .45); }
.enc-outcome.enc-bad { background: var(--accent-soft); border-color: var(--accent); }
.enc-outcome-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 3px 0;
}
.enc-tag {
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  min-width: 78px;
}
.enc-tag-sub {
  font-family: var(--font-prose);
  font-style: italic;
  font-size: .78rem;
  color: var(--muted);
}
.enc-verdict {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .82rem;
  padding: 2px 8px;
  border-radius: 999px;
}
.enc-verdict-ok  { background: rgba(116, 228, 168, .25); color: var(--good); border: 1px solid rgba(116, 228, 168, .45); }
.enc-verdict-bad { background: rgba(255, 155, 155, .20); color: var(--bad);  border: 1px solid rgba(255, 155, 155, .45); }
[data-theme="light"] .enc-verdict-ok  { color: #14532d; }
[data-theme="light"] .enc-verdict-bad { color: #7f1d1d; }

/* δ panel */
.delta-panel {
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.delta-panel.delta-safe   { background: rgba(116, 228, 168, .08); border-color: rgba(116, 228, 168, .45); }
.delta-panel.delta-unsafe { background: var(--accent-soft); border-color: var(--accent); }
.delta-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.delta-label {
  display: block;
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 2px;
}
.delta-formula {
  font-family: var(--font-mono);
  font-size: .9rem;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.delta-pill {
  font-family: var(--font-mono);
  font-size: .76rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
}
.delta-pill-ok  { background: rgba(116, 228, 168, .20); color: var(--good); border-color: rgba(116, 228, 168, .50); }
.delta-pill-bad { background: rgba(255, 155, 155, .20); color: var(--bad);  border-color: rgba(255, 155, 155, .50); }
[data-theme="light"] .delta-pill-ok  { color: #14532d; }
[data-theme="light"] .delta-pill-bad { color: #7f1d1d; }

.pmf-strip {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 70px;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.pmf-bar-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.pmf-bar {
  width: 80%;
  border-radius: 2px 2px 0 0;
  transition: height .25s var(--ease), background-color .25s var(--ease);
}
.pmf-bar-ok   { background: var(--muted); }
.pmf-bar-fail { background: var(--bad); }
[data-theme="light"] .pmf-bar-ok   { background: var(--muted); }
[data-theme="light"] .pmf-bar-fail { background: var(--bad); }
.pmf-bar-k {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--muted);
  margin-top: 2px;
}
.delta-explain {
  margin: 0;
  font-family: var(--font-prose);
  font-size: .92rem;
  line-height: 1.55;
  color: var(--text-soft);
}

.enc-non-claim {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-3);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-prose);
  font-size: .88rem;
  line-height: 1.55;
  color: var(--text-soft);
}
.enc-non-claim strong { color: var(--text); }
.enc-non-claim a { color: var(--link); }

/* export panel */
.export-panel {
  margin-top: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg);
}
.export-panel > summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
  list-style: none;
}
.export-panel > summary::-webkit-details-marker { display: none; }
.export-panel > summary::before {
  content: "▾";
  display: inline-block;
  margin-right: 6px;
  color: var(--muted);
}
.export-note {
  margin: 8px 0;
  font-size: .82rem;
  color: var(--muted);
  font-family: var(--font-prose);
  line-height: 1.5;
}
.export-text {
  width: 100%;
  padding: 8px 10px;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .82rem;
  resize: vertical;
}
.export-text:focus { outline: 2px solid var(--ring); outline-offset: 1px; }

.matrix-caption {
  font-family: var(--font-prose);
  font-style: italic;
  color: var(--muted);
  font-size: .9rem;
  margin-top: 12px;
  text-align: left;
  line-height: 1.55;
}

/* outcome banner */
.outcome {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-family: var(--font-prose);
  font-size: 1rem;
  line-height: 1.6;
  border: 1px solid var(--border-strong);
  display: flex; align-items: flex-start; gap: 12px;
}
.outcome.solvable {
  background: rgba(116, 228, 168, .12);
  border-color: rgba(116, 228, 168, .45);
  color: var(--text);
}
.outcome.hard {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}
.outcome-icon {
  flex-shrink: 0;
  margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .82rem;
}
.outcome.solvable .outcome-icon { background: var(--good); color: #052e16; }
.outcome.hard .outcome-icon { background: var(--accent); color: #1a1300; }
.outcome-body { flex: 1; min-width: 0; }
.outcome .label {
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .72rem;
  margin-right: 8px;
}
.outcome.solvable .label { color: var(--good); }
.outcome.hard .label { color: var(--accent); }
[data-theme="light"] .outcome.solvable .label { color: #14532d; }
[data-theme="light"] .outcome.hard .label { color: var(--accent-strong); }

.outcome .recovered {
  font-family: var(--font-mono);
  color: var(--code-text);
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* -------- references -------- */
.references {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.references-heading {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 700;
}
.references-note {
  margin: 0 0 14px;
  font-size: .82rem;
  color: var(--muted);
}
.references-note code {
  font-family: var(--font-mono);
  font-size: .92em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.reference-list {
  list-style: none;
  counter-reset: ref-counter;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}
.reference-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  counter-increment: ref-counter;
}
.reference-item .ref-id {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--accent);
  font-weight: 700;
  padding-top: 2px;
  white-space: nowrap;
}
.reference-item .ref-id-link {
  color: var(--accent);
  text-decoration: none;
}
.reference-item .ref-id-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.reference-item .ref-text {
  color: var(--text-soft);
  font-size: .92rem;
  line-height: 1.55;
  font-family: var(--font-prose);
}
.reference-item .ref-link-row {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: .82rem;
  word-break: break-all;
}
.reference-item .ref-link {
  color: var(--link);
}

/* -------- footer -------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 20px 28px;
  background: var(--bg-2);
}
.footer-row {
  max-width: 1240px;
  margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  color: var(--muted);
  font-size: .86rem;
}
.footer-cell { white-space: nowrap; }
.dot { color: var(--border-strong); }
.scripture {
  max-width: 1240px;
  margin: 12px auto 0;
  color: var(--muted);
  font-family: var(--font-prose);
  font-style: italic;
  font-size: .92rem;
}

/* -------- motion -------- */
.view, .interactive, .compare-grid { animation: fade-in .25s var(--ease); }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* -------- responsive: tablet -------- */
@media (max-width: 1020px) {
  .compare-grid { grid-template-columns: 1fr; }
  .layout { padding: 24px; gap: 24px; }
}

/* -------- responsive: mobile -------- */
@media (max-width: 880px) {
  .layout {
    display: block;
    padding: 16px;
  }

  /* sidebar becomes a horizontal chip strip at top */
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 18px;
    padding: 0 0 14px 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-section + .sidebar-section { margin-top: 0; }
  .sidebar-heading { display: none; }
  .sidebar-hint { display: none; }
  .sidebar-shortcuts { display: none; }

  /* tighten the intro disclosure on mobile */
  .atlas-intro { padding: 0 16px; }
  .atlas-intro > summary { padding: 12px 14px; font-size: .88rem; }
  .atlas-intro-body { padding: 14px 16px; font-size: .92rem; }

  .concept-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    /* hide scrollbar but keep functionality */
    scrollbar-width: none;
  }
  .concept-list::-webkit-scrollbar { display: none; }

  .concept-link {
    flex: 0 0 auto;
    min-height: var(--tap-min);
    padding: 10px 14px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    scroll-snap-align: start;
    font-size: .92rem;
  }
  .concept-link .grade { display: inline; }
  .concept-link[aria-current="page"] { box-shadow: none; }

  /* header compact */
  .site-header { padding: 10px 16px; }
  .brand-tag { display: none; }

  /* tabs fill width */
  .tabs { width: 100%; }
  .tab {
    flex: 1 1 0;
    justify-content: center;
    padding: 10px 8px;
    font-size: .9rem;
  }

  .interactive { padding: 16px; }
  .interactive-header { gap: 12px; }
  .interactive-controls { width: 100%; }
  .interactive-controls .btn { flex: 1; }

  .footer-row { font-size: .82rem; }
  .footer-row .footer-cell:last-of-type { display: none; }
}

/* -------- responsive: small mobile -------- */
@media (max-width: 420px) {
  .site-header { padding: 8px 12px; }
  .brand-name { font-size: .98rem; }
  .layout { padding: 14px; }
  .concept-title { font-size: 1.45rem; }
  .meta { grid-template-columns: 1fr; }
  .tab .tab-num { display: none; }
}

/* -------- print -------- */
@media print {
  .site-header, .site-nav, .sidebar, .tabs, .interactive, .footer-row { display: none; }
  body { background: #fff; color: #000; }
  .view { max-width: none; }
}
