/* SlideCraft — оформление страниц редактора и показа (сцена слайдов — в stage.css); имя app.css, потому что блокировщики режут styles.css. */
:root {
  --bg: #f3f4f7; --panel: #fff; --text: #1b1d23; --muted: #6b7280; --line: #e3e6ec; --line-strong: #cfd4dd;
  --accent: #2f6fed; --accent-soft: #e8effd; --accent-ink: #1f4fb8; --warn: #b45309; --err: #c62828;
  --mono: ui-monospace, Menlo, Consolas, monospace; --r: 10px; --gap: 12px; --side: 220px; --panel-w: 400px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121419; --panel: #1a1d24; --text: #e8eaf0; --muted: #98a1b3; --line: #2a2f3a; --line-strong: #3a4150;
    --accent: #6b9cff; --accent-soft: #1f2b45; --accent-ink: #9dbcff; --err: #f87171; }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
#app { display: flex; flex-direction: column; height: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.warn { color: var(--warn); font-size: 13px; margin: 0; }
.sp { flex: 1; }

/* шапка */
.bar { display: flex; align-items: center; gap: var(--gap); padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.brand { font-size: 16px; }
.pick { max-width: 260px; }
.count { white-space: nowrap; }
.bar a { color: var(--accent-ink); }

/* раскладка: слайды · сцена · панель */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side) minmax(0, 1fr) var(--panel-w); gap: var(--gap); padding: var(--gap) 16px; }
.side { min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; }
.thumbs { flex: 1; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.thumb { position: relative; aspect-ratio: 16 / 9; border: 2px solid var(--line); border-radius: 6px; overflow: hidden; cursor: pointer; background: #000; flex: none; }
.thumb.is-on { border-color: var(--accent); }
.thumb-box { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; pointer-events: none; }
.thumb-n { position: absolute; left: 6px; bottom: 4px; font: 11px var(--mono); color: #fff; background: rgba(0, 0, 0, .55); padding: 1px 6px; border-radius: 4px; }
.empty { padding: 8px; }
.stage-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 8px; }
.canvas { flex: 1; min-height: 0; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); display: grid; place-items: center; overflow: hidden; }
.canvas-stage { position: relative; box-shadow: 0 2px 16px rgba(0, 0, 0, .25); overflow: hidden; }
.scaled { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; }
.nav-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 6px; flex: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 12px; font: inherit; font-weight: 600; cursor: pointer; border-radius: 0; }
.tabs button.is-on { color: var(--text); border-bottom-color: var(--accent); }
.tab-body { padding: 12px; overflow: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
textarea.dsl { flex: 1; min-height: 240px; width: 100%; resize: none; font: 13px/1.5 var(--mono); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--text); tab-size: 2; white-space: pre; overflow: auto; }
textarea.dsl:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.errors { margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--err); display: flex; flex-direction: column; gap: 4px; }
.errors code { font-family: var(--mono); color: var(--muted); }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
pre.help { margin: 0; white-space: pre-wrap; font: 12px/1.5 var(--mono); background: var(--bg); padding: 10px; border-radius: 8px; }
.link-tab p { margin: 0; }
.link-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--accent-soft); border-radius: 8px; }
.link-box a { flex: 1; min-width: 0; word-break: break-all; color: var(--accent-ink); font-size: 13.5px; }
button, select { font: inherit; font-weight: 600; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
select { font-weight: 500; color: var(--text); background: var(--panel); border-color: var(--line-strong); }
button:disabled { opacity: .55; cursor: default; }
button.ghost { background: transparent; color: var(--accent-ink); }
button.small { padding: 5px 10px; font-size: 13px; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 1180px) { :root { --panel-w: 340px; --side: 180px; } }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(220px, 40vh) 1fr; padding: var(--gap); }
  .side { max-height: 96px; }
  .thumbs { flex-direction: row; }
  .thumb { width: 128px; }
  .hide-m, .count { display: none; }
  textarea.dsl { min-height: 180px; }
}

/* показ */
.show-body, .show-body #app { background: #000; height: 100%; overflow: hidden; }
.show { position: fixed; inset: 0; display: grid; place-items: center; background: #000; cursor: pointer; user-select: none; }
.show-box { position: relative; overflow: hidden; }
.show-hud { position: absolute; right: 14px; bottom: 10px; font: 12px var(--mono); color: #9aa; }
.show-msg { color: #ddd; text-align: center; font-size: 18px; padding: 24px; }
.show-msg p { color: #9aa; font-size: 14px; }

/* 3a: блок, текст которого пришлось ужать сильнее трёх четвертей, — метка в редакторе */
.canvas .blk.tight::after { content: "не влезает"; position: absolute; right: 4px; top: 4px; font: 600 18px/1 system-ui, sans-serif; color: #fff; background: #c62828; padding: 4px 9px; border-radius: 6px; letter-spacing: 0; text-transform: none; }
