/* =========================================================
   Stellar Atlas
   An editorial instrument for watching stars live and die.
   ========================================================= */

:root {
  --bg: #08090c;
  --bg-raised: #0d0e12;
  --panel: #0a0b0e;
  --ink: #f2eee5;
  --ink-soft: #d0cabf;
  --muted: #9a968e;
  --faint: #73716b;
  --line: rgba(239, 233, 221, 0.15);
  --line-soft: rgba(239, 233, 221, 0.085);
  --accent: #f2bf7c;
  --accent-rgb: 242, 191, 124;
  --topbar-h: 58px;
  --serif: "Instrument Serif", "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "Noto Sans SC", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(85% 70% at 70% 45%, rgba(37, 34, 31, 0.24), transparent 60%),
    var(--bg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

::selection {
  color: #0b0b0c;
  background: var(--accent);
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ---------------- Atmosphere ---------------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.15;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.63'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(70% 68% at 0% 8%, rgba(var(--accent-rgb), 0.16), transparent 66%),
    radial-gradient(58% 68% at 6% 10%, rgba(var(--accent-rgb), 0.08), transparent 68%),
    radial-gradient(44% 55% at 18% 88%, rgba(132, 164, 205, 0.06), transparent 72%),
    radial-gradient(42% 48% at 78% 43%, rgba(var(--accent-rgb), 0.055), transparent 72%);
  transition: background 1.2s var(--ease-soft);
}

#ambient-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.78;
  filter: blur(1.2px) saturate(0.9);
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  min-height: 0;
}

/* ---------------- Top bar ---------------- */

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  flex: 0 0 var(--topbar-h);
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 clamp(22px, 3.2vw, 46px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 9, 12, 0.72);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 17px;
  height: 17px;
  color: var(--accent);
  place-items: center;
  transition: color 0.8s var(--ease-soft), transform 0.8s var(--ease-out);
}

.brand:hover .brand-mark {
  transform: rotate(45deg) scale(1.08);
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.35));
}

.brand-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.brand-latin {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
}

.topbar-whisper {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  opacity: 0.72;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: clamp(11px, 1.4vw, 19px);
}

.topbar-tools-rule {
  width: 1px;
  height: 12px;
  background: var(--line);
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: rgba(239, 233, 221, 0.012);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition:
    color 0.3s,
    border-color 0.3s,
    background 0.3s;
}

.sound-toggle[hidden] {
  display: none;
}

.sound-toggle:hover:not(:disabled) {
  color: var(--ink-soft);
  background: rgba(239, 233, 221, 0.015);
  border-color: var(--line);
}

.sound-toggle.is-on {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.035);
  border-color: rgba(var(--accent-rgb), 0.34);
}

.sound-toggle:disabled {
  cursor: wait;
  opacity: 0.52;
}

.sound-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 15px;
  height: 12px;
}

.sound-bars i {
  display: block;
  width: 1.5px;
  height: 11px;
  background: currentColor;
  border-radius: 1px;
  opacity: 0.5;
  transform: scaleY(0.24);
  transform-origin: center;
  transition: transform 0.35s var(--ease-soft), opacity 0.35s;
}

.sound-bars i:nth-child(2) { transform: scaleY(0.52); }
.sound-bars i:nth-child(3) { transform: scaleY(0.36); }
.sound-bars i:nth-child(4) { transform: scaleY(0.66); }
.sound-bars i:nth-child(5) { transform: scaleY(0.3); }

.sound-toggle.is-on .sound-bars i {
  opacity: 1;
  animation: soundBar 0.9s ease-in-out infinite alternate;
}

.sound-toggle.is-on .sound-bars i:nth-child(1) { animation-duration: 0.74s; animation-delay: -0.12s; }
.sound-toggle.is-on .sound-bars i:nth-child(2) { animation-duration: 1.05s; animation-delay: -0.36s; }
.sound-toggle.is-on .sound-bars i:nth-child(3) { animation-duration: 0.82s; animation-delay: -0.22s; }
.sound-toggle.is-on .sound-bars i:nth-child(4) { animation-duration: 1.12s; animation-delay: -0.5s; }
.sound-toggle.is-on .sound-bars i:nth-child(5) { animation-duration: 0.9s; animation-delay: -0.08s; }

.sound-state {
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.08em;
  transition: color 0.3s;
}

.sound-toggle.is-on .sound-state {
  color: var(--accent);
}

@keyframes soundBar {
  0% { transform: scaleY(0.22); }
  100% { transform: scaleY(1); }
}

.help-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: rgba(239, 233, 221, 0.012);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition:
    color 0.3s,
    border-color 0.3s,
    background 0.3s;
}

.help-toggle:hover {
  color: var(--ink);
  background: rgba(var(--accent-rgb), 0.035);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.help-mark {
  display: grid;
  width: 15px;
  height: 15px;
  font-size: 9px;
  line-height: 1;
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  border-radius: 50%;
  place-items: center;
}

.help-text {
  color: var(--muted);
  letter-spacing: 0.12em;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

.status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08), 0 0 8px rgba(var(--accent-rgb), 0.55);
  animation: statusPulse 3.2s ease-in-out infinite;
  transition: background 0.8s, box-shadow 0.8s;
}

.status-divider {
  width: 18px;
  height: 1px;
  background: var(--line);
}

@keyframes statusPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ---------------- Main layout ---------------- */

.layout {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: clamp(400px, 37vw, 528px) minmax(0, 1fr);
  min-height: 0;
}

/* ---------------- Left panel ---------------- */

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(88% 62% at 0% 0%, rgba(176, 203, 232, 0.075), transparent 64%),
    linear-gradient(180deg, rgba(24, 27, 32, 0.20) 0%, rgba(8, 9, 12, 0.10) 55%, rgba(8, 9, 12, 0.28) 100%),
    rgba(7, 9, 13, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset -1px 0 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(32px) saturate(165%);
  -webkit-backdrop-filter: blur(32px) saturate(165%);
}

.panel::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
  background: radial-gradient(115% 48% at 10% 0%, rgba(var(--accent-rgb), 0.075), transparent 60%);
  opacity: 1;
  transition: background 1.1s var(--ease-soft);
}

.panel::after {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, transparent, rgba(var(--accent-rgb), 0.24) 36%, transparent 82%);
  opacity: 0.42;
}

.panel-scroll {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(24px, 3.6vh, 38px) clamp(24px, 2.75vw, 40px) 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.panel-intro,
.chapter,
.timeline-section {
  opacity: 1;
  transform: translateY(0);
}

/* Mass selector */

.micro-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.micro-label {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.micro-value {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.6px;
  letter-spacing: 0.06em;
  transition: color 0.7s var(--ease-soft);
}

.tracks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
  border-top: 1px solid var(--line);
}

.track {
  position: relative;
  min-width: 0;
  padding: 12px 9px 12px 0;
  overflow: hidden;
  color: var(--faint);
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  transition: color 0.35s var(--ease-soft);
}

.track::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  content: "";
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0.9;
  transition: transform 0.55s var(--ease-out), background 0.8s;
}

.track::before {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  content: "";
  background: var(--line-soft);
}

.track:hover {
  color: var(--ink-soft);
}

.track:hover .track-mass {
  color: var(--ink-soft);
}

.track[aria-pressed="true"] {
  color: var(--ink);
}

.track[aria-pressed="true"]::after {
  transform: scaleX(1);
}

.track-mass {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  transition: color 0.35s var(--ease-soft);
}

.track[aria-pressed="true"] .track-mass {
  color: var(--accent);
}

.track-name {
  display: block;
  overflow: hidden;
  font-size: 12.7px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(24px, 4vh, 40px);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.track-legend-rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--line-soft);
}

/* Stage copy */

.chapter {
  transition: opacity 0.22s var(--ease-soft), transform 0.32s var(--ease-out);
}

.chapter.is-switching {
  opacity: 0;
  transform: translateY(7px);
}

.chapter-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 16px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.09em;
}

.stage-index {
  color: var(--accent);
  font-size: 9.5px;
  transition: color 0.8s var(--ease-soft);
}

.stage-total {
  color: var(--faint);
}

.meta-rule {
  width: 24px;
  height: 1px;
  margin: 0 5px;
  background: var(--line);
}

.stage-kicker {
  overflow: hidden;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-title {
  min-height: 1.08em;
  margin: 15px 0 12px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(38px, 3.3vw, 48px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.015em;
  text-wrap: balance;
}

.stage-lead {
  min-height: 80px;
  max-width: 48ch;
  margin: 0;
  color: #b4afa6;
  font-size: clamp(13.2px, 1.02vw, 14.3px);
  font-weight: 300;
  line-height: 1.8;
  letter-spacing: 0.024em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 19px 0 0;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
}

.facts > div {
  min-width: 0;
  padding-right: 10px;
}

.facts > div + div {
  padding-left: 13px;
  border-left: 1px solid var(--line-soft);
}

.facts dt {
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 9.6px;
  font-weight: 300;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.facts dd {
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: clamp(10.2px, 0.82vw, 11.4px);
  line-height: 1.45;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mechanism-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-height: 18px;
  padding-top: 11px;
}

.mechanism-label {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  opacity: 0.8;
  transition: color 0.8s var(--ease-soft);
}

.mechanism-copy {
  overflow: hidden;
  color: var(--faint);
  font-size: 10.2px;
  font-weight: 300;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-note {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 14px;
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}

.stage-note-label {
  padding-top: 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.55;
  letter-spacing: 0.07em;
}

.stage-note p {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13.3px;
  font-weight: 400;
  line-height: 1.82;
  letter-spacing: 0.012em;
  text-wrap: pretty;
}

.concept-term {
  display: inline;
  margin: 0;
  padding: 0 0.04em 0.04em;
  color: var(--ink);
  font-family: var(--sans);
  font-size: inherit;
  font-weight: 600;
  line-height: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  cursor: help;
  background: transparent;
  border: 0;
  border-bottom: 1px dotted rgba(var(--accent-rgb), 0.82);
  border-radius: 1px;
  transition: color 0.2s var(--ease-soft), border-color 0.2s var(--ease-soft);
}

.concept-term:hover,
.concept-term:focus-visible,
.concept-term[aria-expanded="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Timeline */

.timeline-section {
  margin-top: clamp(24px, 3.5vh, 36px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.2px;
  letter-spacing: 0.09em;
  border-bottom: 1px solid var(--line);
}

.section-latin {
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.15em;
}

.timeline {
  position: relative;
  margin: 0;
  padding: 3px 0 0;
  list-style: none;
}

.timeline::before {
  position: absolute;
  top: 19px;
  bottom: 19px;
  left: 27px;
  width: 1px;
  content: "";
  background: linear-gradient(180deg, var(--line), var(--line-soft) 65%, transparent);
  pointer-events: none;
}

.timeline-button {
  position: relative;
  display: grid;
  grid-template-columns: 17px 15px minmax(0, 1fr) auto;
  column-gap: 7px;
  align-items: center;
  width: 100%;
  min-height: 30px;
  padding: 4px 0;
  color: var(--faint);
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 2px;
  transition: color 0.25s var(--ease-soft);
}

.timeline-button::after {
  position: absolute;
  right: -8px;
  left: -8px;
  height: 100%;
  pointer-events: none;
  content: "";
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.045), transparent 80%);
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.35s var(--ease-soft);
}

.timeline-button:hover::after,
.timeline-button.is-active::after {
  opacity: 1;
}

.tl-index {
  position: relative;
  z-index: 1;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  transition: color 0.25s;
}

.tl-dot {
  position: relative;
  z-index: 1;
  display: block;
  width: 5.5px;
  height: 5.5px;
  justify-self: center;
  background: var(--panel);
  border: 1px solid rgba(239, 233, 221, 0.34);
  border-radius: 50%;
  transition:
    background 0.3s var(--ease-soft),
    border-color 0.3s var(--ease-soft),
    box-shadow 0.35s var(--ease-soft),
    transform 0.35s var(--ease-out);
}

.tl-name {
  position: relative;
  z-index: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.8px;
  font-weight: 300;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.25s var(--ease-soft), transform 0.35s var(--ease-out);
}

.tl-time {
  position: relative;
  z-index: 1;
  padding-right: 1px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.3px;
  letter-spacing: 0;
  opacity: 0.64;
  transition: color 0.25s, opacity 0.25s;
  white-space: nowrap;
}

.timeline-button:hover .tl-name {
  color: var(--ink-soft);
}

.timeline-button:hover .tl-dot {
  border-color: rgba(var(--accent-rgb), 0.7);
}

.timeline-button.is-done .tl-dot {
  background: rgba(var(--accent-rgb), 0.35);
  border-color: transparent;
}

.timeline-button.is-active .tl-index {
  color: var(--accent);
}

.timeline-button.is-active .tl-name {
  color: var(--ink);
  transform: translateX(1px);
}

.timeline-button.is-active .tl-time {
  color: var(--ink-soft);
  opacity: 0.82;
}

.timeline-button.is-active .tl-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(var(--accent-rgb), 0.09),
    0 0 11px rgba(var(--accent-rgb), 0.5);
  transform: scale(1.22);
}

/* Footer controls */

.panel-footer {
  position: relative;
  z-index: 2;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 15px clamp(24px, 2.75vw, 40px) 17px;
  background: linear-gradient(180deg, rgba(10, 11, 14, 0.64), rgba(9, 10, 13, 0.95));
  border-top: 1px solid var(--line-soft);
  backdrop-filter: blur(8px);
}

.round-button {
  display: grid;
  width: 42px;
  height: 42px;
  color: var(--ink-soft);
  cursor: pointer;
  background: rgba(239, 233, 221, 0.012);
  border: 1px solid var(--line);
  border-radius: 50%;
  place-items: center;
  transition:
    color 0.3s,
    background 0.3s,
    border-color 0.3s,
    transform 0.3s var(--ease-out);
}

.round-button svg {
  width: 17px;
  height: 17px;
}

.round-button:hover:not(:disabled) {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.035);
  border-color: rgba(var(--accent-rgb), 0.45);
  transform: translateX(-2px);
}

.round-button:active:not(:disabled) {
  transform: translateX(-1px) scale(0.96);
}

.round-button:disabled {
  cursor: default;
  opacity: 0.24;
}

.play-button {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 4px;
  color: var(--ink-soft);
  cursor: pointer;
  background: transparent;
  border: 0;
}

.play-icon {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  place-items: center;
  transition: color 0.3s, border-color 0.3s, background 0.3s, transform 0.3s;
}

.play-icon svg {
  width: 12px;
  height: 12px;
}

.play-icon .icon-pause {
  display: none;
}

.play-button:hover .play-icon {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.4);
  transform: scale(1.06);
}

.play-button.is-playing .play-icon {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.07);
  border-color: rgba(var(--accent-rgb), 0.44);
}

.play-button.is-playing .icon-play {
  display: none;
}

.play-button.is-playing .icon-pause {
  display: block;
}

.play-label {
  font-size: 11.2px;
  font-weight: 300;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.play-button kbd {
  padding: 3px 4px 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}

.next-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  height: 42px;
  padding: 0 15px;
  color: #0a0b0d;
  font-size: 11.2px;
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: pointer;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition:
    color 0.3s,
    background 0.4s var(--ease-soft),
    border-color 0.4s,
    transform 0.3s var(--ease-out),
    opacity 0.3s;
}

.next-button svg {
  width: 17px;
  height: 17px;
  transition: transform 0.35s var(--ease-out);
}

.next-button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

.next-button:hover:not(:disabled) svg {
  transform: translateX(3px);
}

.next-button:active:not(:disabled) {
  transform: scale(0.985);
}

.next-button:disabled {
  color: var(--faint);
  cursor: default;
  background: transparent;
  border-color: var(--line);
}

.auto-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.28), var(--accent));
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0.6;
  pointer-events: none;
}

/* ---------------- Right stage ---------------- */

.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  background:
    radial-gradient(55% 55% at 50% 48%, rgba(var(--accent-rgb), 0.05), transparent 72%),
    #06070a;
}

.stage.is-dragging {
  cursor: grabbing;
}

#cosmos,
#fx {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#cosmos {
  z-index: 0;
  opacity: 0;
  transition: opacity 1.3s var(--ease-soft);
}

.is-ready #cosmos {
  opacity: 1;
}

#fx {
  z-index: 2;
  pointer-events: none;
}

#bh-canvas,
#bh-overlay {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s var(--ease-soft);
}

#bh-canvas {
  z-index: 1;
  pointer-events: none;
  cursor: grab;
}

#bh-overlay {
  z-index: 2;
  pointer-events: none;
}

.stage.bh-active #cosmos,
.stage.bh-active #fx {
  opacity: 0;
  visibility: hidden;
}

.stage.bh-active #bh-canvas {
  opacity: 1;
  pointer-events: auto;
}

.stage.bh-active #bh-overlay {
  opacity: 1;
}

.stage.bh-active.is-dragging #bh-canvas {
  cursor: grabbing;
}

.stage.bh-active .stage-vignette {
  opacity: 0.5;
}

.stage-fallback {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(var(--accent-rgb), 0.42), transparent 10%),
    radial-gradient(circle at 50% 48%, rgba(var(--accent-rgb), 0.16), transparent 35%),
    radial-gradient(62% 55% at 50% 48%, rgba(24, 30, 43, 0.6), transparent 76%),
    #06070a;
}

.webgl-failed #cosmos {
  display: none;
}

.webgl-failed .stage-fallback {
  display: block;
}

.stage-vignette {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 5, 8, 0.45) 0%, transparent 17%, transparent 81%, rgba(4, 5, 8, 0.46) 100%),
    radial-gradient(circle at 50% 46%, transparent 42%, rgba(3, 4, 7, 0.12) 74%, rgba(3, 4, 7, 0.5) 100%);
}

.stage-frame {
  position: absolute;
  z-index: 5;
  inset: 21px;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 11px;
  height: 11px;
  border-color: rgba(239, 233, 221, 0.25);
  border-style: solid;
}

.corner-tl {
  top: 0;
  left: 0;
  border-width: 1px 0 0 1px;
}

.corner-tr {
  top: 0;
  right: 0;
  border-width: 1px 1px 0 0;
}

.corner-bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 1px 1px;
}

.corner-br {
  right: 0;
  bottom: 0;
  border-width: 0 1px 1px 0;
}

/* HUD */

.hud {
  position: absolute;
  z-index: 6;
  right: clamp(27px, 3.1vw, 46px);
  left: clamp(27px, 3.1vw, 46px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.hud-top {
  top: clamp(28px, 3.8vh, 39px);
}

.hud-bottom {
  bottom: clamp(27px, 3.6vh, 37px);
  align-items: flex-end;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.hud-right {
  align-items: flex-end;
  text-align: right;
}

.hud-kicker {
  color: rgba(236, 230, 217, 0.88);
  font-family: var(--mono);
  font-size: 8.8px;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.4s;
}

.hud-note {
  overflow: hidden;
  max-width: 320px;
  color: rgba(236, 230, 217, 0.6);
  font-size: 10.2px;
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scale-readout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: rgba(236, 230, 217, 0.6);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.075em;
  white-space: nowrap;
}

.scale-line {
  position: relative;
  display: block;
  width: 61px;
  height: 1px;
  background: rgba(239, 233, 221, 0.34);
}

.scale-line::before,
.scale-line::after {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 7px;
  content: "";
  background: rgba(239, 233, 221, 0.34);
}

.scale-line::before {
  left: 0;
}

.scale-line::after {
  right: 0;
}

.view-hint {
  position: absolute;
  bottom: 0;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(236, 230, 217, 0.44);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.09em;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: opacity 0.5s;
}

.view-hint svg {
  width: 14px;
  height: 17px;
  opacity: 0.62;
}

.hud-sequence {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: rgba(236, 230, 217, 0.58);
  font-family: var(--mono);
  font-size: 8.2px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.hud-sequence-rule {
  width: 21px;
  height: 1px;
  background: rgba(239, 233, 221, 0.26);
}

#hud-counter {
  color: rgba(236, 230, 217, 0.72);
}


/* ---------------- Physics concept popover ---------------- */

.concept-popover {
  position: fixed;
  z-index: 150;
  width: min(378px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100svh - 24px);
  padding: 18px 19px 17px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink-soft);
  background:
    linear-gradient(180deg, rgba(19, 20, 25, 0.985), rgba(10, 11, 15, 0.99));
  border: 1px solid rgba(var(--accent-rgb), 0.33);
  border-radius: 3px;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.018) inset;
  backdrop-filter: blur(20px);
  visibility: hidden;
  opacity: 0;
  transform: translateY(5px) scale(0.995);
  pointer-events: none;
  transition:
    opacity 0.18s var(--ease-soft),
    transform 0.22s var(--ease-out),
    visibility 0.18s;
  scrollbar-width: none;
}

.concept-popover::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.concept-popover.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.concept-popover[data-placement="bottom"] {
  transform-origin: top center;
}

.concept-popover[data-placement="top"] {
  transform-origin: bottom center;
}

.concept-popover[data-placement="right"] {
  transform-origin: left center;
}

.concept-popover::after {
  position: absolute;
  top: 0;
  right: 22px;
  left: 22px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.6), transparent);
  pointer-events: none;
}

.concept-close {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  width: 27px;
  height: 27px;
  color: var(--faint);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  place-items: center;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.concept-close svg {
  width: 13px;
  height: 13px;
}

.concept-close:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.05);
  border-color: rgba(var(--accent-rgb), 0.24);
}

.concept-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 20px;
  padding-right: 29px;
}

.concept-tag {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.concept-symbol {
  margin-left: auto;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.concept-name {
  margin: 11px 0 9px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0.01em;
}

.concept-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.8px;
  font-weight: 300;
  line-height: 1.8;
  letter-spacing: 0.018em;
}

.concept-formulas {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 14px 0 13px;
}

.concept-formula {
  padding: 8px 10px 9px;
  background: rgba(239, 233, 221, 0.025);
  border-left: 1px solid rgba(var(--accent-rgb), 0.48);
}

.formula-label {
  display: block;
  margin-bottom: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.3;
  letter-spacing: 0.08em;
}

.formula-expr {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11.2px;
  line-height: 1.7;
  overflow-wrap: break-word;
  word-break: normal;
}

.formula-expr i,
.formula-expr var {
  font-family: var(--serif);
  font-style: italic;
}

.formula-expr sub,
.formula-expr sup {
  font-size: 0.7em;
  line-height: 0;
}

.concept-note {
  margin: 0;
  padding-top: 10px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 300;
  line-height: 1.7;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--line-soft);
}

.concept-note sub,
.concept-note sup {
  font-size: 0.72em;
}

@media (max-width: 640px) {
  .concept-popover {
    width: calc(100vw - 24px);
    padding: 16px 16px 15px;
  }

  .concept-head {
    padding-right: 28px;
  }

  .concept-name {
    margin-top: 10px;
    font-size: 22px;
  }

  .concept-body {
    font-size: 12.4px;
    line-height: 1.76;
  }

  .formula-expr {
    font-size: 10.5px;
  }
}

/* ---------------- Help dialog ---------------- */

body.help-open {
  overflow: hidden;
}

.help-backdrop {
  position: fixed;
  z-index: 160;
  inset: 0;
  background: rgba(4, 5, 8, 0.66);
  backdrop-filter: blur(9px);
  opacity: 0;
  transition: opacity 0.24s var(--ease-soft);
}

.help-backdrop.is-open {
  opacity: 1;
}

.help-backdrop[hidden],
.help-dialog[hidden] {
  display: none;
}

.help-dialog {
  position: fixed;
  z-index: 170;
  top: 50%;
  left: 50%;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100svh - 32px);
  padding: 25px 30px 20px;
  overflow-y: auto;
  background:
    radial-gradient(80% 70% at 15% 0%, rgba(var(--accent-rgb), 0.07), transparent 60%),
    linear-gradient(180deg, rgba(19, 20, 25, 0.99), rgba(10, 11, 15, 0.995));
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 3px;
  box-shadow:
    0 36px 100px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.018) inset;
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 10px)) scale(0.99);
  transition:
    opacity 0.22s var(--ease-soft),
    transform 0.3s var(--ease-out),
    visibility 0s linear 0.22s;
  scrollbar-width: none;
}

.help-dialog::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.help-dialog.is-open {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition:
    opacity 0.22s var(--ease-soft),
    transform 0.3s var(--ease-out),
    visibility 0s;
}

.help-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 29px;
  height: 29px;
  color: var(--faint);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  place-items: center;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.help-close svg {
  width: 14px;
  height: 14px;
}

.help-close:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.05);
  border-color: rgba(var(--accent-rgb), 0.24);
}

.help-kicker {
  display: block;
  padding-right: 35px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  opacity: 0.78;
}

.help-intro {
  max-width: 56ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12.6px;
  font-weight: 300;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 36px;
  margin-top: 23px;
}

.help-section-label {
  display: block;
  padding-bottom: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.09em;
  border-bottom: 1px solid var(--line);
}

.help-item {
  display: flex;
  align-items: baseline;
  gap: 11px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.help-item:last-child {
  border-bottom: 0;
}

.help-key {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 3px 5px 4px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  background: rgba(239, 233, 221, 0.025);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}

.help-item > span:last-child {
  color: var(--muted);
  font-size: 11.4px;
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.help-foot {
  margin: 18px 0 0;
  padding-top: 12px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.03em;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 640px) {
  .help-dialog {
    width: calc(100vw - 24px);
    padding: 21px 18px 17px;
  }

  .help-grid {
    grid-template-columns: 1fr;
    gap: 19px;
    margin-top: 19px;
  }

  .help-item {
    padding: 7px 0;
  }

  .help-key {
    min-width: 58px;
  }
}

/* ---------------- Entrance ---------------- */

@media (prefers-reduced-motion: no-preference) {
  .brand,
  .topbar-whisper,
  .topbar-tools {
    animation: topFade 1s var(--ease-out) both;
  }

  .panel-intro {
    animation: riseIn 0.9s 0.08s var(--ease-out) both;
  }

  .chapter {
    animation: riseIn 0.9s 0.17s var(--ease-out) both;
  }

  .timeline-section {
    animation: riseIn 0.9s 0.26s var(--ease-out) both;
  }

  .panel-footer {
    animation: fadeIn 0.9s 0.35s both;
  }

  .hud-top {
    animation: topFade 1.2s 0.42s var(--ease-out) both;
  }

  .hud-bottom {
    animation: fadeIn 1.2s 0.56s both;
  }

  .stage-frame {
    animation: fadeIn 1.2s 0.3s both;
  }
}

@keyframes topFade {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1220px) {
  .play-button kbd {
    display: none;
  }

  .topbar-whisper {
    display: none;
  }

  .stage-title {
    font-size: clamp(35px, 3.55vw, 44px);
  }
}

@media (max-width: 760px) {
  .topbar-status,
  .topbar-tools-rule {
    display: none;
  }

  .topbar-tools {
    gap: 8px;
  }

  .help-text {
    display: none;
  }

  .help-toggle {
    justify-content: center;
    width: 30px;
    padding: 0;
  }
}

@media (max-width: 960px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .layout {
    display: flex;
    flex-direction: column;
  }

  .stage {
    order: 1;
    flex: 0 0 auto;
    height: clamp(420px, 58vh, 620px);
    height: clamp(420px, 58svh, 620px);
    border-bottom: 1px solid var(--line-soft);
  }

  .panel {
    order: 2;
    overflow: visible;
    border-right: 0;
  }

  .panel-scroll {
    overflow: visible;
    padding: 30px clamp(25px, 7vw, 58px) 0;
  }

  .panel-footer {
    position: sticky;
    bottom: 0;
    padding-right: clamp(25px, 7vw, 58px);
    padding-left: clamp(25px, 7vw, 58px);
    background: rgba(9, 10, 13, 0.9);
    backdrop-filter: blur(18px);
  }

  .stage-title {
    font-size: clamp(37px, 5.4vw, 47px);
  }

  .stage-lead {
    max-width: 62ch;
    min-height: 0;
    font-size: 13.8px;
  }

  .track-legend {
    margin-bottom: 31px;
  }

  .timeline-section {
    margin-bottom: 8px;
  }

  .facts dd {
    font-size: 10.5px;
  }

  .hud-note {
    max-width: 250px;
  }

  .view-hint {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-h: 52px;
  }

  .topbar {
    padding: 0 17px;
  }

  .brand {
    gap: 8px;
  }

  .brand-latin {
    display: none;
  }

  .brand-name {
    font-size: 12px;
    letter-spacing: 0.09em;
  }

  .sound-toggle {
    height: 30px;
    padding: 0 8px;
    gap: 6px;
    font-size: 8px;
  }

  .sound-state {
    font-size: 6.5px;
  }

  .stage {
    height: clamp(350px, 52vh, 500px);
    height: clamp(350px, 52svh, 500px);
  }

  .hud {
    right: 19px;
    left: 19px;
  }

  .hud-top {
    top: 23px;
  }

  .hud-bottom {
    bottom: 22px;
  }

  .hud-kicker {
    font-size: 7.2px;
    letter-spacing: 0.09em;
  }

  .hud-note {
    max-width: 195px;
    font-size: 8.7px;
  }

  .hud-right .hud-note {
    max-width: 136px;
  }

  .stage-frame {
    inset: 14px;
  }

  .hud-sequence {
    font-size: 7px;
    gap: 7px;
  }

  .hud-sequence-rule {
    width: 13px;
  }

  .scale-readout {
    font-size: 7px;
    gap: 6px;
  }

  .scale-line {
    width: 43px;
  }

  .panel-scroll {
    padding: 24px 20px 0;
  }

  .panel-footer {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  }

  .round-button {
    width: 40px;
    height: 40px;
  }

  .play-button {
    height: 40px;
    gap: 7px;
  }

  .play-label {
    font-size: 10.5px;
  }

  .next-button {
    height: 40px;
    gap: 10px;
    padding: 0 12px;
    font-size: 10.5px;
  }

  .facts {
    margin-top: 17px;
  }

  .facts dt {
    font-size: 8.8px;
    letter-spacing: 0.02em;
  }

  .facts dd {
    font-family: var(--mono);
    font-size: 9.3px;
    letter-spacing: -0.03em;
  }

  .facts > div + div {
    padding-left: 10px;
  }

  .mechanism-copy {
    font-size: 9px;
  }

  .stage-title {
    margin-top: 13px;
    margin-bottom: 10px;
    font-size: clamp(33px, 9.2vw, 40px);
  }

  .stage-kicker {
    font-size: 8px;
  }

  .chapter-meta {
    font-size: 8.2px;
  }

  .timeline-button {
    grid-template-columns: 16px 15px minmax(0, 1fr) auto;
    column-gap: 5px;
    min-height: 30px;
  }

  .timeline::before {
    left: 25px;
  }

  .tl-name {
    font-size: 11.2px;
  }

  .tl-time {
    font-size: 7.5px;
  }

  .track-name {
    font-size: 11.8px;
  }

  .track-mass {
    font-size: 7.5px;
  }

  .track {
    padding-right: 5px;
  }

  .track-legend {
    gap: 7px;
    font-size: 7px;
    letter-spacing: 0.04em;
  }
}

@media (max-width: 960px) and (max-height: 560px) {
  .stage {
    height: clamp(250px, 58vh, 340px);
    height: clamp(250px, 58svh, 340px);
  }

  .hud-note {
    display: none;
  }

  .hud-top {
    top: 21px;
  }

  .hud-bottom {
    bottom: 19px;
  }
}

@media (max-height: 960px) and (min-width: 961px) {
  .panel-scroll {
    padding-top: 24px;
  }

  .track {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .track-legend {
    margin-bottom: 27px;
  }

  .stage-title {
    margin-top: 12px;
    margin-bottom: 10px;
    font-size: clamp(35px, 3.05vw, 44px);
  }

  .stage-lead {
    min-height: 64px;
    line-height: 1.78;
  }

  .facts {
    margin-top: 15px;
    padding: 11px 0;
  }

  .mechanism-row {
    padding-top: 8px;
  }

  .stage-note {
    margin-top: 17px;
    padding-top: 12px;
  }

  .stage-note p {
    font-size: 12.8px;
    line-height: 1.76;
  }

  .timeline-section {
    margin-top: 24px;
  }

  .timeline-button {
    min-height: 28px;
    padding: 3px 0;
  }

  .panel-footer {
    padding-top: 12px;
    padding-bottom: 14px;
  }
}

@media (max-height: 860px) and (min-width: 961px) {
  .panel-scroll {
    padding-top: 21px;
  }

  .track-legend {
    margin-bottom: 21px;
  }

  .stage-title {
    margin-top: 10px;
    margin-bottom: 8px;
    font-size: clamp(32px, 2.9vw, 40px);
  }

  .stage-lead {
    min-height: 0;
  }

  .facts {
    margin-top: 12px;
    padding: 9px 0;
  }

  .mechanism-row {
    padding-top: 6px;
  }

  .stage-note {
    margin-top: 13px;
    padding-top: 10px;
  }

  .stage-note p {
    font-size: 12.4px;
    line-height: 1.72;
  }

  .timeline-section {
    margin-top: 19px;
  }

  .timeline-button {
    min-height: 25px;
    padding: 2px 0;
  }

  .panel-footer {
    padding-top: 10px;
    padding-bottom: 12px;
  }
}

@media (max-width: 1100px) and (max-height: 860px) and (min-width: 961px) {
  .timeline-section {
    margin-top: 13px;
  }

  .timeline-button {
    min-height: 21px;
  }

  .timeline::before {
    top: 13px;
    bottom: 13px;
  }
}

@media (max-height: 760px) and (min-width: 961px) {
  .panel-scroll {
    padding-top: 17px;
  }

  .track {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .track-legend {
    margin-bottom: 17px;
  }

  .stage-note {
    display: none;
  }

  .stage-title {
    margin-top: 8px;
    margin-bottom: 7px;
    font-size: clamp(30px, 2.75vw, 37px);
  }

  .stage-lead {
    font-size: 12.8px;
    line-height: 1.7;
  }

  .facts {
    margin-top: 10px;
    padding: 8px 0;
  }

  .timeline-section {
    margin-top: 14px;
  }

  .timeline-button {
    min-height: 23px;
  }

  .panel-footer {
    padding-top: 8px;
    padding-bottom: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
