:root {
  --bg: #0b0c0f; --surface: #15171c; --surface-2: #1c1f26; --border: #2a2d35;
  --text: #f2f2f0; --text-dim: #8b8e98; --accent: #ec4899;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4f1; --surface: #ffffff; --surface-2: #ececea; --border: #ddd9d3;
    --text: #14151a; --text-dim: #6b6e78; --accent: #db2777;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0c0f; --surface: #15171c; --surface-2: #1c1f26; --border: #2a2d35;
  --text: #f2f2f0; --text-dim: #8b8e98; --accent: #ec4899;
}
:root[data-theme="light"] {
  --bg: #f5f4f1; --surface: #ffffff; --surface-2: #ececea; --border: #ddd9d3;
  --text: #14151a; --text-dim: #6b6e78; --accent: #db2777;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Onest', system-ui, sans-serif; min-height: 100vh; padding: 0 16px 24px;
}
.wrap { width: 100%; max-width: 980px; margin: 0 auto; }
h1 { font-weight: 800; font-size: clamp(22px, 5vw, 30px); margin: 0 0 4px; letter-spacing: -0.02em; }
.sub { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; line-height: 1.5; max-width: 720px; }

.mk-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .mk-grid { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.mk-left { position: sticky; top: 12px; }
@media (max-width: 820px) { .mk-left { position: static; } }

.mk-stage {
  position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; min-height: 220px; cursor: default;
}
.mk-stage.checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e6e6e6 25%, transparent 25%), linear-gradient(-45deg, #e6e6e6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e6e6e6 75%), linear-gradient(-45deg, transparent 75%, #e6e6e6 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.mk-stage.drag { outline: 3px dashed var(--accent); outline-offset: -3px; }
.mk-stage canvas { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.mk-drop-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 7px 12px; border-radius: 20px;
  white-space: nowrap; pointer-events: none;
}
.mk-drop-hint[hidden] { display: none; }

.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin: 16px 0 8px; font-weight: 600; }
.panel > .section-label:first-child { margin-top: 0; }
.mk-row[hidden] { display: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-btn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 20px; cursor: pointer; line-height: 1.2;
}
.chip-btn:hover { border-color: var(--accent); }
.chip-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sw-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0;
}
.sw.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.row-inline { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.row-inline label { font-size: 13px; color: var(--text-dim); white-space: nowrap; min-width: 92px; }
.row-inline input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.row-inline .val { font-size: 12px; font-weight: 700; color: var(--accent); width: 42px; text-align: right; }
.checks { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.checks label { font-size: 13px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.checks input { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=color] { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); padding: 0; background: none; cursor: pointer; flex: none; }
input[type=text], textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 44px; }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--accent); }

.btn-row { display: flex; gap: 10px; margin-top: 14px; }
button.btn {
  font-family: inherit; font-weight: 700; font-size: 15px; border-radius: 12px; padding: 13px 16px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; flex: 1;
}
button.btn:hover { border-color: var(--accent); }
button.btn:active { transform: scale(0.97); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mk-status { font-size: 13px; color: var(--text-dim); text-align: center; margin-top: 10px; min-height: 18px; }
.mk-status.ok { color: #22c55e; }
.mk-status.err { color: #f87171; }
.note { font-size: 12px; color: var(--text-dim); margin-top: 14px; line-height: 1.6; }
