:root {
  --bg-canvas: #090e17;
  --bg-surface: #101826;
  --bg-elevated: #152033;
  --bg-subtle: #19263c;
  --bg-hover: #1e2e47;

  --border-subtle: #1e2d42;
  --border-default: #283b56;
  --border-strong: #39557a;

  --text-strong: #f1f6fc;
  --text-primary: #c9d6e6;
  --text-muted: #879bb5;
  --text-faint: #60748f;

  --accent: #3b9eff;
  --accent-bright: #68b5ff;
  --accent-deep: #1d74d6;
  --accent-soft: rgba(59, 158, 255, 0.12);
  --accent-border: rgba(92, 173, 255, 0.34);

  --gold: #eab354;
  --gold-bright: #f6ca75;
  --gold-soft: rgba(234, 179, 84, 0.11);
  --gold-border: rgba(234, 179, 84, 0.34);

  --emerald: #34d399;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --header-h: 68px;
  --container-max: 1140px;
  --gutter: clamp(18px, 3.5vw, 40px);

  --font-sans: "Inter", "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  color-scheme: dark;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 28px);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.78;
  background:
    radial-gradient(960px 460px at 18% -6%, rgba(45, 134, 235, 0.14), transparent 68%),
    radial-gradient(760px 380px at 88% 2%, rgba(234, 179, 84, 0.07), transparent 65%),
    var(--bg-canvas);
}

a {
  color: var(--accent-bright);
  text-decoration: underline;
  text-decoration-color: rgba(104, 181, 255, 0.42);
  text-underline-offset: 4px;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

a:hover {
  color: #93cbff;
  text-decoration-color: currentColor;
}

button {
  font: inherit;
}

:is(a, button, summary):focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: rgba(59, 158, 255, 0.32);
  color: var(--text-strong);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

p {
  margin: 8px 0;
}

strong {
  color: var(--text-strong);
  font-weight: 600;
}

:is(h1, h2, h3) {
  color: var(--text-strong);
  line-height: 1.32;
  letter-spacing: -0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 750;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0;
  font-size: clamp(19px, 2vw, 23px);
  font-weight: 700;
}

h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 650;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

code {
  padding: 2px 7px;
  color: #82c4ff;
  background: rgba(59, 158, 255, 0.12);
  border: 1px solid rgba(92, 173, 255, 0.24);
  border-radius: 5px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 8px;
  color: var(--text-strong);
  background: linear-gradient(180deg, #24354d 0%, #182538 100%);
  border: 1px solid #3c5476;
  border-bottom-color: #2c405c;
  border-radius: 6px;
  box-shadow: 0 2px 0 #0c1420, inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-weight: 600;
  line-height: 1.4;
}

small {
  font-size: 12px;
}

.skip {
  position: fixed;
  top: -80px;
  left: 18px;
  z-index: 100;
  padding: 10px 16px;
  color: var(--text-strong);
  background: var(--accent-deep);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip:focus {
  top: 14px;
}

/* ==========================================================================
   Sticky Top Navigation Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 17, 28, 0.84);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid rgba(56, 82, 115, 0.42);
  box-shadow: 0 8px 28px rgba(3, 7, 14, 0.35);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: var(--container-max);
  min-height: var(--header-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text-strong);
  text-decoration: none;
}

.brand:hover {
  color: #ffffff;
}

.brand-mark {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(92, 173, 255, 0.4);
  box-shadow: 0 0 18px rgba(59, 158, 255, 0.22);
  object-fit: cover;
}

.brand strong {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.header-sep {
  width: 1px;
  height: 18px;
  background: var(--border-default);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  color: var(--text-muted);
  background: rgba(25, 38, 60, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.75);
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-label {
  margin: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(9, 14, 23, 0.72);
  border: 1px solid var(--border-default);
  border-radius: 11px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link span {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
}

.nav-link:hover {
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link[aria-current="page"] {
  color: var(--text-strong);
  background: linear-gradient(180deg, rgba(59, 158, 255, 0.22), rgba(29, 116, 214, 0.16));
  border-color: var(--accent-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-link[aria-current="page"] span {
  color: var(--accent-bright);
}

.header-meta {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

/* ==========================================================================
   Main Container & Page Title
   ========================================================================== */
.page {
  min-width: 0;
}

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: 32px var(--gutter) 48px;
}

/* ==========================================================================
   Download & Purchase Bento Hero (index.html)
   ========================================================================== */
.download-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(250px, 1fr);
  gap: 16px;
  margin-bottom: 34px;
}

.download-section {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(22px, 2.6vw, 30px);
  background:
    radial-gradient(460px 220px at 100% 0%, rgba(59, 158, 255, 0.16), transparent 72%),
    linear-gradient(165deg, #132035 0%, #0f1827 100%);
  border: 1px solid rgba(82, 138, 204, 0.36);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 36px rgba(3, 8, 18, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.download-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.download-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--accent-bright);
  background: rgba(59, 158, 255, 0.14);
  border: 1px solid var(--accent-border);
  border-radius: 12px;
}

.download-header h2 {
  font-size: clamp(21px, 2.2vw, 26px);
}

.download-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.download-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 11px 18px;
  border-radius: 11px;
  text-decoration: none;
  font-size: 15px;
}

.download-link svg {
  flex: none;
}

.download-link.is-primary {
  color: #ffffff;
  background: linear-gradient(180deg, #2d8ff5 0%, #1b72d4 100%);
  border: 1px solid #59adff;
  box-shadow: 0 6px 18px rgba(29, 116, 214, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.download-link.is-primary strong {
  color: #ffffff;
}

.download-link.is-primary:hover {
  background: linear-gradient(180deg, #3c9bff 0%, #227de2 100%);
  border-color: #82c2ff;
  transform: translateY(-1px);
}

.download-link.is-secondary {
  color: var(--text-strong);
  background: rgba(25, 39, 61, 0.85);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.download-link.is-secondary span {
  color: var(--accent-bright);
  display: inline-flex;
}

.download-link.is-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent-bright);
  transform: translateY(-1px);
}

.download-link.is-primary span {
  display: inline-flex;
}

.purchase-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(22px, 2.6vw, 30px);
  color: var(--text-strong);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(234, 179, 84, 0.2), transparent 72%),
    linear-gradient(165deg, #1f1c1b 0%, #141824 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 36px rgba(3, 8, 18, 0.42), inset 0 1px 0 rgba(255, 232, 185, 0.08);
}

.purchase-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--gold-bright);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
}

.purchase-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.purchase-body strong {
  color: #fff6e5;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.purchase-arrow {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--gold-bright);
  background: rgba(234, 179, 84, 0.14);
  border: 1px solid var(--gold-border);
  border-radius: 50%;
  font-size: 16px;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.purchase-link:hover {
  border-color: rgba(246, 202, 117, 0.62);
  transform: translateY(-2px);
}

.purchase-link:hover .purchase-arrow {
  background: rgba(234, 179, 84, 0.26);
  transform: translate(2px, -2px);
}

/* ==========================================================================
   Page Intro Header
   ========================================================================== */
.intro {
  margin: 0 0 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.breadcrumb {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
}

.breadcrumb span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb span span {
  color: var(--text-faint);
}

/* ==========================================================================
   Reading Grid & Sticky TOC
   ========================================================================== */
.reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 32px;
  align-items: start;
}

.article {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: 16px;
  background: rgba(16, 24, 38, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.toc strong {
  display: block;
  margin-bottom: 10px;
  padding-left: 10px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc a {
  position: relative;
  display: block;
  padding: 6px 10px;
  color: var(--text-muted);
  border-left: 2px solid var(--border-subtle);
  border-radius: 0 6px 6px 0;
  text-decoration: none;
  line-height: 1.45;
}

.toc a:hover {
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.03);
  border-left-color: var(--border-strong);
}

.toc a.is-active {
  color: var(--accent-bright);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ==========================================================================
   Callouts, Sections & Pills
   ========================================================================== */
.callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(234, 179, 84, 0.12) 0%, rgba(16, 24, 38, 0.92) 100%);
  border: 1px solid var(--gold-border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-md);
}

.callout-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  color: var(--gold-bright);
  background: var(--gold-soft);
  border-radius: 8px;
}

.callout-body {
  min-width: 0;
}

.callout strong {
  display: block;
  margin-bottom: 3px;
  color: #fff3db;
  font-size: 15px;
}

.callout p {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
}

.section {
  padding: clamp(20px, 2.6vw, 30px);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px rgba(3, 8, 16, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 22px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-subtle);
}

.section > h2 {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-head h2 {
  display: flex;
  align-items: center;
}

.section-head p {
  margin: 0;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  margin-right: 12px;
  padding: 0 8px;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  color: var(--gold-bright);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--gold-bright);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(246, 202, 117, 0.7);
}

/* ==========================================================================
   Step-by-Step Timeline
   ========================================================================== */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.steps > li {
  position: relative;
  margin: 0 0 0 15px;
  padding: 1px 0 24px 32px;
  border-left: 1px solid var(--border-default);
  counter-increment: steps;
}

.steps > li:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.steps > li::before {
  content: counter(steps, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: -16px;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: var(--accent-bright);
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  border-radius: 9px;
  box-shadow: 0 0 0 4px var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.steps h3 {
  margin: 4px 0 6px;
}

.steps p {
  margin: 6px 0 0;
  color: var(--text-primary);
}

.steps p.step-note {
  margin-top: 10px;
  padding: 10px 14px;
  color: #f7d99c;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
}

.steps p.step-note strong {
  color: #ffe8ba;
}

.section-foot-note {
  margin: 20px 0 0;
  padding: 12px 16px;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

/* ==========================================================================
   Checklists & Numbered Tiles
   ========================================================================== */
.checklist {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.figure + .checklist {
  margin-top: 20px;
}

.checklist li {
  position: relative;
  margin: 0;
  padding: 13px 16px 13px 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.checklist li::before {
  content: "";
  position: absolute;
  top: 21px;
  left: 16px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.18);
}

.checklist li:target {
  background: rgba(59, 158, 255, 0.1);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px rgba(59, 158, 255, 0.25);
}

.numbered-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: numlist;
}

.numbered-list li {
  position: relative;
  margin: 0;
  padding: 13px 16px 13px 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  counter-increment: numlist;
}

.numbered-list li::before {
  content: counter(numlist);
  position: absolute;
  top: 13px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

/* ==========================================================================
   Dual-Control Trigger Matrix (.modes)
   ========================================================================== */
.modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 26px;
}

.mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 16px 12px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mode kbd {
  min-width: 46px;
  padding: 4px 12px;
  font-size: 13.5px;
  color: var(--accent-bright);
  border-color: var(--accent-border);
}

.mode > span {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  color: var(--gold-bright);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.mode b {
  display: block;
  margin-top: 2px;
  color: var(--text-strong);
  font-size: 14.5px;
  font-weight: 650;
}

.mode small {
  color: var(--text-muted);
}

/* ==========================================================================
   Screenshots & Lightbox Figure
   ========================================================================== */
.figure {
  margin: 22px 0 0;
  padding: 12px;
  background: #0a101a;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.figure:hover {
  border-color: var(--accent-border);
  box-shadow: 0 8px 24px rgba(3, 8, 18, 0.45);
}

.figure a {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  cursor: zoom-in;
}

.figure img {
  margin-inline: auto;
  border-radius: 6px;
  transition: transform 0.22s ease;
}

.figure a:hover img {
  transform: scale(1.01);
}

.figure figcaption {
  padding: 10px 6px 2px;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}

/* ==========================================================================
   FAQ Accordion
   ========================================================================== */
.faq {
  display: grid;
  gap: 10px;
}

.faq details {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.faq details:hover {
  border-color: var(--border-default);
}

.faq details[open] {
  background: #162338;
  border-color: var(--border-strong);
}

.faq summary {
  position: relative;
  padding: 14px 44px 14px 18px;
  color: var(--text-strong);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent-bright);
  border-bottom: 2px solid var(--accent-bright);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.faq details[open] summary::after {
  transform: translateY(-30%) rotate(225deg);
}

.faq details > :not(summary) {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--text-primary);
}

.faq details > ul {
  padding-left: 36px;
}

.faq details > ul li + li {
  margin-top: 6px;
}

/* ==========================================================================
   Pagination & Footer
   ========================================================================== */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 6px;
}

.page-nav a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 210px;
  padding: 14px 18px;
  color: var(--text-strong);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  text-decoration: none;
}

.page-nav a:last-child:not(:first-child) {
  margin-left: auto;
  text-align: right;
}

.page-nav a:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.page-nav small {
  color: var(--text-muted);
  font-size: 12px;
}

.page-nav b {
  color: var(--accent-bright);
  font-size: 15px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 13px;
}

.footer a {
  padding: 5px 12px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  text-decoration: none;
  font-size: 12.5px;
}

.footer a:hover {
  color: var(--text-strong);
  border-color: var(--border-strong);
}

/* ==========================================================================
   Image Lightbox Dialog
   ========================================================================== */
.viewer {
  width: calc(100% - 28px);
  max-width: 1680px;
  max-height: 94dvh;
  padding: 0;
  color: var(--text-strong);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.72);
}

.viewer::backdrop {
  background: rgba(5, 9, 16, 0.86);
  backdrop-filter: blur(8px);
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 13px 18px;
  background: rgba(9, 14, 23, 0.75);
  border-bottom: 1px solid var(--border-subtle);
}

.viewer-bar strong {
  font-size: 14.5px;
}

.viewer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer .button {
  padding: 6px 12px;
  color: var(--text-strong);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 7px;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.viewer .button:hover {
  background: var(--bg-hover);
  border-color: var(--accent-bright);
}

.viewer .button[aria-pressed="true"] {
  color: var(--accent-bright);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.viewer-body {
  max-height: calc(94dvh - 118px);
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #070b12;
}

.viewer-body img {
  width: 100%;
  max-width: none;
  margin-inline: auto;
  border-radius: 6px;
}

.viewer-body.is-original img {
  width: auto;
  margin: 0;
}

.viewer-hint {
  margin: 8px 14px 10px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

body:has(.viewer[open]) {
  overflow: hidden;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1040px) {
  .nav-label,
  .header-meta {
    display: none;
  }

  .reading-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .toc {
    position: static;
    grid-row: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
  }

  .toc strong {
    width: auto;
    margin: 0 4px 0 0;
    padding: 0;
  }

  .toc a {
    padding: 5px 11px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 12.5px;
  }

  .toc a.is-active {
    border-color: var(--accent-border);
  }
}

@media (max-width: 820px) {
  .download-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-link {
    flex-direction: row;
    align-items: center;
    padding: 18px 22px;
  }
}

@media (max-width: 680px) {
  :root {
    --header-h: 108px;
    --gutter: 16px;
  }

  .header-inner {
    flex-wrap: wrap;
    padding-block: 10px;
    gap: 10px;
  }

  .brand-group {
    width: 100%;
    justify-content: space-between;
  }

  .header-sep {
    display: none;
  }

  .nav-group {
    width: 100%;
  }

  .site-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .nav-link {
    justify-content: center;
    padding: 7px 10px;
  }

  .container {
    padding-top: 20px;
    padding-bottom: 34px;
  }

  .download-panel {
    margin-bottom: 24px;
  }

  .download-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .modes {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .mode {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 10px;
    padding: 12px 14px;
    text-align: left;
  }

  .mode b {
    margin: 0 auto 0 4px;
  }

  .steps > li {
    margin-left: 13px;
    padding-left: 26px;
  }

  .page-nav {
    flex-direction: column;
  }

  .page-nav > span:empty {
    display: none;
  }

  .page-nav a,
  .page-nav a:last-child:not(:first-child) {
    width: 100%;
    margin-left: 0;
  }

  .viewer-body {
    max-height: calc(94dvh - 154px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .toc,
  .page-nav,
  .footer,
  .viewer,
  .download-panel {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  :is(h1, h2, h3, strong) {
    color: #000000;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .reading-layout {
    display: block;
  }

  .section,
  .checklist li,
  .numbered-list li,
  .faq details {
    break-inside: avoid;
    background: transparent;
    border-color: #cccccc;
    box-shadow: none;
  }

  a {
    color: inherit;
  }

  details::details-content {
    display: block;
  }
}
