/* SkyMotion / Material 3 Expressive: shared components, separate scientific drawing.
 * Loaded last on every route. Geometry for switches, history and motion is owned
 * by existing modules; this layer owns typography, surfaces and visual states.
 */
@font-face {
  font-family: 'SkyMotion Interface';
  src: url('fonts/interface-regular.woff') format('woff');
  font-weight: 400 500;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'SkyMotion Interface';
  src: url('fonts/interface-bold.woff') format('woff');
  font-weight: 600 800;
  font-style: normal;
  font-display: block;
}
@font-face {font-family:'SkyMotion Reading';src:url('fonts/reading-extra-regular.woff2') format('woff2');font-weight:400 500;font-display:block;unicode-range:U+4E03,U+4E32,U+4E3E,U+4E58,U+4EBA,U+4EF7,U+5112,U+5144,U+518C,U+5192,U+52FE,U+5339,U+534F,U+5938,U+5CF0,U+5F1F,U+5F2F,U+601D,U+614E,U+61D2,U+6233,U+6241,U+626B,U+6279,U+62A2,U+642D,U+653F,U+65A5,U+6714,U+679A,U+6B67,U+6CE1,U+6D3E,U+6D89,U+6FC0,U+7075,U+725B,U+731C,U+751A,U+76AE,U+79C1,U+7A79,U+7B26,U+7D2F,U+7EA0,U+7EAA,U+7EB2,U+7EB5,U+7ED1,U+7F16,U+80A4,U+820D,U+8651,U+8BC4,U+8C28,U+8DF5,U+8FC1,U+9012,U+9636,U+9686,U+96FE,U+98CE,U+9AA8;}
@font-face {font-family:'SkyMotion Reading';src:url('fonts/reading-extra-bold.woff2') format('woff2');font-weight:600 900;font-display:block;unicode-range:U+4E03,U+4E32,U+4E3E,U+4E58,U+4EBA,U+4EF7,U+5112,U+5144,U+518C,U+5192,U+52FE,U+5339,U+534F,U+5938,U+5CF0,U+5F1F,U+5F2F,U+601D,U+614E,U+61D2,U+6233,U+6241,U+626B,U+6279,U+62A2,U+642D,U+653F,U+65A5,U+6714,U+679A,U+6B67,U+6CE1,U+6D3E,U+6D89,U+6FC0,U+7075,U+725B,U+731C,U+751A,U+76AE,U+79C1,U+7A79,U+7B26,U+7D2F,U+7EA0,U+7EAA,U+7EB2,U+7EB5,U+7ED1,U+7F16,U+80A4,U+820D,U+8651,U+8BC4,U+8C28,U+8DF5,U+8FC1,U+9012,U+9636,U+9686,U+96FE,U+98CE,U+9AA8;}
:root {
  --design-font: 'SkyMotion Reading', 'Songti SC', 'SimSun', serif;
  --design-reading-font: var(--design-font);
  --md-sys-color-primary: var(--design-primary);
  --md-sys-color-focus: var(--md-sys-color-primary);
  --md-sys-color-on-primary: var(--design-on-action);
  --md-sys-color-primary-container: var(--design-selected);
  --md-sys-color-on-primary-container: var(--design-on-selected);
  --md-sys-color-surface: var(--design-surface);
  --md-sys-color-surface-container: var(--design-inset);
  --md-sys-color-surface-container-low: var(--design-surface-low);
  --md-sys-color-surface-container-high: var(--design-surface-high);
  --md-sys-color-surface-container-highest: var(--design-surface-highest);
  --md-sys-color-secondary: var(--design-secondary);
  --md-sys-color-secondary-container: var(--design-secondary-container);
  --md-sys-color-on-secondary-container: var(--design-on-secondary-container);
  --md-sys-color-tertiary: var(--design-tertiary);
  --md-sys-color-tertiary-container: var(--design-tertiary-container);
  --md-sys-color-on-tertiary-container: var(--design-on-tertiary-container);
  --md-sys-color-on-surface: var(--design-ink);
  --md-sys-color-on-surface-variant: var(--design-muted);
  --md-sys-color-outline: var(--design-switch-line);
  --md-sys-color-outline-variant: var(--design-line);
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-large-increased: 20px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-extra-large-increased: 32px;
  --md-sys-shape-corner-full: 999px;
  --md-sys-size-target: 40px;
  --md-comp-connected-button-outer-corner: calc(var(--md-sys-size-target) / 2);
  --md-comp-connected-button-inner-corner: var(--md-sys-shape-corner-medium);
  --md-sys-state-hover: color-mix(in srgb, currentColor 8%, transparent);
  --md-sys-state-pressed: color-mix(in srgb, currentColor 12%, transparent);
  --md-sys-motion-duration-short: 150ms;
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-shape-corner-extra-extra-large: 48px;
  --md-sys-motion-duration-medium: 350ms;
  --md-sys-motion-easing-expressive: cubic-bezier(0.34, 1.35, 0.64, 1);
  --md-sys-motion-duration-press: 120ms;
  --md-sys-size-slider-track: 16px;
  --md-sys-size-slider-handle-width: 4px;
  --md-sys-size-slider-handle-height: 44px;
  --md-sys-elevation-level-1: 0 2px 6px var(--design-shadow);
  --md-sys-elevation-level-2: 0 6px 20px var(--design-shadow);
  --design-radius-control: 20px;
  --design-radius-surface: 28px;
  --design-space-tight: 8px;
  --design-space-group: 16px;
  --bg: var(--design-paper);
  --panel: var(--design-surface);
  --line: var(--design-line);
  --text: var(--design-ink);
  --muted: var(--design-muted);
  --blue: var(--design-primary);
  --gold: var(--design-primary);
  --ui-border: var(--design-line);
  --ui-radius: var(--design-radius-surface);
  --ui-control-radius: var(--design-radius-control);
  --md-primary: var(--design-primary);
  --md-primary-hover: var(--design-hover);
  --md-on-primary: var(--design-on-action);
  --md-primary-container: var(--design-selected);
  --md-on-primary-container: var(--design-on-selected);
  --md-surface: var(--design-surface);
  --md-surface-container: var(--design-inset);
  --md-surface-container-low: var(--design-paper);
  --md-outline-variant: var(--design-line);
  --md-on-surface: var(--design-ink);
  --md-on-surface-variant: var(--design-muted);
}
body {
  color: var(--design-ink);
  background: var(--design-paper);
  font-family: var(--design-font);
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  accent-color: var(--design-primary);
  caret-color: var(--design-primary);
  scrollbar-color: var(--design-scrollbar) var(--design-inset);
  scrollbar-width: thin;
}
body :is(button, input, select, textarea) {
  font-family: var(--design-font);
}
/* Shared Material component contract. Route modules own placement, not new skins. */
body :is(button, .page-action, .language-toggle, .layout-launch) {
  min-height: var(--md-sys-size-target, 40px);
  border-radius: var(--md-sys-shape-corner-full);
  font-weight: 500;
  line-height: 1.4;
  transition:
    background-color var(--md-sys-motion-duration-short)
      var(--md-sys-motion-easing-standard),
    color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard),
    box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard),
    border-radius var(--md-sys-motion-duration-medium)
      var(--md-sys-motion-easing-expressive);
}
body
  :is(button, .page-action, .document-download, .document-links a, .page-nav :is(a, .preferences-launch, .assistant-launch)):not(
    :disabled
  ):hover {
  box-shadow: inset 0 0 0 999px var(--md-sys-state-hover);
}
body
  :is(button, .page-action, .document-download, .document-links a, .page-nav :is(a, .preferences-launch, .assistant-launch)):not(
    :disabled
  ):active {
  box-shadow: inset 0 0 0 999px var(--md-sys-state-pressed);
  border-radius: var(--md-sys-shape-corner-large);
}
body
  :is(
    input:not([type='range']):not([type='checkbox']):not([type='radio']):not(
        [type='hidden']
      ),
    select,
    textarea
  ) {
  min-height: var(--md-sys-size-target, 40px);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container-low);
  padding: 8px 12px;
}
body :is(input, select, textarea)[aria-invalid='true'] {
  border-color: var(--design-error-line);
}
body :is(button, input, select, textarea):disabled {
  cursor: not-allowed;
}
body dialog {
  border-radius: var(--md-sys-shape-corner-extra-large);
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container);
}
body :is([role='menu'], .dt-object-menu, .sb-object-menu) {
  border-radius: var(--md-sys-shape-corner-large-increased);
  box-shadow: var(--md-sys-elevation-level-2);
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container);
}
body :is([role='menuitem'], .page-nav :is(a, .preferences-launch, .assistant-launch)) {
  min-height: 40px;
  display: flex;
  align-items: center;
}
body input:is([type='checkbox'], [type='radio'], [type='range']) {
  accent-color: var(--md-sys-color-primary);
}
.md-checkbox-target {
  display: grid;
  place-items: center;
  min-width: var(--md-sys-size-target);
  min-height: var(--md-sys-size-target);
  margin: 0;
  padding: 0;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--design-muted);
  cursor: pointer;
}
.md-checkbox-target:has(input:checked) {
  color: var(--design-primary);
}
.md-checkbox-target:hover {
  background: var(--md-sys-state-hover);
}
.md-checkbox-target:active {
  background: var(--md-sys-state-pressed);
}
.md-dark-surface {
  --md-sys-color-focus: var(--design-night-ink);
}
.md-checkbox-target input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
}
@media (pointer: coarse), (max-width: 760px) {
  :root {
    --md-sys-size-target: 48px;
  }
  body :is(button, .page-nav :is(a, .preferences-launch, .assistant-launch), .page-action, select) {
    min-height: 48px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body :is(button, .page-action, .language-toggle, .layout-launch) {
    transition: none;
  }
}
body
  :is(
    output,
    input[type='number'],
    input[type='time'],
    input[type='date'],
    .facts strong
  ) {
  font-variant-numeric: tabular-nums;
}
::selection {
  background: var(--design-selected);
  color: var(--design-ink);
}
body :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--md-sys-color-focus, var(--design-primary));
  outline-offset: 3px;
}
body a {
  text-underline-offset: 0.22em;
}
body
  :is(
    .page-nav,
    .ui-shell,
    .space-shell,
    .reading-page,
    .ui-parameter-drawer,
    #spaceDrawer,
    .scene-tools-panel
  ) {
  font-family: var(--design-font);
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  font-size: calc(13px * var(--ui-font-scale, 1));
  color: var(--design-primary);
  text-decoration: none;
  border-radius: var(--design-radius-control, 12px);
}
.page-link:hover {
  background: var(--design-inset);
}
.page-action {
  padding: 10px 20px;
}
.page-nav {
  height: var(--ui-nav-height);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border-bottom: 1px solid transparent;
  border-color: transparent;
  background: var(--design-paper);
  overflow-x: auto;
  white-space: nowrap;
}
.page-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-block: 6px;
  text-decoration: none;
}
.page-nav :is(a, .preferences-launch, .assistant-launch) {
  position: relative;
  border-radius: var(--md-sys-shape-corner-small);
  min-height: 40px;
  padding-inline: 16px;
  color: var(--design-muted);
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 500;
}
.page-nav :is(a, .preferences-launch, .assistant-launch):hover {
  color: var(--design-primary);
  background: var(--design-selected);
}
.page-nav :is(a, .preferences-launch, .assistant-launch)[aria-current='page'] {
  color: var(--design-primary);
  background: transparent;
  font-weight: 600;
}
.page-nav :is(a, .preferences-launch, .assistant-launch)[aria-current='page']::after {
  content: '';
  position: absolute;
  inset: auto 12px 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: currentColor;
}
:is(.ui-heading, body[data-page='space'] .head) h1 {
  color: var(--design-ink);
  font-size: calc(24px * var(--ui-font-scale, 1));
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.025em;
}
:is(.ui-heading #uiPlaceText, body[data-page='space'] .head p) {
  color: var(--design-muted);
  font-size: calc(12px * var(--ui-font-scale, 1));
  line-height: 1.7;
}
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  background: var(--design-inset);
  border: 0;
  border-radius: 24px;
  padding: 4px;
}
.view-tabs button {
  background: transparent;
  border: none;
  padding: 7px 13px;
  border-radius: 20px;
  color: var(--design-muted);
  transition: background 200ms var(--motion-ease), color 160ms ease;
  white-space: nowrap;
}
.view-tabs .active {
  background: var(--design-inset);
  color: var(--design-primary);
}
@media (max-width: 1100px) {
  .view-tabs { width: 100%; }
  .view-tabs button { flex: 1; }
}
@media (max-width: 760px) {
  .view-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 22px !important;
  }
  .view-tabs button { font-size: calc(13px * var(--ui-font-scale, 1)); }
}
/* Shared connected single-choice component, following Material 3 Expressive. */
.md-connected-choice {
  display: inline-flex;
  width: auto;
  margin: 0;
  padding: 0;
  gap: 2px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body .md-connected-choice > :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 64px;
  min-height: var(--md-sys-size-target);
  margin: 0;
  padding: 8px;
  gap: 4px;
  border: 0;
  border-radius: var(--md-comp-connected-button-inner-corner);
  color: var(--md-sys-color-on-primary-container);
  background: var(--md-sys-color-primary-container);
  font: 500 calc(14px * var(--ui-font-scale, 1))/1.5 var(--design-font);
  white-space: normal;
  text-align: center;
  text-decoration: none;
  transition:
    border-radius var(--md-sys-motion-duration-medium)
      var(--md-sys-motion-easing-expressive),
    background-color var(--md-sys-motion-duration-short)
      var(--md-sys-motion-easing-standard),
    color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}
body .md-connected-choice > :is(button, a):where([data-choice-edge='first']) {
  border-radius: var(--md-comp-connected-button-outer-corner)
    var(--md-comp-connected-button-inner-corner)
    var(--md-comp-connected-button-inner-corner)
    var(--md-comp-connected-button-outer-corner);
}
body
  .md-connected-choice
  > :is(button, a):where([data-choice-edge='last']) {
  border-radius: var(--md-comp-connected-button-inner-corner)
    var(--md-comp-connected-button-outer-corner)
    var(--md-comp-connected-button-outer-corner)
    var(--md-comp-connected-button-inner-corner);
}
body .md-connected-choice > :is(button,a):where([data-choice-edge='only']) {border-radius:var(--md-comp-connected-button-outer-corner);}
body
  .md-connected-choice
  > :is(button, a):is(
    [aria-pressed='true'],
    [aria-selected='true'],
    [aria-current='page'],
    .active,
    .selected
  ) {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: var(--md-sys-shape-corner-full);
}

body
  .md-connected-choice
  > :is(button, a):is(
    [aria-pressed='true'],
    [aria-selected='true'],
    [aria-current='page'],
    .active,
    .selected
  ):active {
  border-radius: var(--md-sys-shape-corner-large);
}
@media (prefers-reduced-motion: reduce) {
  body .md-connected-choice > :is(button, a) {
    transition: none;
  }
}

/* Compact grids share a32px low-profile surface within a full40/48px target.
   The painted surface is independent of target padding, including on touch screens. */
body .md-choice-grid.md-connected-choice {
  display: grid;
  grid-template-columns: repeat(var(--md-choice-columns, 4), minmax(0, 1fr));
  width: 100%;
  gap: 2px;
}
body .md-connected-choice.md-compact-choice > :is(button, a) {
  --md-choice-fill: var(--md-sys-color-primary-container);
  position: relative;
  isolation: isolate;
  min-width: 0;
  height: var(--md-sys-size-target);
  min-height: var(--md-sys-size-target);
  padding: 0 4px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  box-shadow: none;
  font-size: calc(12px * var(--ui-font-scale, 1));
  line-height: 1.3;
}
body .md-connected-choice.md-compact-choice > :is(button, a):is(:hover, :active) {
  background: transparent;
  border-radius: var(--md-sys-shape-corner-full);
  box-shadow: none;
}
body .md-connected-choice.md-compact-choice > :is(button, a)::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: calc((var(--md-sys-size-target) - 32px) / 2) 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-choice-fill);
  pointer-events: none;
}
body
  .md-connected-choice.md-compact-choice
  > :is(button, a):is([aria-pressed='true'], .active, .selected) {
  --md-choice-fill: var(--md-sys-color-primary);
}
body .md-connected-choice.md-compact-choice > :is(button, a):hover::before {
  box-shadow: inset 0 0 0 999px var(--md-sys-state-hover);
}
body .md-connected-choice.md-compact-choice > :is(button, a):active::before {
  box-shadow: inset 0 0 0 999px var(--md-sys-state-pressed);
}
.ui-parameters > h2 {
  color: var(--design-ink);
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 600;
}
.ui-parameters > h2::before {
  display: none;
}
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  ) {
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--md-sys-shape-corner-large-increased);
  background: var(--design-surface);
  box-shadow: none;
}
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  )
  > summary {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: none;
  cursor: pointer;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.65;
  color: var(--design-ink);
  background: var(--design-surface);
  border-radius: calc(var(--md-sys-shape-corner-large-increased) - 1px);
  padding: 14px 40px 14px 16px;
}
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  )[open] {
  border-color: transparent;
  box-shadow: none;
}
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  )[open]
  > summary {
  background: var(--design-surface);
  color: var(--design-primary);
  border-color: transparent;
  border-radius: calc(var(--md-sys-shape-corner-large-increased) - 1px)
    calc(var(--md-sys-shape-corner-large-increased) - 1px) 0 0;
}
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  )
  > summary:hover {
  background: var(--design-inset);
}
/* Shared disclosure icon and body, including3D explanation sections. */
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  )
  > summary::-webkit-details-marker {
  display: none;
}
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  )
  > summary::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}
body
  :is(.ui-parameters, .md-parameter-rail)
  :is(
    .menu-section,
    .workbench-more,
    .analemma-advanced,
    .ui-information,
    .ui-model-details
  )[open]
  > summary::after {
  transform: translateY(-50%) rotate(225deg);
}
body :is(.ui-parameters, .md-parameter-rail) .menu-section > .menu-content {
  padding: var(--preference-panel-padding, 14px) 16px 16px;
}
.ui-parameters
  :is(
    .menu-summary,
    .range-labels,
    .time-labels,
    .micro,
    .label-row,
    .globe-drag-help,
    .sundial-help,
    .globe-notes
  ) {
  color: var(--design-muted);
  font-size: calc(12px * var(--ui-font-scale, 1));
  line-height: 1.75;
}
.ui-parameters .menu-section[open] > summary .menu-summary {
  color: var(--design-open-muted);
}
.ui-parameters :is(.menu-subsection, .sun-side-summary) {
  background: var(--design-inset);
  border-color: var(--design-line);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: none;
}
.ui-parameters .menu-subsection > summary {
  color: var(--design-primary);
  background: var(--design-inset);
  font-size: calc(12px * var(--ui-font-scale, 1));
  border-radius: calc(var(--md-sys-shape-corner-large) - 1px);
}
.ui-parameters .menu-subsection[open] > summary {
  color: var(--design-ink);
  background: var(--design-selected);
  border-radius: calc(var(--md-sys-shape-corner-large) - 1px)
    calc(var(--md-sys-shape-corner-large) - 1px) 0 0;
}
.ui-parameters :is(.menu-content, .coordinate-editor, .analemma-controls, .ui-field) {
  color: var(--design-ink);
  font-size: calc(13px * var(--ui-font-scale, 1));
}
body
  :is(.ui-parameters, .ui-timeline-host, .side, .timeline, .scene-tools-panel)
  :is(
    select,
    input[type='number'],
    input[type='date'],
    input[type='time'],
    input[type='text']
  ) {
  color: var(--design-ink);
  border-color: var(--design-line);
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-surface-container-low);
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.5;
}
body :is(.ui-parameters, .ui-timeline-host, .side, .timeline) select {
  min-height: var(--md-sys-size-target, 40px);
}
body
  :is(.ui-parameters, .ui-timeline-host, .side, .scene-tools-panel, .preferences-dialog)
  :is(.toggle-row, .overlay-toggle, .toggles > label, .tools-check, .workbench-loop, .preference-row:has(input[type='checkbox'])) {
  color: var(--design-ink);
  font-size: calc(13px * var(--ui-font-scale, 1));
}
body
  :is(.ui-parameters, .ui-timeline-host, .side, .scene-tools-panel, .preferences-dialog)
  :is(.toggle-row, .overlay-toggle, .toggles > label, .tools-check, .workbench-loop, .preference-row:has(input[type='checkbox']))
  > input[type='checkbox'] {
  border-color: var(--design-switch-line);
  background: var(--design-switch-idle);
}
body
  :is(.ui-parameters, .ui-timeline-host, .side, .scene-tools-panel, .preferences-dialog)
  :is(.toggle-row, .overlay-toggle, .toggles > label, .tools-check, .workbench-loop, .preference-row:has(input[type='checkbox']))
  > input[type='checkbox']:checked {
  border-color: var(--design-primary);
  background: var(--design-action);
}
body
  :is(.ui-parameters, .ui-timeline-host, .side, .scene-tools-panel, .preferences-dialog)
  :is(.toggle-row, .overlay-toggle, .toggles > label, .tools-check, .workbench-loop, .preference-row:has(input[type='checkbox']))
  > input[type='checkbox']::after {
  background: var(--design-switch-thumb);
}
body
  :is(.ui-parameters, .ui-timeline-host, .side, .scene-tools-panel, .preferences-dialog)
  :is(.toggle-row, .overlay-toggle, .toggles > label, .tools-check, .workbench-loop, .preference-row:has(input[type='checkbox']))
  > input[type='checkbox']:checked::after {
  background: var(--design-on-action);
}
.ui-parameters .study-navigation .page-link {
  color: var(--design-primary);
  background: var(--design-paper);
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 500;
  border-radius: var(--design-radius-control);
}
.ui-parameters .study-navigation .page-link:hover {
  background: var(--design-selected);
}
.ui-parameters .study-navigation .page-link[aria-current='page'] {
  background: var(--design-selected);
}
.ui-viewbar {
  background: var(--design-surface);
  border-color: var(--design-line);
}
body :is(.ui-parameters, .ui-heading, .ui-timeline-host) button {
  border-color: var(--design-line);
  box-shadow: none;
}
body
  :is(.ui-parameters, .ui-timeline-host)
  :is(.preset-grid button, .workbench-events button, .workbench-look-buttons button) {
  background: var(--design-inset);
  color: var(--design-primary);
  border-radius: var(--design-radius-control);
}
body
  :is(.ui-parameters, .ui-timeline-host)
  :is(.preset-grid button, .workbench-events button).active {
  background: var(--design-action);
  color: var(--design-on-action);
}
body
  :is(.ui-parameters, .ui-heading)
  :is(.ui-sidebar-collapse, .ui-parameters-trigger, .ui-compare-trigger) {
  color: var(--design-primary);
  background: var(--design-surface);
  border-color: var(--design-line);
  border-radius: var(--design-radius-control);
}

.ui-parameter-drawer,
.ui-drawer-header,
body[data-page='space'] #spaceDrawer {
  background: var(--design-paper);
  color: var(--design-ink);
  border-color: var(--design-line);
}
.ui-drawer-header h2 {
  color: var(--design-ink);
  font-size: calc(18px * var(--ui-font-scale, 1));
  font-weight: 600;
}
.ui-drawer-header span {
  color: var(--design-muted);
}
.ui-drawer-header button {
  color: var(--design-primary);
  background: var(--design-selected);
}
body
  :is(.ui-parameters, .ui-viewbar, .side, .timeline)
  :is(button, input, select):disabled {
  color: var(--design-disabled-ink);
  background-color: var(--design-disabled-surface);
  opacity: 0.65;
  cursor: not-allowed;
}
/* Three-dimensional workspace shares the same controls, not a separate theme. */
body[data-page='space'] {
  --space-primary: var(--design-primary);
  --space-line: var(--design-line);
  --space-control-radius: var(--design-radius-control);
  font-family: var(--design-font);
  background: var(--design-paper);
  color: var(--design-ink);
}
body[data-page='space'] :is(.card, .visual, .timeline) {
  border-color: transparent;
  border-radius: var(--design-radius-surface);
  background: var(--design-surface);
  box-shadow: none;
}
body[data-page='space'] .card {
  padding: 16px;
}
body[data-page='space'] .card h2 {
  color: var(--design-ink);
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 600;
}
body[data-page='space'] .planet-name {
  font-size: calc(24px * var(--ui-font-scale, 1));
  font-weight: 600;
  color: var(--design-ink);
}
body[data-page='space']
  :is(
    .planet-type,
    .facts span,
    .info,
    .footer-note,
    .scale,
    .time-head label,
    .date-actions
  ) {
  color: var(--design-muted);
}
body[data-page='space'] .info {
  font-size: calc(12px * var(--ui-font-scale, 1));
  line-height: 1.8;
}
body[data-page='space'] .facts strong {
  color: var(--design-primary);
  font-weight: 600;
}
body[data-page='space'] .facts div {
  border-color: var(--design-line);
  padding-bottom: 8px;
}
body[data-page='space'] #play {
  background: var(--design-action);
  color: var(--design-on-action);
  border-radius: var(--design-radius-control);
}
body[data-page='space'] .time-head output {
  color: var(--design-primary);
  font-size: calc(18px * var(--ui-font-scale, 1));
}
/* A dark observation surface needs its own legible foreground, including drawers. */
body[data-page='space'].space-immersive {
  color: var(--design-ink);
  background: var(--design-paper);
}
body[data-page='space'].space-immersive :is(.head, .viewbar, .timeline) {
  background: var(--design-paper);
  color: var(--design-ink);
}
body[data-page='space'].space-immersive #play {
  background: var(--design-action);
  color: var(--design-on-action);
}
body[data-page='space'].space-immersive h1 {
  font-size: calc(16px * var(--ui-font-scale, 1));
  color: var(--design-ink);
}
body[data-page='space'].space-immersive .stage .label {
  color: var(--design-night-ink);
  background: var(--design-night-label-surface);
}
body[data-page='space'].space-immersive .time-head output {
  color: var(--design-ink);
}
body[data-page='space'].space-immersive input[type='date'] {
  color-scheme: dark;
}
/* Dark canvas annotation tools are deliberately outside the light controls scope. */
.scene-tools-panel {
  background: var(--design-night-surface);
  color: var(--design-night-ink);
  border-color: var(--design-night-line);
  border-radius: var(--design-radius-surface);
  box-shadow: none;
}
body .scene-tools-panel :is(.tools-check, .tools-field, p, label, span) {
  color: var(--design-night-tool-muted);
}
body .scene-tools-panel :is(select, input[type='number']) {
  background: var(--design-night-inset);
  color: var(--design-night-ink);
  border-color: var(--design-night-line);
}
body .scene-tools-panel input[type='checkbox']:checked {
  background: var(--design-night-tool-selected);
  border-color: var(--design-night-tool-selected);
}
/* Reading: one typographic system, generous paragraph rhythm and narrow measure. */
.reading-page {
  background: var(--design-surface);
  color: var(--design-ink);
  border-radius: var(--design-radius-surface);
}
.document-page {
  max-width: 960px;
  padding: 40px 48px;
  font-family: var(--design-font);
  font-size: calc(16px * var(--ui-font-scale, 1));
  line-height: 1.9;
  border-color: var(--design-line);
}
.document-kicker {
  display: none;
}
.document-header {
  border-color: var(--design-line);
  margin-bottom: 28px;
  padding-bottom: 28px;
}
.document-page h1 {
  color: var(--design-ink);
  font-size: calc(30px * var(--ui-font-scale, 1));
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.document-lead {
  color: var(--design-muted);
  max-width: 68ch;
}
.document-page a {
  color: var(--design-primary);
}
.document-toc {
  background: var(--design-paper);
  border-color: var(--design-line);
  border-radius: var(--design-radius-control);
}
.document-toc > h2 {
  color: var(--design-primary);
  font-size: calc(14px * var(--ui-font-scale, 1));
}
.document-toc > h2 {
  background: var(--design-selected);
  border-color: var(--design-line);
}
.document-toc li {
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.8;
}
.document-content h2 {
  color: var(--design-ink);
  font-size: calc(22px * var(--ui-font-scale, 1));
  line-height: 1.5;
  font-weight: 600;
  border-color: var(--design-line);
  margin-top: 40px;
}
.document-content h3 {
  font-size: calc(18px * var(--ui-font-scale, 1));
  line-height: 1.6;
  font-weight: 600;
  margin-top: 28px;
}
.document-content p {
  margin: 16px 0;
}
.document-content blockquote {
  border: 0;
  border-radius: var(--design-radius-control);
  background: var(--design-inset);
  color: var(--design-muted);
}
.document-page :is(th, td) {
  border-color: var(--design-line);
  padding: 12px;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.8;
}
.document-page th {
  background: var(--design-selected);
  color: var(--design-ink);
}
.document-page code {
  background: var(--design-inset);
}
.document-page pre {
  background: var(--design-paper);
  color: var(--design-ink);
  border: 1px solid var(--design-line);
}
.document-page pre code {
  background: none;
  color: inherit;
}
.document-page .micro {
  color: var(--design-muted);
  font-size: calc(13px * var(--ui-font-scale, 1));
}
.development-flow {
  background: var(--design-inset);
}
.development-flow li {
  border-color: var(--design-line);
  border-radius: var(--design-radius-control);
}
.document-page .article-actions {
  border-color: var(--design-line);
}
body :is(.page-action, .author-mail-button) {
  background: var(--design-surface);
  color: var(--design-primary);
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-control);
}
body :is(.page-action, .author-mail-button):hover {
  background: var(--design-paper);
  color: var(--design-hover);
  border-color: var(--design-open-border);
}
.document-page .page-action {
  color: var(--design-primary);
}
.document-page .article-actions :is(.page-action, .page-link) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  min-height: 38px;
  box-sizing: border-box;
  background: var(--design-surface);
  color: var(--design-primary);
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-control);
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.5;
  text-decoration: none;
}
.document-page .article-actions :is(.page-action, .page-link):hover {
  background: var(--design-paper);
  border-color: var(--design-open-border);
  color: var(--design-hover);
}
.document-page .article-actions :is(.page-action, .page-link):focus-visible {
  outline: 3px solid var(--md-sys-color-focus, var(--design-primary));
  outline-offset: 3px;
}

body[data-page='contact'] .reading-page {
  max-width: 880px;
  padding: 36px;
  font-size: calc(15px * var(--ui-font-scale, 1));
  line-height: 1.85;
}
.author-email-box {
  background: var(--design-paper);
  border-color: var(--design-line);
  border-radius: var(--design-radius-control);
}
.author-email-box > a {
  color: var(--design-primary);
}
body[data-page='contact'] :is(h2, h3) {
  color: var(--design-ink);
  line-height: 1.5;
}
/* Welcome retains its original composition and existing star toy. */
body[data-page='welcome'] .welcome-screen {
  font-family: var(--design-font);
}
body[data-page='welcome'] .welcome-intro h1 {
  font-weight: 600;
  letter-spacing: -0.025em;
}
body[data-page='welcome'] :is(button, a) {
  font-family: var(--design-font);
}
body[data-page='welcome'] .welcome-enter {
  background: var(--design-sun);
  color: var(--design-welcome-action-ink);
}
body[data-page='welcome'] .welcome-screen ::selection {
  background: var(--design-sun);
  color: var(--design-ink);
}
/* Preserve the existing drawer breakpoint and animation machinery. */
@media (max-width: 760px) {
  .page-nav {
    padding-inline: 12px;
    padding-block: 5px;
  }
  .page-nav a {
    padding-block: 5px;
  }
  .page-nav :is(a, .preferences-launch, .assistant-launch) {
    padding-inline: 10px;
    font-size: calc(11px * var(--ui-font-scale, 1));
  }
  :is(.ui-heading, body[data-page='space'] .head) h1 {
    font-size: calc(19px * var(--ui-font-scale, 1));
  }
  .document-page {
    padding: 24px 20px;
    font-size: calc(15px * var(--ui-font-scale, 1));
  }
  .document-page h1 {
    font-size: calc(24px * var(--ui-font-scale, 1));
  }
  .document-content h2 {
    font-size: calc(20px * var(--ui-font-scale, 1));
    margin-top: 32px;
  }
  .document-content h3 {
    font-size: calc(17px * var(--ui-font-scale, 1));
  }

  body[data-page='contact'] .reading-page {
    padding: 24px 20px;
    margin: 12px;
  }
}
@media (max-width: 420px) {
  :is(.ui-heading, body[data-page='space'] .head) h1 {
    font-size: calc(17px * var(--ui-font-scale, 1));
  }
  .ui-parameters :is(.menu-summary, .micro) {
    font-size: calc(11px * var(--ui-font-scale, 1));
  }
}
@media print {
  body {
    color: var(--design-print-ink);
    background: var(--design-surface);
  }
  .document-page {
    border: 0;
    padding: 0;
    max-width: none;
  }
}

/* Preserve the requested reading face in each locale, including headings. */
.document-page :is(h1, h2) {
  font-family: var(--design-reading-font);
  font-weight: 400;
  letter-spacing: 0;
}

body[data-page='space'] .drawer-head {
  background: var(--design-paper);
  border-color: var(--design-line);
}
body[data-page='space'] .drawer-head h2 {
  color: var(--design-ink);
}
body[data-page='space'] .drawer-head span {
  color: var(--design-muted);
}
body[data-page='space'] .side .kicker {
  display: none;
}
body[data-page='space'] .side .toggles > label {
  color: var(--design-ink);
}
body[data-page='space'] .side .toggles > label > input[type='checkbox']:checked {
  background: var(--design-action);
  border-color: var(--design-action);
}
/* Native range semantics, with Expressive filled tracks and a narrow upright handle.
 * State owners call updateRanges after assigning values; input events update immediately. */
body input[type='range'] {
  --md-range-progress: 0%;
  --md-range-surface: var(--design-surface);
  appearance: none;
  width: 100%;
  min-width: 0;
  height: var(--md-sys-size-target);
  min-height: var(--md-sys-size-target);
  padding: 0;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  cursor: pointer;
}
body input[type='range']::-webkit-slider-runnable-track {
  height: var(--md-sys-size-slider-track);
  border-radius: var(--md-sys-shape-corner-full);
  background: linear-gradient(
    to right,
    var(--design-action) 0 var(--md-range-progress),
    var(--design-range-track) var(--md-range-progress) 100%
  );
}
body input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: var(--md-sys-size-slider-handle-width);
  height: var(--md-sys-size-slider-handle-height);
  margin-top: calc(
    (var(--md-sys-size-slider-track) - var(--md-sys-size-slider-handle-height)) / 2
  );
  border: 0;
  border-radius: 2px;
  background: var(--design-action);
  box-shadow: 0 0 0 5px var(--md-range-surface);
  transition: width 150ms var(--md-sys-motion-easing-standard);
}
body input[type='range']::-moz-range-track {
  height: var(--md-sys-size-slider-track);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--design-range-track);
}
body input[type='range']::-moz-range-progress {
  height: var(--md-sys-size-slider-track);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--design-action);
}
body input[type='range']::-moz-range-thumb {
  width: var(--md-sys-size-slider-handle-width);
  height: var(--md-sys-size-slider-handle-height);
  border: 0;
  border-radius: 2px;
  background: var(--design-action);
  box-shadow: 0 0 0 5px var(--md-range-surface);
}
body input[type='range']:active {
  --md-sys-size-slider-handle-width: 2px;
}
body input[type='range']:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.md-dark-surface input[type='range'],
body .scene-tools-panel input[type='range'] {
  --md-range-surface: var(--design-night-surface);
}

/* The user's type direction applies to every UI role; numbers remain tabular. */
body :is(.ui-heading, .space-shell .head, .welcome-intro, .document-header) h1,
body[data-page='contact'] .reading-page > .dialog-head h2 {
  font-family: var(--design-reading-font);
  font-weight: 400;
  letter-spacing: 0;
}

/* Review corrections: headings carry identity without redundant eyebrows. */
.ui-drawer-header > div > span,
body[data-page='space'] .drawer-head > div > span,
#contextEyebrow {
  display: none;
}
body[data-page='space'] .stage-reset svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

/* Welcome actions use the same control radius as the rest of the site. */
body[data-page='welcome']
  :is(.welcome-enter, .welcome-sky-actions button, .welcome-corner-links > :is(a,button)) {
  border-radius: var(--design-radius-control);
}

/* Unified Song typography: full UI, native fields and plot annotations. */
body
  :is(
    .page-nav,
    .ui-shell,
    .space-shell,
    .reading-page,
    dialog,
    .ui-parameters,
    .ui-timeline-host
  ),
body :is(button, input, select, textarea, output) {
  font-family: var(--design-font);
}
body .page-nav,
body .ui-viewbar {
  scrollbar-width: none;
}
body .page-nav::-webkit-scrollbar,
body .ui-viewbar::-webkit-scrollbar {
  display: none;
}

body .ui-heading #uiParametersButton {
  min-height: var(--md-sys-size-target, 40px);
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--design-inset);
  color: var(--design-primary);
  border-color: var(--design-line);
}

.ui-plot > .observer-explanation-button {
  position: absolute;
  z-index: 8;
  bottom: 14px;
  left: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--design-canvas-action-line);
  border-radius: var(--md-sys-shape-corner-large);
  color: var(--design-canvas-action-ink);
  background: var(--design-canvas-action-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ui-plot > .observer-explanation-button[hidden] {
  display: none;
}
.observer-explanation-button svg {
  width: 18px;
  height: 18px;
}
.observer-explanation {
  font-family: var(--design-font);
  border-color: var(--design-line);
  background: var(--design-surface);
}
.observer-explanation-example {
  background: var(--design-inset);
}
@media (max-width: 760px) and (min-height: 501px) {
  .ui-shell {
    padding: 8px 12px 12px;
    gap: 8px;
  }
  .ui-heading {
    gap: 8px;
  }
  .ui-heading h1 {
    font-size: calc(19px * var(--ui-font-scale, 1));
  }

  .ui-heading #uiParametersButton {
    padding: 6px 8px;
    font-size: calc(12px * var(--ui-font-scale, 1));
  }
  .ui-viewbar {
    padding: 6px;
    gap: 6px;
    min-height: 44px;
    flex-wrap: wrap;
    overflow: visible;
  }
  .ui-viewbar .view-tabs {
    gap: 4px;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }
  .ui-viewbar .view-tabs > button {
    flex: 1 1 64px;
    min-height: var(--md-sys-size-target, 40px);
    padding: 5px 6px;
    font-size: calc(12px * var(--ui-font-scale, 1));
  }
}

/* Keep the selection strip free of an extra enclosing pill. */
body .ui-viewbar .view-tabs {
  background: transparent;
  border: 0;
  border-radius: 0;
}
@media (max-width: 360px) and (min-height: 501px) {
  .ui-shell .ui-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .ui-shell .ui-heading > div:first-child {
    grid-column: 1 / -1;
  }
  .ui-shell .ui-heading .ui-body-host {
    grid-column: 1;
    margin: 0;
  }
  .ui-shell .ui-heading #uiParametersButton {
    grid-column: 2;
    grid-row: 2;
  }
}

/* On compact canvases, place help in the free upper corner, away from azimuths. */
@media (max-width: 600px) {
  .ui-plot > .observer-explanation-button {
    top: 12px;
    right: 12px;
    left: auto;
    bottom: auto;
  }
  .ui-plot #viewHint {
    display: none;
  }
}
/* One action treatment, including both date directions and the canvas reset. */

body .ui-plot #resetView,
body[data-page='space'] #play {
  background: var(--design-action);
  color: var(--design-on-action);
  border: 1px solid var(--design-action);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: none;
}
body[data-page='space'] #reset {
  border: 1px solid var(--design-action);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: none;
}

body .ui-plot #resetView:hover {
  background: var(--design-action-hover);
  color: var(--design-on-action);
  border-color: var(--design-action-hover);
}

/* Complete the surface audit: legacy cards, body shortcuts and 3D overlays. */
.ui-parameters .metrics article {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 10px 8px;
  min-width: 0;
  text-align: center;
  background: var(--md-sys-color-secondary-container);
  border: 1px solid transparent;
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: none;
}
.ui-parameters .metrics strong {
  margin: 0;
  font-size: calc(18px * var(--ui-font-scale, 1));
  line-height: 1.4;
  word-break: keep-all;
  text-wrap: balance;
  font-variant-numeric: tabular-nums;
  color: var(--design-primary);
  font-family: var(--design-font);
}
.ui-parameters .metrics :is(article > span, .metric-definition > summary) {
  min-height: 20px;
  line-height: 20px;
}
.ui-parameters .metrics article > span {
  display: grid;
  place-items: center;
}
.ui-parameters .metrics .metric-definition > summary {
  min-height: var(--md-sys-size-target);
  justify-content: center;
}
.ui-parameters .metrics :is(article > span, small, .metric-definition summary) {
  color: var(--design-muted);
}
.ui-parameters #observerControls,
.ui-parameters .model-explanation {
  background: var(--design-paper);
  border-color: var(--design-line);
  border-radius: var(--md-sys-shape-corner-large);
  color: var(--design-ink);
  box-shadow: none;
}
.ui-parameters .observer-bodies button,
.ui-parameters #reset {
  background: var(--design-action);
  color: var(--design-on-action);
  border: 1px solid var(--design-action);
  border-radius: var(--md-sys-shape-corner-large);
  font-family: var(--design-font);
  box-shadow: none;
}
body[data-page='space'] .inspection-readout {
  background: var(--design-night-surface);
  color: var(--design-night-ink);
  border: 1px solid var(--design-night-line);
  border-radius: var(--md-sys-shape-corner-large);
  font-family: var(--design-font);
}
body[data-page='space'] .inspection-readout strong {
  color: var(--design-night-ink);
  font-family: var(--design-font);
}
body[data-page='space'] .scene-tools summary,
body .ui-plot #viewReset {
  border: 1px solid var(--design-action);
  border-radius: var(--md-sys-shape-corner-large);
  font-family: var(--design-font);
  box-shadow: none;
}
.observer-explanation:focus {
  outline: none;
}
.observer-explanation {
  border: 1px solid var(--design-line);
  color: var(--design-ink);
}
body[data-page='space'] .scene-tools[open] summary {
  border-radius: var(--md-sys-shape-corner-large);
}

/* Matching row baselines when the workbench has room for multiple columns. */

body .ui-parameters .menu-footer #reset {
  border-color: var(--design-action);
  border-radius: var(--md-sys-shape-corner-large);
}

/* Quiet supporting actions: same teal identity without large filled surfaces. */
body .ui-parameters .observer-bodies button,
body .ui-parameters .menu-footer #reset,
body[data-page='space'] .focus {
  background: var(--design-surface);
  color: var(--design-action);
  border: 1px solid var(--design-line);
  box-shadow: none;
}

body .ui-parameters .observer-bodies button:hover,
body .ui-parameters .menu-footer #reset:hover,
body[data-page='space'] .focus:hover {
  background: var(--design-selected);
  color: var(--design-action-hover);
  border-color: var(--design-open-border);
}

/* Canvas actions stay readable without becoming solid accent blocks. */
body[data-page='space'] #reset,
body[data-page='space'] .scene-tools summary,
body[data-page='space'] .scene-tools[open] summary {
  background: var(--design-night-surface);
  color: var(--design-night-ink);
  border-color: var(--design-night-line);
}

/* Manual-mode and playback states use the same interface palette. */
body
  :is(.ui-parameters, .ui-timeline-host)
  :is(
    .label-row output,
    .menu-summary,
    .text-button,
    #restoreDate,
    #dateObservationRestore
  ) {
  color: var(--design-primary);
}
body :is(.ui-parameters, .ui-timeline-host) .text-button:hover {
  color: var(--design-hover);
  background: var(--design-selected);
}
body #idealDateHint {
  background: var(--design-inset);
  color: var(--design-muted);
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-control);
  padding: 10px 12px;
}
body #dateObservationRestore {
  padding: 4px 0;
  margin-top: 4px;
  background: transparent;
}
body input[type='checkbox'] {
  accent-color: var(--design-primary);
}
body :is(.ui-parameters, .ui-timeline-host) .workbench-loop {
  grid-column: 1 / -1;
  justify-self: stretch;
}
/* Every parameter note and auxiliary reset shares the same quiet treatment. */
body .ui-parameters :is(.analemma-results, #analemmaDateLinkNote, .model-explanation) {
  background: var(--design-inset);
  color: var(--design-muted);
  border-radius: var(--design-radius-control);
}
body
  .ui-parameters
  :is(
    #analemmaIdealReset,
    #analemmaIdealNote button,
    #solarDateUnlink,
    #analemmaResetView,
    #globeRecenter
  ) {
  background: var(--design-surface);
  color: var(--design-primary);
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-control);
}
body
  .ui-parameters
  :is(
    #analemmaIdealReset,
    #analemmaIdealNote button,
    #solarDateUnlink,
    #analemmaResetView,
    #globeRecenter
  ):hover {
  background: var(--design-selected);
  color: var(--design-hover);
}
/* Shared outlined auxiliary action, independent of route and element tag. */
body :is(button, a).md-outlined-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: var(--md-sys-size-target);
  padding: 8px 12px;
  margin: 0;
  background: var(--design-surface);
  color: var(--design-primary);
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-control);
  font: 500 calc(14px * var(--ui-font-scale, 1))/1.5 var(--design-font);
  text-decoration: none;
  white-space: nowrap;
}
body :is(button, a).md-outlined-action:hover {
  background: var(--design-surface);
  box-shadow: inset 0 0 0 999px var(--md-sys-state-hover);
}
body :is(button, a).md-outlined-action:active {
  box-shadow: inset 0 0 0 999px var(--md-sys-state-pressed);
}

/* Reading rhythm: the canvas leads; controls form a quiet, legible frame. */
body :is(.ui-heading, .space-shell .head) h1 {
  line-height: 1.3;
  text-wrap: balance;
}
body .ui-heading #uiPlaceText {
  margin-top: 4px;
}
body .ui-information :is(p, li),
body .side .card > p {
  text-wrap: pretty;
}
body .ui-information :is(p, li) {
  line-height: 1.8;
}
body .ui-information h2 {
  line-height: 1.45;
  margin-bottom: 12px;
}
body .ui-viewbar .view-tabs {
  align-items: stretch;
  gap: 4px;
}
body .ui-viewbar .view-tabs > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--md-sys-size-target, 40px);
  text-align: center;
  text-wrap: balance;
}

.document-content :is(p, li) {
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.document-content :is(h2, h3, h4) {
  text-wrap: balance;
  scroll-margin-top: 80px;
}
.document-content h2 {
  margin-bottom: 16px;
}
.document-content h3 {
  margin-bottom: 12px;
}
.document-content li + li {
  margin-top: 8px;
}
@media (min-width: 761px) {
  body .ui-heading {
    padding-block: 4px;
  }
}
/* Calendar steps share the quiet action treatment in both rail and timeline. */
body
  :is(.ui-parameters, .ui-timeline-host)
  :is(#workbenchPrevMonth, #workbenchNextMonth, #workbenchPrevDate, #workbenchNextDate) {
  background: var(--design-surface);
  color: var(--design-primary);
  border: 1px solid var(--design-line);
  box-shadow: none;
}
body
  :is(.ui-parameters, .ui-timeline-host)
  :is(
    #workbenchPrevMonth,
    #workbenchNextMonth,
    #workbenchPrevDate,
    #workbenchNextDate
  ):hover {
  background: var(--design-selected);
  color: var(--design-hover);
  border-color: var(--design-open-border);
}
body
  :is(.ui-parameters, .ui-timeline-host)
  :is(
    #workbenchPrevMonth,
    #workbenchNextMonth,
    #workbenchPrevDate,
    #workbenchNextDate
  ):disabled {
  background: var(--design-inset);
  color: var(--design-muted);
  border-color: var(--design-line);
}
/* Development flow is a sequence, not an uneven grid of independent cards. */
.document-page .development-flow {
  padding: 20px 24px;
  background: var(--design-paper);
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-surface);
}
.document-page .development-flow figcaption {
  margin-bottom: 16px;
  color: var(--design-ink);
}
.document-page .development-flow ol {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
}
.document-page .development-flow li,
.document-page .development-flow li + li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  line-height: 1.65;
  color: var(--design-ink);
}
.document-page .development-flow li + li {
  border-top: 1px solid var(--design-line);
}
.document-page .development-flow li::before {
  content: counter(flow);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 28px;
  border: 1px solid var(--design-line);
  border-radius: 8px;
  background: var(--design-surface);
  color: var(--design-primary);
  font-variant-numeric: tabular-nums;
  font-size: calc(13px * var(--ui-font-scale, 1));
}
.document-page .development-flow p {
  margin: 16px 0 0;
  color: var(--design-muted);
  line-height: 1.8;
}
@media (max-width: 600px) {
  .document-page .development-flow {
    padding: 16px;
  }
}
/* Authored monochrome SVG silhouettes, independent of OS emoji rendering. */
body :is(#workbenchPlay, body[data-page='space'] #play) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
body :is(#workbenchPlay, body[data-page='space'] #play)::before {
  content: '';
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 2.5 13 8l-9 5.5Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 2.5 13 8l-9 5.5Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
body :is(#workbenchPlay, body[data-page='space'] #play)[aria-pressed='true']::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3h3v10H3zm7 0h3v10h-3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3h3v10H3zm7 0h3v10h-3z'/%3E%3C/svg%3E");
}
/* Auxiliary states share the palette, including contact overlays and lazy tools. */
body .author-email-actions > *,
body .author-email-actions .author-mail-button,
body .ui-parameters :is(#shadowView, #solarDateShow) {
  background: var(--design-surface);
  color: var(--design-primary);
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-control);
  box-shadow: none;
}
body .author-email-actions > *:hover,
body .ui-parameters :is(#shadowView, #solarDateShow):hover {
  background: var(--design-selected);
  color: var(--design-hover);
  border-color: var(--design-open-border);
}
body .author-email-actions > *:active,
body .ui-parameters :is(#shadowView, #solarDateShow):active {
  background: var(--design-inset);
  color: var(--design-hover);
}
body .ui-parameters .month-ticks button {
  color: var(--design-muted);
}
body .ui-parameters .month-ticks button.selected-month {
  color: var(--design-primary);
}
body .ui-parameters .sundial-question summary {
  color: var(--design-primary);
}
body .ui-sundial-hint {
  background: var(--design-paper);
  color: var(--design-muted);
}
body[data-page='space'] .language-nav > .language-toggle {
  background: var(--design-surface);
  color: var(--design-primary);
  border-color: var(--design-line);
}
body[data-page='space'] .language-nav > .language-toggle:hover {
  background: var(--design-selected);
}
body[data-page='space'] .scene-tools-panel button[data-camera] {
  background: transparent;
  color: var(--design-night-ink);
  border-color: var(--design-night-line);
}
body[data-page='space'] .scene-tools-panel button[data-camera][aria-pressed='true'] {
  background: var(--design-action);
  color: var(--design-on-action);
  border-color: var(--design-action);
}
body[data-page='space'] .scene-tools-panel button[data-camera]:hover {
  background: var(--design-night-inset);
}
body[data-page='space'] button.label {
  background: var(--design-night-label-soft);
  color: var(--design-night-ink);
  border-color: var(--design-night-line);
}
body[data-page='space'] button.label:hover {
  background: var(--design-night-inset);
  color: var(--design-night-ink);
}
body .author-feedback-note {
  color: var(--design-muted);
  border-color: var(--design-line);
}
body .author-email-box > span,
body #authorCopyStatus {
  color: var(--design-muted);
}
/* Site-owned calendars replace the unthemeable Safari date popup. */
body dialog.site-calendar {
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 16px;
  box-sizing: border-box;
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-surface);
  background: var(--design-surface);
  color: var(--design-ink);
  font-family: var(--design-font);
  box-shadow: 0 12px 36px var(--design-shadow-dialog);
  overflow-y: auto;
}
.site-calendar::backdrop {
  background: var(--design-scrim);
}
body .site-calendar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--md-sys-size-target, 40px);
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  color: var(--design-ink);
  background: transparent;
  cursor: pointer;
}
body .site-calendar button:hover {
  background: var(--design-inset);
}
body .site-calendar button[aria-pressed='true'] {
  background: var(--design-selected);
  border-color: var(--design-open-border);
  color: var(--design-accent-hover);
  font-weight: 700;
}
body .site-calendar button:disabled {
  opacity: 0.4;
  cursor: default;
}
.site-calendar-head {
  display: grid;
  grid-template-columns: var(--md-sys-size-target) minmax(0, 1fr) var(
      --md-sys-size-target
    );
  gap: 4px;
  align-items: center;
}
.site-calendar-head svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.site-calendar-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  font-size: calc(13px * var(--ui-font-scale, 1));
  color: var(--design-muted);
}
body .site-calendar-year input {
  width: 88px;
  min-height: var(--md-sys-size-target, 40px);
  border: 1px solid var(--design-line);
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  color: var(--design-ink);
  background: var(--design-surface);
}
.site-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.site-calendar-grid.site-calendar-months {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 360px) {
  body dialog.site-calendar {
    width: calc(100vw - 16px);
    padding: 8px;
  }
  .site-calendar-grid {
    gap: 0;
  }
}
.site-calendar-weekday {
  text-align: center;
  padding: 6px 0;
  font-size: calc(12px * var(--ui-font-scale, 1));
  color: var(--design-muted);
}
.site-calendar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--design-line);
}
body .site-calendar-actions button {
  padding: 6px 16px;
  border-color: var(--design-line);
  background: var(--design-surface);
  color: var(--design-accent);
}
body .site-calendar-actions button:hover {
  background: var(--design-selected);
}
body input.site-date-field {
  min-height: var(--md-sys-size-target, 40px);
  padding: 6px 10px;
  border: 1px solid var(--design-line);
  border-radius: var(--design-radius-control);
  background: var(--design-surface);
  color: var(--design-ink);
  font-family: var(--design-font);
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
body dialog.site-calendar:not([open]) {
  display: none;
}
body dialog.site-calendar[open] {
  display: block;
}
body .site-calendar-year button {
  min-width: 80px;
  min-height: var(--md-sys-size-target, 40px);
  padding: 4px 12px;
  border: 1px solid var(--design-line);
  background: var(--design-surface);
  color: var(--design-accent);
}
body dialog.site-calendar:not([open]) {
  pointer-events: none;
}
body[data-page='space'] #spaceDrawerClose {
  background: transparent;
  color: var(--design-ink);
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  padding: 10px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body[data-page='space'].space-immersive #spaceDrawerClose {
  color: var(--design-night-ink);
}
body[data-page='space'] #spaceDrawerClose:hover {
  background: var(--design-inset);
}
body[data-page='space'].space-immersive #spaceDrawerClose:hover {
  background: var(--design-night-inset);
}
#spaceDrawerClose svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
body
  :is(
    #workbenchPrevDate,
    #workbenchNextDate,
    #workbenchPrevMonth,
    #workbenchNextMonth,
    #moonPrevMonth,
    #moonNextMonth
  ) {
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body
  :is(
    #workbenchPrevDate,
    #workbenchNextDate,
    #workbenchPrevMonth,
    #workbenchNextMonth,
    #moonPrevMonth,
    #moonNextMonth
  )::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m14 5-7 7 7 7' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m14 5-7 7 7 7' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
body :is(#workbenchNextDate, #workbenchNextMonth, #moonNextMonth)::before {
  transform: rotate(180deg);
}
body
  .ui-shell
  :is(
    #workbenchPrevDate,
    #workbenchNextDate,
    #workbenchPrevMonth,
    #workbenchNextMonth,
    #moonPrevMonth,
    #moonNextMonth
  ) {
  font-size: 0;
}
/* Failure recovery never keeps the whole application behind its font loader. */
.font-load-notice {
  position: fixed;
  z-index: 100000;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 10px 14px;
  box-sizing: border-box;
  border: 1px solid var(--design-line);
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--design-surface);
  color: var(--design-ink);
  font: calc(14px * var(--ui-font-scale, 1))/1.5 var(--design-font);
}
body .font-load-notice button {
  flex-shrink: 0;
  min-height: var(--md-sys-size-target, 40px);
  padding: 6px 10px;
  border: 1px solid var(--design-line);
  border-radius: 8px;
  background: var(--design-surface);
  color: var(--design-accent);
  font: inherit;
  cursor: pointer;
}
body .font-load-notice button:hover {
  background: var(--design-inset);
}
body .font-load-notice button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Corresponding reflections share the bottom position and warm night palette. */
html:lang(en) .welcome-quote-zh,
html:not(:lang(en)) .welcome-quote-en {
  display: none;
}
html:lang(en) body[data-page='welcome'] .welcome-quote {
  width: min(100%, 72ch);
  align-self: center;
  color: var(--design-welcome-quote);
  font-family: 'SkyMotion Charter', Charter, 'Bitstream Charter', Georgia, serif;
  font-style: normal;
  font-size: calc(clamp(14px, 1.2vw, 17px) * var(--ui-font-scale, 1));
  line-height: 1.55;
  letter-spacing: 0;
  text-wrap: balance;
}
@media (max-height: 400px) {
  html:lang(en) body[data-page='welcome'] .welcome-quote {
    width: 100%;
    font-size: calc(12px * var(--ui-font-scale, 1));
    line-height: 1.45;
  }
}
@media (min-width: 601px) and (max-height: 300px) {
  body[data-page='welcome'] .welcome-layout {
    padding: 4px 0;
  }
  body[data-page='welcome'] .welcome-intro h1 {
    font-size: calc(25px * var(--ui-font-scale, 1));
    margin-bottom: 8px;
  }
  body[data-page='welcome'] .welcome-intro > p {
    margin-bottom: 12px;
  }
  body[data-page='welcome'] .welcome-enter {
    min-height: 36px;
    padding: 6px 16px;
  }
  body[data-page='welcome']
    :is(
      .welcome-sky-actions button,
      .welcome-corner-links > :is(a,button),
      .welcome-corner-links > :is(a,button):visited
    ),
  html:lang(en)
    body[data-page='welcome']
    :is(
      .welcome-sky-actions button,
      .welcome-corner-links > :is(a,button),
      .welcome-corner-links > :is(a,button):visited
    ) {
    min-height: var(--md-sys-size-target, 40px);
    padding: 3px 8px;
  }
}

/* Ad astra is drawn by the existing star canvas, never by a font or overlay. */
html.welcome-opening
  body[data-page='welcome']
  :is(.welcome-brand, .welcome-layout, .welcome-quote) {
  opacity: var(--opening-reveal, 0);
  pointer-events: none;
}
html.welcome-opening .welcome-brand .language-toggle {
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  html.welcome-opening
    body[data-page='welcome']
    :is(.welcome-brand, .welcome-layout, .welcome-quote) {
    opacity: 1;
    pointer-events: auto;
  }
}

/* The font-independent constellation can paint while locale fonts prepare. */
html.welcome-opening[data-language-pending] {
  background: var(--design-welcome-night);
}
html.welcome-opening[data-language-pending]::after {
  display: none;
}
html.welcome-opening[data-language-pending] :is(body, .welcome-screen, #welcomeSky) {
  visibility: visible !important;
}

/* A short conversation makes the transition from observing to reading explicit. */
.document-entrance {
  --entrance-ink: var(--design-ink);
  --entrance-answer: var(--design-muted);
  --entrance-last: var(--design-reading-final);
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  align-content: center;
  padding: max(32px, env(safe-area-inset-top)) clamp(24px, 6vw, 96px)
    max(84px, env(safe-area-inset-bottom));
  background-color: var(--design-paper);
  color: var(--entrance-ink);
  font-family: var(--design-font);
  overflow: auto;
}
.document-entrance[data-theme='night'] {
  --entrance-ink: var(--design-welcome-answer);
  --entrance-answer: var(--design-welcome-quote);
  --entrance-last: var(--design-welcome-final);
  background-color: var(--design-welcome-night);
}
.entrance-dialogue {
  width: min(100%, 800px);
  margin: auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.entrance-sentence {
  width: 100%;
  opacity: 0;
  margin: 0 0 clamp(14px, 2vh, 24px);
  font-size: calc(clamp(19px, 2.1vw, 27px) * var(--ui-font-scale, 1));
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  text-wrap: pretty;
}
.entrance-sentence:first-child {
  font-size: calc(clamp(28px, 3.6vw, 46px) * var(--ui-font-scale, 1));
  margin-bottom: clamp(22px, 3vh, 34px);
}
.entrance-sentence[data-voice='answer'] {
  margin-left: 0;
  color: var(--entrance-answer);
}
.entrance-sentence:last-of-type {
  margin-top: 22px;
  margin-bottom: 0;
  font-size: calc(clamp(21px, 2.5vw, 31px) * var(--ui-font-scale, 1));
  color: var(--entrance-last);
}
html:not(:lang(en)) .entrance-sentence {
  line-height: 1.75;
  letter-spacing: 0.025em;
}
body .document-entrance .entrance-continue {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  margin: 0;
  min-height: var(--md-sys-size-target,44px);
  padding: 10px 20px;
  border: 1px solid var(--design-line);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--design-surface);
  color: var(--design-action);
  font: 400 calc(14px * var(--ui-font-scale, 1))/1.5 var(--design-font);
  text-decoration: none;
  cursor: pointer;
}
.entrance-continue:hover {
  color: var(--entrance-ink);
  background: transparent;
}
.entrance-continue:focus-visible {
  outline: 1px solid var(--entrance-answer);
  outline-offset: 6px;
}
@media (max-height: 550px) {
  .document-entrance {
    padding-top: 20px;
    padding-bottom: 64px;
  }
  .entrance-sentence {
    font-size: calc(17px * var(--ui-font-scale, 1));
    line-height: 1.35 !important;
    margin-bottom: 10px;
  }
  .entrance-sentence:first-child {
    font-size: calc(25px * var(--ui-font-scale, 1));
    margin-bottom: 14px;
  }
  .entrance-sentence:last-of-type {
    font-size: calc(19px * var(--ui-font-scale, 1));
    margin-top: 12px;
  }
}
@media (max-height: 330px) {
  .entrance-sentence {
    font-size: calc(15px * var(--ui-font-scale, 1));
    margin-bottom: 5px;
  }
  .entrance-sentence:first-child {
    font-size: calc(20px * var(--ui-font-scale, 1));
    margin-bottom: 8px;
  }
  .entrance-sentence:last-of-type {
    font-size: calc(16px * var(--ui-font-scale, 1));
    margin-top: 8px;
  }
}
@media (max-width: 600px) and (max-height: 700px) {
  .document-entrance {
    padding-top: 24px;
    padding-bottom: 70px;
  }
  .entrance-sentence {
    font-size: calc(17px * var(--ui-font-scale, 1));
    margin-bottom: 12px;
    line-height: 1.5;
  }
  html:not(:lang(en)) .entrance-sentence {
    line-height: 1.65;
  }
  .entrance-sentence:first-child {
    font-size: calc(26px * var(--ui-font-scale, 1));
    margin-bottom: 18px;
  }
  .entrance-sentence:last-of-type {
    font-size: calc(19px * var(--ui-font-scale, 1));
    margin-top: 16px;
  }
}

/* Secondary explanations share the paper palette, including expanded menus. */
body
  :is(.ui-parameters, .ui-parameter-drawer)
  :is(
    #workbenchHint,
    #durationDefinition,
    #globeDragExplanation,
    .workbench-more p,
    .year-strip-head > label,
    .sundial-time-label,
    .sundial-clock p,
    .sundial-question p
  ),
body[data-page='diagrams'] .ui-linked-menu-note {
  color: var(--design-muted);
}
body[data-page='not-found'] .reading-page a:not(.page-action) {
  color: var(--design-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
body[data-page='not-found'] .reading-page a:hover {
  color: var(--design-hover);
}
body[data-page='not-found'] .language-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
}
@media (max-width: 760px) {
  body[data-page='diagrams'] .ui-viewbar.ui-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
  }
  body[data-page='diagrams'] .ui-viewbar.ui-tabs > button {
    flex-shrink: 0;
    white-space: nowrap;
  }
}
/* Override the legacy important caption and the relocated needle readout. */
body #globeDragExplanation {
  color: var(--design-muted) !important;
}
body #sundialNeedleValue {
  color: var(--design-primary);
}

.ui-observation-context {
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.6;
  color: var(--design-muted);
  margin: 12px 0;
}
.ui-model-details p {
  margin: 12px 14px;
  line-height: 1.75;
}
.ui-metric-notes {
  margin: 14px;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.7;
}
.ui-metric-notes dt {
  margin-top: 12px;
  font-weight: 600;
  color: var(--design-primary);
}
.ui-metric-notes dd {
  margin: 4px 0 0;
}
.ui-metric-notes small {
  display: block;
  font-size: calc(12px * var(--ui-font-scale, 1));
}

/* Shared connected choices retain one value owner and native form compatibility. */
body .md-choice-native {position:absolute!important;inset:0 auto auto 0;width:1px!important;height:1px!important;min-height:0!important;padding:0!important;border:0!important;opacity:0;clip-path:inset(50%);pointer-events:none}
body .md-range-step {position:relative;isolation:isolate;flex:none;width:32px;min-width:32px;min-height:44px;padding:0;border:0;background:transparent;color:var(--design-accent);font:inherit;font-size:16px;cursor:pointer}
body .md-range-step::before {content:'';position:absolute;z-index:-1;width:26px;height:28px;left:50%;top:50%;transform:translate(-50%,-50%);border-radius:8px;background:var(--design-inset)}
body .md-range-step::after {content:'';position:absolute;inset:0 -6px;background:transparent}
/* Native values are presented by bundled Google Material Web components. */
body .md-choice-field {display:inline-flex;flex-direction:column;gap:6px;min-width:0;max-width:100%;width:100%;vertical-align:middle}
body .md-choice-buttons {display:grid;grid-template-columns:repeat(var(--choice-count,2),minmax(0,1fr));gap:4px;width:100%;min-width:0}
body .md-choice-buttons[data-choice-count='1'] {--choice-count:1}
body .md-choice-buttons[data-choice-count='3'] {--choice-count:3}
body .md-choice-buttons[data-choice-count='4'] {--choice-count:4}
@media(max-width:480px) {body .md-choice-buttons[data-choice-count='4'] {--choice-count:2}}

/* Official components consume the existing palette and fonts through public tokens. */
:root {
  --md-ref-typeface-plain: var(--design-font);
  --md-ref-typeface-brand: var(--design-font);
  --md-sys-typescale-label-large-font: var(--design-font);
  --md-sys-typescale-label-large-size: calc(14px * var(--ui-font-scale, 1));
  --md-sys-typescale-body-large-font: var(--design-font);
  --md-sys-typescale-body-large-size: calc(14px * var(--ui-font-scale, 1));
}
body .md-choice-select {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  --md-outlined-select-text-field-container-shape: var(--design-radius-control);
  --md-outlined-select-text-field-container-height: 48px;
  --md-menu-container-color: var(--design-surface);
}
body .md-choice-buttons > md-filter-chip {
  min-width: 0;
  width: 100%;
  --md-filter-chip-container-height: var(--md-sys-size-target);
  --md-filter-chip-label-text-color: var(--md-sys-color-on-primary-container);
  --md-filter-chip-container-shape: var(--md-comp-connected-button-inner-corner);
  --md-filter-chip-leading-space: 8px;
  --md-filter-chip-trailing-space: 8px;
  --md-filter-chip-label-text-font: var(--design-font);
  --md-filter-chip-label-text-size: calc(14px * var(--ui-font-scale, 1));
}
body .md-choice-buttons > md-filter-chip[data-choice-edge='first'] {
  --md-filter-chip-container-shape-start-start: var(--md-comp-connected-button-outer-corner);
  --md-filter-chip-container-shape-end-start: var(--md-comp-connected-button-outer-corner);
}
body .md-choice-buttons > md-filter-chip[data-choice-edge='last'] {
  --md-filter-chip-container-shape-start-end: var(--md-comp-connected-button-outer-corner);
  --md-filter-chip-container-shape-end-end: var(--md-comp-connected-button-outer-corner);
}
body .md-choice-buttons > md-filter-chip:is([selected],[data-choice-edge='only']) {
  --md-filter-chip-container-shape: var(--md-sys-shape-corner-full);
  --md-filter-chip-container-shape-start-start: var(--md-sys-shape-corner-full);
  --md-filter-chip-container-shape-start-end: var(--md-sys-shape-corner-full);
  --md-filter-chip-container-shape-end-start: var(--md-sys-shape-corner-full);
  --md-filter-chip-container-shape-end-end: var(--md-sys-shape-corner-full);
}
body .md-choice-buttons > md-filter-chip[selected] {
  --md-filter-chip-selected-container-color: var(--md-sys-color-primary);
  --md-filter-chip-selected-label-text-color: var(--md-sys-color-on-primary);
  --md-filter-chip-selected-leading-icon-color: var(--md-sys-color-on-primary);
  --md-filter-chip-selected-focus-label-text-color: var(--md-sys-color-on-primary);
  --md-filter-chip-selected-hover-label-text-color: var(--md-sys-color-on-primary);
  --md-filter-chip-selected-pressed-label-text-color: var(--md-sys-color-on-primary);
  --md-filter-chip-label-text-color: var(--md-sys-color-on-primary);
}
