:root {
  color-scheme: light;
  --green-300: #5CE79A; --green-500: #00B072; --green-900: #005054;
  --gold-500: #D8B56B;
  --teal-600: #0D9488;
  --fajr: #A2B9EB; --dhuhr: #FFD740; --asr: #FF8C42; --maghrib: #FF5252; --isha: #2E3A87;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --text-xs: 0.75rem; --text-sm: 0.8125rem;
  --text-base: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --text-h3: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --text-h2: clamp(1.5rem, 1.25rem + 1vw, 2.125rem);
  --text-hero: clamp(2.25rem, 1.4rem + 3.6vw, 4.25rem);
  --space-block: clamp(2.5rem, 2rem + 2vw, 4.5rem);
  --radius-sm: 8px; --radius: 14px;
  --duration: 220ms; --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w: 296px; --toc-w: 218px; --header-h: 60px;
}
:root, :root[data-theme="light"] {
  --bg: #FBFAF7;
  --bg-tint: radial-gradient(120% 80% at 12% -10%, #E8F7EE 0%, transparent 55%), radial-gradient(90% 60% at 100% 0%, #FBF4E4 0%, transparent 50%);
  --surface: #FFFFFF; --surface-2: #F4F3EE; --surface-sunken: #F0EFE9;
  --text: #16211C; --text-soft: #4C5A53; --text-faint: #7C8983;
  --border: #E3E2DA; --border-strong: #CFCEC3;
  --accent: #00B072; --accent-ink: #00694A; --accent-wash: #EBF9F1;
  --gold-ink: #7A5A21; --gold-wash: #FBF3E2; --warn-ink: #B45309;
  --shadow-sm: 0 1px 2px rgba(22,33,28,.06), 0 2px 8px rgba(22,33,28,.04);
  --shadow-md: 0 2px 6px rgba(22,33,28,.06), 0 12px 32px rgba(22,33,28,.07);
  --nav-glass: rgba(251,250,247,.82); --and-ink: #7C4DBE;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --teal-600: #2DD4BF;
  --bg: #060B22;
  --bg-tint: radial-gradient(120% 80% at 10% -10%, #0B2A31 0%, transparent 55%), radial-gradient(90% 60% at 100% 0%, #191539 0%, transparent 50%);
  --surface: #0D1533; --surface-2: #111B3D; --surface-sunken: #0A1029;
  --text: #EDF1F5; --text-soft: #A9B4C6; --text-faint: #77839A;
  --border: #1E2A52; --border-strong: #2B3A6B;
  --accent: #00D08A; --accent-ink: #55D8B4; --accent-wash: rgba(0,182,132,.12);
  --gold-ink: #E5C888; --gold-wash: rgba(216,181,107,.12); --warn-ink: #FBBF24;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,.35), 0 18px 48px rgba(0,0,0,.4);
  --nav-glass: rgba(6,11,34,.82); --and-ink: #C4A6F5;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
body {
  margin: 0; font-family: var(--font-sans); font-size: var(--text-base); line-height: 1.65;
  color: var(--text); background: var(--bg); background-image: var(--bg-tint);
  background-repeat: no-repeat; background-attachment: fixed;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.topbar {
  position: sticky; top: 0; z-index: 60;
  padding: 0 clamp(14px, 2vw, 26px);
  background: var(--nav-glass); backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: 12px; height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.02em; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; flex-shrink: 0; }
.brand span { color: var(--text); font-size: 1.0625rem; }
.brand b { color: var(--teal-600); font-weight: 650; }
.brand em { font-style: normal; color: var(--text-faint); font-weight: 400; font-size: 0.9375rem; }
.download-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 999px; background: #0D9488; color: #fff; font-size: var(--text-sm); font-weight: 600; flex-shrink: 0; transition: background var(--duration) var(--ease), transform var(--duration) var(--ease); }
.download-btn:hover { background: #0F766E; color: #fff; text-decoration: none; transform: translateY(-1px); }
.download-btn:active { transform: translateY(0) scale(.97); }
.download-btn svg { width: 15px; height: 15px; }
.topbar .spacer { flex: 1; }
.search-wrap { position: relative; flex: 0 1 320px; min-width: 0; }
.search-wrap > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); pointer-events: none; }
#nav-search { width: 100%; height: 36px; padding: 0 34px 0 33px; font: inherit; font-size: var(--text-sm); color: var(--text); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 999px; transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease); }
#nav-search::placeholder { color: var(--text-faint); }
#nav-search:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }
.search-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 600 10px/1 var(--font-mono); color: var(--text-faint); background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 4px 5px; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-soft); cursor: pointer; transition: transform var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease); }
.icon-btn:hover { color: var(--accent-ink); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0) scale(.96); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: initial; }
:root[data-theme="dark"] .icon-btn .moon { display: none; }
#menu-btn { display: none; }

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); align-items: start; max-width: 1600px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; padding: 26px 18px 60px clamp(14px, 2vw, 26px); border-right: 1px solid var(--border); scrollbar-width: thin; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
.nav-group { margin-bottom: 22px; }
.nav-group > .nav-label { display: flex; align-items: baseline; gap: 8px; font-size: var(--text-xs); font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 8px 10px; }
.nav-group > .nav-label .num { font-family: var(--font-mono); font-size: 9px; font-weight: 600; color: var(--accent-ink); background: var(--accent-wash); border-radius: 4px; padding: 2px 4px; letter-spacing: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 6px 12px 6px 11px; border-radius: 9px; font-size: var(--text-sm); color: var(--text-soft); border-left: 2px solid transparent; transition: color var(--duration) var(--ease), background var(--duration) var(--ease), border-color var(--duration) var(--ease); }
.sidebar li a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar li a.active { color: var(--accent-ink); font-weight: 600; background: var(--accent-wash); border-left-color: var(--accent); }
.sidebar li a mark { background: var(--gold-wash); color: var(--gold-ink); border-radius: 3px; padding: 0 2px; }
.sidebar li.hidden, .nav-group.hidden { display: none; }
/* The version numbers under "Release history": a step further in, and quieter
   than the entries above them — a list of numbers, not of topics. Tabular
   figures so the column of versions lines up. */
.sidebar .nav-sub { margin: 2px 0 6px; }
.sidebar .nav-sub li a { padding-left: 26px; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.sidebar .nav-sub li a:hover { color: var(--text); }
.no-results { display: none; font-size: var(--text-sm); color: var(--text-faint); padding: 12px; }
.no-results.show { display: block; }

.content { min-width: 0; padding: 0 clamp(16px, 3vw, 52px) 120px; }
.content-inner { max-width: 820px; margin: 0 auto; }
@media (min-width: 1400px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }
  .toc { display: block; }
}
.toc { display: none; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 34px 24px 60px 6px; font-size: var(--text-sm); }
.toc h4 { margin: 0 0 10px; font-size: var(--text-xs); letter-spacing: .09em; text-transform: uppercase; color: var(--text-faint); font-weight: 650; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 4px 0 4px 12px; color: var(--text-faint); border-left: 2px solid var(--border); line-height: 1.4; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }

.hero { padding: clamp(48px, 6vw, 92px) 0 clamp(30px, 4vw, 54px); position: relative; }
.hero::before { content: ""; position: absolute; inset: auto auto 0 -14vw; width: 46vw; height: 46vw; max-width: 560px; max-height: 560px; background: radial-gradient(circle at 30% 30%, var(--accent-wash), transparent 62%); z-index: -1; pointer-events: none; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-wash); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 999px; padding: 5px 13px; }
.hero h1 { font-size: var(--text-hero); line-height: 1.02; letter-spacing: -.035em; font-weight: 700; margin: 20px 0 0; text-wrap: balance; }
.hero h1 .thin { font-family: var(--font-serif); font-weight: 400; font-style: italic; letter-spacing: -.015em; color: var(--text-soft); }
.hero .lede { font-size: var(--text-lg); color: var(--text-soft); max-width: 60ch; margin: 22px 0 0; text-wrap: pretty; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 0; margin: 34px 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.hero-stats div { flex: 1 1 130px; min-width: 0; padding: 15px 18px; border-left: 1px solid var(--border); }
.hero-stats div:first-child { border-left: 0; }
.hero-stats dt { font-size: var(--text-xs); color: var(--text-faint); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.hero-stats dd { margin: 3px 0 0; font-size: 1.375rem; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-note { margin: 26px 0 0; padding: 14px 16px; font-size: var(--text-sm); color: var(--text-soft); border-left: 3px solid var(--gold-500); background: var(--gold-wash); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.part { margin-top: var(--space-block); padding-top: 18px; border-top: 1px solid var(--border); }
.part > .part-label { display: flex; align-items: center; gap: 10px; font-size: var(--text-xs); font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 6px; }
.part > .part-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.part > .part-intro { color: var(--text-soft); margin: 0 0 8px; max-width: 62ch; }
section[id] { padding-top: 30px; margin-bottom: 8px; }
h2 { font-size: var(--text-h2); line-height: 1.15; letter-spacing: -.03em; font-weight: 680; margin: 0 0 4px; text-wrap: balance; display: flex; align-items: baseline; gap: 12px; }
h2 .idx { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; color: var(--accent-ink); background: var(--accent-wash); border-radius: 6px; padding: 4px 7px; letter-spacing: 0; flex-shrink: 0; transform: translateY(-2px); }
h3 { font-size: var(--text-h3); font-weight: 640; letter-spacing: -.02em; margin: 32px 0 6px; text-wrap: balance; }
h4 { font-size: 0.9375rem; font-weight: 650; letter-spacing: -.01em; margin: 22px 0 4px; color: var(--text); }
.section-lede { color: var(--text-soft); font-size: var(--text-lg); margin: 10px 0 4px; max-width: 62ch; text-wrap: pretty; }
p { margin: 12px 0; max-width: 68ch; text-wrap: pretty; }
ul.body, ol.body { margin: 12px 0; padding-left: 20px; max-width: 68ch; }
ul.body li, ol.body li { margin: 5px 0; }
ul.body li::marker { color: var(--accent); }
ol.body li::marker { color: var(--text-faint); font-variant-numeric: tabular-nums; font-weight: 600; }
strong { font-weight: 640; }

.path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0; padding: 9px 12px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 10px; font-size: var(--text-sm); }
.path .lbl { font-weight: 650; color: var(--text-faint); font-size: var(--text-xs); letter-spacing: .06em; text-transform: uppercase; margin-right: 2px; }
.path code { font: 600 var(--text-sm)/1.4 var(--font-sans); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; color: var(--text); }
.path .sep { color: var(--text-faint); font-size: 11px; }

.table-scroll { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead th { text-align: left; font-weight: 650; font-size: var(--text-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td code, p code, li code, .inner code { font: 500 0.8125em/1.4 var(--font-mono); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.num-col { font-variant-numeric: tabular-nums; white-space: nowrap; }

.callout { margin: 18px 0; padding: 14px 16px 14px 44px; position: relative; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: var(--text-sm); box-shadow: var(--shadow-sm); }
.callout::before { content: ""; position: absolute; left: 15px; top: 16px; width: 17px; height: 17px; background-repeat: no-repeat; background-size: contain; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout p, .callout ul.body, .callout ol.body { max-width: 66ch; }
.callout .t { display: block; font-weight: 650; margin-bottom: 2px; letter-spacing: -.01em; }
.callout.tip { border-color: color-mix(in srgb, var(--accent) 28%, var(--border)); background: var(--accent-wash); }
.callout.tip .t { color: var(--accent-ink); }
.callout.tip::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300A06A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7V17h8v-2.3A7 7 0 0 0 12 2z'/%3E%3C/svg%3E"); }
.callout.note { border-color: var(--border-strong); }
.callout.note::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C8983' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.01'/%3E%3C/svg%3E"); }
.callout.warn { border-color: color-mix(in srgb, var(--asr) 40%, var(--border)); background: color-mix(in srgb, var(--asr) 8%, var(--surface)); }
.callout.warn .t { color: var(--warn-ink); }
.callout.warn::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF8C42' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19L12 3.5z'/%3E%3Cpath d='M12 10v4M12 17.5v.01'/%3E%3C/svg%3E"); }
.callout.premium { border-color: color-mix(in srgb, var(--gold-500) 40%, var(--border)); background: var(--gold-wash); }
.callout.premium .t { color: var(--gold-ink); }
.callout.premium::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239B7435' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8l4.5 3L12 4l4.5 7L21 8l-1.8 11H4.8L3 8z'/%3E%3C/svg%3E"); }

.cards { display: grid; gap: 12px; margin: 18px 0; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); }
.card { padding: 15px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease), border-color var(--duration) var(--ease); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card h5 { margin: 0 0 4px; font-size: 0.9375rem; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 7px; }
.card p { margin: 0; font-size: var(--text-sm); color: var(--text-soft); max-width: none; }
.card .dot { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; background: var(--accent); }

.tag { display: inline-block; vertical-align: middle; font-size: 10px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; white-space: nowrap; border: 1px solid transparent; }
.tag.pro { color: var(--gold-ink); background: var(--gold-wash); border-color: color-mix(in srgb, var(--gold-500) 35%, transparent); }
.tag.ios { color: var(--accent-ink); background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.tag.and { color: var(--and-ink); background: color-mix(in srgb, #7C4DBE 10%, transparent); border-color: color-mix(in srgb, #7C4DBE 28%, transparent); }
.tag.free { color: var(--text-soft); background: var(--surface-sunken); border-color: var(--border); }

details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 10px 0; box-shadow: var(--shadow-sm); overflow: hidden; }
details[open] { border-color: var(--border-strong); }
summary { cursor: pointer; padding: 13px 16px 13px 40px; font-weight: 620; font-size: 0.9375rem; letter-spacing: -.01em; position: relative; list-style: none; transition: background var(--duration) var(--ease); }
summary::-webkit-details-marker { display: none; }
summary:hover { background: var(--surface-2); }
summary::before { content: ""; position: absolute; left: 15px; top: 50%; width: 9px; height: 9px; margin-top: -5px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); transition: transform var(--duration) var(--ease); }
details[open] summary::before { transform: rotate(45deg); }
details .inner { padding: 12px 16px 14px 40px; font-size: var(--text-sm); color: var(--text-soft); border-top: 1px solid var(--border); }
details .inner > :first-child { margin-top: 0; }
details .inner > :last-child { margin-bottom: 0; }
details .inner p, details .inner ul.body, details .inner ol.body { max-width: 66ch; }

figure.shot { margin: 20px 0; }
figure.shot img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); box-shadow: var(--shadow-sm); }
figure.shot.phone img { max-width: 300px; margin-inline: auto; }
figure.shot figcaption { margin-top: 9px; font-size: var(--text-sm); color: var(--text-faint); max-width: 66ch; text-wrap: pretty; }

.prayer-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.prayer-strip div { flex: 1 1 90px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; border-top: 3px solid var(--c); box-shadow: var(--shadow-sm); }
.prayer-strip span { display: block; font-size: var(--text-xs); color: var(--text-faint); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.prayer-strip b { display: block; font-size: 0.9375rem; font-weight: 640; letter-spacing: -.01em; margin-top: 2px; }

.anchor { margin-left: 8px; font-size: 0.7em; color: var(--text-faint); opacity: 0; transition: opacity var(--duration) var(--ease); text-decoration: none; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--accent); text-decoration: none; }

footer { margin-top: 70px; padding-top: 26px; border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-faint); }
footer p { max-width: 62ch; }
footer .foot-grid { display: flex; flex-wrap: wrap; gap: 26px; justify-content: space-between; align-items: flex-end; }

#to-top { position: fixed; right: 20px; bottom: 20px; z-index: 55; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--nav-glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--text-soft); cursor: pointer; display: grid; place-items: center; opacity: 0; pointer-events: none; box-shadow: var(--shadow-md); transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), color var(--duration) var(--ease); }
#to-top.show { opacity: 1; pointer-events: auto; }
#to-top:hover { color: var(--accent-ink); transform: translateY(-2px); }
#to-top svg { width: 17px; height: 17px; }

@media (max-width: 1024px) { :root { --sidebar-w: 260px; } }
@media (max-width: 860px) {
  #menu-btn { display: grid; }
  .search-kbd { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: var(--header-h) auto 0 0; width: min(84vw, 320px); z-index: 58; background: var(--bg); background-image: var(--bg-tint); transform: translateX(-102%); transition: transform var(--duration) var(--ease); box-shadow: var(--shadow-md); padding-left: 18px; }
  .sidebar.open { transform: translateX(0); }
  .scrim { position: fixed; inset: var(--header-h) 0 0; z-index: 57; background: rgba(0,0,0,.38); opacity: 0; pointer-events: none; transition: opacity var(--duration) var(--ease); }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .hero-stats div { flex-basis: 46%; }
}
@media (max-width: 560px) {
  .search-wrap { flex: 1 1 auto; }
  .brand em { display: none; }
  .brand span { display: none; }
  .download-btn { width: 38px; padding: 0; justify-content: center; }
  .download-btn > span { display: none; }
  h2 { flex-direction: column; gap: 6px; }
  h2 .idx { transform: none; }
  .hero-stats div { flex-basis: 100%; border-left: 0; border-top: 1px solid var(--border); }
  .hero-stats div:first-child { border-top: 0; }
}
@media print {
  .topbar, .sidebar, .toc, #to-top, .scrim { display: none !important; }
  .shell { display: block; max-width: none; }
  body { background: #fff; color: #000; }
  section[id], details { break-inside: avoid; }
  details .inner { display: block !important; }
}

/* ---- multi-page guide: home link, page head, part index, pager ---------- */

.nav-home { display: flex; align-items: center; gap: 9px; padding: 7px 12px; margin: 0 0 20px; border-radius: 9px; font-size: var(--text-sm); font-weight: 600; color: var(--text-soft); border-left: 2px solid transparent; transition: color var(--duration) var(--ease), background var(--duration) var(--ease); }
.nav-home svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-home:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-home.active { color: var(--accent-ink); background: var(--accent-wash); border-left-color: var(--accent); }
a.nav-label { text-decoration: none; }
a.nav-label:hover { color: var(--accent-ink); text-decoration: none; }
.nav-group.current > .nav-label { color: var(--accent-ink); }
.nav-group.current > .nav-label .num { background: var(--accent); color: #fff; }

.page-head { padding: clamp(34px, 5vw, 60px) 0 6px; position: relative; }
.page-head::before { content: ""; position: absolute; inset: auto auto 0 -14vw; width: 42vw; height: 42vw; max-width: 480px; max-height: 480px; background: radial-gradient(circle at 30% 30%, var(--accent-wash), transparent 62%); z-index: -1; pointer-events: none; }
.page-eyebrow { display: inline-flex; align-items: center; gap: 9px; margin: 0; font-size: var(--text-xs); font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.page-eyebrow .num { font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--accent-ink); background: var(--accent-wash); border-radius: 5px; padding: 3px 6px; letter-spacing: 0; }
.page-head h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3.25rem); line-height: 1.05; letter-spacing: -.035em; font-weight: 700; margin: 14px 0 0; text-wrap: balance; }
.page-intro { font-size: var(--text-lg); color: var(--text-soft); max-width: 60ch; margin: 16px 0 0; text-wrap: pretty; }
.page-head + section[id] { padding-top: 34px; }

.part-index { margin-top: var(--space-block); padding-top: 18px; border-top: 1px solid var(--border); }
.part-index > .part-label { display: flex; align-items: center; gap: 10px; font-size: var(--text-xs); font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 6px; }
.part-index > .part-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.part-index > .part-intro { color: var(--text-soft); margin: 0 0 8px; max-width: 62ch; }
.part-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; margin: 22px 0 0; }
.part-card { display: flex; flex-direction: column; gap: 5px; padding: 16px 17px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--text); transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
.part-card:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); box-shadow: var(--shadow-md); }
.part-card-num { font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--accent-ink); background: var(--accent-wash); border-radius: 5px; padding: 3px 6px; align-self: flex-start; }
.part-card-title { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.02em; margin-top: 3px; }
.part-card-intro { font-size: var(--text-sm); color: var(--text-soft); line-height: 1.5; }
.part-card-meta { margin-top: auto; padding-top: 8px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.start-btn { display: inline-flex; align-items: center; gap: 9px; margin-top: 26px; height: 46px; padding: 0 22px; border-radius: 999px; background: #0D9488; color: #fff; font-weight: 600; font-size: var(--text-base); transition: background var(--duration) var(--ease), transform var(--duration) var(--ease); }
.start-btn:hover { background: #0F766E; color: #fff; text-decoration: none; transform: translateY(-1px); }
.start-btn svg { width: 17px; height: 17px; }

.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: var(--space-block); padding-top: 26px; border-top: 1px solid var(--border); }
.pager-link { display: flex; flex-direction: column; gap: 5px; padding: 15px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); min-width: 0; transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
a.pager-link:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); box-shadow: var(--shadow-md); }
.pager-link.next { text-align: right; align-items: flex-end; }
.pager-dir { font-size: var(--text-xs); font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.pager-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pager-num { font-size: var(--text-xs); color: var(--text-faint); font-weight: 600; letter-spacing: .04em; }
.pager-title { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.pager-link.is-end { background: var(--surface-2); box-shadow: none; }
.pager-link.is-end .pager-dir { color: var(--text-faint); }
.pager-link.is-end .pager-title { color: var(--text-soft); font-weight: 600; }
.pager-progress { margin: 14px 0 0; text-align: center; font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); max-width: none; }
@media (max-width: 560px) {
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-link.next { text-align: left; align-items: flex-start; }
}
@media print { .pager, .nav-home { display: none !important; } }
