:root {
  --bg: #15171c;
  --panel: #1d2027;
  --panel-2: #262a33;
  --text: #e6e8ee;
  --muted: #8b91a0;
  --accent: #5b8cff;
  --border: #323744;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { display: flex; overflow: hidden; }

#viewport {
  position: relative; flex: 1; min-width: 0;
  /* мягкий «размытый интерьер» за моделью */
  background:
    radial-gradient(ellipse 60% 50% at 30% 35%, rgba(255,255,255,.35), transparent 70%),
    radial-gradient(ellipse 40% 60% at 80% 40%, rgba(200,205,220,.5), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(120,125,140,.5), transparent 70%),
    linear-gradient(180deg, #b9bdc8 0%, #a4a8b5 60%, #8f93a1 100%);
}
#viewport canvas { display: block; width: 100%; height: 100%; outline: none; }
#status { position: absolute; left: 16px; top: 16px; padding: 6px 10px; border-radius: 6px; background: rgba(0,0,0,.55); font-size: 13px; pointer-events: none; }
#status:empty { display: none; }
#status.error { background: rgba(180, 30, 30, .85); max-width: calc(100% - 32px); }
#drop-hint { position: absolute; inset: 12px; display: none; place-items: center; border: 2px dashed var(--accent); border-radius: 12px; background: rgba(91,140,255,.08); font-size: 18px; pointer-events: none; }
body.dragging #drop-hint { display: grid; }

#panel { width: 320px; flex: none; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--border); }
#panel section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
#panel h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#panel h3 { margin: 12px 0 6px; font-size: 13px; font-weight: 600; }
.row { display: flex; gap: 8px; margin-bottom: 8px; }
.row.wrap { flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; padding: 7px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; user-select: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.active { border-color: var(--accent); color: var(--accent); }
.hint { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }

.slider { display: grid; grid-template-columns: 1fr 110px 34px; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.slider input { width: 100%; accent-color: var(--accent); }
.slider output { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

#gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
#gallery img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
#gallery img.active { border-color: var(--accent); }
#preview[hidden] { display: none; }
#preview { display: block; width: 100%; height: auto; margin-bottom: 8px; border-radius: 6px; background: #000; }

details summary { cursor: pointer; padding: 4px 0; font-weight: 600; }

@media (max-width: 760px) {
  body { flex-direction: column; }
  #viewport { flex: none; height: 55vh; }
  #panel { width: 100%; flex: 1; border-left: none; border-top: 1px solid var(--border); }
}
