/* Нейросеть изнутри — лабораторный журнал на чернильно-синем: холодный и тёплый классы, тонкие линии. */
:root {
  --bg: #0b1322;
  --bg2: #0f1a2d;
  --line: rgba(160, 190, 230, 0.14);
  --line2: rgba(160, 190, 230, 0.26);
  --ink: #e7edf6;
  --dim: #97a8c0;
  --cool: #4ea6ff;
  --warm: #ff8b4f;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --serif: "IBM Plex Serif", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  background: radial-gradient(1200px 700px at 30% 20%, #122039 0%, var(--bg) 60%);
  color: var(--ink);
  font: 400 14.5px/1.45 var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; gap: 24px; padding: 18px 24px 14px; }
.title h1 { margin: 0; font: 600 24px/1.1 var(--sans); letter-spacing: -0.01em; }
.title p { margin: 3px 0 0; font-size: 14px; color: var(--dim); }
.datasets { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.ds {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 6px;
  border: 1px solid var(--line2);
  border-radius: 19px;
  font-size: 13.5px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.ds canvas { width: 26px; height: 26px; border-radius: 50%; }
.ds:hover { background: rgba(160, 190, 230, 0.07); }
.ds[aria-checked="true"] { border-color: var(--ink); background: rgba(160, 190, 230, 0.1); }
.transport { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.tb { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line2); display: grid; place-items: center; transition: background 0.2s var(--ease); }
.tb svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tb:hover { background: rgba(160, 190, 230, 0.1); }
.tb.main { width: 46px; height: 46px; background: var(--ink); border-color: var(--ink); }
.tb.main svg { fill: var(--bg); stroke: var(--bg); }
.tb.main .i-pause { display: none; }
.tb.main.on .i-pause { display: block; }
.tb.main.on .i-play { display: none; }
.speed { display: flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; margin-left: 4px; }
.speed button { height: 34px; padding: 0 10px; font: 500 13px/1 var(--mono); color: var(--dim); }
.speed button[aria-checked="true"] { background: rgba(160, 190, 230, 0.16); color: var(--ink); }

/* ---------- сцены ---------- */
.stages { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 292px; gap: 18px; padding: 0 24px 12px; min-height: 0; }
.stage { position: relative; margin: 0; display: flex; flex-direction: column; min-height: 0; }
.stage figcaption { display: flex; align-items: baseline; gap: 10px; padding: 2px 2px 8px; flex-wrap: wrap; }
.stage figcaption b { font-weight: 600; font-size: 15px; }
.stage figcaption span { font-size: 13.5px; color: var(--dim); }
.stage canvas { flex: 1; width: 100%; min-height: 0; display: block; }
#inCv { cursor: crosshair; }
.readout {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font: 400 12.5px/1.4 var(--mono);
  color: var(--ink);
  background: rgba(11, 19, 34, 0.82);
  border: 1px solid var(--line2);
  border-radius: 6px;
  padding: 6px 9px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.readout.on { opacity: 1; }

.side { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.side > * { flex-shrink: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stats div { background: var(--bg2); padding: 9px 10px; }
.stats span { display: block; font-size: 12.5px; color: var(--dim); }
.stats b { display: block; margin-top: 2px; font: 500 18px/1.1 var(--mono); }
#lossCv { width: 100%; height: 86px; display: block; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); }
.legend { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dim); margin-top: -4px; }
.legend i { width: 16px; height: 0; border-top: 2px solid var(--ink); display: inline-block; }
.legend i.l-test { border-top-style: dashed; border-top-color: var(--dim); margin-left: 8px; }
.ctl { display: grid; gap: 5px; font-size: 13.5px; }
.ctl > span:first-child { display: flex; justify-content: space-between; color: var(--dim); }
.ctl output { font: 500 12.5px/1 var(--mono); color: var(--ink); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.seg button { height: 34px; font: 500 13px/1 var(--mono); color: var(--dim); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: rgba(160, 190, 230, 0.16); color: var(--ink); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; --p: 50%; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--ink) 0 var(--p), var(--line2) var(--p) 100%); }
input[type="range"]::-moz-range-track { height: 3px; background: var(--line2); }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -6px; border-radius: 50%; background: var(--ink); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--line2); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid var(--bg); }
.note { margin: 0; font-size: 13px; color: var(--dim); line-height: 1.45; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg.two button { font: 500 13px/1 var(--sans); display: flex; align-items: center; justify-content: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.cool { background: var(--cool); }
.dot.warm { background: var(--warm); }

/* ---------- архитектура ---------- */
.net { border-top: 1px solid var(--line); padding: 10px 24px 16px; background: linear-gradient(180deg, rgba(15, 26, 45, 0.6), rgba(11, 19, 34, 0.9)); }
.net-head { display: flex; align-items: center; gap: 14px; }
.net-head b { font-weight: 600; font-size: 15px; }
.net-head span { font: 400 13px/1 var(--mono); color: var(--dim); }
.net-actions { margin-left: auto; display: flex; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 16px; font-size: 13.5px; transition: background 0.2s var(--ease); }
.chip:hover { background: rgba(160, 190, 230, 0.1); }
.chip:disabled { opacity: 0.35; cursor: default; }
.net-body { position: relative; height: 252px; margin-top: 4px; }
#netCv { position: absolute; inset: 0; width: 100%; height: 100%; }
.lc { position: absolute; display: flex; align-items: center; gap: 2px; transform: translateX(-50%); font: 500 12.5px/1 var(--mono); color: var(--dim); }
.lc button { width: 26px; height: 26px; border-radius: 13px; border: 1px solid var(--line2); color: var(--ink); font: 500 15px/1 var(--mono); }
.lc button:hover { background: rgba(160, 190, 230, 0.12); }
.lc b { min-width: 18px; text-align: center; color: var(--ink); font-weight: 500; }
.tip {
  position: absolute;
  pointer-events: none;
  font: 400 12.5px/1.4 var(--mono);
  background: rgba(11, 19, 34, 0.94);
  border: 1px solid var(--line2);
  border-radius: 6px;
  padding: 6px 9px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}

@media (max-width: 1100px) and (min-width: 821px) {
  .stages { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 250px; }
  .ds span { display: none; }
  .ds { padding: 0 6px; }
}
@media (max-width: 820px) {
  body { display: block; height: auto; overflow-x: hidden; overflow-y: auto; }
  .top { flex-wrap: wrap; gap: 12px; padding: 14px 14px 10px; }
  .datasets { order: 3; width: 100%; margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ds { flex: none; }
  .transport { margin-left: auto; }
  .speed { display: none; }
  .stages { display: flex; flex-direction: column; padding: 0 14px 12px; }
  .stage canvas { flex: none; aspect-ratio: 1; height: auto; }
  .side { overflow: visible; }
  .net { padding: 10px 14px 16px; }
  .net-body { height: 236px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
  #netCv { width: 640px; }
  .net-head { flex-wrap: wrap; row-gap: 8px; }
}
