/* Shared parameter geometry. Scoped away from welcome, diagrams and inline playback actions. */
:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .side, .scene-tools-panel, .preferences-dialog)
  :is(.toggle-row, .overlay-toggle, .toggles > label, .tools-check, .workbench-loop, .preference-row:has(input[type='checkbox'])) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--design-ink);
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.6;
  white-space: normal;
  cursor: pointer;
}

:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .side, .scene-tools-panel, .preferences-dialog)
  :is(.toggle-row, .overlay-toggle, .toggles > label, .tools-check, .workbench-loop, .preference-row:has(input[type='checkbox']))
  > span {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
  overflow-wrap: anywhere;
}

:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .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'] {
  appearance: none;
  box-sizing: border-box;
  position: relative;
  justify-self: end;
  grid-column: 2;
  grid-row: 1;
  flex-shrink: 0;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--design-switch-line);
  border-radius: 999px;
  background: var(--design-inset);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
}

:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .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 {
  content: '';
  display: block;
  position: absolute;
  width: 16px;
  height: 16px;
  top: 6px;
  left: 6px;
  border-radius: 50%;
  background: var(--design-muted);
  transform: translateX(0);
  transition:
    transform 240ms cubic-bezier(0.22, 1.2, 0.36, 1),
    background-color 180ms ease;
}

:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .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);
}

:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .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 {
  width: 24px;
  height: 24px;
  top: 2px;
  left: 2px;
  transform: translateX(20px);
  background: var(--design-on-action);
}

:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .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']:focus-visible {
  outline: 2px solid var(--md-sys-color-focus, var(--design-primary));
  outline-offset: 3px;
}

:is(.ui-parameters, .ui-timeline-host, body[data-page='space'] .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']:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-parameters .solar-overlay-bar {
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.ui-parameters .solar-date-options,
body[data-page='space'] .side .toggles {
  gap: 0;
}

/* One gap owns the whole related-link list, including the sundial wrapper. */
.ui-parameters .menu-section > .study-navigation {
  gap: 8px;
}
.ui-parameters .study-navigation .life-devices-entry {
  margin: 0;
  padding: 0;
  gap: 0;
}
.ui-parameters .study-navigation :is(.page-link, .menu-subsection > summary) {
  min-height: 44px;
  border-radius: var(--ui-control-radius, 12px);
  box-sizing: border-box;
}
.ui-parameters .label-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.ui-parameters :is(.menu-content, .analemma-comparison, .solar-date-options) > button {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--md-sys-size-target, 40px);
  border-radius: var(--ui-control-radius, 12px);
  white-space: normal;
  line-height: 1.5;
}

body[data-page='space'] .scene-tools-panel .tools-check {
  color: var(--design-night-ink);
}

body[data-page='space'] .scene-tools-panel .tools-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, 48%);
  gap: 12px;
  min-height: 44px;
  margin: 8px 0;
  line-height: 1.6;
}
body[data-page='space'] .scene-tools-panel .tools-field select {
  width: 100%;
  min-width: 0;
  min-height: var(--md-sys-size-target, 40px);
  border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
  :is(
      .ui-parameters,
      .ui-timeline-host,
      body[data-page='space'] .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'],
  :is(
      .ui-parameters,
      .ui-timeline-host,
      body[data-page='space'] .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 {
    transition: none;
  }
}
