@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url("../fonts/space-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("../fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url("../fonts/space-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("../fonts/space-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #06080b; --panel: #10151a; --ink: #e7ebef; --muted: #a9b3be; --line: #303941; --accent: #ffd8a6;
  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif; --display: var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --gutter: clamp(1rem, 4.6vw, 5.5rem);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dawn: #ffd8a6; --silver: #e7ebef;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html[data-guide] { scroll-behavior: auto; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.55 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: inherit; text-underline-offset: .2em; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: #ffdcaa; color: #17130f; }
.shell { width: min(calc(100% - 2 * var(--gutter)), 74rem); margin-inline: auto; }
.visually-hidden, .skip-link { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { clip-path: none; z-index: 10; top: .7rem; left: var(--gutter); width: auto; height: auto; padding: .5rem .85rem; color: var(--bg); background: var(--accent); }
.ui-icon { flex: none; vertical-align: middle; }
.guide-symbol { display: block; width: 100%; height: auto; max-width: 100%; pointer-events: none; }

/* One stage, with the lattice projected into the same square as the studio mark. */
.manual-stage {
  min-height: 100svh; position: relative; isolation: isolate; display: grid; place-items: center;
  padding: max(22px, env(safe-area-inset-top)) var(--gutter) max(70px, env(safe-area-inset-bottom));
}
.manual-composition { display: grid; justify-items: center; width: min(100%, 62rem); text-align: center; }
.sentinel {
  --cage: clamp(156px, min(30svh, 28vw), 295px);
  display: grid; place-items: center; position: relative; isolation: isolate;
  width: 100%; height: calc(var(--cage) * 1.36); touch-action: pan-y pinch-zoom;
}
.sentinel-anchor { display: block; position: relative; width: var(--cage); aspect-ratio: 1; pointer-events: none; }
[data-sentinel-still] {
  display: block; position: absolute; inset: -13%; width: 126%; height: 126%; max-width: none; object-fit: contain;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 84%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, #000 84%, transparent 100%);
}
[data-sentinel-canvas] {
  display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0;
  /* Blend the studio renderer's viewport-wide atmosphere into this embedded stage. */
  --edge-x: linear-gradient(90deg, transparent, black 9%, black 91%, transparent);
  --edge-y: linear-gradient(0deg, transparent, black 12%, black 88%, transparent);
  -webkit-mask-image: var(--edge-x), var(--edge-y); -webkit-mask-composite: source-in;
  mask-image: var(--edge-x), var(--edge-y); mask-composite: intersect;
}
.sentinel[data-sentinel-state="live"] [data-sentinel-canvas] { opacity: 1; }
.sentinel[data-sentinel-state="live"] [data-sentinel-still] { visibility: hidden; }
#manual-title {
  margin: .12em 0 0; font: 500 clamp(2.75rem, 5vw, 4.6rem)/.98 var(--sans); letter-spacing: -.045em; text-wrap: balance;
}
@supports (background-clip: text) or (-webkit-background-clip: text) {
  #manual-title, .reader-title-main {
    background-image: radial-gradient(ellipse 60% 110% at var(--visitor-x, 50%) var(--visitor-y, 40%), #fff3d8 0%, #eef2f4 32%, #b8c3cc 78%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
}
.cover-lead { max-width: 35rem; margin: 1.05rem 0 0; color: #b9c3cd; font: 400 clamp(.95rem, 1.15vw, 1.04rem)/1.55 var(--sans); text-wrap: balance; }
.guide-list {
  position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(100%, 55rem);
  margin-block: clamp(1.7rem, 4.5svh, 3.4rem) .6rem; scroll-margin-block-start: 1rem;
}
.guide-list::before, .guide-list::after {
  content: ''; position: absolute; left: 50%; width: 100%; height: 1px; translate: -50% 0; pointer-events: none;
  --gx: calc(50% + var(--rail-x, 0px)); --g: var(--rail-glow, 0);
  background:
    linear-gradient(90deg, transparent calc(var(--gx) - 110px), rgb(255 243 216 / calc(var(--g) * .1)) calc(var(--gx) - 72px), rgb(255 243 216 / calc(var(--g) * .34)) calc(var(--gx) - 34px),
      rgb(255 243 216 / calc(var(--g) * .5)) var(--gx), rgb(255 243 216 / calc(var(--g) * .34)) calc(var(--gx) + 34px), rgb(255 243 216 / calc(var(--g) * .1)) calc(var(--gx) + 72px), transparent calc(var(--gx) + 110px)),
    linear-gradient(90deg, transparent, rgb(184 195 204 / .056) 9%, rgb(184 195 204 / .19) 22%, rgb(238 242 244 / .4) 38%, rgb(245 242 233 / .56) 50%,
      rgb(238 242 244 / .4) 62%, rgb(184 195 204 / .19) 78%, rgb(184 195 204 / .056) 91%, transparent);
  transform: scaleX(var(--rail, 1)); opacity: clamp(0, var(--rail, 1) * 2.4, 1); }

.guide-list::before { top: 0; }
.guide-list::after { bottom: 0; }
.guide-row {
  position: relative; display: grid; grid-template-rows: auto 1fr auto auto; justify-items: center;
  gap: .48rem; padding: clamp(1.1rem, 2.8svh, 1.75rem) clamp(.8rem, 2vw, 1.9rem);
  text-decoration: none; touch-action: manipulation;
}
.guide-row h2 { margin: 0; font: 500 clamp(1.17rem, 1.72vw, 1.5rem)/1.2 var(--sans); letter-spacing: -.035em; }
.guide-row p { margin: 0; color: #aab5bf; max-width: 29ch; text-wrap: balance; font: 400 .89rem/1.43 var(--sans); }
.row-meta { display: block; padding-top: .32rem; color: #9aa7b2; font: 400 clamp(.67rem, .85vw, .75rem)/1.45 var(--mono); }
.guide-action {
  position: relative; display: inline-flex; align-items: center; gap: .42em; padding: .15rem 0 .3rem; margin-top: .22rem;
  color: #dce1e6; font: 400 .9rem/1.2 var(--sans);
}
.guide-action svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.15; transition: transform .28s var(--ease); }
.guide-action::after {
  position: absolute; content: ''; inset: auto -2px 0; height: 1px; transform: scaleX(.42); opacity: .65;
  background: linear-gradient(90deg, transparent, #ffd8a6, transparent); transition: transform .36s var(--ease), opacity .3s;
}
.guide-row:is(:hover, :focus-visible) :is(h2, .guide-action), .guide-row[data-started] .step-count { color: var(--accent); }
.guide-row:is(:hover, :focus-visible) .guide-action::after { opacity: 1; transform: scaleX(1); }
.guide-row:is(:hover, :focus-visible) .guide-action svg { transform: translateX(2px); }
.library-progress {
  position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: max(20px, env(safe-area-inset-left));
  min-height: 36px; display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; color: #a4b0bc;
  font: 400 .68rem/1.5 var(--mono); letter-spacing: .025em;
}
.library-meter { width: 1.8rem; height: 1px; background: #53606b; }
.library-meter::before { content: ''; display: block; width: var(--complete, 0%); height: 100%; background: var(--accent); }
.save-note:empty { display: none; }
.library-tools { position: absolute; z-index: 3; bottom: max(14px, env(safe-area-inset-bottom)); right: max(13px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 1px; }
.motion-toggle, .reading-switch { display: grid; place-items: center; width: 44px; height: 44px; border: 0; padding: 0; background: transparent; color: var(--muted); touch-action: manipulation; }
.motion-toggle svg { width: 34px; height: 34px; padding: 8px; border: 1px solid #ffffff25; border-radius: 50%; background: #0a1113aa; fill: none; stroke: currentColor; stroke-width: 1.2; }
.motion-toggle:hover, .motion-toggle:focus-visible, .reading-switch:hover { color: var(--accent); }
.play-icon, .motion-toggle[aria-pressed="true"] .pause-icon, .reading-switch .to-dark, [data-reading-theme="light"] .reading-switch .to-light { display: none; }
.motion-toggle[aria-pressed="true"] .play-icon, [data-reading-theme="light"] .reading-switch .to-dark { display: inline; }
.reading-switch .ui-icon { width: 17px; height: 17px; }

/* Reused from the studio's resource disclosure. Each host owns its placement. */
.resource-index { --edge: 16px; --pause-slot: 0px; --index-ease: var(--ease); --index-fade: 190ms; --index-draw: 340ms; position: relative; }
.resource-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; list-style: none;
  color: var(--muted); cursor: pointer; border-radius: 50%; touch-action: manipulation;
  transition: color var(--index-fade) ease;
}
.resource-toggle::-webkit-details-marker { display: none; }
.resource-icon { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; }
.resource-icon path { transform-box: fill-box; transform-origin: center; transition: transform var(--index-draw) var(--index-ease), opacity var(--index-fade); }
.resource-icon .rule-mid { transform-origin: left; }
.resource-index[open] .resource-toggle, .resource-toggle:focus-visible { color: var(--dawn); }
.resource-index[open] .rule-top { transform: translateY(5px) rotate(45deg); }
.resource-index[open] .rule-mid { opacity: 0; transform: scaleX(.2); }
.resource-index[open] .rule-bottom { transform: translateY(-5px) rotate(-45deg); }
.resource-toggle:focus-visible, .resource-entry:focus-visible { outline: 1px solid var(--dawn); outline-offset: -3px; }
.resource-index::details-content { transition: content-visibility var(--index-fade) allow-discrete; }
.resource-panel {
  position: absolute; right: calc(4px - var(--pause-slot)); bottom: calc(100% + 6px);
  width: min(246px, calc(100vw - 2 * var(--edge))); padding: 17px 18px 11px;
  color: var(--silver); background: #0d1418f7; border: 1px solid #b7c1c42c; border-radius: 7px;
  box-shadow: 0 8px 26px #0004; opacity: 0; transform: translateY(5px);
  transition: opacity var(--index-fade) ease, transform var(--index-draw) var(--index-ease);
}
.resource-panel::before {
  content: ''; position: absolute; inset: -1px 18% auto; height: 1px;
  background: linear-gradient(90deg, transparent, #ffdfa863, transparent); pointer-events: none;
}
@supports (backdrop-filter: blur(14px)) or (-webkit-backdrop-filter: blur(14px)) {
  .resource-panel { background: linear-gradient(145deg, #172026cf, #0a1014d4); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}
.resource-index[open] .resource-panel { opacity: 1; transform: none; }
.resource-index:not([open]) .resource-panel { pointer-events: none; }
@starting-style { .resource-index[open] .resource-panel { opacity: 0; transform: translateY(5px); } }
.resource-panel h2 {
  display: flex; align-items: center; gap: 10px; margin: 0 0 4px;
  font: 400 10.5px/1.2 'IBM Plex Mono', monospace; letter-spacing: .11em; text-transform: uppercase; color: var(--muted);
}
.resource-panel h2::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, #a5b4bf38, transparent); }
.resource-entry {
  position: relative; display: grid; row-gap: 3px; padding: 10px 4px 10px 0; text-decoration: none;
  font: 400 16px/1.35 'Space Grotesk', sans-serif; letter-spacing: -.018em; color: var(--silver);
  transition: color var(--index-fade) ease;
}
.resource-entry small { color: var(--text-2); font-size: 12px; letter-spacing: .005em; }
.resource-entry::after {
  content: ''; height: 1px; width: 25px; position: absolute; bottom: 3px; left: 0;
  background: linear-gradient(90deg, var(--dawn), transparent); transform: scaleX(0); transform-origin: left;
  transition: transform var(--index-draw) var(--index-ease);
}
.resource-entry:focus-visible { color: var(--dawn); outline-offset: 4px; }
.resource-entry:focus-visible::after { transform: scaleX(1); }
@media (hover: hover) {
  .resource-toggle:hover, .resource-entry:hover { color: var(--dawn); }
  .resource-index:not([open]) .resource-toggle:hover .rule-mid { transform: scaleX(1.3333); }
  .resource-entry:hover::after { transform: scaleX(1); }
}

@media (max-width: 639px), (max-width: 670px) and (min-height: 521px) {
  .manual-stage { padding-inline: max(19px, env(safe-area-inset-left)); }
  .sentinel { --cage: clamp(130px, min(22svh, 43vw), 185px); height: calc(var(--cage) * 1.3); }
  #manual-title { font-size: clamp(2.1rem, 7.55vw, 3.15rem); line-height: 1.04; }
  .cover-lead { max-width: 32rem; font-size: .94rem; }
  .guide-list { grid-template-columns: 1fr; width: min(100%, 32rem); text-align: left; margin-top: 1.55rem; }
  .guide-row { grid-template: auto auto auto / minmax(0,1fr) auto; justify-items: start; column-gap: .5rem; row-gap: .24rem; padding: .85rem .25rem; }
  .guide-row + .guide-row { border-top: 1px solid #9ba9b418; }
  .guide-row h2 { grid-column: 1; font-size: 1.16rem; }
  .guide-row p { grid-column: 1; max-width: 34ch; font-size: .86rem; text-wrap: initial; }
  .row-meta { grid-column: 1 / -1; padding: .05rem 0 0; font-size: .67rem; }
  .guide-action { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: .75rem; white-space: nowrap; }
  .library-progress { max-width: calc(100% - 124px); }
}
@media (orientation: landscape) and (max-height: 520px) and (min-width: 640px) {
  .manual-stage { padding-block: 1rem 2.75rem; }
  .manual-composition { grid-template-columns: minmax(120px, 25%) 1fr; column-gap: 1.2rem; }
  .sentinel { grid-column: 1; grid-row: 1 / 4; align-self: center; --cage: min(17vw, 42svh); }
  #manual-title, .cover-lead, .guide-list { grid-column: 2; }
  #manual-title { font-size: clamp(2.1rem, 4.2vw, 3rem); }
  .cover-lead { margin-top: .45rem; }
  .guide-list { margin-top: .6rem; }
  .guide-row { padding: .5rem .4rem; gap: .3rem; }
  .guide-row h2 { font-size: 1rem; }
  .guide-row p { font-size: .78rem; }
  .guide-list .row-meta { font-size: .62rem; }
  .guide-action { font-size: .78rem; }
}
@media (forced-colors: active) { #manual-title, .reader-title-main { color: CanvasText; background: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: 0s !important; }
}
@media print { .skip-link, .library-tools { display: none; } }
