:root {
  color-scheme: dark;
  --ui-bg: #101418;
  --ui-surface-1: #171d22;
  --ui-surface-2: #1d252c;
  --ui-surface-3: #202a31;
  --ui-overlay: rgba(0, 0, 0, 0.75);
  --ui-overlay-strong: rgba(9, 18, 30, 0.94);
  --ui-input: #0f1418;
  --ui-text: #e7edf2;
  --ui-text-strong: #ffffff;
  --ui-muted: #97a7b3;
  --ui-border: #2c3842;
  --ui-border-strong: #3f505c;
  --ui-shadow: rgba(0, 0, 0, 0.46);
  --ui-focus: #79e6ff;
  --ui-info: #00a0c8;
  --ui-success: #18a058;
  --ui-warning: #d6a600;
  --ui-danger: #d14b4b;
  --ui-tint-info: rgba(0, 160, 200, 0.12);
  --ui-tint-success: rgba(24, 160, 88, 0.12);
  --ui-tint-warning: rgba(214, 166, 0, 0.12);
  --ui-tint-danger: rgba(209, 75, 75, 0.12);
  --ui-graph-label: #dce8ef;
  --ui-graph-label-stroke: #0d1317;
  --ui-graph-node-border: #e7edf2;
  --ui-graph-node-highlight: #ffffff;
  --ui-graph-shadow: rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  color-scheme: light;
  --ui-bg: #edf2f7;
  --ui-surface-1: #ffffff;
  --ui-surface-2: #f5f8fb;
  --ui-surface-3: #e8eef4;
  --ui-overlay: rgba(255, 255, 255, 0.94);
  --ui-overlay-strong: rgba(248, 251, 254, 0.98);
  --ui-input: #ffffff;
  --ui-text: #24313d;
  --ui-text-strong: #101820;
  --ui-muted: #5d6c78;
  --ui-border: #c9d3dc;
  --ui-border-strong: #aab8c4;
  --ui-shadow: rgba(27, 43, 57, 0.2);
  --ui-focus: #006f91;
  --ui-info: #006f91;
  --ui-success: #08783f;
  --ui-warning: #8a6500;
  --ui-danger: #ad2f35;
  --ui-tint-info: rgba(0, 111, 145, 0.1);
  --ui-tint-success: rgba(8, 120, 63, 0.1);
  --ui-tint-warning: rgba(138, 101, 0, 0.11);
  --ui-tint-danger: rgba(173, 47, 53, 0.1);
  --ui-graph-label: #17212b;
  --ui-graph-label-stroke: #ffffff;
  --ui-graph-node-border: #344454;
  --ui-graph-node-highlight: #0b1722;
  --ui-graph-shadow: rgba(26, 42, 56, 0.24);
}

html[data-theme="light"] #scene-composition-hud {
  border-color: rgba(93, 108, 120, 0.48);
  background: rgba(248, 251, 254, 0.72);
  box-shadow: 0 5px 18px rgba(27, 43, 57, 0.18);
}

html[data-theme="light"] #scene-composition-hud .scene-composition-hud__drawer {
  border-color: rgba(93, 108, 120, 0.5);
  background: rgba(248, 251, 254, 0.95);
  box-shadow: 0 8px 24px rgba(27, 43, 57, 0.2);
}

.sm-theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ui-border-strong);
  border-radius: 6px;
  background: var(--ui-surface-3);
  color: var(--ui-text-strong);
  box-shadow: 0 4px 12px var(--ui-shadow);
  font: 700 20px/1 Arial, sans-serif;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.sm-theme-toggle:hover {
  border-color: var(--ui-info);
  background: var(--ui-surface-2);
}

.sm-theme-toggle:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ui-focus) 45%, transparent);
  outline-offset: 2px;
}

.sm-theme-toggle[aria-pressed="true"] {
  color: #174b63;
  background: #f8fbff;
  border-color: #6f9caf;
}

.cesium-viewer-toolbar .sm-theme-toggle--cesium {
  display: inline-grid;
  width: 32px;
  min-width: 32px;
  height: 32px;
  margin: 1px 2px;
  border-radius: 4px;
  vertical-align: top;
}

html[data-theme="light"] body {
  background-color: var(--ui-bg);
  color: var(--ui-text);
}

html[data-theme="light"] :is(input, select, textarea) {
  border-color: var(--ui-border-strong);
  background-color: var(--ui-input);
  color: var(--ui-text);
}

html[data-theme="light"] :is(input, select, textarea)::placeholder {
  color: #758492;
}

html[data-theme="light"] .overlay-panel {
  border: 1px solid var(--ui-border);
  background: var(--ui-overlay);
  color: var(--ui-text);
  box-shadow: 0 10px 28px var(--ui-shadow);
}

html[data-theme="light"] .overlay-panel :is(h1, h2, h3, strong, b) {
  color: var(--ui-text-strong);
}

html[data-theme="light"] .overlay-panel :is(small, .sm-note) {
  color: var(--ui-muted);
}

html[data-theme="light"] :is(.orbit-toggle-btn, .ground-toggle-btn) {
  border-color: var(--ui-border-strong);
  background: linear-gradient(180deg, #ffffff, #e9eff5);
  color: var(--ui-text-strong);
  text-shadow: none;
  box-shadow: 0 4px 14px var(--ui-shadow);
}

html[data-theme="light"] :is(
  .sm-connectivity-panel,
  .radio-panel,
  .ground-panel,
  .tasking-gb-panel,
  .mission-settings-panel
) {
  border-color: var(--ui-border);
  background: var(--ui-overlay-strong);
  color: var(--ui-text);
  box-shadow: 0 14px 34px var(--ui-shadow);
}

html[data-theme="light"] #orbit-panel {
  --module-accent: #2d75b5;
  --module-header: #245887;
  --module-tint: #e9f2fa;
}

html[data-theme="light"] #mission-panel {
  --module-accent: #b66b24;
  --module-header: #7a461b;
  --module-tint: #fbf0e4;
}

html[data-theme="light"] #celestrak-panel {
  --module-accent: #596fc1;
  --module-header: #3d4f91;
  --module-tint: #eef0fb;
}

html[data-theme="light"] #radio-panel {
  --module-accent: #1387ae;
  --module-header: #17617d;
  --module-tint: #e5f4f8;
}

html[data-theme="light"] #ground-panel {
  --module-accent: #278653;
  --module-header: #1c603c;
  --module-tint: #e8f5ed;
}

html[data-theme="light"] #connectivity-panel {
  --module-accent: #8350b7;
  --module-header: #63368e;
  --module-tint: #f2eafb;
}

/* .scene-module-light-surface */
html[data-theme="light"] :is(
  #orbit-panel,
  #mission-panel,
  #celestrak-panel,
  #radio-panel,
  #ground-panel,
  #connectivity-panel
) {
  border-color: color-mix(in srgb, var(--module-accent) 58%, #ffffff);
  background: rgba(249, 252, 254, 0.96);
  color: var(--ui-text);
  box-shadow: 0 14px 34px var(--ui-shadow);
  text-shadow: none;
}

/* .scene-module-light-title */
html[data-theme="light"] :is(
  #orbit-panel,
  #mission-panel,
  #celestrak-panel,
  #radio-panel,
  #ground-panel
) > :is(h1, h2),
html[data-theme="light"] #connectivity-panel > .sm-connectivity-header {
  border-color: var(--module-header);
  background: linear-gradient(180deg, var(--module-accent), var(--module-header));
  color: #ffffff;
  text-shadow: 0 1px rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] :is(
  #orbit-panel,
  #mission-panel,
  #celestrak-panel,
  #radio-panel,
  #ground-panel,
  #connectivity-panel
) :is(
  form,
  details,
  .bulk-orbits-panel,
  .mission-network-settings,
  .celestrak-section,
  .celestrak-groups-tree,
  .celestrak-group,
  .radio-main-control,
  .radio-panel-scroll,
  .radio-phased-profile-info,
  .radio-panel-footer,
  .ground-header,
  .ground-link-card,
  .ground-details,
  .ground-pass,
  .ground-radio,
  .ground-sats .item,
  .sm-connectivity-section
) {
  border-color: color-mix(in srgb, var(--module-accent) 32%, var(--ui-border));
  background: var(--module-tint);
  color: var(--ui-text);
  box-shadow: none;
}

html[data-theme="light"] :is(
  #orbit-panel,
  #mission-panel,
  #celestrak-panel,
  #radio-panel,
  #ground-panel,
  #connectivity-panel
) :is(h2, h3, strong, b, summary, .orbit-header, .sm-connectivity-choice-title) {
  color: var(--ui-text-strong);
  text-shadow: none;
}

/* .scene-module-light-muted */
html[data-theme="light"] :is(
  #orbit-panel,
  #mission-panel,
  #celestrak-panel,
  #radio-panel,
  #ground-panel,
  #connectivity-panel
) :is(
  small,
  .hint,
  .orbit-params,
  .celestrak-note,
  .celestrak-group-meta,
  .radio-summary-note,
  .ground-note,
  .sm-connectivity-choice-note
) {
  color: var(--ui-muted);
  text-shadow: none;
}

/* .scene-module-light-input */
html[data-theme="light"] :is(
  #orbit-panel,
  #mission-panel,
  #celestrak-panel,
  #radio-panel,
  #ground-panel,
  #connectivity-panel
) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-color: var(--ui-border-strong) !important;
  background: var(--ui-input) !important;
  color: var(--ui-text-strong) !important;
  text-shadow: none;
}

html[data-theme="light"] :is(#orbit-panel, #mission-panel) :is(
  #orbit-form,
  #bulk-orbits-form,
  #mission-form,
  #mission-bulk-orbits-form,
  .mission-network-settings,
  form label,
  #orbit-list-container,
  #mission-list-container,
  #orbit-list li,
  #mission-list li
) {
  border-color: color-mix(in srgb, var(--module-accent) 32%, var(--ui-border));
  background: var(--module-tint);
  color: var(--ui-text);
}

html[data-theme="light"] #orbit-panel #orbit-list-container h2 {
  color: var(--module-header);
  text-shadow: none;
}

html[data-theme="light"] #orbit-panel #orbit-list .orbit-header {
  color: var(--ui-text-strong);
  text-shadow: none;
}

html[data-theme="light"] #orbit-panel #orbit-list .orbit-params {
  color: var(--ui-text);
  text-shadow: none;
}

html[data-theme="light"] :is(#orbit-panel, #mission-panel) .bulk-orbits-panel > summary {
  border-color: color-mix(in srgb, var(--module-accent) 45%, var(--ui-border));
  background: color-mix(in srgb, var(--module-tint) 78%, #ffffff);
  color: var(--ui-text-strong);
}

html[data-theme="light"] #celestrak-panel :is(
  .celestrak-section,
  .celestrak-groups-tree,
  .celestrak-group,
  .celestrak-orbit-list li
) {
  border-color: color-mix(in srgb, var(--module-accent) 32%, var(--ui-border));
  background: var(--module-tint);
  color: var(--ui-text);
}

html[data-theme="light"] #celestrak-panel :is(
  .celestrak-status,
  .celestrak-summary,
  .celestrak-stats,
  .celestrak-loaded-list,
  .celestrak-orbit-list .orbit-params
) {
  color: var(--ui-text);
}

html[data-theme="light"] #radio-panel :is(
  .radio-panel-top > label,
  .radio-panel-top > .radio-inline-row,
  .radio-main-control,
  .radio-panel-scroll,
  .radio-phased-profile-info,
  details,
  label,
  .radio-panel-footer,
  #radio-mesh-info,
  #radio-session-summary,
  #radio-link-summary,
  #radio-energy-summary,
  .radio-energy-card,
  #radio-phased-profile-card,
  #radio-phased-profile-table
) {
  border-color: color-mix(in srgb, var(--module-accent) 34%, var(--ui-border));
  background: var(--module-tint);
  color: var(--ui-text);
  box-shadow: none;
}

html[data-theme="light"] #radio-panel details > summary {
  border-color: color-mix(in srgb, var(--module-accent) 45%, var(--ui-border));
  background: color-mix(in srgb, var(--module-tint) 75%, #ffffff);
  color: var(--ui-text-strong);
}

html[data-theme="light"] #radio-panel :is(
  h3,
  .radio-summary-title,
  .radio-metric-value,
  .radio-energy-card-value,
  .radio-profile-card-title,
  .radio-profile-card-line,
  .radio-profile-card-line span,
  .radio-profile-table-value
) {
  color: var(--ui-text-strong);
}

html[data-theme="light"] #radio-panel :is(
  .radio-label,
  .radio-metric-label,
  .radio-energy-card-label,
  .radio-profile-card-line b,
  .radio-profile-table-label
) {
  color: var(--module-header);
}

html[data-theme="light"] #radio-panel :is(
  .radio-phased-profile-info small,
  .radio-summary-note
) {
  color: var(--ui-muted);
}

html[data-theme="light"] #radio-panel :is(
  .radio-panel-scroll,
  .radio-phased-profile-info,
  .radio-panel-footer
)::-webkit-scrollbar-track {
  background: var(--ui-surface-3);
}

html[data-theme="light"] #radio-panel .radio-apply-button,
html[data-theme="light"] #radio-panel .radio-panel-footer > button[type="submit"] {
  border-color: var(--module-header);
  background: linear-gradient(180deg, var(--module-accent), var(--module-header));
  color: #ffffff;
}

html[data-theme="light"] #ground-panel .ground-header {
  border-color: color-mix(in srgb, var(--module-accent) 42%, var(--ui-border));
  background: var(--module-tint);
}

html[data-theme="light"] #ground-title {
  color: var(--ui-text-strong);
  text-shadow: none;
}

html[data-theme="light"] #ground-panel :is(
  .ground-link-card,
  .ground-details,
  .ground-pass,
  .ground-radio,
  .ground-sats .item,
  .ground-kpi-card,
  .ground-info-chip
) {
  border-color: color-mix(in srgb, var(--module-accent) 32%, var(--ui-border));
  background: var(--module-tint);
  color: var(--ui-text);
  box-shadow: none;
}

html[data-theme="light"] #ground-panel :is(
  .ground-link-card span,
  .ground-link-controls label,
  .ground-kpi-card span,
  .ground-chip-label,
  .ground-sats-title
) {
  color: var(--ui-muted);
}

html[data-theme="light"] #ground-panel :is(
  .ground-link-card b,
  .ground-details b,
  .ground-pass b,
  .ground-radio b,
  .ground-kpi-card b,
  .ground-info-chip > b,
  .ground-chip-value
) {
  color: var(--ui-text-strong) !important;
  text-shadow: none;
}

html[data-theme="light"] #ground-panel .ground-info-chip::before,
html[data-theme="light"] #ground-panel .ground-zone-summary,
html[data-theme="light"] #ground-panel .ground-zone-summary > b {
  color: var(--module-header);
  text-shadow: none;
}

html[data-theme="light"] #ground-panel .ground-tab {
  border-color: color-mix(in srgb, var(--module-accent) 34%, var(--ui-border));
  background: var(--module-tint);
  color: var(--ui-text);
}

html[data-theme="light"] #ground-panel .ground-tab.is-active {
  border-color: var(--module-header);
  background: var(--module-accent);
  color: #ffffff;
}

html[data-theme="light"] #ground-panel :is(
  .ground-link-controls input,
  .ground-link-controls select
) {
  border-color: var(--ui-border-strong);
  background: var(--ui-input);
  color: var(--ui-text-strong);
}

html[data-theme="light"] :is(
  .sm-connectivity-section,
  .sm-connectivity-status,
  .sm-connectivity-result,
  .radio-profile-card,
  .ground-kpi-card,
  .ground-tab-panel,
  .tasking-gb-card
) {
  border-color: var(--ui-border);
  background: var(--ui-surface-2);
  color: var(--ui-text);
}

html[data-theme="light"] .sm-connectivity-header {
  border-bottom-color: var(--ui-border);
}

html[data-theme="light"] .sm-connectivity-title {
  color: #ffffff;
  text-shadow: 0 1px rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] .sm-connectivity-subtitle {
  color: rgba(255, 255, 255, 0.84);
}

html[data-theme="light"] .sm-connectivity-icon-btn {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

html[data-theme="light"] .sm-connectivity-section h3 {
  color: var(--ui-text-strong);
}

html[data-theme="light"] .sm-connectivity-section label {
  color: var(--ui-text);
}

html[data-theme="light"] .sm-connectivity-choice {
  border-color: color-mix(in srgb, var(--module-accent) 28%, var(--ui-border));
  background: var(--module-tint);
  color: var(--ui-text);
}

html[data-theme="light"] .sm-connectivity-choice:hover {
  border-color: var(--module-accent);
  background: color-mix(in srgb, var(--module-tint) 72%, #ffffff);
}

html[data-theme="light"] .sm-connectivity-choice-title {
  color: var(--ui-text-strong);
}

html[data-theme="light"] .sm-connectivity-choice-note {
  color: var(--ui-muted);
}

html[data-theme="light"] .sm-connectivity-section-hint,
html[data-theme="light"] .sm-connectivity-help,
html[data-theme="light"] .sm-connectivity-muted {
  color: var(--ui-muted);
}

html[data-theme="light"] .sm-connectivity-symbol {
  color: var(--ui-warning);
}

html[data-theme="light"] .sm-connectivity-section input[type="number"] {
  border-color: var(--ui-border-strong);
  background: var(--ui-input);
  color: var(--ui-text-strong);
}

html[data-theme="light"] .sm-connectivity-statusbar {
  border-top-color: var(--ui-border);
}

html[data-theme="light"] .sm-connectivity-workload,
html[data-theme="light"] .sm-connectivity-workload-metric {
  color: var(--ui-muted);
}

html[data-theme="light"] .sm-connectivity-workload-metric b {
  color: var(--ui-text-strong);
  text-shadow: none;
}

html[data-theme="light"] .sm-connectivity-status-item {
  border-color: color-mix(in srgb, var(--module-accent) 25%, var(--ui-border));
  background: var(--module-tint);
}

html[data-theme="light"] .sm-connectivity-status-label {
  color: var(--ui-info);
}

html[data-theme="light"] .sm-connectivity-status-value {
  color: var(--ui-text-strong);
}

html[data-theme="light"] #connectivity-status-stage {
  color: #5e7100;
}

html[data-theme="light"] #connectivity-status-checks,
html[data-theme="light"] #connectivity-status-files,
html[data-theme="light"] #connectivity-status-remaining {
  color: #805800;
}

html[data-theme="light"] #connectivity-status-links {
  color: var(--ui-success);
}

html[data-theme="light"] #connectivity-result-path {
  color: var(--ui-muted);
}

html[data-theme="light"] .sm-local-credit {
  border-color: #26889d;
  background: rgba(255, 255, 255, 0.9);
  color: #174b5a;
  text-shadow: none;
  box-shadow: 0 3px 12px var(--ui-shadow);
}

html[data-theme="light"] .mc-topbar {
  background: var(--ui-surface-1);
  border-color: var(--ui-border);
}

html[data-theme="light"] .mc-panel-title {
  border-bottom-color: var(--ui-border);
  background: var(--ui-surface-2);
  color: var(--ui-text-strong);
}

html[data-theme="light"] .mc-panel-title h2 {
  color: var(--ui-text-strong);
}

html[data-theme="light"] .mc-fieldset {
  border-color: var(--ui-border);
  background: var(--ui-surface-2);
  color: var(--ui-text);
}

html[data-theme="light"] .mc-fieldset-title {
  color: var(--ui-text-strong);
}

html[data-theme="light"] .mc-fieldset label {
  color: var(--ui-muted);
}

html[data-theme="light"] .mc-actions {
  border-top-color: var(--ui-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), var(--ui-surface-1));
}

html[data-theme="light"] .mc-badge {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
}

html[data-theme="light"] .mc-badge.is-ok,
html[data-theme="light"] .mc-badge.is-new {
  border-color: color-mix(in srgb, var(--ui-success) 55%, var(--ui-border));
  background: var(--ui-tint-success);
  color: var(--ui-success);
}

html[data-theme="light"] :is(
  .mc-panel,
  .mc-card,
  .mc-kpi,
  .mission-card,
  .execution-card,
  .network-map-panel,
  .link-activity-table-wrap
) {
  border-color: var(--ui-border);
  background-color: var(--ui-surface-1);
  color: var(--ui-text);
  box-shadow: 0 8px 24px var(--ui-shadow);
}

html[data-theme="light"] :is(.mc-link, .mc-secondary, .mc-topbar button) {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-3);
  color: var(--ui-text);
}

html[data-theme="light"] :is(
  .network-map-stage,
  .network-map-details,
  .network-map-controls,
  .mission-execution-board,
  .link-activity-table th,
  .link-activity-table td
) {
  border-color: var(--ui-border);
  background-color: var(--ui-surface-2);
  color: var(--ui-text);
}

html[data-theme="light"] .analyzer-page {
  --analyzer-los: #176dcc;
  --analyzer-cyan: #007b9d;
  --analyzer-violet: #7440b8;
  --analyzer-panel: rgba(255, 255, 255, 0.97);
  --analyzer-line: rgba(86, 111, 133, 0.28);
  background: radial-gradient(circle at 83% -10%, rgba(116, 64, 184, 0.09), transparent 32rem), var(--ui-bg);
  color: var(--ui-text);
}

html[data-theme="light"] .analyzer-page .analyzer-layer-switch button[data-layer="los"],
html[data-theme="light"] .analyzer-page .analyzer-layer-card[data-layer="los"] {
  --layer-accent: var(--analyzer-los);
  --layer-tint: #eaf3ff;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-switch button[data-layer="rf"],
html[data-theme="light"] .analyzer-page .analyzer-layer-card[data-layer="rf"] {
  --layer-accent: var(--analyzer-cyan);
  --layer-tint: #e6f6fa;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-switch button[data-layer="net"],
html[data-theme="light"] .analyzer-page .analyzer-layer-card[data-layer="net"] {
  --layer-accent: var(--analyzer-violet);
  --layer-tint: #f2eafb;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-switch button {
  border-color: color-mix(in srgb, var(--layer-accent) 48%, var(--ui-border));
  background: var(--layer-tint);
  color: var(--ui-text);
  box-shadow: none;
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-switch button strong {
  color: var(--ui-text-strong);
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-switch button strong span {
  color: var(--layer-accent);
}

html[data-theme="light"] .analyzer-page .analyzer-layer-switch button[aria-pressed="true"] {
  border-color: var(--layer-accent);
  background: color-mix(in srgb, var(--layer-tint) 72%, var(--layer-accent));
  box-shadow: inset 0 -4px 0 var(--layer-accent), 0 4px 12px color-mix(in srgb, var(--layer-accent) 22%, transparent);
  transform: translateY(-1px);
}

html[data-theme="light"] .analyzer-page .analyzer-layer-card {
  border-color: var(--ui-border);
  border-left-color: var(--layer-accent);
  background: var(--ui-surface-2);
  color: var(--ui-text);
  box-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-card.is-selected {
  border-color: color-mix(in srgb, var(--layer-accent) 52%, var(--ui-border));
  border-left-color: var(--layer-accent);
  background: color-mix(in srgb, var(--layer-tint) 84%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--layer-accent) 18%, transparent);
}

html[data-theme="light"] .analyzer-page .analyzer-layer-card h3 {
  color: var(--ui-text-strong);
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-card :is(dt, p, .analyzer-layer-reasons) {
  color: var(--ui-muted);
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-card :is(dd, p output) {
  color: var(--ui-text-strong);
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-layer-card .analyzer-metric-help {
  border-color: color-mix(in srgb, var(--layer-accent) 42%, var(--ui-border));
  background: color-mix(in srgb, var(--layer-tint) 82%, #ffffff);
  color: var(--layer-accent);
}

html[data-theme="light"] .analyzer-page :is(
  #analyzer-import,
  #analyzer-local-open,
  #analyzer-search-go
),
html[data-theme="light"] .analyzer-page .analyzer-dynamics-jump button {
  border-color: var(--ui-info);
  background: var(--ui-info);
  color: #ffffff;
  text-shadow: none;
  box-shadow: 0 3px 9px color-mix(in srgb, var(--ui-info) 24%, transparent);
}

html[data-theme="light"] .analyzer-page :is(
  #analyzer-import,
  #analyzer-local-open,
  #analyzer-search-go
):hover:not(:disabled),
html[data-theme="light"] .analyzer-page .analyzer-dynamics-jump button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--ui-info) 78%, #000000);
  background: color-mix(in srgb, var(--ui-info) 86%, #ffffff);
  color: #ffffff;
}

html[data-theme="light"] .analyzer-page :is(
  #analyzer-import,
  #analyzer-local-open,
  #analyzer-search-go
):disabled,
html[data-theme="light"] .analyzer-page .analyzer-dynamics-jump button:disabled {
  border-color: var(--ui-border);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
  box-shadow: none;
  opacity: 0.72;
}

html[data-theme="light"] .analyzer-page .analyzer-player > button {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-2);
  color: var(--ui-text-strong);
  text-shadow: none;
  box-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-player > button:hover:not(:disabled) {
  border-color: var(--ui-info);
  background: var(--ui-surface-3);
  color: var(--ui-info);
}

html[data-theme="light"] .analyzer-page .analyzer-player > button[aria-pressed="true"] {
  border-color: var(--ui-info);
  background: var(--ui-tint-info);
  color: var(--ui-info);
  box-shadow: inset 0 -3px 0 var(--ui-info);
}

html[data-theme="light"] .analyzer-page .analyzer-player > button:disabled {
  border-color: var(--ui-border);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
  box-shadow: none;
  opacity: 0.65;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-jump label {
  color: var(--ui-muted);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-jump input {
  border-color: var(--ui-border-strong);
  background: var(--ui-input);
  color: var(--ui-text-strong);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle.is-edge {
  --series-accent: var(--ui-info);
  --series-tint: var(--ui-tint-info);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle.is-los {
  --series-accent: var(--analyzer-los);
  --series-tint: #eaf3ff;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle.is-rf {
  --series-accent: var(--analyzer-cyan);
  --series-tint: #e6f6fa;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle.is-net {
  --series-accent: var(--analyzer-violet);
  --series-tint: #f2eafb;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle.is-new {
  --series-accent: var(--ui-success);
  --series-tint: var(--ui-tint-success);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle.is-lost {
  --series-accent: var(--ui-danger);
  --series-tint: var(--ui-tint-danger);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle {
  border-color: color-mix(in srgb, var(--series-accent) 50%, var(--ui-border));
  background: var(--series-tint);
  color: var(--ui-text-strong);
  text-shadow: none;
  box-shadow: none;
  opacity: 1;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle[aria-pressed="true"] {
  border-color: var(--series-accent);
  background: var(--series-tint);
  color: var(--ui-text-strong);
  box-shadow: inset 0 -3px 0 var(--series-accent);
  opacity: 1;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle[aria-pressed="false"] {
  border-color: var(--ui-border);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
  box-shadow: none;
  opacity: 0.72;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle:hover:not(:disabled) {
  border-color: var(--series-accent);
  background: color-mix(in srgb, var(--series-tint) 78%, #ffffff);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle i {
  background: var(--series-accent);
  color: var(--series-accent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--series-accent) 48%, transparent);
  filter: none;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-toggle[aria-pressed="false"] i {
  background: var(--series-accent);
  color: var(--series-accent);
  box-shadow: none;
  filter: none;
  opacity: 0.35;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-kpi {
  --kpi-accent: #667784;
  --kpi-tint: var(--ui-surface-2);
  border: 1px solid color-mix(in srgb, var(--kpi-accent) 32%, var(--ui-border));
  border-left-width: 3px;
  border-left-color: var(--kpi-accent);
  background: var(--kpi-tint);
  color: var(--ui-text);
  box-shadow: none;
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-kpi.is-edge {
  --kpi-accent: var(--ui-info);
  --kpi-tint: var(--ui-tint-info);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-kpi.is-preserved {
  --kpi-accent: #52745f;
  --kpi-tint: #edf5f0;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-kpi.is-new {
  --kpi-accent: var(--ui-success);
  --kpi-tint: var(--ui-tint-success);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-kpi.is-lost {
  --kpi-accent: var(--ui-danger);
  --kpi-tint: var(--ui-tint-danger);
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-kpi span {
  color: var(--ui-muted);
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page .analyzer-dynamics-kpi output {
  color: var(--ui-text-strong);
  text-shadow: none;
}

html[data-theme="light"] .analyzer-page :is(
  .mc-card,
  .analyzer-toggle,
  .analyzer-map-stage,
  .analyzer-stable-stage,
  .analyzer-stable-sidebar-section,
  .analyzer-stable-toolbar,
  .analyzer-import-progress,
  .analyzer-object-read-status,
  .analyzer-dynamics-chart-shell
) {
  border-color: var(--ui-border);
  background-color: var(--ui-surface-1);
  color: var(--ui-text);
  box-shadow: 0 8px 24px var(--ui-shadow);
}

html[data-theme="light"] .analyzer-page :is(
  .analyzer-list,
  .analyzer-details,
  .analyzer-stable-details,
  .analyzer-neighbor-heading,
  .analyzer-map-legend,
  .analyzer-stable-reference,
  .analyzer-dynamics-footer p
) {
  color: var(--ui-text);
}

html[data-theme="light"] .analyzer-page :is(
  .analyzer-row b,
  .analyzer-interval-title,
  .analyzer-stable-kpi output,
  .analyzer-stable-details h3,
  .analyzer-stable-detail-row strong,
  .analyzer-progress-copy strong
) {
  color: var(--ui-text-strong);
}

html[data-theme="light"] .analyzer-page :is(
  .analyzer-group-detail-summary,
  .analyzer-interval-summary,
  .analyzer-stable-kpi span,
  .analyzer-stable-component small,
  .analyzer-stable-detail-row span,
  .analyzer-object-read-copy span
) {
  color: var(--ui-muted);
}

html[data-theme="light"] .analyzer-help-tooltip,
html[data-theme="light"] .analyzer-dynamics-tooltip {
  border-color: var(--ui-info);
  background: var(--ui-overlay-strong);
  color: var(--ui-text);
  box-shadow: 0 12px 28px var(--ui-shadow);
}

html[data-theme="light"] .analyzer-stable-earth-stage {
  background: #dfe8ef;
}

html[data-theme="light"] .analyzer-stable-status.is-ready {
  color: #086d3e;
}

html[data-theme="light"] .analyzer-stable-status.is-neutral {
  color: #7a5700;
}

html[data-theme="light"] .analyzer-stable-status.is-error {
  color: #a4262d;
}

html[data-theme="light"] .cesium-button {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-1);
  color: var(--ui-text-strong);
  fill: var(--ui-text-strong);
  box-shadow: 0 2px 8px var(--ui-shadow);
}

html[data-theme="light"] .cesium-button:hover {
  border-color: var(--ui-info);
  background: var(--ui-surface-3);
}

html[data-theme="light"] .cesium-infoBox {
  border-color: var(--ui-border-strong);
  background: var(--ui-overlay-strong);
  color: var(--ui-text);
  box-shadow: 0 10px 28px var(--ui-shadow);
}

html[data-theme="light"] .cesium-infoBox-title {
  background: var(--ui-surface-3);
  color: var(--ui-text-strong);
}

html[data-theme="light"] button.cesium-infoBox-close {
  color: var(--ui-text-strong);
}

@media (prefers-reduced-motion: reduce) {
  .sm-theme-toggle {
    transition: none;
  }
}

html[data-theme="light"] #scene-line-style-panel {
  border-color: rgba(93, 108, 120, 0.62);
  background: rgba(248, 251, 254, 0.97);
  color: var(--ui-text);
  box-shadow: 0 14px 34px rgba(27, 43, 57, 0.24);
}

html[data-theme="light"] #scene-line-style-panel .scene-line-style-panel__header,
html[data-theme="light"] #scene-line-style-panel .scene-line-style-panel__footer {
  border-color: var(--ui-border);
  background: rgba(231, 238, 244, 0.94);
}

html[data-theme="light"] #scene-line-style-panel .scene-line-style-panel__section {
  border-color: var(--ui-border);
}

html[data-theme="light"] #scene-line-style-panel :is(
  .scene-line-style-panel__title,
  .scene-line-style-panel__label,
  .scene-line-style-panel__value
) {
  color: var(--ui-text-strong);
}

html[data-theme="light"] #scene-line-style-panel :is(
  .scene-line-style-panel__drag-hint,
  .scene-line-style-panel__note,
  .scene-line-style-panel__live-note
) {
  color: var(--ui-muted);
}

html[data-theme="light"] #scene-line-style-panel :is(
  .scene-line-style-panel__close,
  .scene-line-style-panel__reset,
  .scene-line-style-panel__reset-all
) {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-2);
  color: var(--ui-text);
}

html[data-theme="light"] #scene-line-style-panel :is(
  .scene-line-style-panel__close,
  .scene-line-style-panel__reset,
  .scene-line-style-panel__reset-all
):hover {
  border-color: var(--ui-info);
  background: var(--ui-surface-3);
  color: var(--ui-text-strong);
}

/* Этап 24: кнопка-книжка справки (ui/help_book.js) — на сцене, в шапках панелей и страниц */
.sm-help-book {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(120, 220, 255, 0.55);
  border-radius: 8px;
  background: radial-gradient(circle at 30% 25%, rgba(70, 190, 255, 0.28), rgba(12, 22, 40, 0.92) 70%);
  box-shadow: 0 0 10px rgba(54, 224, 255, 0.35);
  cursor: pointer;
  perspective: 120px;
}

.sm-help-book:hover {
  border-color: #7fefff;
  box-shadow: 0 0 16px rgba(54, 224, 255, 0.7);
}

.sm-help-book .sm-book {
  width: 26px;
  height: 26px;
  overflow: visible;
}

.sm-book-pages { fill: #e9f6ff; stroke: #9cc8e6; stroke-width: 0.6; }
.sm-book-spine { fill: #1b3e86; }

.sm-book-front {
  transform-origin: 12px 19px;
  transform-box: view-box;
  transition: transform 0.35s ease;
}

.sm-help-book:hover .sm-book-front {
  transform: perspective(60px) rotateY(-28deg);
}

.sm-book-cover { stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.6; }

.sm-book-shine {
  animation: sm-book-shine 4.5s ease-in-out infinite;
}

.sm-book-mark {
  fill: #fff;
  font: 900 17px/1 Arial, sans-serif;
  paint-order: stroke;
  stroke: rgba(10, 30, 80, 0.55);
  stroke-width: 1.2px;
  transform-origin: 22.5px 19.5px;
  transform-box: view-box;
  animation: sm-book-breathe 2.6s ease-in-out infinite;
}

@keyframes sm-book-shine {
  0%, 55% { transform: skewX(-18deg) translateX(0); }
  85%, 100% { transform: skewX(-18deg) translateX(62px); }
}

@keyframes sm-book-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0)); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 2px rgba(180, 240, 255, 0.95)); }
}

@media (prefers-reduced-motion: reduce) {
  .sm-book-shine, .sm-book-mark { animation: none; }
}

/* на панели Cesium — как соседние кнопки */
.cesium-viewer-toolbar .sm-help-book.sm-help-book--cesium {
  width: 32px;
  height: 32px;
  margin: 2px 3px;
  vertical-align: middle;
}

/* в шапке панели — маленькая */
.sm-help-book.sm-help-book--panel {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.sm-help-book.sm-help-book--panel .sm-book {
  width: 19px;
  height: 19px;
}
