/* Лаборатория движения в поле Земли — панельный тёмный интерфейс */

:root {
  --bg-deep: #0f120f;
  --bg-elevated: #161b16;
  --surface: #1a2119;
  --surface-hover: #222b21;
  --border: rgba(176, 187, 156, 0.18);
  --border-strong: rgba(198, 214, 132, 0.56);
  --text: #e8eedf;
  --text-muted: #b0bc9f;
  --text-dim: #879278;
  --accent: #b6c56a;
  --accent-soft: rgba(182, 197, 106, 0.14);
  --accent2: #8ea35a;
  --accent-strong: #d4e07f;
  --panel-muted: rgba(170, 186, 150, 0.08);
  --panel-strong: rgba(182, 197, 106, 0.2);
  --success: #97c36e;
  --warning: #d9b466;
  --danger: #d98979;
  --radius-lg: 10px;
  --radius: 8px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(170, 186, 150, 0.06);
  /* Системные шрифты — без загрузки из сети (установщик / офлайн) */
  --font: system-ui, -apple-system, "Segoe UI", "DM Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
  /* Поля страницы: адаптивно + не меньше системных «безопасных зон» */
  --pad-inline: clamp(0.5rem, 1.2vw + 0.35rem, 1.35rem);
  --pad-block-start: clamp(1rem, 2vh, 1.75rem);
  --pad-block-end: clamp(1.5rem, 4vh, 3rem);
  --layout-gap: clamp(1.1rem, 2vw, 1.75rem);
  --content-max: 100%;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(180deg, #090d09 0%, #101710 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Фон: сетка + градиент */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 65% at 50% -10%, rgba(182, 197, 106, 0.05), transparent 56%),
    linear-gradient(180deg, #101510 0%, #141b14 100%);
}

.bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(170, 186, 150, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(170, 186, 150, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.45;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent);
}

.app {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--content-max);
  margin: 0;
  padding-top: max(var(--pad-block-start), env(safe-area-inset-top, 0px));
  padding-bottom: max(var(--pad-block-end), env(safe-area-inset-bottom, 0px));
  padding-left: max(var(--pad-inline), env(safe-area-inset-left, 0px));
  padding-right: max(var(--pad-inline), env(safe-area-inset-right, 0px));
}

/* --- Шапка --- */
.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  margin-bottom: clamp(0.85rem, 2vw, 1.25rem);
  padding-bottom: clamp(1rem, 2vw, 1.35rem);
  border-bottom: 1px solid rgba(176, 187, 156, 0.14);
  min-width: 0;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1 1 auto;
}

.logo-mark {
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(182, 197, 106, 0.32));
}

.app-header__titles h1 {
  margin: 0;
  font-size: clamp(1.25rem, 4.2vw + 0.6rem, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, #edf3e4 0%, #a9b79a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.app-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pill--ok {
  border-color: rgba(151, 195, 110, 0.45);
  color: var(--success);
  background: rgba(151, 195, 110, 0.12);
}

.kbd-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.kbd-hint kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  margin: 0 0.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.lead {
  margin: 0 0 clamp(1.1rem, 2.5vw, 1.65rem);
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 52rem;
  width: 100%;
}

.lead strong {
  color: var(--text);
}

.formula {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--accent);
  padding: 0.1rem 0.35rem;
  background: var(--accent-soft);
  border-radius: 6px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

/* --- Рабочий стол: верхняя панель + выезжающая панель «Данные» + основная зона на всю ширину --- */
.workbench {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
  width: 100%;
  min-width: 0;
  position: relative;
}

.workbench__topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 0.85rem;
}

.workbench__topbar-tools {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  margin: 0;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(182, 197, 106, 0.45);
  background: rgba(182, 197, 106, 0.12);
  transition: background 0.15s, border-color 0.15s;
}

.drawer-toggle:hover {
  background: rgba(182, 197, 106, 0.2);
  border-color: rgba(182, 197, 106, 0.6);
}

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

.workbench--drawer-open .drawer-toggle {
  background: rgba(182, 197, 106, 0.22);
  border-color: rgba(182, 197, 106, 0.65);
}

.drawer-toggle__icon {
  flex-shrink: 0;
  opacity: 0.9;
}

.drawer-toggle__text {
  white-space: nowrap;
}

.workbench__topbar .dash-toolbar .toolbar {
  margin-top: 0;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.workbench__topbar .dash-toolbar .toolbar + .toolbar {
  margin-top: 0.45rem;
}

.workbench__topbar .dash-toolbar .toolbar--files {
  margin-bottom: 0;
}

.workbench__backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 8, 4, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.workbench--drawer-open .workbench__backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.workbench__drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(100vw - 1.25rem, 400px);
  max-width: 100%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding-top: max(env(safe-area-inset-top, 0px), 0.5rem);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(env(safe-area-inset-left, 0px), 0.5rem);
  padding-right: 0.65rem;
  background: linear-gradient(180deg, #171d17 0%, #111610 100%);
  border-right: 1px solid var(--border);
  box-shadow: 10px 0 48px rgba(0, 0, 0, 0.5);
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

.workbench--drawer-open .workbench__drawer {
  transform: translateX(0);
}

.workbench__drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.35rem 0 0.65rem;
  border-bottom: 1px solid rgba(176, 187, 156, 0.15);
}

.workbench__drawer-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.workbench__drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.65rem 0 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.workbench__main {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
  min-width: 0;
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .workbench__backdrop,
  .workbench__drawer {
    transition: none;
  }
}

@media (min-width: 1440px) {
  :root {
    --layout-gap: 1.5rem;
  }
}

/* --- Карточки --- */
.surface-card {
  background: linear-gradient(180deg, rgba(24, 32, 23, 0.96) 0%, rgba(22, 29, 22, 0.98) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2vw, 1.45rem) clamp(1.15rem, 2.2vw, 1.6rem);
  box-shadow: var(--shadow-card);
  min-width: 0;
  max-width: 100%;
}

.surface-card--results {
  border-color: rgba(182, 197, 106, 0.22);
}

.surface-card--chart {
  min-height: 0;
}

.surface-card.workbench__topbar {
  padding: clamp(0.6rem, 1.1vw, 0.8rem) clamp(0.75rem, 1.4vw, 1rem);
}

.surface-card.workbench__data-card {
  padding: clamp(0.85rem, 1.5vw, 1.15rem) clamp(0.95rem, 1.6vw, 1.25rem);
}

#section1d,
#sectionProj {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* 1D-графики рядом на десктопе, одинаковая высота области графика */
#chartsSecondary1d {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--layout-gap);
}

@media (min-width: 1100px) {
  #chartsSecondary1d {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }

  #chartsSecondary1d > .surface-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #chartsSecondary1d > .surface-card .chart-frame--tall {
    flex: 1 1 auto;
    height: min(38vh, 400px);
    min-height: 300px;
    max-height: min(42vh, 440px);
  }
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.1rem;
  min-width: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.04rem;
  font-weight: 600;
  color: #dfe8d2;
  letter-spacing: -0.02em;
  min-width: 0;
}

.card-title__icon {
  color: var(--accent);
  font-size: 0.85em;
  opacity: 0.9;
}

.card-head__badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Поле H */
.field-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.input-with-unit {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-with-unit:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-with-unit input {
  width: 7rem;
  padding: 0.55rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
}

.input-with-unit input:focus {
  outline: none;
}

.unit {
  padding: 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-left: 1px solid var(--border);
}

/* Таблица */
.table-shell {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(52vh, 430px);
  background: var(--bg-elevated);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

thead th {
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: linear-gradient(180deg, #1c271d 0%, #151f16 100%);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th:first-child {
  border-radius: var(--radius) 0 0 0;
}

thead th:last-child {
  border-radius: 0 var(--radius) 0 0;
}

tbody td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(170, 186, 150, 0.08);
  vertical-align: middle;
}

tbody tr:nth-child(even) td {
  background: rgba(170, 186, 150, 0.03);
}

tbody tr:hover td {
  background: rgba(182, 197, 106, 0.08);
}

.col-num {
  width: 2.5rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.col-s {
  font-family: var(--mono);
}

td input.inp-t,
td input.inp-d,
td input.inp-x,
td input.inp-y {
  width: 100%;
  min-width: 5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
}

td input.inp-t:focus,
td input.inp-d:focus,
td input.inp-x:focus,
td input.inp-y:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(182, 197, 106, 0.1);
}

td.s-computed {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  padding-left: 0.65rem;
}

.table-caption {
  margin: 0.6rem 0 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Панель кнопок */
.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: stretch;
  gap: 0.55rem 0.65rem;
  margin-top: 1.1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.85rem;
  padding: 0.56rem 0.95rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #1d261d 0%, #182118 100%);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  width: 100%;
  max-width: 100%;
}

.btn:hover {
  background: #263126;
  border-color: rgba(182, 197, 106, 0.45);
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.btn-ghost {
  background: transparent;
}

.btn-ghost--warn:hover {
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
}

.btn-primary {
  margin-left: 0;
  border: 1px solid rgba(182, 197, 106, 0.65);
  color: #0c110b;
  background: linear-gradient(135deg, #b6c56a 0%, #9eb25f 55%, #899d51 100%);
  box-shadow: 0 3px 12px rgba(182, 197, 106, 0.22);
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 5px 16px rgba(182, 197, 106, 0.28);
}

/* Компактные кнопки в учебной панели */
.btn.btn-sm {
  min-height: 2.25rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Узкие экраны: сетка 2 колонки, главное действие — на всю ширину */
@media (max-width: 640px) {
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
}

@media (max-width: 420px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
}

/* Метрики */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: clamp(0.55rem, 1.5vw, 0.75rem);
  min-width: 0;
  width: 100%;
}

.metric {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.metric--accent {
  border-color: rgba(182, 197, 106, 0.38);
  background: linear-gradient(145deg, rgba(182, 197, 106, 0.12) 0%, var(--bg-elevated) 100%);
}

.metric__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.metric__value {
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: none;
  min-width: 0;
}

.metric__unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hint--banner:empty {
  display: none;
}

.hint--banner:not(:empty) {
  margin-top: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(217, 180, 102, 0.5);
  background: rgba(217, 180, 102, 0.12);
  color: var(--warning);
}

.hint--small {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* График */
.chart-frame {
  position: relative;
  height: min(42vh, 400px);
  min-height: 280px;
  border-radius: calc(var(--radius) + 1px);
  border: 1px solid var(--border);
  background: radial-gradient(ellipse at 50% 0%, rgba(182, 197, 106, 0.08), transparent 55%), var(--bg-elevated);
  padding: 0.6rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.chart-frame canvas {
  display: block;
  max-width: 100%;
}

/* Сегменты модели */
.sim-intro {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.segmented {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}

@media (min-width: 640px) {
  .segmented {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.seg-item {
  position: relative;
  flex: 1;
  min-width: 140px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 0.65rem 0.75rem;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.seg-item:hover {
  border-color: rgba(182, 197, 106, 0.35);
}

.seg-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.seg-item:focus-within {
  outline: 2px solid rgba(182, 197, 106, 0.5);
  outline-offset: 2px;
}

.seg-item:has(input:checked) {
  border-color: rgba(182, 197, 106, 0.55);
  background: rgba(182, 197, 106, 0.15);
  box-shadow: 0 0 0 1px rgba(182, 197, 106, 0.25);
}

.seg-item__text {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.seg-item__sub {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Слайдер */
.slider-control {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: opacity 0.2s;
}

.slider-control.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.slider-control__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.slider-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.slider-control input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  appearance: none;
  background: rgba(170, 186, 150, 0.3);
  accent-color: var(--accent);
}

.slider-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #d4e07f, #8ea35a);
  border: 2px solid #111710;
  box-shadow: 0 2px 8px rgba(182, 197, 106, 0.4);
  cursor: pointer;
}

.slider-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #d4e07f, #8ea35a);
  border: 2px solid #111710;
  cursor: pointer;
}

/* Подвал */
.app-footer {
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  padding-top: clamp(0.85rem, 2vw, 1.15rem);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.app-footer .dot {
  opacity: 0.4;
}

/* Учебный режим */
.toggle-edu {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toggle-edu input {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
}

.edu-panel {
  margin-bottom: clamp(1rem, 2vw, 1.35rem);
  padding: clamp(0.9rem, 2vw, 1.15rem) clamp(1rem, 2vw, 1.25rem);
  border-radius: var(--radius);
  border: 1px solid rgba(182, 197, 106, 0.35);
  background: rgba(182, 197, 106, 0.07);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.edu-panel__title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--accent-strong);
}

.edu-steps {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.edu-steps li {
  margin-bottom: 0.35rem;
}

.edu-hint {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.edu-hint--footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(170, 186, 150, 0.2);
}

.edu-wizard-head {
  margin-bottom: 0.75rem;
}

.edu-wizard-lead {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.edu-scenario {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.edu-scenario__label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-right: 0.25rem;
}

.edu-scenario__btn {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.edu-scenario__btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.edu-scenario__btn.is-active {
  border-color: rgba(182, 197, 106, 0.55);
  color: var(--accent-strong);
  background: rgba(182, 197, 106, 0.16);
}

.edu-wizard-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.edu-wizard-step {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(22, 31, 23, 0.65);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.edu-wizard-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(170, 186, 150, 0.18);
  color: var(--text-muted);
}

.edu-wizard-step.is-done {
  border-color: rgba(151, 195, 110, 0.45);
  color: var(--text-muted);
}

.edu-wizard-step.is-done .edu-wizard-step__num {
  background: rgba(151, 195, 110, 0.24);
  color: #d2e8bd;
}

.edu-wizard-step.is-current {
  border-color: rgba(182, 197, 106, 0.55);
  box-shadow: 0 0 0 1px rgba(182, 197, 106, 0.25);
  color: var(--text);
}

.edu-wizard-step.is-current .edu-wizard-step__num {
  background: rgba(182, 197, 106, 0.28);
  color: var(--accent-strong);
}

.edu-wizard-detail {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.edu-wizard-detail p {
  margin: 0;
}

.edu-wizard-ack {
  margin: 0 0 0.65rem;
}

.edu-wizard-ack__note {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.edu-example {
  margin-top: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(22, 31, 23, 0.65);
}

.edu-example__summary {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}

.edu-example__summary::-webkit-details-marker {
  display: none;
}

.edu-example__body {
  padding: 0 0.75rem 0.75rem;
}

.edu-example__hint {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.edu-example__pre {
  margin: 0 0 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-muted);
  max-height: 220px;
  overflow: auto;
}

/* Метрики моделей */
.metric--wide {
  grid-column: span 2;
}

@media (max-width: 520px) {
  .metric--wide {
    grid-column: span 1;
  }
}

.metric-subgrid {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.metrics-heading {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(170, 186, 150, 0.12);
  min-width: 0;
}

.metric-row .mono {
  flex-shrink: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-row .accent {
  color: var(--accent);
}

.metric-row--k {
  font-weight: 500;
  color: var(--text);
}

.card-head--wrap {
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

@media (max-width: 640px) {
  .card-head--wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-head--wrap .chk-compare {
    width: 100%;
    justify-content: flex-start;
  }
}

.chk-compare {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  min-width: 0;
  flex-shrink: 1;
}

.chk-compare input {
  accent-color: var(--accent);
}

.chart-hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.chart-hint--inline {
  margin: 0 0 0.5rem;
  line-height: 1.35;
}

.chart-frame--tall {
  min-height: 320px;
  height: min(48vh, 440px);
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.85rem, 2vw, 1.15rem);
  width: 100%;
  min-width: 0;
}

@media (min-width: 700px) {
  .chart-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.chart-frame--half {
  height: 260px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.chart-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.chart-frame--half canvas {
  flex: 1;
  min-height: 0;
}

.chart-frame--residual {
  height: 240px;
  min-height: 200px;
}

.residual-hint {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.residual-hint--ok {
  color: var(--success);
}

.residual-hint--warn {
  color: var(--warning);
}

/* Предупреждения UX */
.ux-warnings:empty {
  display: none;
}

.ux-warnings:not(:empty) {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  color: var(--warning);
  border: 1px solid rgba(217, 180, 102, 0.5);
  border-radius: var(--radius-sm);
  background: rgba(217, 180, 102, 0.1);
}

td input.inp-t.input-invalid,
td input.inp-d.input-invalid,
td input.inp-x.input-invalid,
td input.inp-y.input-invalid {
  border-color: var(--danger) !important;
  background: rgba(248, 113, 113, 0.08) !important;
}

tbody tr.row-outlier {
  background: rgba(248, 113, 113, 0.18) !important;
}

tbody tr.row-outlier td {
  background: transparent !important;
}

.outlier-banner {
  margin: 0 0 0.65rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.1);
}

.outlier-banner:empty,
.outlier-banner[hidden] {
  display: none !important;
}

.toolbar--files {
  margin-bottom: 0.5rem;
}

.diagnostics-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.diagnostics-strip:empty,
.diagnostics-strip[hidden] {
  display: none !important;
}

.diag-badge {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 6px;
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.diag-badge--warn {
  color: var(--warning);
  border-color: rgba(217, 180, 102, 0.55);
  background: rgba(217, 180, 102, 0.15);
}

.diag-badge--danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
}

.metric__label--tip {
  cursor: help;
  border-bottom: 1px dotted rgba(170, 186, 150, 0.45);
}

/* Подсветка подсказок (title) в учебном режиме */
body.edu-tooltips-active .metric__label--tip,
body.edu-tooltips-active .metrics-heading.metric__label--tip {
  color: var(--accent-strong);
}

/* Отчёт: вывод */
.report-actions {
  margin-top: 1rem;
}

.btn-report {
  border-color: rgba(182, 197, 106, 0.5);
  color: var(--accent-strong);
}

.report-block {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.report-block__title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--accent-strong);
}

.report-block__body.prose {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.report-block__body.prose p {
  margin: 0 0 0.65rem;
}

.report-block__body.prose p:last-child {
  margin-bottom: 0;
}

/* PDF export host (off-screen) */
.pdf-export-host {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 820px;
  padding: 24px;
  background: #ffffff;
  color: #0f172a;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.pdf-export-host h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.pdf-export-host h2 {
  font-size: 15px;
  margin: 16px 0 8px;
}

.pdf-export-host table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12px;
}

.pdf-export-host th,
.pdf-export-host td {
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
  text-align: left;
}

.pdf-export-host .chart-cap {
  max-width: 100%;
  margin: 8px 0;
}

/* Широкие и очень широкие экраны: комфортные поля и предел ширины контента */
@media (min-width: 1280px) {
  :root {
    --pad-inline: clamp(1.35rem, 3.2vw, 2.85rem);
  }
}

@media (min-width: 1600px) {
  :root {
    --content-max: 1380px;
    --pad-inline: clamp(1.5rem, 4vw, 3.25rem);
    --layout-gap: 2.25rem;
  }
}

/* Вкладки режима + раскрывающееся моделирование */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
  width: 100%;
  max-width: 100%;
}

.mode-tab {
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.25;
  min-height: 2.85rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #1b241b 0%, #171f17 100%);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex: 1 1 auto;
  min-width: min(100%, 8.5rem);
  text-align: center;
}

.mode-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.mode-tab.is-active {
  border-color: var(--border-strong);
  color: var(--accent);
  background: linear-gradient(180deg, rgba(182, 197, 106, 0.3) 0%, rgba(182, 197, 106, 0.14) 100%);
}

@media (max-width: 520px) {
  .mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .mode-tab {
    min-width: 0;
    width: 100%;
  }
}

/* Методический блок (лабораторная работа) */
.methodology-block {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.methodology-block__summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  list-style: none;
}

.methodology-block__summary::-webkit-details-marker {
  display: none;
}

.methodology-block__body {
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.methodology-block__body p {
  margin: 0 0 0.65rem;
}

.methodology-block__body p:last-child {
  margin-bottom: 0;
}

.sim-details {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.25rem;
  border: none;
}

.sim-details.surface-card {
  padding: 0;
  overflow: hidden;
}

.sim-details__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.sim-details__summary::-webkit-details-marker {
  display: none;
}

.sim-details__title {
  font-size: 1.05rem;
}

.sim-details__hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-dim);
}

.sim-details[open] .sim-details__hint {
  opacity: 0.75;
}

.sim-details__body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.slider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

