/* ============================================================
   Общий "чехол" для интерактивных тренажёров курса.
   Подключается из images/<Раздел>/<файл>.html как ../_trainer/trainer.css
   Переменные продублированы из assets/style.css, чтобы тренажёры
   оставались самодостаточными standalone-страницами.
   ============================================================ */
:root {
  --bg: #070c16;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #0e1c33 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 30%, #0b1a2a 0%, transparent 55%);
  --panel: #0e1728;
  --panel-2: #121e33;
  --border: #1d2b45;
  --text: #dbe4f0;
  --muted: #8b9bb4;
  --accent: #38bdf8;
  --accent-2: #4ade80;
  --amber: #fbbf24;
  --grid-line: rgba(56, 189, 248, .05);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #eef3f9;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #dcebfa 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 30%, #e3f0ea 0%, transparent 55%);
  --panel: #ffffff;
  --panel-2: #f4f8fd;
  --border: #d7e1ee;
  --text: #182338;
  --muted: #5b6b84;
  --accent: #0369a1;
  --accent-2: #15803d;
  --amber: #b45309;
  --grid-line: rgba(3, 105, 161, .06);
  --shadow: 0 8px 24px rgba(23, 43, 77, .10);
  color-scheme: light;
}

html, body {
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 56px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 56px 100%,
    var(--bg-grad),
    var(--bg) !important;
  color: var(--text) !important;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif !important;
  min-height: 100vh;
  margin: 0;
}

/* ---------- Верхняя панель тренажёра ---------- */
.tr-bar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  font-family: "Segoe UI", system-ui, sans-serif;
}
.tr-brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--text) !important; font-weight: 700; font-size: 15px;
  text-decoration: none !important;
}
.tr-brand:hover { color: var(--accent) !important; }
.tr-badge {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
  color: var(--accent-2) !important;
}
.tr-theme-btn {
  cursor: pointer; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); border-radius: 8px; width: 32px; height: 32px; font-size: 15px;
  flex-shrink: 0;
}
.tr-theme-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Тело тренажёра ---------- */
.tr-shell {
  max-width: 1100px; margin: 0 auto; padding: 28px 20px 56px;
}
.tr-shell h1, .tr-shell h2, .tr-shell h3 { color: var(--text); }
.tr-shell p, .tr-shell label, .tr-shell figcaption, .tr-shell span { color: var(--text); }

/* Универсальная переокраска стандартных контролов */
.tr-shell input, .tr-shell select, .tr-shell button {
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
.tr-shell input[type="file"] { padding: 6px; }
.tr-shell input[type="color"] {
  padding: 2px; width: 44px; height: 32px; cursor: pointer;
}
.tr-shell input[type="range"] { padding: 0; accent-color: var(--accent); }
.tr-shell input[type="number"] { text-align: center; }
.tr-shell button {
  cursor: pointer; font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.tr-shell button:hover { border-color: var(--accent); color: var(--accent); }
.tr-shell select { cursor: pointer; }

.tr-shell canvas, .tr-shell video {
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tr-shell .controls,
.tr-shell .matrix-input,
.tr-shell .matrix-container {
  background: transparent !important;
}

.tr-hint {
  max-width: 70ch; margin: 0 auto 20px; text-align: center;
  color: var(--muted); font-size: 15px; line-height: 1.6;
}
