/* Skin Maker preview + the window's layout around it (the module adds .mkp-on to the shell when it mounts).
   Wide (1212 px and up): the Species bar and the colour layers keep their natural width top-left (X / Y / Z right
   after the layer names); the stage fills the rest of the window - right of the layers and under them, down to the
   window's bottom - with Preview / Male / Female beside the Species bar. Narrower: Preview, then the stage, then
   the layers, one under the other. */
.mkp-head { display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0; min-height:34px; }
.mkp-title { margin:0; font:600 13.5px/1 'Lexend', system-ui, sans-serif; color:var(--mk-text, #f4f2ed); white-space:nowrap; }
.mkp-sex { display:inline-flex; box-sizing:border-box; height:34px; padding:3px; border:1px solid var(--mk-field-line, #2a2f2d); border-radius:7px; background:var(--mk-field, #0d1210); }
.mkp-sex button {
  height:26px; padding:0 12px; border:0; border-radius:5px; background:none; color:var(--mk-faint, #716f67);
  font:600 11.5px/1 'Lexend', system-ui, sans-serif; cursor:pointer;
}
.mkp-sex button:hover { color:#cfd2d0; }
.mkp-sex button[aria-pressed="true"] { background:#1d2320; color:var(--mk-text, #f4f2ed); }
.mkp-sex button:focus-visible, .mkp-retry:focus-visible { outline:2px solid #6aa7ff; outline-offset:1px; }

.mkp {
  --mkp-fx:0px; --mkp-fy:0px; --mkp-fw:100%; --mkp-fh:100%;
  position:relative; box-sizing:border-box; min-width:0; height:clamp(300px, 46vh, 520px); overflow:hidden;
  border:1px solid var(--mk-line, #1f2120); border-radius:10px;
  background:
    radial-gradient(var(--mkp-fw) var(--mkp-fh) at calc(var(--mkp-fx) + var(--mkp-fw) / 2) calc(var(--mkp-fy) + var(--mkp-fh) * .55), #1b201d 0%, #121513 50%, #0b0d0c 100%),
    var(--mk-panel, #0d100f);
}
.mkp-canvas { position:absolute; inset:0; display:block; width:100%; height:100%; outline:none; cursor:grab; touch-action:none; }
.mkp-canvas:active { cursor:grabbing; }
/* loading + fault sit in the middle of the free part */
.mkp-wait, .mkp-fault { position:absolute; left:var(--mkp-fx); top:var(--mkp-fy); width:var(--mkp-fw); height:var(--mkp-fh); pointer-events:none; }
.mkp-wait::before {
  content:''; position:absolute; left:50%; top:50%; width:22px; height:22px; margin:-11px 0 0 -11px; box-sizing:border-box;
  border:2px solid #2a2f2d; border-top-color:#8f8a7f; border-radius:50%; opacity:0;
}
.mkp[data-state="loading"] .mkp-wait::before { opacity:1; animation:mkp-spin .9s linear infinite; }
@keyframes mkp-spin { to { transform:rotate(360deg); } }
.mkp-fault { display:none; margin:0; align-items:center; justify-content:center; gap:10px; color:var(--mk-faint, #716f67); font:500 11.5px/1 'Lexend', system-ui, sans-serif; }
.mkp[data-state="fault"] .mkp-fault, .mkp[data-state="off"] .mkp-fault { display:flex; pointer-events:auto; }
.mkp[data-state="off"] .mkp-retry { display:none; }
.mkp[data-state="fault"] .mkp-canvas, .mkp[data-state="off"] .mkp-canvas { visibility:hidden; }
.mkp-retry { height:30px; padding:0 12px; border:1px solid var(--mk-btn-line, #313332); border-radius:6px; background:#151716; color:var(--mk-text, #f4f2ed); font:600 11.5px/1 'Lexend', system-ui, sans-serif; cursor:pointer; }
.mkp-retry:hover { border-color:#454b47; background:#1c201e; }

/* wide: layers dock top-left at their natural width, the stage takes the rest down to the window's bottom */
@media (min-width:1212px) {
  .maker-shell.mkp-on {
    --mkp-dock:856px;
    grid-template-columns:var(--mkp-dock) minmax(0, 1fr); grid-template-rows:auto auto auto minmax(0, 1fr);
    column-gap:0; min-height:calc(100vh - 16px); min-height:calc(100dvh - 16px);
  }
  .mkp-on > .maker-top { grid-column:1 / -1; grid-row:1; }
  .mkp-on > .maker-bar { grid-column:1; grid-row:2; }
  .mkp-on > .mkp-head { grid-column:2; grid-row:2; padding-left:16px; }
  .mkp-on > .mkp { grid-column:1 / -1; grid-row:3 / 5; height:auto; min-height:0; }
  .mkp-on > .maker-table {
    grid-column:1; grid-row:3; align-self:start; position:relative; z-index:1;
    box-shadow:6px 6px 22px rgba(0, 0, 0, .38);
  }
  /* compact layers: actions right after Z, the name column just wide enough for the longest name */
  .mkp-on .maker-thead, .mkp-on .maker-region { --trail:104px; }
}

@media (max-width:760px) {
  .mkp { height:300px; }
}
