/* Студия — общий стиль.
   Шрифты только системные: никаких googleapis, иначе у мобильного
   интернета российских операторов белый экран на 15-30 секунд. */

:root {
  --bg:      #0f1115;
  --panel:   #171a21;
  --panel-2: #1d212a;
  --line:    #262b36;
  --text:    #e6e8ec;
  --muted:   #8b93a3;
  --dim:     #5f6878;
  --accent:  #ffb454;
  --accent-d:#c9822e;
  --ok:      #4ade80;
  --warn:    #fbbf24;
  --err:     #f87171;
  --r:       12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

/* ───── Шапка ───── */
header.top {
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 21, .85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
header.top .in {
  max-width: 1080px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
}
.brand { font-weight: 650; letter-spacing: -.01em; font-size: 16px; }
.brand span { color: var(--accent); }
.grow { flex: 1; }

/* ───── Кнопки ───── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { background: #242936; border-color: #333a49; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #241703; font-weight: 600; }
.btn.primary:hover { background: #ffc06e; border-color: #ffc06e; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); border-color: #3a2429; }
.btn.danger:hover { background: #2a1a1e; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ───── Панели и поля ───── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card .hint { margin: 0 0 14px; color: var(--muted); font-size: 13px; }

label.f { display: block; margin-bottom: 14px; }
label.f .lb { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

input[type=text], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-d); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select { appearance: none; cursor: pointer; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; min-width: 0; }

/* ───── Список проектов ───── */
.projects { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.proj {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px; color: inherit;
  transition: border-color .15s, background .15s;
}
.proj:hover { border-color: #39404f; background: var(--panel-2); text-decoration: none; }
.proj .nm { font-weight: 600; font-size: 15px; letter-spacing: -.01em; margin-bottom: 3px; }
.proj .meta { color: var(--muted); font-size: 13px; }
.proj .foot { margin-top: 12px; display: flex; align-items: center; gap: 8px; }

/* ───── Этапы ───── */
.stages { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.stg {
  padding: 6px 11px; border-radius: 20px; font-size: 12.5px;
  border: 1px solid var(--line); color: var(--dim); background: var(--panel);
  white-space: nowrap;
}
.stg.done { color: var(--ok); border-color: #1f3a2b; background: #11201a; }
.stg.now  { color: #241703; background: var(--accent); border-color: var(--accent); font-weight: 600; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 12px; border: 1px solid var(--line); color: var(--muted);
  background: var(--panel-2); white-space: nowrap;
}
.pill.now { color: #241703; background: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ───── Материалы ───── */
.files { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.file {
  position: relative; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--panel-2); aspect-ratio: 1;
}
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file .nm {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  font-size: 11.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file .x {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border-radius: 6px; border: 0; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.file:hover .x { opacity: 1; }

.drop {
  border: 1.5px dashed var(--line); border-radius: var(--r);
  padding: 26px; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent-d); background: var(--panel-2); color: var(--text); }

/* ───── Мелочи ───── */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.sp { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0;
  background: var(--panel); color: var(--text);
  width: min(560px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog .bd { padding: 20px; }
dialog .ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
dialog h2 { margin: 0 0 16px; font-size: 17px; letter-spacing: -.01em; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5); z-index: 100;
}
.toast.err { border-color: #4a2a30; color: #ffb4b4; }

@media (max-width: 560px) {
  .wrap { padding: 18px 14px 60px; }
  .projects { grid-template-columns: 1fr; }
}

/* ───── Пояснения к моделям и смета ───── */
.note {
  margin-top: 7px; font-size: 12.5px; line-height: 1.5; color: var(--muted);
}
.note > div { margin-top: 3px; }
.note .ru {
  display: inline-block; margin-right: 8px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; font-size: 12px;
}
.note .ru.ok   { color: var(--ok);   background: #11201a; }
.note .ru.warn { color: var(--warn); background: #241d09; }
.note .ru.err  { color: var(--err);  background: #2a1417; }
.note .src { font-size: 11.5px; color: var(--dim); }

.smeta {
  margin-top: 4px; padding: 13px 15px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 13.5px;
}
.smeta .src { display: block; margin-top: 6px; font-size: 11.5px; color: var(--dim); line-height: 1.45; }

/* ───── Сцены: превью слева, текст справа ───── */
.scene {
  display: flex; gap: 14px; padding: 14px 0;
  border-top: 1px solid var(--line);
}
.scene:first-child { border-top: 0; padding-top: 4px; }
.scene .prev {
  flex: 0 0 150px; border-radius: 10px; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line);
  align-self: flex-start;
}
.scene .prev img, .scene .prev video { width: 100%; display: block; background: #000; }
.scene .prev .нет {
  padding: 34px 10px; text-align: center; color: var(--dim); font-size: 12px;
}
.scene .txt { flex: 1; min-width: 0; }
.ok  { color: var(--ok); }
.err { color: var(--err); }

/* ───── Ход работы ───── */
.job {
  margin-top: 14px; padding: 12px 15px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 13.5px;
}
.job.running { border-color: var(--accent-d); }
.job.failed  { border-color: #4a2a30; }
.job.done    { border-color: #1f3a2b; }
.job .err { margin-top: 6px; font-size: 12.5px; }

@media (max-width: 560px) {
  .scene { flex-direction: column; }
  .scene .prev { flex: none; max-width: 220px; }
}

/* ───── Варианты персонажа ───── */
.heroes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.hero {
  position: relative; border: 2px solid var(--line); border-radius: 12px;
  overflow: hidden; background: var(--panel-2); aspect-ratio: 2/3;
}
.hero.выбран { border-color: var(--accent); }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .нет { display: grid; place-items: center; height: 100%; padding: 12px;
             text-align: center; font-size: 12px; color: var(--dim); }
.hero .взять {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  justify-content: center; opacity: 0; transition: opacity .15s;
}
.hero:hover .взять, .hero:focus-within .взять { opacity: 1; }
.hero .метка {
  position: absolute; left: 10px; bottom: 10px;
  background: var(--accent); color: #241703; font-weight: 600;
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
}
code { background:var(--panel-2); padding:1px 5px; border-radius:4px; font-size:12px; }
