:root {
  --bg: #f4f6f9; --card: #fff; --line: #e3e7ee; --text: #1f2328; --muted: #6b7280;
  --ok: #1a7f37; --ok-bg: #e7f5ec; --warn: #b35c00; --warn-bg: #fff4e5; --bad: #b42318; --bad-bg: #fde8e6;
  --idle: #4b5563; --idle-bg: #eceff3; --accent: #2b59c3; --accent-bg: #e8eefb;
  --soft: #f6f8fa; --code-bg: #eef1f5; --bar-bg: #e9edf2; --shadow: rgba(0,0,0,.08); --dark: #0f172a; --dark-text: #e5e7eb; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
a, a:visited { color: var(--accent); }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, "Segoe UI", system-ui, sans-serif; }
header { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand .sub { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 13px; }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav button { border: 0; background: none; padding: 6px 9px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--muted); }
nav button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
nav button:hover { color: var(--text); }
.status { margin-left: auto; color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
@media (max-width: 1250px) { .brand .sub { display: none; } }
#net { width: 8px; height: 8px; border-radius: 50%; background: #c9ced6; display: inline-block; }
#net.ok { background: var(--ok); } #net.bad { background: var(--bad); }
main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
.tab { display: none; } .tab.on { display: block; }
h2 { font-size: 16px; margin: 22px 0 10px; } h2:first-child { margin-top: 4px; }
h3 { font-size: 14px; margin: 14px 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cards.stats { margin: 6px 0 14px; } .cards.stats .v { font-size: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .k { color: var(--muted); font-size: 12px; } .card .v { font-size: 22px; font-weight: 600; margin-top: 2px; } .card .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
code, .mono { font-family: var(--mono); font-size: 12px; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--dark); color: var(--dark-text); padding: 10px 12px; border-radius: 8px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.4; margin: 6px 0; white-space: pre-wrap; word-break: break-word; max-height: 420px; }
pre.light { background: var(--soft); color: var(--text); border: 1px solid var(--line); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.accent { background: var(--accent-bg); color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 12px; }
.bar { height: 8px; background: var(--bar-bg); border-radius: 4px; overflow: hidden; min-width: 90px; }
.bar i { display: block; height: 100%; background: var(--ok); } .bar i.warn { background: #e8a33d; } .bar i.bad { background: var(--bad); }
.alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.alert { padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); border: 1px solid #f3d9b1; cursor: pointer; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: #f1b7b2; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.group { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.group .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.group .head b { font-size: 15px; }
.group .task { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.map { overflow-x: auto; }
.map svg { display: block; }
.node { cursor: pointer; }
.node rect { stroke-width: 1.5; }
.node text { font-size: 12px; fill: var(--text); }
.node text.role { font-size: 11px; fill: var(--muted); }
.edge { stroke: #a3adbb; stroke-width: 1.5; fill: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 6px 0 2px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 7px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 12px; color: var(--accent); }
.btn:hover { background: var(--accent-bg); }
input.filter { border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font: inherit; width: 320px; max-width: 100%; }
.clip { max-height: 7.2em; overflow: hidden; position: relative; }
.clip.open { max-height: none; }
details > summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; }
details > summary::before { content: "▸ "; } details[open] > summary::before { content: "▾ "; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 20; overflow: auto; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 12px; padding: 18px 20px; width: min(1000px, 100%); position: relative; }
.modal .close { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 14px; }
.chart .col i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 1px; }
.chart .col span { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.empty { color: var(--muted); padding: 14px; text-align: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } main { padding: 12px; } header { padding: 8px 12px; } }
.answer { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.prompt { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--soft); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 8px; padding: 10px 12px; }
.clip:not(.open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.4em; background: linear-gradient(to bottom, transparent, var(--soft)); pointer-events: none; }
.err { color: var(--bad); }

/* --- действия, формы, терминал --- */
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #244aa3; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 2px 8px; font-size: 11px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.user-menu { position: relative; cursor: pointer; color: var(--text); font-weight: 600; }
.user-menu .dd { display: none; position: absolute; right: 0; top: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-width: 180px; box-shadow: 0 6px 20px var(--shadow); z-index: 30; }
.user-menu.open .dd { display: block; }
.user-menu .dd a { display: block; padding: 6px 10px; color: var(--text); text-decoration: none; font-weight: 400; border-radius: 6px; font-size: 13px; }
.user-menu .dd a:hover { background: var(--accent-bg); }
form.f label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
form.f input[type=text], form.f input[type=password], form.f select, form.f textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
form.f textarea { min-height: 140px; font-family: inherit; resize: vertical; }
form.f .inline { display: flex; gap: 10px; flex-wrap: wrap; }
form.f .inline > * { flex: 1; min-width: 140px; }
.radio-row label, .check-row label { display: inline-flex; align-items: center; gap: 4px; margin: 2px 10px 2px 0; font-size: 13px; color: var(--text); }
.acc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.acc-grid label { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; cursor: pointer; margin: 0; }
.acc-grid label.busy { background: var(--idle-bg); color: var(--muted); }
.acc-grid label.limit { background: var(--bad-bg); color: var(--bad); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: var(--dark-text); padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 40; max-width: 90vw; }
.toast.bad { background: var(--bad); }
.job-out { background: var(--dark); color: var(--dark-text); padding: 10px 12px; border-radius: 8px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 50vh; overflow: auto; }
.diff { font-family: var(--mono); font-size: 12px; white-space: pre; overflow: auto; max-height: 70vh; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 8px 0; }
.diff div { padding: 0 10px; min-height: 1.3em; }
.diff .add { background: #e6ffec; color: #116329; } .diff .del { background: #ffebe9; color: #82071e; } .diff .hunk { background: #ddf4ff; color: #0550ae; } .diff .file { background: #eaeef2; font-weight: 600; }
.test-ok { color: var(--ok); } .test-bad { color: var(--bad); }
#tab-terminal { height: calc(100vh - 80px); }
#tab-terminal iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 10px; background: #000; }
.keys { display: flex; gap: 4px; flex-wrap: wrap; }
.keys .btn { font-family: var(--mono); }
.live { font-size: 11px; color: var(--ok); }
.prompt-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.prompt-card .t { font-weight: 600; }
.linechart { width: 100%; height: 160px; }
.linechart path { fill: none; stroke-width: 1.5; }
.linechart text { font-size: 10px; fill: var(--muted); }
.linechart line { stroke: var(--line); }
.tabs2 { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs2 .btn.on { background: var(--accent-bg); }
@media (max-width: 700px) { .acc-grid { grid-template-columns: repeat(2, 1fr); } }

.term-frame { width: 100%; height: 62vh; border: 1px solid var(--line); border-radius: 8px; background: #000; }
.modal-box.wide { width: min(1300px, 100%); }

.group.ports { border-left: 3px solid #6f42c1; }
.feed { max-height: 50vh; overflow: auto; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.feed .ev { padding: 4px 0; border-bottom: 1px dashed var(--line); white-space: pre-wrap; word-break: break-word; }
.feed .ev:last-child { border-bottom: 0; }
.feed .ev.tool { color: var(--accent); font-size: 12px; }
.feed .ev.res { color: var(--muted); font-size: 12px; } .feed .ev.res.bad { color: var(--bad); }
.screen-wrap { position: relative; }
pre.screen { max-height: 62vh; min-height: 300px; cursor: text; outline: none; border: 2px solid transparent; margin: 0; }
pre.screen:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.screen-hint { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }

/* --- мобильные устройства --- */
.panel { overflow-x: auto; }
.keys-mobile { display: none; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
@media (pointer: coarse) { .keys-mobile { display: flex; } .screen-hint { display: none; } }
@media (max-width: 900px) {
  header { gap: 8px; padding: 8px 10px; }
  .brand { font-size: 15px; }
  nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  nav::-webkit-scrollbar { display: none; }
  nav button { white-space: nowrap; padding: 6px 10px; }
  #clock { display: none; }
  .status { gap: 6px; }
  .modal { padding: 8px 6px; }
  .modal-box { padding: 14px 12px 16px; border-radius: 10px; }
  .modal .close { right: 6px; top: 2px; font-size: 26px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .card { padding: 10px 12px; } .card .v { font-size: 19px; }
  .groups { grid-template-columns: 1fr; }
  .btn.sm { padding: 6px 10px; font-size: 12px; }
  .btn { padding: 7px 12px; }
  table.wide { min-width: 640px; }
  td, th { padding: 6px 6px; }
  pre.screen { min-height: 200px; max-height: 45vh; font-size: 11px; }
  pre { font-size: 11px; }
  #tab-terminal { height: calc(100dvh - 130px); }
  input.filter { width: 100%; }
  .legend { gap: 8px; }
  .toast { bottom: 12px; left: 12px; right: 12px; transform: none; max-width: none; }
  .acc-grid { grid-template-columns: repeat(3, 1fr); }
  form.f .inline > * { min-width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 1px 0; } .kv div:nth-child(odd) { margin-top: 6px; }
  h2 { font-size: 15px; margin-top: 18px; }
}

/* тонкая сворачиваемая строка (список Unity projects на вкладке «Репозитории») */
.panel.thin { padding: 6px 12px; }
.panel.thin > details > summary { font-size: 13px; padding: 2px 0; }
table.thin { margin-top: 6px; font-size: 13px; }
table.thin td { padding: 4px 10px 4px 0; line-height: 1.4; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.thin td:first-child { color: var(--text); width: 1%; padding-right: 28px; }
.btn.grey { color: var(--muted); }
.btn.grey:hover { background: var(--idle-bg); }
table.thin td.acc { padding-left: 6px; }

/* Docs: документы, раскрываемые на странице */
details.doc > summary .doc-links { float: right; font-size: 12px; }
.doc-body { margin-top: 10px; }
.doc-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.md { font-size: 14px; line-height: 1.5; max-width: 1100px; }
.md h1 { font-size: 20px; margin: 16px 0 8px; } .md h2 { font-size: 17px; margin: 18px 0 6px; } .md h3 { font-size: 15px; margin: 14px 0 4px; }
.md p { margin: 6px 0; } .md ul, .md ol { margin: 6px 0 6px 22px; } .md li { margin: 2px 0; }
.md table { width: auto; margin: 8px 0; font-size: 13px; } .md th, .md td { padding: 4px 10px; border: 1px solid var(--line); }
.md pre { background: var(--soft); color: var(--text); border: 1px solid var(--line); max-height: none; }
.md code { background: var(--code-bg); padding: 1px 4px; border-radius: 4px; font-family: var(--mono); font-size: 12.5px; } .md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding: 2px 12px; color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md a { color: var(--accent); }

.done-groups { margin-top: 12px; }
.done-groups > summary { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.done-groups > summary:hover { border-color: var(--accent); color: var(--accent); }
.done-groups > summary::before { content: "▸"; color: var(--muted); font-size: 12px; } .done-groups[open] > summary::before { content: "▾"; }
.done-groups .groups, .done-groups > .panel { opacity: .85; }
.tlist .done-groups > summary { padding: 7px 10px; margin-bottom: 6px; }
/* Задачи: список слева, выбранная задача справа */
.tasks2 { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: start; }
.tlist { padding: 8px; position: sticky; top: 56px; max-height: calc(100vh - 80px); overflow: auto; }
.trow { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; column-gap: 6px; align-items: center; padding: 5px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.trow .sub { grid-column: 2 / 4; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.trow:hover { background: var(--accent-bg); } .trow.on { background: var(--accent-bg); } .trow.on .nm { font-weight: 600; color: var(--accent); }
.trow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); } .trow .dot.ok { background: var(--ok); } .trow .dot.warn { background: #e8a33d; }
.trow .nm { overflow: hidden; text-overflow: ellipsis; font-weight: 600; } .trow .st { text-align: right; }
.tdetail { max-width: 1100px; min-width: 0; }
.tlist .done-groups { margin-top: 8px; } .tlist .done-groups > summary { margin-bottom: 4px; }
@media (max-width: 900px) { .tasks2 { grid-template-columns: 1fr; } .tlist { position: static; max-height: 260px; } }
details.branches { margin-top: 8px; }
details.branches > summary { font-weight: 600; }

/* Viewer */
nav button[data-tab="viewer"] { background: var(--ok-bg); color: var(--ok); font-weight: 600; } nav button[data-tab="viewer"]:hover { background: #cfe9d8; color: var(--ok); }
nav button[data-tab="viewer"].on { background: var(--ok); color: #fff; }
.viewer { display: grid; grid-template-columns: 300px minmax(380px, 1fr) 380px; gap: 12px; align-items: start; }
.vside .panel { position: sticky; top: 8px; }
.vq { width: 100%; box-sizing: border-box; margin: 8px 0 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 13px; }
.vlist-items { max-height: calc(100vh - 290px); overflow: auto; }
.vgame { display: flex; align-items: baseline; gap: 6px; padding: 4px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.vgame:hover { background: var(--accent-bg); } .vgame.on { background: var(--ok-bg); }
.vgame .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; background: var(--idle); } .vgame .dot.ok { background: var(--ok); } .vgame .dot.warn { background: #e8a33d; }
.vgame .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; } .vgame .id { font: 11px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.vgame .st { margin-left: auto; font-size: 11px; color: var(--muted); flex: none; }
.vframe { width: 100%; height: 920px; border: 1px solid var(--line); border-radius: 10px; background: #15171c; }
.vcomposer .v-text, #v-text { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px; box-sizing: border-box; resize: vertical; }
.vrev { padding: 8px 0; border-bottom: 1px solid var(--line); } .vrev.fixed { opacity: .75; }
.vrev-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; } .vrev-act { margin-left: auto; display: flex; gap: 4px; }
.vrev-body { margin-top: 4px; }
.vline { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.vline::before, .vline::after { content: ""; flex: 1; border-top: 2px solid var(--line); }
.vgroup { margin-top: 6px; padding-left: 8px; border-left: 3px solid var(--line); }
.vcomposer.edit { margin-top: 6px; padding: 8px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-bg); }
.vdrop { margin-top: 6px; padding: 8px; border: 1px dashed var(--line); border-radius: 8px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .vdrop.over { border-color: var(--ok); background: var(--ok-bg); }
.vshot { position: relative; margin-top: 8px; } .vshot img { display: block; max-width: 100%; max-height: 260px; border: 1px solid var(--line); border-radius: 8px; background: #000; }
.vshot .x { position: absolute; top: 6px; right: 6px; border: 0; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; cursor: pointer; padding: 2px 7px; }
.vshot .vcap { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 12px; }
.vrimg { margin: 6px 0; } .vrimg img { display: block; max-width: 100%; max-height: 220px; border: 1px solid var(--line); border-radius: 8px; } .vrimg figcaption { font-size: 12px; color: var(--text); margin-top: 3px; }
@media (max-width: 1250px) { .viewer { grid-template-columns: 300px 1fr; } .vside { grid-column: 1 / -1; } .vside .panel { position: static; } }
@media (max-width: 900px) { .viewer { grid-template-columns: 1fr; } .vframe { height: 700px; } .vlist-items { max-height: 320px; } }

/* --- тёмная тема: по системной настройке (без выбора) или по выбору в меню пользователя (html[data-theme]) --- */
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { color-scheme: dark;
  --bg: #0f1115; --card: #171a21; --line: #2a2f3a; --text: #e6e8ec; --muted: #9aa3b2;
  --ok: #4cc27a; --ok-bg: #15301f; --warn: #f0a24b; --warn-bg: #332410; --bad: #f27474; --bad-bg: #3a1a1a;
  --idle: #a3abb8; --idle-bg: #232833; --accent: #7fa6ff; --accent-bg: #1d2a4a;
  --soft: #1c2029; --code-bg: #242a35; --bar-bg: #242a35; --shadow: rgba(0,0,0,.5); --dark: #05070b; --dark-text: #d6dae2; } }
html[data-theme="dark"] { color-scheme: dark;
  --bg: #0f1115; --card: #171a21; --line: #2a2f3a; --text: #e6e8ec; --muted: #9aa3b2;
  --ok: #4cc27a; --ok-bg: #15301f; --warn: #f0a24b; --warn-bg: #332410; --bad: #f27474; --bad-bg: #3a1a1a;
  --idle: #a3abb8; --idle-bg: #232833; --accent: #7fa6ff; --accent-bg: #1d2a4a;
  --soft: #1c2029; --code-bg: #242a35; --bar-bg: #242a35; --shadow: rgba(0,0,0,.5); --dark: #05070b; --dark-text: #d6dae2; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .alert { border-color: #4a3a1a; } html:not([data-theme="light"]) .alert.bad { border-color: #5a2a2a; }
  html:not([data-theme="light"]) .diff .add { background: #12301b; color: #7ee2a0; } html:not([data-theme="light"]) .diff .del { background: #3a1818; color: #f29b9b; } html:not([data-theme="light"]) .diff .hunk { background: #14263a; color: #8ec3ff; } html:not([data-theme="light"]) .diff .file { background: #242a35; }
  html:not([data-theme="light"]) nav button[data-tab="viewer"]:hover { background: #1d4028; } html:not([data-theme="light"]) .btn.primary { color: #fff; } html:not([data-theme="light"]) nav button[data-tab="viewer"].on { color: #0b1a10; }
  html:not([data-theme="light"]) input, html:not([data-theme="light"]) textarea, html:not([data-theme="light"]) select { background: var(--soft); color: var(--text); border-color: var(--line); } }
html[data-theme="dark"] .alert { border-color: #4a3a1a; } html[data-theme="dark"] .alert.bad { border-color: #5a2a2a; }
html[data-theme="dark"] .diff .add { background: #12301b; color: #7ee2a0; } html[data-theme="dark"] .diff .del { background: #3a1818; color: #f29b9b; } html[data-theme="dark"] .diff .hunk { background: #14263a; color: #8ec3ff; } html[data-theme="dark"] .diff .file { background: #242a35; }
html[data-theme="dark"] nav button[data-tab="viewer"]:hover { background: #1d4028; } html[data-theme="dark"] .btn.primary { color: #fff; } html[data-theme="dark"] nav button[data-tab="viewer"].on { color: #0b1a10; }
html[data-theme="dark"] input, html[data-theme="dark"] textarea, html[data-theme="dark"] select { background: var(--soft); color: var(--text); border-color: var(--line); }

/* Viewer: экран загрузки поверх кадра до ready (иконка тайтла из сборки) */
.vstage { position: relative; }
.vload { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #15171c; color: #e6e7ea; border-radius: 10px; z-index: 2; text-align: center; padding: 16px; }
.vload img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.vload b { font-size: 16px; }
.vload .bar { width: 220px; height: 8px; background: rgba(255,255,255,.12); } .vload .bar i { transition: width .6s ease; }
.vload.err { color: #ff9a8a; } .vload.err .bar i { background: var(--bad); }
#v-hostlog details { margin-top: 2px; } #v-hostlog summary { cursor: pointer; }
@keyframes vspin { to { transform: rotate(360deg); } }

.dot.wait { background: #5b8def; }

/* Viewer: тег новой игры (до первого открытия пользователем) */
.tag-new { font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: var(--ok); border-radius: 4px; padding: 3px 4px 2px; flex: none; align-self: center; }

/* Viewer v3: один блок на всю ширину и высоту окна — список у левого края · дебаг · сцена · ревью */
main:has(.tab.on > .vsys) { max-width: none; padding: 0; }
.vsys { display: grid; grid-template-columns: 260px 320px minmax(440px, 1fr) 360px; grid-template-areas: "list debug stage side"; height: calc(100vh - var(--vtop, 60px)); background: var(--card); border-bottom: 1px solid var(--line); }
.vpane { min-height: 0; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); overflow: hidden; }
.vpane:last-child { border-right: 0; }
.vlist { grid-area: list; } .vdbg { grid-area: debug; } .vmain { grid-area: stage; background: var(--soft); } .vside { grid-area: side; }
.vpane-h { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; background: var(--card); flex: none; min-height: 42px; box-sizing: border-box; }
.vpane-h b { font-size: 14px; } .vpane-h .sp { margin-left: auto; } .vpane-h .vname { font-size: 15px; }
.vpane-s { padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.vpane-f { padding: 8px 12px; border-top: 1px solid var(--line); flex: none; }
.vpane-b { flex: 1 1 auto; overflow: auto; padding: 12px; }
.vpane-empty { padding: 28px 12px; text-align: center; }
.vq { width: 100%; box-sizing: border-box; margin: 0; }
.vlist-items { flex: 1 1 auto; overflow: auto; padding: 6px; max-height: none; }
.vgame { padding: 5px 8px; } .vgame .nm { flex: 1 1 auto; } .vgame .id { flex: 0 1 auto; }
.vdebug { flex: 1 1 auto; overflow: auto; padding: 8px 12px 16px; font-size: 12.5px; width: auto; max-height: none; }
.vsec { border-top: 1px solid var(--line); padding: 6px 0; } .vsec:first-child { border-top: 0; padding-top: 0; }
.vsec > summary { cursor: pointer; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); list-style: none; display: flex; gap: 6px; align-items: baseline; user-select: none; }
.vsec > summary::-webkit-details-marker { display: none; } .vsec > summary::before { content: "▸"; font-size: 10px; } .vsec[open] > summary::before { content: "▾"; }
.vsec > summary .muted { font-weight: 500; text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vsec-b { padding-top: 6px; }
.vdebug .row { display: flex; gap: 4px 6px; align-items: center; margin: 4px 0; flex-wrap: wrap; }
.vdebug input[type=number], .vdebug input[type=text] { height: 24px; box-sizing: border-box; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 12.5px; background: var(--card); color: inherit; min-width: 0; }
.vdebug .n3 { width: 76px; } .vdebug .n2 { width: 56px; } .vdebug .grow { flex: 1 1 80px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 11.5px; line-height: 22px; }
.vdebug .btn.xs.on { background: var(--accent-bg); color: var(--accent); }
.vdebug .seg { display: inline-flex; } .vdebug .seg .btn { border-radius: 0; margin-left: -1px; } .vdebug .seg .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; } .vdebug .seg .btn:last-child { border-radius: 0 6px 6px 0; }
.vres { display: grid; grid-template-columns: minmax(48px, 1fr) 84px auto; gap: 4px 6px; align-items: center; margin: 4px 0; }
.vres code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.vdebug.dirty #v-res-apply { background: var(--accent); color: #fff; border-color: var(--accent); }
.vdebug textarea { width: 100%; box-sizing: border-box; min-height: 150px; font: 11.5px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: var(--card); color: inherit; }
.vsnaps > div { display: flex; gap: 6px; align-items: center; padding: 3px 0; border-top: 1px dashed var(--line); } .vsnaps b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .vsnaps .seg { margin-left: auto; flex: none; }
.vopts { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; } .vopts > label { color: var(--muted); white-space: nowrap; } .vopts label.chk { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.vstagewrap { flex: 1 1 auto; overflow: auto; padding: 12px; display: flex; flex-direction: column; align-items: center; }
.vbar { width: 100%; max-width: 392px; margin: 0 0 6px; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, monospace; box-sizing: border-box; }
.vstage { position: relative; width: 392px; max-width: 100%; flex: none; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px var(--shadow); background: #15171c; }
.vstage .vframe { width: 392px; max-width: 100%; height: 846px; display: block; box-sizing: border-box; border: 0; border-radius: 0; }
.vload { border-radius: 0; }
.vcount { margin-top: 8px; min-height: 16px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.vcount .chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 11.5px; color: var(--muted); } .vcount .chip.on { color: var(--text); } .vcount .chip.bad { color: var(--bad); border-color: var(--bad); }
.vstrip { width: 392px; max-width: 100%; box-sizing: border-box; display: flex; align-items: flex-start; gap: 10px; padding: 6px 10px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.vstrip .vstat { flex: 1 1 auto; min-width: 0; white-space: pre-wrap; word-break: break-word; } .vstrip .vstat details { margin-top: 2px; } .vstrip .vstat summary { cursor: pointer; }
.vstrip .vopen { flex: none; white-space: nowrap; text-decoration: none; }
.vmain.nodebug .vstage, .vmain.nodebug .vstage .vframe, .vmain.nodebug .vbar { width: 100%; max-width: none; }
.vmain.nodebug .vstage .vframe { height: 920px; }
.vside .panel { position: static; }
@media (max-width: 1500px) { .vsys { grid-template-columns: 230px 290px minmax(400px, 1fr) 300px; } }
@media (max-width: 1250px) { .vsys { grid-template-columns: 230px 290px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 34%); grid-template-areas: "list debug stage" "list debug side"; } .vside { border-right: 0; border-top: 1px solid var(--line); } }
@media (max-width: 1000px) { .vsys { height: auto; min-height: calc(100vh - var(--vtop, 60px)); grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "list stage" "list debug" "list side"; } .vpane { overflow: visible; } .vlist { position: sticky; top: var(--vtop, 60px); height: calc(100vh - var(--vtop, 60px)); overflow: hidden; } .vdbg { border-top: 1px solid var(--line); } .vstagewrap, .vdebug, .vpane-b { overflow: visible; } }
@media (max-width: 760px) { .vsys { grid-template-columns: minmax(0, 1fr); grid-template-areas: "list" "stage" "debug" "side"; } .vlist { position: static; height: auto; } .vlist-items { max-height: 40vh; } .vpane { border-right: 0; border-bottom: 1px solid var(--line); } }
.vhost .vstat { white-space: pre-wrap; word-break: break-word; } .vhost .vstat details { margin-top: 2px; } .vhost .vstat summary { cursor: pointer; }
.vhost .vcount { justify-content: flex-start; margin: 6px 0 2px; }
.vhead .vopen { text-decoration: none; padding: 0 7px; font-size: 13px; }
.vpane-h.vhead { flex-wrap: nowrap; gap: 8px; }
.vhead-l { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; white-space: nowrap; overflow: hidden; }
.vhead-l > * { flex: none; } .vhead-l .vhead-info { flex: 1 1 250px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vhead-r { flex: none; display: flex; align-items: center; gap: 4px; }
.vhead-r .btn.xs { padding: 0 7px; font-size: 13px; min-width: 28px; text-align: center; }
.tag-new.tag-upd { background: var(--accent); }

/* Производительность */
.pchart { position: relative; margin: 8px 0 4px; } .pchart svg { width: 100%; height: 260px; display: block; }
#pc-task svg { height: 220px; }
.pchart .pg { stroke: var(--line); stroke-width: 1; } .pchart .pt { fill: var(--muted); font-size: 11px; }
.pchart .pcur { stroke: var(--text); stroke-width: 1; opacity: .5; }
.ptip { position: absolute; top: 6px; min-width: 200px; max-width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; line-height: 1.45; box-shadow: 0 6px 18px var(--shadow); pointer-events: none; z-index: 3; }
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: baseline; }
.plegs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; } .pleg { white-space: nowrap; }
.ptasks .prow { cursor: pointer; } .ptasks .prow:hover { background: var(--accent-bg); } .ptasks .pprocs td { background: var(--soft); }
.seg { display: inline-flex; } .seg .btn { border-radius: 0; margin-left: -1px; } .seg .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; } .seg .btn:last-child { border-radius: 0 6px 6px 0; }
.seg .btn.on { background: var(--accent-bg); color: var(--accent); }
#tab-perf .cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 14px; }
#tab-perf .panel { margin-bottom: 14px; }
.group.ports .pcpu { margin: 6px 0 2px; } .group.ports .pcpu b { color: var(--text); }

/* подключение аккаунтов к пулу */
.pl-list { padding-left: 22px; margin: 6px 0; } .pl-list li { margin: 5px 0; } .pl-res > div { margin: 3px 0; }

/* Настройки */
.stable td { vertical-align: top; } .stable td:nth-child(2) { white-space: nowrap; } .stable td:nth-child(4) { word-break: break-word; }
.spend { color: #c88a00; white-space: normal; margin-top: 3px; } .snowrap { white-space: nowrap; }

/* Viewer: блоки списка игр 1–4 — только визуальное деление */
.vsep { display: flex; align-items: center; gap: 6px; margin: 8px 4px 3px; font: 10px var(--mono); color: var(--muted); line-height: 1; }
.vsep:first-child { margin-top: 2px; } .vsep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Viewer: «Начать» — исправление по комментариям */
.vfix { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.vfix-last { margin-top: 4px; padding: 0 2px; }

/* Viewer: QR игры */
.vqrbox { display: flex; justify-content: center; cursor: zoom-in; } .vqrbox svg { width: 100%; max-width: 220px; height: auto; background: #fff; border-radius: 6px; }
.qrbig { display: flex; justify-content: center; } .qrbig svg { width: min(360px, 80vw); height: auto; background: #fff; border-radius: 8px; }
.qrurl { word-break: break-all; padding: 6px 8px; background: var(--soft); border-radius: 6px; user-select: all; }

/* Viewer: кружки комментариев в списке игр */
.vgame .vrc { display: inline-flex; gap: 3px; flex: none; margin-left: 4px; align-self: center; }
.vgame .vrc i { font: 600 10px/16px var(--mono); font-style: normal; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; text-align: center; color: #fff; box-sizing: border-box; }
.vgame .vrc i.o { background: #e8a33d; } .vgame .vrc i.c { background: var(--ok); }

/* Viewer: итерации исправлений вместо id */
.vgame .vfixn { font: 600 11px var(--mono); color: var(--accent); flex: none; margin-left: auto; } .vgame .vfixn.z { opacity: .5; font-weight: 400; }

/* Флот */
.fev { font-size: 12px; line-height: 1.45; padding: 2px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; } .fev:last-child { border-bottom: 0; }
.fnh { padding: 6px 0; border-bottom: 1px solid var(--line); } .fnh:last-child { border-bottom: 0; }
.fun { display: flex; flex-wrap: wrap; gap: 8px; } .fstage { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.fbar { position: relative; min-width: 120px; height: 18px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.fbar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); opacity: .35; } .fbar.c i { background: #c2410c; }
.fbar span { position: relative; padding: 0 6px; font-size: 12px; line-height: 18px; }
.fcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 900px) { .fcols { grid-template-columns: 1fr; } }

/* переключатель сайтов панели (aurora / iris) в бренде */
.site-menu { position: relative; cursor: pointer; user-select: none; }
.site-menu .site-cur { border-radius: 6px; padding: 2px 6px; margin-left: -6px; } .site-menu:hover .site-cur, .site-menu.open .site-cur { background: var(--soft); }
.site-menu .dd { display: none; position: absolute; left: 0; top: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-width: 190px; box-shadow: 0 6px 18px var(--shadow); z-index: 20; }
.site-menu.open .dd { display: block; }
.site-menu .dd a { display: block; padding: 6px 10px; color: var(--text); text-decoration: none; font-weight: 600; border-radius: 6px; font-size: 14px; }
.site-menu .dd a:hover { background: var(--accent-bg); } .site-menu .dd a.cur { color: var(--accent); } .site-menu .dd a .muted { font-weight: 400; font-size: 12px; }
