/* Skin Maker (staff): a full-window dark editor - top bar (logo, title, name, Undo / Redo, Import, Export, Publish),
   Species / Pattern / Clear all, the colour layers panel (X / Y / Z with ± and row actions). Sizes and colours are
   measured from the reference at 1568 x 826. */
html, body { margin:0; padding:0; }
body.skin-maker-page {
  --mk-page:#0b0d0c; --mk-panel:#0d100f; --mk-line:#1f2120; --mk-sep:#232420; --mk-row:#191c1b;
  --mk-field:#0d1210; --mk-field-line:#2a2f2d; --mk-btn:#151717; --mk-btn-line:#313332;
  --mk-text:#f4f2ed; --mk-dim:#aba9a5; --mk-faint:#716f67; --mk-green:#34d399;
  --mk-warm:linear-gradient(90deg, rgba(64,48,16,.32) 0, rgba(64,48,16,.10) 22%, rgba(64,48,16,0) 45%);
  min-height:100vh; background:radial-gradient(900px 260px at 0 0, rgba(120,88,30,.16), transparent 70%), var(--mk-page);
  color:var(--mk-text); font-family:'Lexend', system-ui, sans-serif; -webkit-text-size-adjust:100%;
}
.skin-maker-page .maker-shell { visibility:hidden; }
.skin-maker-page.maker-open .maker-shell { visibility:visible; }
.maker-locked { margin:0; padding:4rem 1rem; text-align:center; font:600 1rem/1.2 'Lexend', system-ui, sans-serif; letter-spacing:.14em; color:#d6d8d7; }

.maker-main { box-sizing:border-box; min-height:100vh; padding:4px 4px 12px 7px; }
.maker-shell {
  container:maker / inline-size;
  display:grid; grid-template-columns:minmax(0, 1fr); row-gap:13px; font:600 11.5px/1.2 'Lexend', system-ui, sans-serif; color:var(--mk-text);
}
.maker-shell svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex:0 0 auto; }

/* buttons + fields */
.maker-btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px; box-sizing:border-box; height:34px; padding:0 15px;
  border:1px solid var(--mk-btn-line); border-radius:7px; background:var(--mk-btn); color:var(--mk-text);
  font:600 11.5px/1 'Lexend', system-ui, sans-serif; white-space:nowrap; cursor:pointer;
}
.maker-btn:hover:not(:disabled) { background:#1b1e1d; border-color:#3d403e; }
.maker-btn:focus-visible, .maker-link:focus-visible, .maker-act:focus-visible, .maker-sign:focus-visible, .maker-logo:focus-visible { outline:2px solid #6aa7ff; outline-offset:1px; }
.maker-btn:disabled { cursor:not-allowed; color:#55595a; border-color:#232625; }
.maker-icon { width:34px; padding:0; }
.maker-icon svg { width:13px; height:13px; }
.maker-btn-save { background:linear-gradient(180deg, #493212, #3f2b11); border-color:#b27018; color:#ffd08a; }
.maker-btn-save:hover:not(:disabled) { background:linear-gradient(180deg, #573b14, #4a3212); border-color:#d08a26; }
.maker-btn-save:disabled { background:#1c1912; border-color:#4a3c27; color:#7d6a4d; }
.maker-btn-apply { background:linear-gradient(180deg, #123a29, #0f3122); border-color:#2f9e6e; color:#8ff0c4; }
.maker-btn-apply:hover:not(:disabled) { background:linear-gradient(180deg, #164a34, #12392a); border-color:#3fbf86; }
.maker-btn-apply:disabled { background:#101a15; border-color:#21483a; color:#4f7d68; }
.maker-inline { display:inline-flex; align-items:center; gap:10px; min-width:0; }
.maker-inline > span { color:var(--mk-dim); white-space:nowrap; }
.maker-inline select, .maker-dialog textarea, .maker-dialog input {
  box-sizing:border-box; height:34px; min-width:0; border:1px solid var(--mk-field-line); border-radius:6px; background:var(--mk-field);
  color:var(--mk-text); padding:0 10px; font:600 11.5px/1 'Lexend', system-ui, sans-serif;
}
.maker-inline select {
  -webkit-appearance:none; appearance:none; padding-right:30px; cursor:pointer;
  background-image:linear-gradient(45deg, transparent 50%, #c9ccca 50%), linear-gradient(135deg, #c9ccca 50%, transparent 50%);
  background-position:calc(100% - 17px) 15px, calc(100% - 12px) 15px; background-size:5px 5px, 5px 5px; background-repeat:no-repeat;
}
.maker-inline select option { background:#101312; color:var(--mk-text); }
.maker-inline select:focus, .maker-dialog textarea:focus, .maker-dialog input:focus, .maker-name:focus-within { outline:none; border-color:#4b8f6f; }

/* top bar: 52 px, 8 px inside */
.maker-top {
  display:flex; align-items:center; gap:8px; min-width:0; box-sizing:border-box; height:52px; padding:8px 12px;
  border:1px solid #232624; border-radius:10px; background:var(--mk-warm), var(--mk-panel);
}
.maker-logo { display:flex; align-items:center; flex:0 0 auto; height:34px; padding-right:12px; margin-right:4px; border-right:1px solid #35302a; border-radius:2px; }
.maker-logo img { display:block; width:39px; height:34px; object-fit:contain; }
.maker-title { margin:0 4px 0 0; font:600 13.5px/1 'Lexend', system-ui, sans-serif; letter-spacing:0; color:#b0ada7; white-space:nowrap; }
.maker-name {
  display:inline-flex; align-items:center; gap:8px; box-sizing:border-box; height:34px; padding:0 12px; min-width:0; flex:0 1 auto;
  border:1px solid var(--mk-field-line); border-radius:6px; background:var(--mk-field); color:#7f8481; cursor:text;
}
.maker-name input { width:7.5rem; min-width:5rem; max-width:16rem; border:0; padding:0; background:transparent; color:var(--mk-text); font:600 11.5px/1 'Lexend', system-ui, sans-serif; outline:none; }
.maker-name input::placeholder { color:#6c716e; }
.maker-name svg { width:12px; height:12px; }
@supports (field-sizing:content) { .maker-name input { field-sizing:content; width:auto; } }
.maker-status { flex:1 1 0; min-width:0; margin:0 0 0 8px; color:var(--mk-faint); font:500 11px/1.2 'Lexend', system-ui, sans-serif; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.maker-status.is-error { color:#f87171; }
.maker-status.is-done { color:var(--mk-green); }
#makerImport { margin-left:1px; }

/* Species / Pattern / Clear all: 34 px */
.maker-bar { display:flex; align-items:center; flex-wrap:wrap; gap:10px 17px; min-height:34px; padding-left:1px; }
.maker-f-species select { width:150px; }
.maker-f-pattern select { width:80px; }
.maker-link { height:34px; padding:0 10px; border:0; border-radius:6px; background:none; color:var(--mk-faint); font:500 10.5px/1 'Lexend', system-ui, sans-serif; cursor:pointer; }
.maker-link:hover { color:#cfd2d0; }
.maker-link.is-armed { color:#fff; background:#7f1d1d; padding:0 12px; }

/* the colour layers panel: title 37 px, header 44 px, rows 46 px; it ends after the last row */
.maker-table { border:1px solid var(--mk-line); border-radius:10px; background:var(--mk-warm), var(--mk-panel); overflow:hidden; }
.maker-table-title { margin:0; height:37px; padding:0 14px; font:600 15.5px/37px 'Lexend', system-ui, sans-serif; letter-spacing:0; color:var(--mk-text); border-bottom:1px solid var(--mk-sep); }
.maker-thead, .maker-region { --trail:228px; }
.maker-thead {
  display:grid; align-items:center; column-gap:8px; box-sizing:border-box; height:45px; padding:6px 11px 6px 18px; border-bottom:1px solid var(--mk-sep);
  grid-template-columns:minmax(0, 1fr) 168px 168px 168px calc(var(--trail) - 3px); color:var(--mk-dim);
}
.maker-th-axis { display:flex; align-items:center; justify-content:center; height:32px; box-sizing:border-box; border:1px solid #2e3030; border-radius:6px; background:#121414; color:var(--mk-text); font:700 12px/1 'Lexend', system-ui, sans-serif; }
.maker-th-acts { justify-self:end; width:88px; }
.maker-regions { display:block; padding:4px 0; }
.maker-region {
  position:relative; display:grid; align-items:center; box-sizing:border-box; height:46px; padding:5px 11px 10px 16px;
  grid-template-columns:52px 26px minmax(0, 1fr) 176px 176px 167px var(--trail);
}
.maker-region::after { content:''; position:absolute; left:18px; right:12px; bottom:0; height:1px; background:var(--mk-row); }
.maker-region:hover { background:rgba(255,255,255,.015); }
.maker-region.is-dragging { background:rgba(52,211,153,.06); outline:1px dashed #3a8f6a; }
.maker-drag { position:relative; justify-self:start; width:20px; height:26px; border:0; padding:0; background:none; cursor:grab; touch-action:none; }
.maker-drag::before { content:''; position:absolute; left:6px; top:8px; width:8px; height:11px; background:radial-gradient(circle, #61625e 1.1px, transparent 1.4px) 0 0 / 4px 4px; }
.maker-drag:hover::before { filter:brightness(1.6); }
.maker-drag:active { cursor:grabbing; }

.maker-tile { position:relative; display:block; width:26px; height:26px; box-sizing:border-box; border:1px solid #2d322f; border-radius:5px; overflow:hidden; background:#000; }
.maker-chip { position:absolute; inset:-4px; width:calc(100% + 8px); height:calc(100% + 8px); padding:0; border:0; background:transparent; cursor:pointer; }
.maker-chip::-webkit-color-swatch-wrapper { padding:0; }
.maker-chip::-webkit-color-swatch { border:0; }
.maker-chip::-moz-color-swatch { border:0; }
.maker-glitch { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none;
  background:linear-gradient(150deg, #0b1a13 0%, #15382a 50%, #2a9c70 100%); }
.maker-glitch[hidden] { display:none; }
.maker-glitch svg { width:12px; height:12px; fill:#ff822d; stroke:#ff822d; stroke-width:1; }
.maker-region.is-glitch .maker-tile { border-color:#4a9278; }
.maker-region-head { display:flex; align-items:center; gap:8px; min-width:0; padding-left:10px; }
.maker-region-name { min-width:0; font:600 11.5px/1.1 'Lexend', system-ui, sans-serif; color:var(--mk-text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.maker-region.is-glitch .maker-region-name { color:var(--mk-green); }
.maker-key { flex:0 0 auto; padding:2px 5px; border-radius:3px; background:#22221d; color:#6b6c67; font:500 9.5px/1 ui-monospace, 'DM Mono', monospace; }

.maker-xyz { display:contents; }
.maker-xyz label { display:grid; grid-template-columns:142px 20px; align-items:center; column-gap:5px; min-width:0; }
.maker-xyz label > span { display:none; }
.maker-xyz input {
  box-sizing:border-box; width:100%; min-width:0; height:30px; border:1px solid var(--mk-field-line); border-radius:5px; background:var(--mk-field);
  color:var(--mk-text); padding:0 8px; font:400 13px/1 'Lexend', system-ui, sans-serif;
}
.maker-xyz input.is-neg { color:var(--mk-green); }
.maker-xyz input:focus { outline:none; border-color:#4b8f6f; }
.maker-xyz input[aria-invalid="true"] { color:#fca5a5; border-color:#7f1d1d; }
.maker-sign, .maker-act { display:flex; align-items:center; justify-content:center; box-sizing:border-box; padding:0; cursor:pointer; }
.maker-sign { width:20px; height:22px; border:1px solid #262928; border-radius:4px; background:#151716; color:#737571; font:600 11px/1 'Lexend', system-ui, sans-serif; }
.maker-act { width:26px; height:26px; border:1px solid var(--mk-btn-line); border-radius:5px; background:#151716; color:#adaca8; }
.maker-sign:hover, .maker-act:hover:not(:disabled) { color:#fff; border-color:#454b47; background:#1c201e; }
.maker-row-actions { display:flex; justify-content:flex-end; gap:5px; }
.maker-act svg { width:12px; height:12px; }
.maker-act:disabled { cursor:not-allowed; opacity:.35; }

/* dialogs (Import, Publish) */
.maker-dialog { width:min(680px, calc(100vw - 32px)); margin:auto; padding:0; border:1px solid #232624; border-radius:10px; background:#0d100f; color:var(--mk-text); box-shadow:0 18px 50px rgba(0,0,0,.6); }
.maker-dialog-small { width:min(300px, calc(100vw - 32px)); }
.maker-dialog::backdrop { background:rgba(0,0,0,.7); }
.maker-dialog-body { display:grid; gap:12px; padding:14px; font:600 11.5px/1.2 'Lexend', system-ui, sans-serif; }
.maker-dialog-field { display:grid; gap:8px; }
.maker-dialog-field > span { font:600 13.5px/1 'Lexend', system-ui, sans-serif; color:var(--mk-text); }
.maker-dialog textarea { height:auto; min-height:10rem; padding:10px 12px; font:500 12px/1.5 ui-monospace, 'DM Mono', monospace; resize:vertical; }
.maker-dialog input { width:100%; font:400 13px/1 'Lexend', system-ui, sans-serif; }
.maker-dialog input:disabled { opacity:.45; cursor:not-allowed; }
/* Publish: Patron reward (owner / website admins / curators) */
.maker-dialog select {
  box-sizing:border-box; width:100%; height:34px; min-width:0; border:1px solid var(--mk-field-line); border-radius:6px;
  background-color:var(--mk-field); color:var(--mk-text); padding:0 30px 0 10px; font:400 13px/1 'Lexend', system-ui, sans-serif;
  -webkit-appearance:none; appearance:none; cursor:pointer;
  background-image:linear-gradient(45deg, transparent 50%, #c9ccca 50%), linear-gradient(135deg, #c9ccca 50%, transparent 50%);
  background-position:calc(100% - 17px) 15px, calc(100% - 12px) 15px; background-size:5px 5px, 5px 5px; background-repeat:no-repeat;
}
.maker-dialog select option { background:#101312; color:var(--mk-text); }
.maker-dialog select:focus { outline:none; border-color:#4b8f6f; }
#makerRewardField[hidden] { display:none; }
.maker-dialog-status { margin:-4px 0 0; min-height:0; color:#f87171; font:500 11px/1.2 'Lexend', system-ui, sans-serif; }
.maker-dialog-status:empty { display:none; }
.maker-dialog-actions { display:flex; justify-content:flex-end; gap:8px; }

/* Publish: Image (pick or drop, any size) + upload progress */
#makerPublishBox { width:min(360px, calc(100vw - 32px)); }
.maker-drop {
  position:relative; display:flex; align-items:center; justify-content:center; box-sizing:border-box; height:150px; overflow:hidden;
  border:1px dashed #3a3f3c; border-radius:6px; background:var(--mk-field); color:var(--mk-faint); cursor:pointer;
  font:500 11.5px/1 'Lexend', system-ui, sans-serif;
}
.maker-drop:hover, .maker-drop.is-over { border-color:#4b8f6f; color:#cfd2d0; }
.maker-drop:focus-visible { outline:2px solid #6aa7ff; outline-offset:1px; }
.maker-drop.has-image { border-style:solid; }
.maker-drop img { display:block; width:100%; height:100%; object-fit:contain; }
.maker-drop img[hidden], .maker-drop-text[hidden], .maker-upload[hidden] { display:none; }
.maker-upload { display:grid; grid-template-columns:minmax(0, 1fr) auto 26px; align-items:center; gap:6px 8px; }
.maker-upload-name { min-width:0; color:var(--mk-dim); font:500 11px/1.2 'Lexend', system-ui, sans-serif; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.maker-upload-pct { color:var(--mk-text); font:500 11px/1 'Lexend', system-ui, sans-serif; font-variant-numeric:tabular-nums; }
.maker-upload.is-done .maker-upload-pct { color:var(--mk-green); }
.maker-upload.is-stopped .maker-upload-pct { color:#f87171; }
.maker-upload progress { grid-column:1 / -1; width:100%; height:6px; -webkit-appearance:none; appearance:none; border:0; border-radius:3px; background:#1d2120; overflow:hidden; }
.maker-upload progress::-webkit-progress-bar { background:#1d2120; }
.maker-upload progress::-webkit-progress-value { background:#b27018; }
.maker-upload progress::-moz-progress-bar { background:#b27018; }
.maker-upload.is-done progress::-webkit-progress-value { background:var(--mk-green); }
.maker-upload.is-done progress::-moz-progress-bar { background:var(--mk-green); }

/* narrower: actions follow Z */
@container maker (max-width:1240px) {
  .maker-thead, .maker-region { --trail:104px; }
}
@container maker (max-width:1020px) {
  .maker-top .maker-logo { padding-right:8px; margin-right:0; }
  .maker-region { grid-template-columns:28px 26px minmax(0, 1fr) 176px 176px 167px var(--trail); padding-left:10px; }
}
/* two lines per layer: name, key and actions; then X / Y / Z */
@container maker (max-width:860px) {
  .maker-top { height:auto; flex-wrap:wrap; }
  .maker-status { order:9; flex-basis:100%; margin:0; }
  .maker-thead { display:none; }
  .maker-region { height:auto; grid-template-columns:24px 26px minmax(0, 1fr) auto; row-gap:8px; padding:8px 11px 10px 10px; }
  .maker-xyz { display:grid; grid-column:1 / -1; grid-row:2; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:8px; }
  .maker-xyz label { grid-template-columns:14px minmax(0, 1fr) 20px; }
  .maker-xyz label > span { display:block; color:var(--mk-faint); text-align:center; }
  .maker-row-actions { grid-column:4; grid-row:1; }
}

/* phone: each layer: name line, then X / Y / Z one per line */
@media (max-width:760px) {
  .maker-main { padding:8px; }
  .maker-shell { row-gap:10px; }
  .maker-top { display:grid; grid-template-columns:34px 34px 1fr 1fr; padding:10px; gap:8px; }
  .maker-logo { grid-column:1 / 3; border-right:0; padding:0; margin:0; }
  .maker-title { grid-column:3 / -1; font-size:15px; color:var(--mk-text); }
  .maker-name { grid-column:1 / -1; }
  .maker-name input { width:100%; max-width:none; flex:1 1 auto; }
  .maker-status { grid-column:1 / -1; white-space:normal; }
  #makerImport { margin-left:0; }
  .maker-btn-save, .maker-btn-apply { grid-column:1 / -1; height:42px; }
  .maker-bar { display:grid; grid-template-columns:1fr auto; gap:8px 10px; }
  .maker-f-species, .maker-f-pattern { grid-column:1 / -1; }
  .maker-f-species select, .maker-f-pattern select { flex:1 1 auto; width:auto; }
  .maker-f-species select { width:100%; }
  .maker-region { padding:10px; }
  .maker-xyz { grid-template-columns:1fr; gap:6px; }
  .maker-xyz label { grid-template-columns:16px minmax(0, 1fr) 36px; }
  .maker-xyz input { height:40px; font-size:14px; }
  .maker-sign { width:36px; height:36px; font-size:14px; }
  .maker-act { width:34px; height:34px; }
}
