:root {
  color-scheme: dark;
  --ink: #030b1d;
  --navy: #061737;
  --navy-2: #092657;
  --cobalt: #0b4ba3;
  --cyan: #56e6ff;
  --cyan-soft: #b7f5ff;
  --yellow: #ffe34b;
  --lime: #b9ef49;
  --coral: #ff7b6d;
  --cream: #fff9df;
  --white: #f7fbff;
  --muted: #adc4dc;
  --line: rgba(115, 224, 255, .42);
  --glass: rgba(7, 31, 73, .78);
  --reader-size: 1.075rem;
  --shadow: 0 24px 80px rgba(0, 0, 0, .46), inset 0 1px 1px rgba(255, 255, 255, .28);
  font-family: Inter, Avenir Next, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; overflow: hidden; color: var(--cream); background: radial-gradient(circle at 16% 8%, #164b9d 0, transparent 31%), radial-gradient(circle at 82% 7%, #291a65 0, transparent 35%), linear-gradient(135deg, #020817, #061635 57%, #020615); }
body.font-small { --reader-size: .98rem; }
body.font-large { --reader-size: 1.22rem; }
body.high-contrast .chapter-copy p, body.high-contrast .chapter-copy li { color: #fff; }
body.quiet .cosmos { opacity: .12; }
body.motion-paused *, body.motion-paused *::before, body.motion-paused *::after { animation-play-state: paused !important; }
body.narration-playing *, body.narration-playing *::before, body.narration-playing *::after { animation-play-state: paused !important; }
body.narration-playing .diagram-stage [filter] { filter: none !important; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; z-index: 1000; left: 18px; top: -80px; padding: 12px 18px; border-radius: 0 0 12px 12px; color: #07152f; background: var(--yellow); font-weight: 900; transition: top .2s; }
.skip-link:focus { top: 0; }
.cosmos { position: fixed; inset: 0; overflow: hidden; opacity: .72; pointer-events: none; transition: opacity .35s; background-image: radial-gradient(circle at 12% 22%, rgba(255, 227, 75, .95) 0 1.5px, transparent 2px), radial-gradient(circle at 82% 71%, rgba(86, 230, 255, .9) 0 1px, transparent 2px), radial-gradient(circle at 48% 42%, rgba(255, 255, 255, .75) 0 1px, transparent 2px); background-size: 140px 120px, 170px 150px, 110px 100px; animation: star-drift 28s linear infinite; }
.cosmos::before, .cosmos::after, .cosmos span { content: ""; position: absolute; border-radius: 50%; filter: blur(.2px); }
.cosmos::before { width: 420px; height: 150px; top: 8%; left: 7%; border: 1px solid rgba(86,230,255,.23); transform: rotate(-15deg); box-shadow: inset 0 0 70px rgba(55,137,255,.08), 0 0 40px rgba(55,137,255,.08); }
.cosmos::after { width: 560px; height: 220px; right: -8%; bottom: 4%; border: 1px solid rgba(185,239,73,.13); transform: rotate(17deg); }
.cosmos span:nth-child(1) { width: 10px; height: 10px; top: 16%; left: 34%; background: var(--yellow); box-shadow: 0 0 18px var(--yellow); animation: float-one 11s ease-in-out infinite alternate; }
.cosmos span:nth-child(2) { width: 7px; height: 7px; top: 63%; left: 7%; background: var(--coral); box-shadow: 0 0 16px var(--coral); animation: float-two 14s ease-in-out infinite alternate; }
.cosmos span:nth-child(3) { width: 8px; height: 8px; right: 18%; top: 19%; background: var(--lime); box-shadow: 0 0 16px var(--lime); animation: float-one 15s 2s ease-in-out infinite alternate-reverse; }

.terminal-shell { position: relative; display: grid; grid-template: auto minmax(0, 1fr) auto / 276px minmax(0, 1fr); gap: 14px; width: calc(100vw - 30px); height: calc(100dvh - 30px); margin: 15px; padding: 15px; overflow: hidden; border: 1px solid rgba(185, 241, 255, .63); border-radius: 34px; background: linear-gradient(145deg, rgba(79, 179, 255, .18), rgba(7, 23, 56, .88) 24%, rgba(4, 14, 37, .96)); box-shadow: 0 0 0 4px rgba(93, 196, 255, .11), 0 0 55px rgba(58, 171, 255, .24), inset 0 0 45px rgba(48, 159, 255, .08); backdrop-filter: blur(24px) saturate(1.2); }
.terminal-shell::after { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(255,255,255,.08); border-radius: 28px; pointer-events: none; }
.glass-panel { border: 1px solid rgba(137, 225, 255, .39); background: linear-gradient(145deg, rgba(22, 75, 138, .4), rgba(5, 24, 57, .84)); box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, .05) inset; backdrop-filter: blur(22px) saturate(1.22); }

.topbar { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(240px, 1fr) auto; align-items: center; min-height: 84px; padding: 10px 16px; border-radius: 24px; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid rgba(137,225,255,.38); border-radius: 50%; cursor: pointer; background: linear-gradient(180deg, rgba(26,72,135,.95), rgba(4,24,59,.96)); box-shadow: inset 0 2px 3px rgba(255,255,255,.24), inset 0 -5px 12px rgba(0,0,0,.26), 0 6px 14px rgba(0,0,0,.3), 0 0 24px rgba(84,230,255,.18); }
.brand-mark span { width: 25px; height: 25px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 16px var(--yellow), -13px 8px 0 -8px var(--coral), 14px -5px 0 -9px var(--lime); }
.book-id { min-width: 0; padding-left: 15px; }
.book-id p { margin: 0 0 3px; color: var(--cyan); text-transform: uppercase; letter-spacing: .18em; font: 700 .67rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-id p i { display: inline-block; width: 5px; height: 5px; margin: 0 8px 1px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.book-id h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(1.05rem, 1.8vw, 1.65rem); letter-spacing: .018em; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.bubble-button, .icon-button, .play-button, .rail-toggle, .motion-toggle, .mini-bookmark, .segmented button { border: 1px solid rgba(154, 229, 255, .37); color: var(--cream); cursor: pointer; background: linear-gradient(180deg, rgba(30, 77, 138, .96), rgba(5, 27, 66, .96)); box-shadow: inset 0 2px 1px rgba(255,255,255,.23), inset 0 -4px 9px rgba(0,0,0,.26), 0 5px 12px rgba(0,0,0,.31), 0 0 0 2px rgba(5,22,55,.72); transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, color .18s, background .18s; }
.bubble-button:hover, .icon-button:hover, .play-button:hover, .rail-toggle:hover, .motion-toggle:hover, .mini-bookmark:hover, .segmented button:hover { transform: translateY(-2px); filter: brightness(1.14); }
.bubble-button:active, .icon-button:active, .play-button:active, .rail-toggle:active, .motion-toggle:active, .mini-bookmark:active { transform: translateY(1px) scale(.985); box-shadow: inset 0 5px 10px rgba(0,0,0,.32), 0 2px 5px rgba(0,0,0,.22); }
.bubble-button { min-width: 94px; min-height: 44px; padding: 10px 15px; border-radius: 999px; text-transform: uppercase; letter-spacing: .075em; font-size: .78rem; font-weight: 850; }
.bubble-button span { padding-right: 6px; color: var(--cyan); }
.bubble-button.active, .play-button { color: #07152f; border-color: #fff09a; background: linear-gradient(180deg, #fff59c, var(--yellow) 69%, #d6b21c); }
.bubble-button.active span { color: #07152f; }
.icon-button, .rail-toggle, .mini-bookmark { width: 44px; height: 44px; border-radius: 50%; font-size: 1.35rem; line-height: 1; }

.chapter-rail { grid-row: 2; display: grid; grid-template-rows: auto 1fr auto; min-height: 0; overflow: hidden; border-radius: 24px; transition: width .25s ease, opacity .25s ease, transform .25s ease; }
.rail-heading { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.rail-heading div { display: grid; gap: 2px; }
.rail-heading small { color: var(--coral); text-transform: uppercase; letter-spacing: .16em; font: 700 .62rem ui-monospace, monospace; }
.rail-heading span { text-transform: uppercase; letter-spacing: .13em; font-weight: 850; }
.rail-toggle { width: 34px; height: 34px; font-size: .95rem; }
.chapter-nav { min-height: 0; overflow: auto; scrollbar-color: rgba(84,230,255,.5) transparent; scrollbar-width: thin; }
.chapter-nav ol { list-style: none; margin: 0; padding: 10px; }
.chapter-nav li { margin: 4px 0; }
.chapter-nav li[data-section-id="earth-cuisine"] { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(86,230,255,.2); }
.chapter-nav li[data-section-id="cuisine-cannabis"] { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(86,230,255,.2); }
.chapter-nav li[data-section-id="behavior-catastrophizing"] { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(255,227,75,.24); }
.chapter-nav li[data-section-id="behavior-system-repair"] { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,227,75,.24); }
.chapter-nav button { width: 100%; min-height: 52px; display: grid; grid-template-columns: 39px 1fr auto; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid transparent; border-radius: 15px; color: rgba(237,247,255,.7); text-align: left; background: transparent; cursor: pointer; transition: background .18s, color .18s, border .18s, transform .18s; }
.chapter-nav button:hover { color: white; background: rgba(43,104,175,.27); transform: translateX(2px); }
.chapter-nav li.current button { color: #081831; border-color: rgba(255,246,150,.82); background: linear-gradient(135deg, var(--yellow), #cbe94e); box-shadow: 0 7px 22px rgba(255,228,74,.22), inset 0 1px rgba(255,255,255,.5); }
.chapter-nav .chapter-number { font: 850 .74rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.chapter-nav .chapter-name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .79rem; line-height: 1.22; }
.chapter-nav .bookmark-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 7px var(--coral); }
.rail-footer { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-top: 1px solid var(--line); background: rgba(2,14,38,.35); }
.rail-footer p { margin: 0; color: var(--muted); font: .66rem/1.45 ui-monospace, monospace; }
.rail-footer strong { color: var(--lime); text-transform: uppercase; letter-spacing: .08em; }
.signal-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 11px var(--lime); animation: signal 2.4s ease-in-out infinite; }
.terminal-shell.rail-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.terminal-shell.rail-collapsed .chapter-rail { opacity: 0; pointer-events: none; transform: translateX(-28px); }

.reader-pane { grid-row: 2; display: grid; grid-template-columns: minmax(330px, .9fr) minmax(390px, 1.1fr); min-height: 0; overflow: hidden; border-radius: 24px; }
.reader-pane article { min-width: 0; overflow: auto; overscroll-behavior: contain; padding: clamp(28px, 3.3vw, 58px); scrollbar-color: rgba(255,227,75,.42) transparent; scrollbar-width: thin; background: linear-gradient(148deg, rgba(8,27,65,.98), rgba(3,14,39,.99)); }
.chapter-header { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.eyebrow { margin: 0 0 9px; color: var(--cyan); text-transform: uppercase; letter-spacing: .2em; font: 800 .72rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.reader-pane h2 { max-width: 14ch; margin: 0 0 27px; color: var(--yellow); text-wrap: balance; font-size: clamp(2rem, 3.5vw, 4rem); line-height: .97; letter-spacing: -.04em; text-transform: uppercase; }
.mini-bookmark { width: 39px; height: 39px; color: var(--cyan); }
.mini-bookmark[aria-pressed="true"], #bookmark-button[aria-pressed="true"] { color: #07152f; border-color: #fff09a; background: linear-gradient(180deg, #fff59c, var(--yellow) 69%, #d6b21c); }
.chapter-copy { max-width: 72ch; }
.chapter-copy p, .chapter-copy li { color: rgba(244,248,255,.84); font: var(--reader-size)/1.75 Georgia, "Iowan Old Style", "Times New Roman", serif; transition: font-size .2s, color .2s; }
.chapter-copy p { margin: 0 0 1.3em; }
.chapter-copy .opening { color: #fff; font-size: calc(var(--reader-size) * 1.17); line-height: 1.62; }
.chapter-copy strong { color: var(--cream); }
.chapter-copy em { color: var(--cyan-soft); }
.chapter-copy h3 { margin: 2rem 0 .8rem; color: var(--cyan); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em; }
.chapter-copy ul { margin: 0 0 1.45rem; padding-left: 1.25rem; }
.chapter-copy li { margin: .4rem 0; padding-left: .35rem; }
.chapter-copy li::marker { color: var(--lime); }
.chapter-end { display: flex; align-items: center; justify-content: center; gap: 13px; padding: 24px 0 2px; }
.chapter-end span { width: 56px; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan)); }.chapter-end span:last-child { transform: scaleX(-1); }.chapter-end i { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }

.visual-pane { position: relative; display: grid; grid-template-rows: auto minmax(0,1fr) auto; min-width: 0; min-height: 0; overflow: hidden; padding: 19px; border-left: 1px solid var(--line); background: radial-gradient(circle at 48% 48%, rgba(30,118,199,.34), transparent 40%), linear-gradient(160deg, rgba(4,19,48,.75), rgba(5,26,64,.97)); }
.visual-pane::before { content: ""; position: absolute; inset: 0; opacity: .19; background-image: linear-gradient(rgba(84,230,255,.2) 1px, transparent 1px), linear-gradient(90deg, rgba(84,230,255,.2) 1px, transparent 1px); background-size: 32px 32px; mask-image: radial-gradient(circle, #000, transparent 72%); }
.visual-pane::after { content: ""; position: absolute; width: 70%; aspect-ratio: 1; right: -25%; top: 15%; border-radius: 50%; border: 1px solid rgba(84,230,255,.14); box-shadow: 0 0 70px rgba(47,143,255,.12), inset 0 0 60px rgba(47,143,255,.08); animation: slow-turn 32s linear infinite; }
.visual-heading, .visual-caption, .diagram-stage { position: relative; z-index: 1; }
.visual-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.visual-heading > div { display: grid; gap: 3px; }
.visual-heading span { color: var(--coral); font: 800 .63rem ui-monospace, monospace; letter-spacing: .17em; text-transform: uppercase; }
.visual-heading strong { color: var(--cyan); font-size: .88rem; letter-spacing: .02em; }
.motion-toggle { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 7px 11px; border-radius: 999px; font: 750 .66rem ui-monospace, monospace; text-transform: uppercase; letter-spacing: .07em; }
.motion-toggle i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.motion-toggle[aria-pressed="false"] i { background: var(--muted); box-shadow: none; }
.diagram-stage { min-height: 0; overflow: hidden; display: grid; place-items: center; }
.diagram-stage svg { width: min(100%, 700px); height: 100%; min-height: 350px; max-height: 650px; overflow: visible; }
.diagram-stage .grid-line { stroke: rgba(86,230,255,.13); stroke-width: 1; }
.diagram-stage .route { fill: none; stroke: rgba(86,230,255,.58); stroke-width: 2; stroke-dasharray: 7 10; animation: route-flow 9s linear infinite; }
.diagram-stage .route.yellow { stroke: rgba(255,227,75,.75); }.diagram-stage .route.coral { stroke: rgba(255,123,109,.68); }.diagram-stage .route.lime { stroke: rgba(185,239,73,.68); }
.diagram-stage .node { stroke: rgba(255,255,255,.82); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pulse 2.8s ease-in-out infinite alternate; }
.diagram-stage .node.cyan { fill: var(--cyan); }.diagram-stage .node.yellow { fill: var(--yellow); }.diagram-stage .node.lime { fill: var(--lime); }.diagram-stage .node.coral { fill: var(--coral); }.diagram-stage .node.navy { fill: var(--cobalt); }
.diagram-stage .packet { fill: #fff; filter: drop-shadow(0 0 6px var(--cyan)); }
.diagram-stage .diagram-label { fill: var(--cream); font: 700 12px ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }.diagram-stage .diagram-small { fill: var(--muted); font: 600 10px ui-monospace, monospace; letter-spacing: .08em; }
.diagram-stage .halo { fill: none; stroke: rgba(86,230,255,.24); stroke-width: 1.5; animation: halo 3.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.diagram-stage .orbit { fill: none; stroke: rgba(86,230,255,.42); stroke-width: 1.5; }
.diagram-stage .rotate-group { transform-origin: 260px 210px; animation: slow-turn 23s linear infinite; }
.diagram-stage .float-group { animation: diagram-float 6s ease-in-out infinite alternate; }
.diagram-stage .dash { animation: route-flow 7s linear infinite; }
.visual-caption { display: grid; gap: 10px; padding: 10px 5px 2px; border-top: 1px solid rgba(86,230,255,.17); }
.visual-caption p { margin: 0; color: rgba(224,240,255,.72); font: .74rem/1.45 ui-monospace, monospace; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 15px; color: rgba(236,246,255,.7); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.legend span { display: flex; align-items: center; gap: 6px; }.legend i { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }.dot-cyan{background:var(--cyan);color:var(--cyan)}.dot-yellow{background:var(--yellow);color:var(--yellow)}.dot-lime{background:var(--lime);color:var(--lime)}.dot-coral{background:var(--coral);color:var(--coral)}

.transport { grid-column: 1 / -1; display: grid; grid-template-columns: auto auto minmax(120px, 1fr) auto auto; align-items: center; gap: 14px; padding: 9px 13px; border-radius: 22px; }
.play-button { min-width: 154px; height: 44px; border-radius: 999px; font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.play-button span:first-child { margin-right: 7px; }
.progress-wrap { display: grid; gap: 5px; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font: .6rem ui-monospace, monospace; text-transform: uppercase; letter-spacing: .09em; }
.progress-track { height: 9px; overflow: hidden; border: 1px solid rgba(137,225,255,.35); border-radius: 99px; background: rgba(1,9,27,.72); box-shadow: inset 0 3px 6px rgba(0,0,0,.38); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--yellow)); box-shadow: 0 0 14px var(--cyan); transition: width .4s ease; }
.transport output { min-width: 66px; text-align: center; color: var(--yellow); font: 850 .74rem ui-monospace, monospace; }

.search-dialog { width: min(760px, calc(100vw - 28px)); max-height: min(780px, calc(100dvh - 28px)); padding: 0; border: 0; color: var(--cream); background: transparent; }
.search-dialog::backdrop { background: rgba(1,6,20,.76); backdrop-filter: blur(8px); }
.search-card { display: grid; max-height: inherit; overflow: hidden; padding: 18px; border-radius: 25px; }
.search-card header, .settings-card header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.search-card header p, .settings-card header p { margin: 0; color: var(--coral); text-transform: uppercase; letter-spacing: .15em; font: 800 .62rem ui-monospace, monospace; }
.search-card h2 { margin: 3px 0 0; font-size: 1.6rem; }
.search-field { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 18px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(1,12,34,.66); }
.search-field span { color: var(--cyan); font-size: 1.4rem; }
.search-field input { width: 100%; padding: 13px 0; border: 0; outline: 0; color: white; background: transparent; font-size: 1rem; }
.search-status { color: var(--muted); font: .72rem ui-monospace, monospace; }
.search-results { min-height: 0; margin: 0; padding: 0; overflow: auto; list-style: none; }
.search-results button { width: 100%; margin: 4px 0; padding: 13px; border: 1px solid rgba(86,230,255,.16); border-radius: 14px; color: white; text-align: left; cursor: pointer; background: rgba(20,67,126,.28); }
.search-results button:hover { border-color: var(--cyan); background: rgba(20,67,126,.48); }
.search-results strong { color: var(--yellow); }.search-results span { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; }

.settings-card { position: fixed; z-index: 100; top: 112px; right: 31px; width: min(320px, calc(100vw - 40px)); padding: 17px; border-radius: 22px; }
.settings-card fieldset { margin: 18px 0; padding: 0; border: 0; }.settings-card legend { margin-bottom: 8px; color: var(--muted); font-size: .75rem; }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); padding: 4px; border: 1px solid rgba(86,230,255,.25); border-radius: 15px; background: rgba(1,12,34,.6); }
.segmented button { height: 42px; border-radius: 11px; }.segmented button:nth-child(1){font-size:.75rem}.segmented button:nth-child(2){font-size:1rem}.segmented button:nth-child(3){font-size:1.25rem}.segmented button.selected{color:#07152f;background:var(--yellow)}
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid rgba(86,230,255,.14); font-size: .84rem; }.setting-row input { width: 20px; height: 20px; accent-color: var(--yellow); }
.toast { position: fixed; z-index: 110; left: 50%; bottom: 98px; max-width: calc(100vw - 40px); padding: 10px 16px; border: 1px solid rgba(255,242,150,.62); border-radius: 999px; color: #07152f; background: var(--yellow); box-shadow: 0 8px 26px rgba(0,0,0,.35); font-size: .78rem; font-weight: 850; opacity: 0; transform: translate(-50%, 14px); pointer-events: none; transition: opacity .2s, transform .2s; }.toast.show { opacity: 1; transform: translate(-50%,0); }
noscript { position: fixed; inset: auto 20px 20px; z-index: 1000; padding: 16px; background: var(--coral); color: #07152f; font-weight: bold; }

@keyframes star-drift { to { background-position: 140px 120px, -170px 150px, 110px -100px; } }
@keyframes float-one { to { transform: translate(42px, 24px); } }
@keyframes float-two { to { transform: translate(-25px, 38px); } }
@keyframes route-flow { to { stroke-dashoffset: -68; } }
@keyframes pulse { to { transform: scale(1.13); filter: brightness(1.15); } }
@keyframes halo { from { opacity: .8; transform: scale(.35); } to { opacity: 0; transform: scale(1.25); } }
@keyframes slow-turn { to { transform: rotate(360deg); } }
@keyframes diagram-float { to { transform: translateY(-10px); } }
@keyframes signal { 50% { opacity: .35; transform: scale(.78); } }

@media (max-width: 1150px) {
  .terminal-shell { grid-template-columns: 228px minmax(0,1fr); }
  .reader-pane { grid-template-columns: minmax(310px,.95fr) minmax(330px,1.05fr); }
  .bubble-button { min-width: 76px; padding-inline: 12px; }.bubble-button span { display: none; }
  .wide-only { display: none; }
}

@media (max-width: 880px) {
  body { overflow: auto; }
  body.narration-playing .visual-pane { display: none; }
  .terminal-shell { width: calc(100vw - 12px); height: auto; min-height: calc(100dvh - 12px); margin: 6px; padding: 9px; grid-template: auto auto minmax(0,1fr) auto / minmax(0,1fr); border-radius: 24px; }
  .topbar { grid-template-columns: auto minmax(0,1fr); }.top-actions { grid-column: 1 / -1; padding-top: 10px; overflow-x: auto; }.top-actions .bubble-button { min-width: 95px; }
  .chapter-rail { grid-row: 2; min-height: auto; }.chapter-nav { overflow-x: auto; }.chapter-nav ol { display: flex; }.chapter-nav li { min-width: 218px; }.rail-footer { display: none; }
  .reader-pane { grid-row: 3; grid-template-columns: minmax(0,1fr); overflow: visible; }.reader-pane article { overflow: visible; padding: clamp(27px,7vw,50px); }.visual-pane { min-height: 520px; border-left: 0; border-top: 1px solid var(--line); }
  .transport { grid-row: 4; grid-template-columns: auto auto minmax(0,1fr) auto; position: sticky; bottom: 5px; z-index: 20; }
  .transport output { display: none; }
  .transport .play-button { display: inline-flex; width: 44px; min-width: 44px; padding: 0; align-items: center; justify-content: center; }
  .transport .play-button span:first-child { margin: 0; }
  .transport .play-button .play-label { display: none; }
  .terminal-shell.rail-collapsed { grid-template-columns: minmax(0,1fr); }.terminal-shell.rail-collapsed .chapter-rail { display: none; }
}

@media (max-width: 560px) {
  .terminal-shell { padding: 7px; gap: 9px; }.topbar { min-height: 72px; padding: 8px; border-radius: 19px; }.brand-mark { width: 48px; height: 48px; }.book-id { padding-left: 10px; }.book-id p { display: none; }.book-id h1 { font-size: .95rem; white-space: normal; }
  .top-actions { gap: 6px; }.top-actions .bubble-button { min-width: 82px; min-height: 40px; }.icon-button { width: 40px; height: 40px; }.top-actions #settings-button { display: none; }
  .reader-pane h2 { font-size: clamp(1.85rem,11vw,3rem); }.chapter-copy p, .chapter-copy li { line-height: 1.68; }.visual-pane { min-height: 430px; padding: 15px; }.diagram-stage svg { min-height: 300px; }
  .chapter-nav li { min-width: 190px; }.chapter-nav .chapter-name { font-size: .72rem; }
  .motion-toggle { padding: 6px 8px; }.visual-caption p { font-size: .67rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
