:root {
  --bg: #09111d;
  --bg-soft: #0f1928;
  --border: rgba(164, 197, 228, 0.14);
  --border-strong: rgba(164, 197, 228, 0.26);
  --text: #edf4ff;
  --muted: #a0b1c9;
  --accent: #8fb9ff;
  --accent-strong: #d8b36a;
  --surface: linear-gradient(180deg, rgba(16, 30, 48, 0.94), rgba(8, 16, 28, 0.82));
  --surface-raised: linear-gradient(180deg, rgba(20, 35, 56, 0.98), rgba(10, 18, 31, 0.9));
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.22);
  --max-width: 1180px;
  --reader-width: 860px;
  --reader-font-size: 1.2rem;
  --reader-line-height: 1.85;
  --reader-bg: linear-gradient(180deg, rgba(18, 25, 38, 0.98), rgba(12, 17, 28, 0.98));
  --reader-surface: #101722;
  --reader-text: #ebf2ff;
  --reader-muted: #afbdd3;
  --reader-border: rgba(255, 255, 255, 0.08);
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(90, 140, 212, 0.18), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(216, 179, 106, 0.14), transparent 20%),
    linear-gradient(135deg, #050a12 0%, #0b1624 52%, #07101b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 70px 70px;
  opacity: 0.18;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  height: 40vh;
  background: linear-gradient(180deg, transparent, rgba(3, 7, 13, 0.45));
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border-strong);
  background: rgba(6, 12, 21, 0.96);
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: var(--shadow-soft);
}

.skip-link:focus-visible {
  left: 1rem;
  top: 1rem;
  outline-offset: 2px;
}

button {
  font: inherit;
}

.site-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 0 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(6, 12, 21, 0.72);
  backdrop-filter: blur(16px);
  isolation: isolate;
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: rgba(6, 12, 21, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  z-index: -1;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.98rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.06) 28%),
    linear-gradient(135deg, rgba(216, 179, 106, 0.95), rgba(143, 185, 255, 0.4));
  box-shadow: 0 0 22px rgba(143, 185, 255, 0.18);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav a,
.reader-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(237, 244, 255, 0.78);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav a:hover,
.reader-control:hover {
  color: var(--text);
}

.nav a:not(.button) {
  position: relative;
  min-height: 2.35rem;
  font-weight: 600;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.18);
}

.button,
.reader-control,
.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  line-height: 1;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.button {
  color: var(--text);
  font-weight: 700;
  background: linear-gradient(135deg, rgba(143, 185, 255, 0.2), rgba(255, 255, 255, 0.06));
}

.topbar .button {
  min-height: 2.55rem;
  padding: 0 1.15rem;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(8, 17, 29, 0.18);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.button:hover,
.reader-control:hover,
.filter-button:hover,
.filter-button.is-active {
  background: rgba(143, 185, 255, 0.18);
  border-color: rgba(143, 185, 255, 0.34);
}

.button-ghost {
  background: transparent;
}

.topbar .button-ghost:hover {
  background: rgba(8, 17, 29, 0.26);
  border-color: rgba(255, 255, 255, 0.16);
}

.hero,
.library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(260px, 0.82fr);
  gap: 2rem;
  align-items: stretch;
  padding: 3.8rem 0 2.3rem;
}

.physics-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.56fr) minmax(220px, 0.56fr);
  gap: 1rem;
  align-items: start;
  padding: 3.8rem 0 2.3rem;
}

.hero-copy,
.library-hero-copy {
  position: relative;
}

.physics-hero-copy {
  position: relative;
}

.hero-copy::before,
.library-hero-copy::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1.2rem;
  width: 4rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(216, 179, 106, 0.95), transparent);
}

.physics-hero-copy::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1.2rem;
  width: 4rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(216, 179, 106, 0.95), transparent);
}

.hero-copy h1,
.library-hero h1,
.physics-hero h1,
.section-heading h2,
.reader-header h1 {
  margin: 0;
  font-family: "Baskervville", serif;
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.hero-copy h1,
.library-hero h1 {
  font-size: clamp(3.6rem, 8vw, 6.7rem);
  max-width: 13.5ch;
  text-wrap: balance;
}

.physics-hero h1 {
  font-size: clamp(3.2rem, 7vw, 5.6rem);
  max-width: 16ch;
}

.hero-copy h1,
.library-hero h1,
.physics-hero h1 {
  margin-bottom: 0.32em;
}

.hero-text,
.library-intro,
.section-intro {
  text-wrap: pretty;
}

.library-intro,
.section-intro,
.feature-card p,
.timeline p,
.story-card p,
.library-card p,
.note-grid p,
.footer-copy,
.library-status,
.reader-footer p,
.panel-points p,
.library-side-card p:last-child,
.orbit-points p,
.story-empty p {
  color: var(--muted);
  line-height: 1.75;
}

.eyebrow,
.panel-label,
.story-meta,
.card-index,
.timeline span {
  margin: 0 0 1rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.hero-highlights span,
.story-tag,
.library-tag {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #dbe8fb;
  font-size: 0.82rem;
  line-height: 1;
}

.hero-panel,
.hero-orbit-card,
.physics-summary-card,
.feature-card,
.story-card,
.timeline article,
.library-card,
.note-grid article,
.library-side-card,
.library-side-metrics article,
.world-notes article,
.story-empty {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-panel,
.hero-orbit-card,
.physics-summary-card,
.feature-card,
.story-card,
.timeline article,
.library-card,
.note-grid article {
  border-radius: 1.5rem;
}

.hero-panel::before,
.hero-orbit-card::before,
.physics-summary-card::before,
.feature-card::before,
.story-card::before,
.timeline article::before,
.library-card::before,
.note-grid article::before,
.library-side-card::before,
.library-side-metrics article::before,
.world-notes article::before,
.story-empty::before,
.site-footer::before,
.reader-footer::before,
.story-reader::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}

.hero-panel {
  padding: 1.6rem;
}

.physics-summary-card {
  padding: 1.5rem;
  border-radius: 1.5rem;
}

.physics-summary-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.7;
}

.physics-summary-list li + li {
  margin-top: 0.6rem;
}

.physics-jump-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

.physics-jump-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #dbe8fb;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.physics-jump-links a:hover {
  background: rgba(143, 185, 255, 0.14);
  border-color: rgba(143, 185, 255, 0.28);
}

.inline-link {
  color: #f1cf8c;
  text-decoration: underline;
  text-decoration-color: rgba(241, 207, 140, 0.42);
  text-underline-offset: 0.14em;
}

.article-linkout {
  margin-top: 1rem;
}

.source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.1rem;
}

.source-pills a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(241, 207, 140, 0.22);
  background: rgba(241, 207, 140, 0.08);
  color: #f6d89c;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.source-pills a:hover {
  background: rgba(241, 207, 140, 0.14);
  border-color: rgba(241, 207, 140, 0.34);
}

.physics-toc {
  position: sticky;
  top: 6.2rem;
  z-index: 4;
  width: min(11.5rem, 100%);
  margin: 0;
  float: right;
  margin-left: 2.25rem;
  margin-bottom: 1.75rem;
  padding: 0.1rem 0 0.1rem 0.9rem;
  border-left: 1px solid rgba(164, 197, 228, 0.16);
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  opacity: 0.78;
}

.physics-toc a {
  display: block;
  padding: 0.35rem 0;
  color: rgba(160, 177, 201, 0.9);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  border-top: 0;
}

.physics-toc a:hover {
  color: var(--text);
}

.physics-toc a.is-active {
  color: var(--text);
  transform: translateX(2px);
}

.hero-side {
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto;
  gap: 1.2rem;
}

.hero-orbit-card {
  padding: 1.5rem;
  display: grid;
  gap: 1.2rem;
  align-content: start;
}

.network-map {
  border-radius: 1.15rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 30% 20%, rgba(143, 185, 255, 0.18), transparent 26%),
    radial-gradient(circle at 76% 72%, rgba(216, 179, 106, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.network-map svg {
  width: 100%;
  display: block;
}

.network-map-bg {
  fill: rgba(8, 17, 29, 0.82);
}

.network-grid path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.network-links path {
  fill: none;
  stroke: url(#networkStroke);
  stroke-width: 1.9;
  stroke-linecap: round;
  opacity: 0.9;
}

.network-rings circle {
  fill: none;
  stroke: rgba(143, 185, 255, 0.14);
  stroke-width: 1;
}

.network-labels text {
  fill: rgba(237, 244, 255, 0.86);
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.star {
  fill: #8fb9ff;
  filter: url(#softGlow);
}

.star.sol {
  fill: #fff2cf;
}

.star.proxima,
.star.alpha {
  fill: #b9d3ff;
}

.star.tau {
  fill: #d8b36a;
}

.star.eridani {
  fill: #95c8ff;
}

.star.wolf {
  fill: #c5b6ff;
}

.orbit-points {
  display: grid;
  gap: 0.75rem;
}

.orbit-points p,
.panel-points p {
  margin: 0;
}

.hero-panel blockquote {
  margin: 0 0 1.2rem;
  font-family: "Baskervville", serif;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1.15;
}

.panel-points {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1.3rem;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.signal-grid span {
  aspect-ratio: 1;
  border-radius: 0.85rem;
  background:
    linear-gradient(135deg, rgba(143, 185, 255, 0.28), rgba(216, 179, 106, 0.12)),
    rgba(255, 255, 255, 0.04);
  animation: pulse 5s ease-in-out infinite;
}

.signal-grid span:nth-child(odd) {
  animation-delay: 0.6s;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem 0 4rem;
}

.metrics article {
  padding: 1.35rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow-soft);
}

.metrics article p {
  margin: 0;
  color: var(--muted);
}

.metrics span {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 2rem;
  font-weight: 800;
}

.editorial-band {
  margin: 0 0 3.2rem;
  padding: 2rem clamp(1.25rem, 4vw, 3rem);
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(143, 185, 255, 0.09), rgba(216, 179, 106, 0.06)),
    rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow-soft);
}

.editorial-band blockquote {
  margin: 0;
}

.editorial-band p {
  margin: 0;
  font-family: "Baskervville", serif;
  font-size: clamp(1.32rem, 2.4vw, 1.82rem);
  line-height: 1.38;
  color: var(--text);
  font-style: italic;
}

.section {
  padding: 2rem 0 4.8rem;
}

.section-heading {
  display: grid;
  gap: 1rem;
  max-width: none;
  margin-bottom: 2rem;
}

.compact-heading {
  margin-bottom: 1.4rem;
}

.section-heading h2 {
  font-size: clamp(2.6rem, 5vw, 4.3rem);
}

.section-intro,
.library-intro {
  margin: 0;
  max-width: none;
}

.feature-grid,
.story-grid,
.note-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.physics-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.physics-history-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 1.4rem;
}

.feature-grid,
.note-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.story-card,
.library-card,
.note-grid article {
  padding: 1.55rem;
}

.physics-card,
.physics-article,
.physics-history-grid article {
  position: relative;
  overflow: hidden;
  padding: 1.55rem;
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.physics-card::before,
.physics-article::before,
.physics-history-grid article::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}

.physics-card h3,
.physics-article h3,
.physics-history-grid h3 {
  margin: 0 0 0.8rem;
  font-size: 1.35rem;
}

.physics-card p,
.physics-article p,
.physics-article li,
.physics-history-grid p,
.physics-table {
  color: var(--muted);
  line-height: 1.75;
}

.physics-points {
  margin: 1rem 0 1.1rem;
  padding-left: 1.25rem;
  color: var(--muted);
}

.physics-points li {
  margin-bottom: 0.65rem;
  line-height: 1.8;
}

.physics-points-compact {
  margin: 0.55rem 0 0;
}

.physics-points-compact li {
  margin-bottom: 0.45rem;
  line-height: 1.65;
}

.equation-definitions {
  margin: 0.95rem 0 1.05rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.equation-definitions-label {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.physics-article {
  margin-top: 1.25rem;
}

.physics-diagram {
  margin-top: 1.15rem;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 16% 18%, rgba(143, 185, 255, 0.12), transparent 26%),
    radial-gradient(circle at 82% 78%, rgba(216, 179, 106, 0.08), transparent 24%),
    rgba(7, 14, 24, 0.82);
}

.physics-diagram svg {
  width: 100%;
  display: block;
}

.settings-figure {
  margin: 1.2rem 0 0;
}

.settings-figure-frame {
  position: relative;
  overflow: hidden;
  border-radius: 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 14% 18%, rgba(143, 185, 255, 0.16), transparent 26%),
    radial-gradient(circle at 82% 16%, rgba(216, 179, 106, 0.12), transparent 22%),
    radial-gradient(circle at 78% 78%, rgba(143, 185, 255, 0.08), transparent 28%),
    rgba(7, 14, 24, 0.88);
  box-shadow: var(--shadow-soft);
}

.settings-figure-frame::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  pointer-events: none;
}

.settings-figure-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.settings-figure figcaption {
  margin-top: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}

.physics-diagram-bg {
  fill: rgba(8, 17, 29, 0.88);
}

.physics-diagram-grid path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.physics-guide path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1.5;
  stroke-dasharray: 4 8;
  stroke-linecap: round;
}

.physics-beam path {
  fill: none;
  stroke: rgba(143, 185, 255, 0.78);
  stroke-width: 4;
  stroke-linecap: round;
}

.physics-sail {
  fill: rgba(216, 179, 106, 0.22);
  stroke: rgba(216, 179, 106, 0.85);
  stroke-width: 3;
}

.physics-spine {
  fill: rgba(255, 255, 255, 0.08);
  stroke: url(#spineStroke);
  stroke-width: 2;
}

.physics-tether {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 2;
  stroke-dasharray: 7 6;
  stroke-linecap: round;
}

.physics-node {
  fill: #fff0c8;
  stroke: rgba(216, 179, 106, 0.8);
  stroke-width: 2;
}

.physics-node-alt {
  fill: #b8d3ff;
  stroke: rgba(143, 185, 255, 0.9);
}

.physics-radiator {
  fill: rgba(143, 185, 255, 0.1);
  stroke: rgba(143, 185, 255, 0.7);
  stroke-width: 2;
}

.physics-module {
  fill: rgba(255, 255, 255, 0.06);
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 2;
}

.physics-module-core {
  fill: rgba(216, 179, 106, 0.14);
  stroke: rgba(216, 179, 106, 0.55);
  stroke-width: 1.5;
}

.physics-torpor-stack .physics-module {
  fill: rgba(143, 185, 255, 0.06);
}

.physics-label-line path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.5;
}

.physics-direction path {
  fill: none;
  stroke: rgba(216, 179, 106, 0.72);
  stroke-width: 2;
  stroke-linecap: round;
}

.physics-labels text {
  fill: rgba(237, 244, 255, 0.86);
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.physics-article pre,
.physics-card pre {
  margin: 1rem 0 1.2rem;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: rgba(5, 10, 18, 0.62);
}

.physics-article code,
.physics-card code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  color: var(--text);
  font-size: 0.92rem;
}

.physics-equation {
  margin: 1rem 0 1.2rem;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: rgba(5, 10, 18, 0.62);
}

.physics-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.physics-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 36rem;
}

.physics-table th,
.physics-table td {
  padding: 0.95rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.physics-table th {
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(10, 18, 31, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.physics-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

.physics-table tbody tr:hover {
  background: rgba(143, 185, 255, 0.05);
}

.physics-notes {
  margin-top: 1.2rem;
}

.feature-card h3,
.timeline h3,
.story-card h3,
.library-card h2,
.note-grid h3 {
  margin: 0 0 0.8rem;
  font-size: 1.28rem;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  position: relative;
}

.physics-timeline {
  margin-bottom: 1.2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 1.1rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(143, 185, 255, 0.18), rgba(216, 179, 106, 0.28), rgba(143, 185, 255, 0.18));
  z-index: 0;
}

.timeline article {
  padding: 1.5rem;
  z-index: 1;
}

.story-card,
.library-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.story-card h3,
.library-card h2,
.library-side-card h2,
.world-notes h3 {
  font-family: "Baskervville", serif;
  font-size: clamp(1.65rem, 3vw, 2.1rem);
  line-height: 1.06;
}

.story-card p,
.library-card p,
.library-side-card h2,
.world-notes h3 {
  margin: 0;
}

.card-meta-line {
  color: #e8edf7;
  font-family: "Crimson Text", serif;
  font-size: 1.08rem;
  line-height: 1.45;
}

.story-card-top,
.library-card-top,
.story-card h3,
.library-card h2,
.story-card > p,
.library-card > p,
.story-card-tags,
.story-card-footer,
.library-card-tags,
.library-footer {
  margin-top: 1rem;
}

.story-card-top,
.library-card-top {
  margin-top: 0;
}

.story-card-top,
.library-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.story-card-readtime,
.library-card-readtime {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.story-card-tags,
.library-card-tags {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-content: flex-start;
}

.story-card-footer {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  align-items: flex-start;
  margin-top: auto;
  padding-top: 1.35rem;
  position: relative;
}

.story-card-footer::before {
  content: "";
  width: 3.25rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(143, 185, 255, 0.24), rgba(143, 185, 255, 0));
}

.story-tag,
.library-tag {
  min-height: 1.8rem;
  padding: 0 0.72rem;
  font-size: 0.76rem;
  color: #bfd1ea;
}

.story-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid rgba(143, 185, 255, 0.28);
  background: rgba(143, 185, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

.story-card-link:hover,
.library-footer a:hover {
  background: rgba(143, 185, 255, 0.22);
  border-color: rgba(143, 185, 255, 0.44);
}

.world-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
  margin-top: 1.5rem;
}

.world-notes article {
  padding: 1.75rem 1.8rem;
  border-radius: 1.5rem;
  box-shadow: var(--shadow-soft);
  background:
    linear-gradient(180deg, rgba(24, 39, 61, 0.96), rgba(11, 20, 34, 0.9)),
    rgba(255, 255, 255, 0.02);
}

.world-notes .panel-label {
  margin-bottom: 1rem;
}

.world-notes h3 {
  margin: 0 0 1rem;
  line-height: 1.12;
}

.world-notes p:last-child {
  margin: 0;
}

.world-notes p:last-child,
.library-side-card p:last-child {
  margin: 0;
}

.world-notes article p:last-child {
  max-width: 34rem;
  font-size: 1rem;
  line-height: 1.9;
  color: #b8c8dd;
}

.section-actions {
  margin-top: 1.5rem;
}

.library-controls {
  padding-top: 0;
  padding-bottom: 2rem;
}

.filter-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.library-status {
  margin: 0;
}

.library-context {
  margin: 0 0 1.25rem;
  max-width: 42rem;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.65;
}

.library-context a {
  color: #f1cf8c;
  text-decoration: underline;
  text-decoration-color: rgba(241, 207, 140, 0.42);
  text-underline-offset: 0.14em;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.library-card.is-hidden {
  display: none;
}

.library-footer {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  align-items: flex-start;
  margin-top: auto;
  padding-top: 1.55rem;
  color: var(--muted);
  font-size: 0.95rem;
  position: relative;
}

.library-footer span {
  display: block;
  width: 100%;
  color: rgba(226, 235, 248, 0.8);
  line-height: 1.55;
}

.library-footer::before {
  content: "";
  width: 3.25rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(143, 185, 255, 0.24), rgba(143, 185, 255, 0));
}

.library-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  min-width: 8.4rem;
  padding: 0 1.1rem;
  margin-top: 0;
  border-radius: 999px;
  border: 1px solid rgba(143, 185, 255, 0.34);
  background: linear-gradient(135deg, rgba(143, 185, 255, 0.2), rgba(143, 185, 255, 0.1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 24px rgba(23, 38, 65, 0.24);
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
}

.reader-shell {
  width: min(calc(100% - 2rem), 1320px);
}

.topbar-reader {
  padding-bottom: 1rem;
  position: static;
  top: auto;
  background: transparent;
  backdrop-filter: none;
}

.topbar-reader::before {
  display: none;
}

.reader-main {
  display: flex;
  justify-content: center;
  padding: 1.1rem 0 1.5rem;
}

.story-reader {
  width: min(100%, var(--reader-width));
  padding: 3rem clamp(1.4rem, 4vw, 4rem);
  border-radius: 1.8rem;
  border: 1px solid var(--reader-border);
  background: var(--reader-bg), var(--reader-surface);
  color: var(--reader-text);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

.reader-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--reader-border);
}

.reader-header h1 {
  font-size: clamp(3rem, 6vw, 4.6rem);
}

.deck {
  margin-top: 1rem;
  color: var(--reader-muted);
  font-size: 1.06rem;
  line-height: 1.8;
}

.story-reader p {
  margin: 0 0 1.35rem;
  font-family: "Crimson Text", serif;
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
}

.story-reader h1,
.story-reader h2,
.story-reader h3,
.story-reader h4 {
  margin: 2.2rem 0 1rem;
  font-family: "Baskervville", serif;
  line-height: 1.08;
}

.story-reader h1 {
  font-size: clamp(2.4rem, 4.8vw, 3.7rem);
}

.story-reader h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.story-reader h3,
.story-reader h4 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.story-reader ul,
.story-reader ol {
  margin: 0 0 1.5rem;
  padding-left: 1.4rem;
  color: var(--reader-text);
}

.story-reader li {
  margin-bottom: 0.65rem;
  font-family: "Crimson Text", serif;
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
}

.story-reader blockquote {
  margin: 1.8rem 0;
  padding: 1.2rem 1.4rem;
  border-left: 3px solid rgba(216, 179, 106, 0.65);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 1rem 1rem 0;
}

.story-reader blockquote p:last-child {
  margin-bottom: 0;
}

.story-reader hr {
  margin: 2.2rem auto;
  width: min(7rem, 32%);
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.story-reader a {
  color: #f1cf8c;
  text-decoration: underline;
  text-decoration-color: rgba(241, 207, 140, 0.45);
  text-underline-offset: 0.14em;
}

.story-reader code,
.story-reader pre {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.story-reader :not(pre) > code {
  padding: 0.15rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.88em;
}

.story-reader pre {
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: rgba(5, 10, 18, 0.7);
}

.story-reader pre code {
  display: block;
  font-size: 0.92rem;
  line-height: 1.7;
}

.story-reader .story-meta {
  color: #e6c98d;
}

.reader-toolbar-shell {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.7rem;
}

.reader-toolbar-toggle {
  min-height: 2.75rem;
  padding: 0 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 17, 29, 0.82);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  cursor: pointer;
}

.reader-toolbar-toggle:hover,
.reader-toolbar-toggle[aria-expanded="true"] {
  background: rgba(18, 31, 49, 0.92);
  border-color: rgba(143, 185, 255, 0.28);
}

.reader-toolbar {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.9rem;
  width: min(100vw - 2rem, 42rem);
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 1.2rem;
  background: rgba(8, 17, 29, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.reader-toolbar[hidden] {
  display: none;
}

.reader-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.reader-toolbar-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 0.15rem;
}

body:is([data-page="reader"], [data-page="story"]) .reader-control.is-active,
body:is([data-page="reader"], [data-page="story"]) [data-theme-toggle][aria-pressed="false"] {
  background: rgba(216, 179, 106, 0.2);
  border-color: rgba(216, 179, 106, 0.34);
  color: var(--text);
}

.story-empty {
  width: min(100%, 760px);
  padding: 2rem;
  border-radius: 1.5rem;
}

.story-empty h1 {
  margin: 0 0 1rem;
  font-family: "Baskervville", serif;
  font-size: clamp(2.6rem, 6vw, 4rem);
}

body.reader-light {
  --reader-bg: linear-gradient(180deg, rgba(248, 249, 252, 0.97), rgba(237, 240, 247, 0.96));
  --reader-surface: #f4f7fb;
  --reader-text: #14202f;
  --reader-muted: #43556e;
  --reader-border: rgba(20, 32, 47, 0.1);
}

body.reader-light .story-reader .story-meta {
  color: #8a6520;
}

body.reader-light .story-reader blockquote {
  background: rgba(20, 32, 47, 0.04);
  border-left-color: rgba(138, 101, 32, 0.55);
}

body.reader-light .story-reader hr {
  border-top-color: rgba(20, 32, 47, 0.16);
}

body.reader-light .story-reader a {
  color: #7d5a16;
  text-decoration-color: rgba(125, 90, 22, 0.38);
}

body.reader-light .story-reader :not(pre) > code {
  background: rgba(20, 32, 47, 0.08);
}

body.reader-light .story-reader pre {
  border-color: rgba(20, 32, 47, 0.12);
  background: rgba(20, 32, 47, 0.05);
}

body.reader-light .reader-toolbar {
  background: rgba(8, 17, 29, 0.84);
}

.reader-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 4px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.06);
}

.reader-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  box-shadow: 0 0 20px rgba(143, 185, 255, 0.32);
}

.library-hero {
  grid-template-columns: minmax(0, 1.3fr) minmax(250px, 0.68fr);
  gap: 1.15rem;
  align-items: end;
}

.library-hero-copy {
  max-width: 940px;
}

.library-hero h1 {
  max-width: 15ch;
  font-size: clamp(3.1rem, 6vw, 5.4rem);
}

.library-side {
  display: grid;
  gap: 1rem;
  align-self: stretch;
}

.library-side-card,
.library-side-metrics article {
  border: 1px solid var(--border);
  border-radius: 1.4rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.library-side-card {
  padding: 1.4rem;
}

.library-side-card h2 {
  margin: 0 0 0.9rem;
}

.library-side-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.library-side-metrics article {
  padding: 1.15rem 1.2rem;
}

.library-side-metrics span {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 1.8rem;
  font-weight: 800;
}

.library-side-metrics p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.site-footer,
.reader-footer {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  align-items: center;
  padding: 1.25rem 1.4rem;
  margin: 0 0 2rem;
  border-radius: 1.4rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.footer-title {
  margin: 0 0 0.35rem;
  font-family: "Baskervville", serif;
  font-size: 1.7rem;
}

.footer-copy,
.reader-footer p {
  margin: 0;
  max-width: 42rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
}

.footer-links a {
  transition: color 160ms ease;
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-6px);
  }
}

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

  .signal-grid span {
    animation: none;
  }
}

@media (max-width: 980px) {
  .hero,
  .library-hero,
  .physics-hero,
  .feature-grid,
  .physics-grid,
  .story-grid,
  .note-grid,
  .timeline,
  .library-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .hero-copy h1,
  .library-hero h1,
  .physics-hero h1 {
    max-width: 13ch;
  }

  .library-side-metrics,
  .world-notes {
    grid-template-columns: 1fr 1fr;
  }

  .physics-toc {
    position: static;
    float: none;
    width: 100%;
    margin: 0 0 2rem;
  }

  .timeline {
    position: relative;
    padding-left: 1.4rem;
    gap: 1.5rem;
  }

  .timeline::before {
    display: none;
  }

  .timeline::after {
    content: "";
    position: absolute;
    left: 0.3rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: linear-gradient(
      180deg,
      rgba(143, 185, 255, 0.4),
      rgba(216, 179, 106, 0.35),
      rgba(143, 185, 255, 0.28)
    );
    border-radius: 999px;
  }

  .timeline article {
    padding-left: 0.35rem;
    overflow: visible;
  }

  .timeline article::after {
    content: "";
    position: absolute;
    left: -0.95rem;
    top: 1.45rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    box-shadow: 0 0 0 3px rgba(6, 12, 21, 0.96);
  }
}

@media (min-width: 1500px) {
  .physics-toc {
    position: fixed;
    top: 6.2rem;
    right: max(1rem, calc((100vw - var(--max-width)) / 2 - 13rem));
    margin: 0;
  }
}

@media (max-width: 720px) {
  .site-shell,
  .reader-shell {
    width: min(calc(100% - 1rem), var(--max-width));
  }

  .topbar,
  .library-footer,
  .site-footer,
  .reader-footer {
    align-items: flex-start;
  }

  .library-footer,
  .site-footer,
  .reader-footer {
    flex-direction: column;
  }

  .library-footer a,
  .reader-footer .button {
    min-width: 100%;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
    padding: 0.85rem 0 0.7rem;
  }

  .nav {
    align-items: center;
  }

  .nav a {
    min-height: 2.3rem;
    padding: 0 0.8rem;
    line-height: 1;
  }

  body:not([data-page="reader"]):not([data-page="story"]) .topbar .nav {
    width: 100%;
    justify-content: flex-start;
    gap: 0.55rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 0 0.15rem;
    scrollbar-width: none;
  }

  body:not([data-page="reader"]):not([data-page="story"]) .topbar .nav::-webkit-scrollbar {
    display: none;
  }

  body:not([data-page="reader"]):not([data-page="story"]) .topbar .nav a:not(.button-ghost) {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
  }

  body:not([data-page="reader"]):not([data-page="story"]) .topbar .button-ghost {
    min-height: 2.3rem;
    padding: 0 0.9rem;
    flex: 0 0 auto;
  }

  .story-card-top,
  .library-card-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .library-hero,
  .physics-hero {
    gap: 1.35rem;
    padding: 2.7rem 0 2rem;
  }

  .hero-copy::before,
  .library-hero-copy::before,
  .physics-hero-copy::before {
    top: -0.9rem;
    width: 3.1rem;
  }

  .hero-actions,
  .section-actions {
    width: 100%;
  }

  .hero-actions .button,
  .section-actions .button {
    width: 100%;
  }

  .hero-orbit-card,
  .hero-panel,
  .feature-card,
  .story-card,
  .library-card,
  .note-grid article,
  .library-side-card,
  .library-side-metrics article,
  .world-notes article,
  .physics-summary-card,
  .physics-card,
  .physics-article,
  .timeline article {
    padding: 1.25rem;
    border-radius: 1.25rem;
  }

  .story-card-link,
  .library-footer a {
    width: 100%;
  }

  .story-card-footer,
  .library-footer {
    padding-top: 1.15rem;
  }

  .metrics article {
    padding: 1.1rem 1.15rem;
  }

  .story-reader {
    padding: 1.4rem;
  }

  .reader-toolbar {
    justify-content: flex-start;
    width: min(calc(100vw - 1.2rem), 32rem);
    padding: 0.6rem 0.7rem;
    border-radius: 1rem;
    gap: 0.6rem;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .reader-toolbar-shell {
    right: 0.7rem;
    bottom: 0.7rem;
  }

  .reader-toolbar-toggle {
    min-height: 2.4rem;
    padding: 0 0.9rem;
    font-size: 0.92rem;
  }

  .reader-toolbar-group {
    flex-wrap: nowrap;
    flex: 0 0 auto;
  }

  .reader-toolbar-label {
    display: none;
  }

  .reader-main {
    padding: 1.2rem 0 5.5rem;
  }

  .topbar-reader {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0 0.4rem;
    gap: 0.7rem;
  }

  .topbar-reader .brand {
    min-width: 0;
    gap: 0.65rem;
  }

  .topbar-reader .brand-mark {
    width: 2.1rem;
    height: 2.1rem;
  }

  .topbar-reader .brand strong {
    font-size: 0.82rem;
    letter-spacing: 0.06em;
  }

  .topbar-reader .brand small {
    display: none;
  }

  .topbar-reader .nav {
    gap: 0.45rem;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
  }

  .topbar-reader .nav a,
  .topbar-reader .reader-control {
    min-height: 2.2rem;
    padding: 0 0.8rem;
    font-size: 0.88rem;
  }

  .hero-copy h1,
  .library-hero h1 {
    font-size: clamp(2.45rem, 10.8vw, 3.5rem);
    max-width: none;
  }

  .physics-hero h1 {
    font-size: clamp(2.5rem, 12vw, 3.7rem);
    max-width: none;
  }

  .section-heading h2 {
    font-size: clamp(2rem, 10vw, 3rem);
    line-height: 1.02;
  }

  .hero-text,
  .library-intro,
  .section-intro,
  .feature-card p,
  .timeline p,
  .story-card p,
  .library-card p,
  .note-grid p {
    line-height: 1.65;
  }

  body:is([data-page="reader"], [data-page="story"]) .topbar {
    position: static !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.55rem !important;
    padding: 0.45rem 0 0.2rem !important;
    backdrop-filter: none !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .brand {
    min-width: 0 !important;
    gap: 0.45rem !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .brand-mark {
    width: 1.7rem !important;
    height: 1.7rem !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .brand strong {
    font-size: 0.72rem !important;
    letter-spacing: 0.04em !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .brand small {
    display: none !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .nav {
    gap: 0.3rem !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .nav a,
  body:is([data-page="reader"], [data-page="story"]) .reader-control {
    min-height: 1.75rem !important;
    padding: 0 0.55rem !important;
    font-size: 0.74rem !important;
    border-radius: 999px !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-main {
    padding: 0.65rem 0 4rem !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-toolbar {
    width: min(calc(100vw - 0.8rem), 28rem) !important;
    padding: 0.35rem 0.4rem !important;
    gap: 0.35rem !important;
    border-radius: 0.8rem !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-toolbar::-webkit-scrollbar {
    display: none;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-toolbar-group {
    flex-wrap: nowrap !important;
    flex: 0 0 auto !important;
    gap: 0.3rem !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-toolbar-label {
    display: none !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .story-reader {
    padding: 1rem !important;
    border-radius: 1rem !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-header {
    margin-bottom: 1rem !important;
    padding-bottom: 0.85rem !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-header h1 {
    font-size: clamp(2rem, 9vw, 2.8rem) !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .deck {
    font-size: 0.88rem !important;
    line-height: 1.5 !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .story-reader p {
    margin-bottom: 0.9rem !important;
  }
}

@media (max-width: 540px) {
  .hero,
  .library-hero,
  .physics-hero {
    padding-top: 2.2rem;
  }

  .library-side-metrics,
  .world-notes {
    grid-template-columns: 1fr;
  }

  .site-shell,
  .reader-shell {
    width: min(calc(100% - 0.8rem), var(--max-width));
  }

  .topbar {
    gap: 0.6rem;
    padding-top: 0.75rem;
  }

  .brand {
    gap: 0.65rem;
  }

  .brand-mark {
    width: 2.15rem;
    height: 2.15rem;
  }

  .brand strong {
    font-size: 0.82rem;
    letter-spacing: 0.05em;
  }

  .brand small {
    font-size: 0.72rem;
  }

  .hero-actions,
  .filter-row {
    gap: 0.7rem;
  }

  .hero-actions {
    align-items: center;
  }

  .hero-highlights {
    gap: 0.55rem;
  }

  .hero-highlights span,
  .story-tag,
  .library-tag {
    min-height: 1.85rem;
    font-size: 0.74rem;
  }

  .button,
  .filter-button,
  .library-footer a {
    min-height: 2.55rem;
    padding: 0 0.9rem;
  }

  .topbar:not(.topbar-reader) .nav a {
    min-height: 2.15rem;
    padding: 0 0.72rem;
    font-size: 0.82rem;
  }

  .hero-copy h1,
  .library-hero h1 {
    font-size: clamp(2.15rem, 9.6vw, 3rem);
    max-width: none;
  }

  .physics-hero h1,
  .section-heading h2 {
    font-size: clamp(1.9rem, 9vw, 2.7rem);
  }

  .reader-header h1 {
    max-width: none;
  }

  .hero-text,
  .library-intro,
  .section-intro {
    font-size: 0.98rem;
  }

  .feature-card,
  .story-card,
  .library-card,
  .note-grid article,
  .world-notes article,
  .physics-card,
  .physics-article,
  .timeline article {
    padding: 1.1rem;
  }

  .library-side-card,
  .library-side-metrics article {
    padding: 1.05rem;
  }

  .metrics span,
  .library-side-metrics span {
    font-size: 1.55rem;
  }

  .story-reader {
    padding: 1.15rem;
    border-radius: 1.2rem;
  }

  .story-reader p {
    font-size: max(1.02rem, var(--reader-font-size));
  }

  .deck {
    font-size: 0.96rem;
  }

  .topbar-reader .nav a {
    padding: 0 0.7rem;
    font-size: 0.84rem;
  }

  .topbar-reader .reader-control {
    min-height: 2.05rem;
    padding: 0 0.7rem;
    font-size: 0.82rem;
  }

  .reader-toolbar {
    padding: 0.5rem 0.55rem;
  }

  .reader-toolbar-shell {
    right: 0.5rem;
    bottom: 0.5rem;
  }

  .reader-toolbar-toggle {
    min-height: 2.15rem;
    padding: 0 0.75rem;
    font-size: 0.84rem;
  }

  .site-footer,
  .reader-footer {
    padding: 1.05rem 1rem;
  }

  body:is([data-page="reader"], [data-page="story"]) .nav a {
    font-size: 0.68rem !important;
    padding: 0 0.45rem !important;
  }

  body:is([data-page="reader"], [data-page="story"]) .reader-control {
    min-height: 1.65rem !important;
    padding: 0 0.45rem !important;
    font-size: 0.7rem !important;
  }
}
