/* Панель загрузки VTopia. Токены — те же, что у сайта VTube Connect
   (src/assets/css/styles.css): графит, один акцент, без свечений. */

@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/golos-text-v7-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/golos-text-v7-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/golos-text-v7-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/golos-text-v7-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/onest-v11-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/onest-v11-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/onest-v11-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/onest-v11-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --font-display: 'Onest', 'Golos Text', 'Segoe UI', sans-serif;
  --font-body: 'Golos Text', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;

  --bg-app: #121214;
  --bg-base: #121214;
  --bg-surface: #1b1b1e;
  --bg-elevated: #161618;
  --bg-hover: #27272b;
  --bg-inset: #0d0d0f;
  --border: #2a2a2f;
  --border-strong: #3a3a40;
  --border-subtle: #1f1f23;

  --text-primary: #f4f4f5;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;

  --accent: #3498db;
  --accent-hover: #2c87c9;
  --accent-subtle: rgba(52, 152, 219, 0.12);
  --accent-border: rgba(52, 152, 219, 0.4);
  --on-accent: #fff;

  --success: #37ad77;
  --success-subtle: rgba(55, 173, 119, 0.12);
  --warning: #d99e40;
  --warning-subtle: rgba(217, 158, 64, 0.12);
  --danger: #d9544f;
  --danger-subtle: rgba(217, 84, 79, 0.12);

  --radius: 8px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

/* ── Вход ─────────────────────────────────────────────────────────────── */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.75rem 1.75rem;
}
.login-card .wordmark { font-size: 2.1rem; }
.login-sub { margin: 0.35rem 0 1.6rem; color: var(--text-muted); }
.login-card .btn { width: 100%; height: 44px; margin-top: 0.4rem; }
.login-error { min-height: 1.4em; margin: 0 0 0.6rem; font-size: 0.85rem; color: var(--danger); }

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ── Шапка ────────────────────────────────────────────────────────────── */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(18, 18, 20, 0.92);
  border-bottom: 1px solid var(--border-subtle);
}
.top-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: flex; align-items: baseline; gap: 0.7rem; }
.brand .wordmark { font-size: 1.45rem; }
.brand span { color: var(--text-faint); font-size: 0.9rem; }
.who { display: flex; align-items: center; gap: 0.8rem; color: var(--text-muted); font-size: 0.88rem; }

/* ── Раскладка ────────────────────────────────────────────────────────── */
.page { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1000px) { .grid { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.card-head h2 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.pill {
  font-size: 0.72rem; font-variant-numeric: tabular-nums;
  color: var(--text-muted); background: var(--bg-base);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px;
}
.note { font-size: 0.82rem; line-height: 1.55; color: var(--text-muted); margin: 0 0 0.9rem; }
.note b { color: var(--text-secondary); font-weight: 600; }
.note-tail { margin: 0.85rem 0 0; }
.note.flush { margin: 0; }
.noscript { margin: 24px; }
.empty {
  font-size: 0.82rem; line-height: 1.5; color: var(--text-faint);
  border: 1px dashed var(--border); border-radius: 10px; padding: 0.85rem; text-align: center; margin: 0;
}
.error { font-size: 0.84rem; line-height: 1.5; color: var(--danger); margin: 0.75rem 0 0; }
.hint { font-size: 0.74rem; color: var(--text-faint); }
.hint.bad { color: var(--danger); }

/* ── Кнопки ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 38px; padding: 0 1rem; border-radius: 9px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-sm { height: 32px; padding: 0 0.8rem; font-size: 0.78rem; }
.btn-primary { border: 1px solid transparent; background: var(--accent); color: var(--on-accent); }
.btn-ghost { border: 1px solid var(--border); background: var(--bg-base); color: var(--text-secondary); }
.link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  transition: color 0.18s ease;
}
.link:disabled { opacity: 0.45; cursor: default; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: none; border: 1px solid var(--border);
  color: var(--text-faint); cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.icon-btn:active:not(:disabled) { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.45; cursor: default; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
  .btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-primary); }
  .link:hover:not(:disabled) { color: var(--text-primary); }
  .icon-btn:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
  .changes li:hover { background: var(--bg-surface); }
  .build:hover { border-color: var(--border-strong); }
}

.btn:focus-visible, .icon-btn:focus-visible, .link:focus-visible, .changes summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.actions .actions { margin-top: 0; }
.actions-split { justify-content: space-between; }

/* ── Поля ─────────────────────────────────────────────────────────────── */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; min-width: 0; }
.field label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.input {
  width: 100%; padding: 0.55rem 0.7rem;
  background: var(--bg-base); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-primary); font-size: 0.88rem;
  transition: border-color 0.18s ease;
}
textarea.input { resize: vertical; min-height: 72px; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); }
.input:disabled { opacity: 0.6; }
.input.bad { border-color: var(--danger); }
.input::placeholder { color: var(--text-faint); }

/* ── Выпуск и факты ───────────────────────────────────────────────────── */
.release-ver { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 0.8rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 1rem; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.facts dd { margin: 0.15rem 0 0; font-size: 0.88rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.release-note { margin: 0.9rem 0 0; font-size: 0.84rem; line-height: 1.55; color: var(--text-secondary); white-space: pre-line; }
.build-id { display: block; margin-top: 0.9rem; font-size: 0.72rem; color: var(--text-faint); word-break: break-all; }

/* ── Новый билд ───────────────────────────────────────────────────────── */
.start {
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem; text-align: center;
  padding: 1.8rem 1rem; border: 1px dashed var(--border-strong); border-radius: 12px;
  background: var(--bg-base);
}
.start svg { color: var(--text-faint); }
.start p { margin: 0; max-width: 460px; font-size: 0.86rem; line-height: 1.6; color: var(--text-muted); }

.folder {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.85rem; margin-bottom: 0.85rem;
  background: var(--bg-base); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-muted);
}
.folder-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.folder-main b { color: var(--text-primary); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-main span { font-size: 0.76rem; font-variant-numeric: tabular-nums; }

.progress { margin-top: 0.4rem; }
.bar { position: relative; height: 6px; border-radius: 999px; overflow: hidden; background: var(--bg-inset); }
.bar span {
  position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0);
  background: var(--accent); border-radius: inherit;
  transition: transform 0.45s linear;
}
.bar.busy span { animation: pulse 1.4s var(--ease-in-out) infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.progress-meta {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 0.55rem; font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums;
}

.diff { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin: 0.4rem 0 0.8rem; }
@media (max-width: 640px) { .diff { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chip {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.55rem 0.7rem; border-radius: 10px;
  background: var(--bg-base); border: 1px solid var(--border);
  font-size: 0.72rem; color: var(--text-muted);
}
.chip b { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.chip.add b { color: var(--success); }
.chip.mod b { color: var(--warning); }
.chip.del b { color: var(--danger); }

.changes { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-base); }
.changes summary {
  cursor: pointer; padding: 0.6rem 0.8rem; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
  list-style: none; border-radius: 10px;
}
.changes summary::-webkit-details-marker { display: none; }
.changes summary::before { content: '+'; display: inline-block; width: 1rem; color: var(--text-faint); }
.changes[open] summary::before { content: '\2212'; }
.changes ul { list-style: none; margin: 0; padding: 0 0.4rem 0.4rem; max-height: 280px; overflow: auto; }
.changes li { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.4rem; border-radius: 6px; font-size: 0.78rem; }
.tag {
  flex: 0 0 auto; width: 64px; text-align: center;
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 5px; padding: 3px 0 2px;
}
.tag.add { color: var(--success); background: var(--success-subtle); }
.tag.mod { color: var(--warning); background: var(--warning-subtle); }
.tag.del { color: var(--danger); background: var(--danger-subtle); }
.path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); color: var(--text-secondary); }
.size { flex: 0 0 auto; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.more { padding: 0 0.8rem 0.6rem; }

.check { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; font-size: 0.82rem; color: var(--text-secondary); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  width: 17px; height: 17px; border-radius: 5px; flex: 0 0 auto;
  border: 1px solid var(--border-strong); background: var(--bg-base);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check-box::after {
  content: ''; width: 5px; height: 9px; margin-top: -2px;
  border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check input:focus-visible + .check-box { outline: 2px solid var(--accent-border); outline-offset: 2px; }

.done {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 0.9rem; padding: 0.8rem 0.9rem; border-radius: 10px;
  background: var(--success-subtle); border: 1px solid rgba(55, 173, 119, 0.35);
  color: var(--success);
}
.done p { flex: 1; margin: 0; font-size: 0.86rem; color: var(--text-secondary); }
.done .actions { margin-top: 0; }

/* Блоки этапа появляются, а не вспыхивают. */
.progress, .diff, .changes, .done, .error, .actions {
  transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out);
}
@starting-style {
  .progress, .diff, .changes, .done, .error, .actions { opacity: 0; transform: translateY(4px); }
}

/* ── Билды ────────────────────────────────────────────────────────────── */
.builds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.build {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 0.75rem 0.85rem; border-radius: 11px;
  background: var(--bg-base); border: 1px solid var(--border);
  transition: border-color 0.18s ease;
}
.build.current { border-color: rgba(55, 173, 119, 0.45); }
.build-main { flex: 1; min-width: 0; }
.build-title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.badge {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 7px 2px; border-radius: 5px;
  color: var(--success); background: var(--success-subtle);
}
.build-meta { margin-top: 0.2rem; font-size: 0.76rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.build-note {
  margin: 0.4rem 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line;
}
.build-actions { display: flex; align-items: center; gap: 0.4rem; flex: 0 0 auto; }

/* ── Уведомления ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  font-size: 0.86rem;
  color: var(--text-secondary);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.toast.ok { border-color: rgba(55, 173, 119, 0.45); }
.toast.err { border-color: rgba(217, 84, 79, 0.5); color: var(--text-primary); }
.toast.hide { opacity: 0; transform: translateY(6px); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
  .bar.busy span { animation: none; }
  .progress, .diff, .changes, .done, .error, .actions { transition: opacity 0.2s ease; transform: none; }
  .toast { transition: opacity 0.2s ease; transform: none; }
}
