/* ================= Редактор персонажа (как в Podium) ================= */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.char-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 14px; transition: border-color .15s; }
.char-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow) inset; }
.char-card .top { display: flex; gap: 10px; align-items: flex-start; }
.avatar { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; flex-shrink: 0; }
.char-card .excerpt { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card .foot { display: flex; gap: 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 5px; }
.dot.on { background: #38bdf8; }
.ring { position: relative; width: 38px; height: 38px; flex-shrink: 0; margin-left: auto; }
.ring svg { transform: rotate(-90deg); }
.ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

.editor { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; padding-bottom: 90px; }
.side-nav { position: sticky; top: 76px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.side-nav .group { font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding: 12px 8px 4px; }
.side-nav button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 10px; border: 0; border-left: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; border-radius: 6px; text-align: left; }
.side-nav button:hover { color: var(--text); background: var(--panel-2); }
.side-nav button.active { color: var(--accent-2); background: var(--accent-soft); border-left-color: var(--accent); }
.iq-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 20px; font-size: 12px; font-weight: 700; }
.iq-bar .track { flex: 1; height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; }
.iq-bar .fill { height: 100%; border-radius: 2px; }
.sec { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.sec > h2 { margin: 0 0 2px; font-size: 16px; }
.sec > .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.cap { font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.fieldset { display: flex; flex-direction: column; gap: 6px; }
.fieldset + .fieldset, .grid2 + .fieldset, .fieldset + .grid2 { margin-top: 14px; }
/* в сетке колонки выравниваются по верху — отступ между полями даёт gap, а не margin */
.grid2 > .fieldset, .grid3 > .fieldset { margin-top: 0; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { padding: 9px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { padding: 13px 14px; border: 1px solid var(--border); background: var(--panel-2); border-radius: 12px; cursor: pointer; font-weight: 600; text-align: left; color: var(--text); font: inherit; }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.opt small { display: block; color: var(--muted); font-weight: 400; margin-top: 3px; font-style: italic; }
.radio-list .opt { display: flex; gap: 10px; align-items: flex-start; width: 100%; margin-bottom: 6px; }
.radio-list .opt::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); margin-top: 2px; flex-shrink: 0; }
.radio-list .opt.on::before { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); font-size: 12px; }
.tag button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; }
.dropzone { border: 1.5px dashed var(--border); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--text); }
.dropzone .ico { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000; border: 2px solid transparent; cursor: pointer; }
.thumb.sel { border-color: var(--accent); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 4px; right: 4px; background: rgba(0, 0, 0, .7); border: 0; color: #fff; border-radius: 6px; cursor: pointer; padding: 1px 6px; }
.badge-n { position: absolute; bottom: 4px; left: 4px; background: #38bdf8; color: #fff; border-radius: 8px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
/* видео в сетках — обложкой (оригинал лежит в Telegram) */
.thumb .play, .pic .play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; display: grid; place-items: center; pointer-events: none; }
.pic { position: relative; }
.scene-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.scene-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--panel-2); cursor: pointer; min-height: 110px; display: flex; flex-direction: column; gap: 6px; }
.scene-card:hover { border-color: var(--accent); }
.scene-card.new { border-style: dashed; align-items: center; justify-content: center; color: var(--muted); }
.scene-card.off { opacity: .5; }
.save-bar { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; padding: 8px; background: rgba(22, 18, 26, .92); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); z-index: 40; backdrop-filter: blur(8px); }
.price-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.price-row input { width: 90px; }
.pct-group { font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding: 10px 12px 4px; }

/* редактор сцены — выезжающая панель */
.drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 60; display: flex; justify-content: flex-end; }
.drawer { width: 100%; max-width: 640px; height: 100%; overflow: auto; background: var(--bg); border-left: 1px solid var(--border); padding: 18px; }
.step { border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); padding: 10px; margin-bottom: 8px; }
.step-row { display: flex; gap: 10px; align-items: center; }
.step .mv { display: flex; flex-direction: column; }
.step .mv button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; line-height: 1.1; }
.step .pic { position: relative; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; background: #000; flex-shrink: 0; }
.step .pic img, .step .pic video { width: 100%; height: 100%; object-fit: cover; }
.step .price { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: var(--panel); }
.step .price input { border: 0; background: none; width: 72px; padding: 7px 0; }
/* поле вложено в рамку цены: подсвечиваем только рамку, без второго кольца фокуса вокруг самого поля */
.step .price input:focus { box-shadow: none; border: 0; }
.step .price:focus-within { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-glow); }
.step .price .stars { font-size: 11px; color: var(--muted); white-space: nowrap; }
.step .flags { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.step .flags button { border: 0; background: var(--panel); color: var(--muted); padding: 6px 10px; cursor: pointer; }
.step .flags button.on { background: var(--accent-soft); color: var(--text); }
.step .flags button:disabled { opacity: .3; cursor: default; }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .side-nav { position: static; }
  .opt-grid { grid-template-columns: 1fr; }
  .save-bar { left: 50%; }
}
