/* Общие цвета, кнопки, поля и окна — для главной и редактора. */
:root {
  --bg: #0f0f13;
  --bg2: #16161c;
  --panel: #1b1b22;
  --panel2: #22222b;
  --line: #2d2d38;
  --line2: #3a3a48;
  --text: #ecebf2;
  --muted: #9a99a9;
  --accent: #ff4f7b;
  --accent2: #ff7a59;
  --accent-ink: #ffffff;
  --sel: #4da3ff;
  --ok: #3ccf8e;
  --err: #ff5d5d;
  --radius: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --display: 'Unbounded', 'Inter', sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f3f7;
  --bg2: #ebeaf0;
  --panel: #ffffff;
  --panel2: #f3f2f7;
  --line: #e1e0e8;
  --line2: #cfcdd9;
  --text: #17161d;
  --muted: #6c6a7a;
  --shadow: 0 10px 40px rgba(20, 16, 40, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }

.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 44px; height: 44px; stroke-width: 1.3; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel2); border-color: var(--line); }
.btn.ghost.on { background: var(--panel2); color: var(--accent); }
.btn.icon-only { width: 36px; padding: 0; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.small.icon-only { width: 30px; padding: 0; }
.btn.big { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.wide { width: 100%; }

.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 8px 2px; }

/* Поля */
.ctl { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.ctl-top { display: flex; align-items: center; gap: 8px; }
.ctl-label { font-size: 12.5px; color: var(--muted); flex: 1; user-select: none; }
.num { width: 64px; height: 26px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg2); text-align: right; font-size: 12.5px; }
.num::-webkit-inner-spin-button { opacity: .4; }
.unit { color: var(--muted); font-size: 12px; margin-left: -4px; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; margin: 0; cursor: pointer; --p: 50%; }
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line2) var(--p)); }
.slider::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line2); }
.slider::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; margin-top: -6px; box-shadow: 0 1px 4px rgba(0,0,0,.4); border: 0; }
.slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.color-wrap { display: flex; gap: 8px; align-items: center; }
.color { width: 40px; height: 32px; border: 1px solid var(--line2); border-radius: 8px; padding: 2px; background: var(--bg2); cursor: pointer; }
.color::-webkit-color-swatch-wrapper { padding: 0; }
.color::-webkit-color-swatch { border: 0; border-radius: 5px; }
.hex, .search, .text-in, .sel, .title-in { height: 34px; border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 0 10px; outline: none; }
.hex { width: 96px; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.hex:focus, .search:focus, .text-in:focus, .sel:focus, .title-in:focus, .num:focus { border-color: var(--sel); }
textarea.text-in { height: auto; min-height: 60px; padding: 8px 10px; resize: vertical; width: 100%; line-height: 1.35; }
input.text-in, .search, .sel { width: 100%; }
.sel { cursor: pointer; }

.ctl-toggle { flex-direction: row; align-items: center; cursor: pointer; }
.ctl-toggle.mini { margin: 0; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.knob { position: absolute; inset: 0; border-radius: 20px; background: var(--line2); transition: background .15s; }
.knob::after { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(14px); }

.segment { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg { flex: 1; height: 28px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* Окна */
.modal-back { position: fixed; inset: 0; background: rgba(5, 5, 10, .6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; backdrop-filter: blur(3px); }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 18px 20px 20px; overflow: auto; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; text-align: center; }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--err); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Мои работы */
.works { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 14px; }
.work { position: relative; border-radius: 12px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; transition: transform .12s, border-color .12s; }
.work:hover { transform: translateY(-2px); border-color: var(--line2); }
.work img { width: 100%; aspect-ratio: 1; display: block; object-fit: cover; }
.work-meta { padding: 8px 10px 10px; display: flex; flex-direction: column; }
.work-meta b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-meta span { color: var(--muted); font-size: 12px; }
.work-acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.work:hover .work-acts, .work:focus-within .work-acts { opacity: 1; }
.work-acts .btn { background: rgba(0,0,0,.6); color: #fff; }
.works-empty { padding: 24px 0; }
@media (hover: none) { .work-acts { opacity: 1; } }
