/* wg-maker.css - 4D Wing Skin Maker (wings.9minecraft.net). Mobile first. Light/dark via [data-theme] or prefers-color-scheme. */
.wgm {
  --wgm-bg: #ffffff; --wgm-fg: #1b2333; --wgm-mut: #5d6779; --wgm-card: #f4f7fb; --wgm-line: #dde3ee;
  --wgm-acc: #1aa6b0; --wgm-acc2: #0e7f88; --wgm-acc-fg: #ffffff; --wgm-gold: #f0b429; --wgm-err: #c7352b; --wgm-warn: #b7791f; --wgm-ok: #2f8f4e;
  --wgm-stage: linear-gradient(#8fb8ff 0%, #c9defc 64%, #86b860 64%, #5f9a3e 100%);
  --wgm-top: 0px;
  color: var(--wgm-fg); background: var(--wgm-bg); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; position: relative; box-sizing: border-box; max-width: 100%;
}
.wgm *, .wgm *::before, .wgm *::after { box-sizing: border-box; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wgm {
    --wgm-bg: #12161d; --wgm-fg: #e6edf7; --wgm-mut: #9aa6b8; --wgm-card: #1a2029; --wgm-line: #2b3441;
    --wgm-acc: #3fc7cf; --wgm-acc2: #6be2e8; --wgm-acc-fg: #08262a; --wgm-stage: linear-gradient(#18234a 0%, #2a3a6e 64%, #24331f 64%, #1a2616 100%);
  }
}
[data-theme="dark"] .wgm {
  --wgm-bg: #12161d; --wgm-fg: #e6edf7; --wgm-mut: #9aa6b8; --wgm-card: #1a2029; --wgm-line: #2b3441;
  --wgm-acc: #3fc7cf; --wgm-acc2: #6be2e8; --wgm-acc-fg: #08262a; --wgm-stage: linear-gradient(#18234a 0%, #2a3a6e 64%, #24331f 64%, #1a2616 100%);
}
.wgm.is-drop { outline: 3px dashed var(--wgm-acc); outline-offset: 4px; }

/* stage */
.wgm-stagewrap { position: relative; border-radius: 12px; overflow: hidden; background: var(--wgm-stage); height: min(58vh, 440px); min-height: 300px; }
.wgm-stage { position: absolute; inset: 0; }
.wgm-stage canvas, .wgm-stage .s43d-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
.wgm-stage .s43d-msg { padding: 20px; color: #fff; }
.wgm-ov { position: absolute; display: flex; gap: 6px; align-items: center; z-index: 2; }
.wgm-ov-t { left: 8px; top: 8px; right: 8px; pointer-events: none; }
.wgm-ov-t > * { pointer-events: auto; }
.wgm-ov-r { right: 8px; bottom: 8px; }
.wgm-badge { position: absolute; left: 8px; bottom: 8px; z-index: 2; font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(10, 16, 28, .62); color: #fff; max-width: calc(100% - 200px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wgm-ov .wgm-seg { background: rgba(10, 16, 28, .55); border-radius: 999px; padding: 3px; }
.wgm-ov .wgm-chip { background: transparent; color: #fff; border-color: transparent; }
.wgm-ov .wgm-chip.is-on { background: #fff; color: #10202a; }
.wgm-ov .wgm-ib, .wgm-ov .wgm-chip-s { background: rgba(10, 16, 28, .6); color: #fff; border-color: transparent; }

/* status */
.wgm-status { font-size: 14px; color: var(--wgm-mut); min-height: 1.45em; padding: 0 2px; }
.wgm-status.is-err { color: var(--wgm-err); font-weight: 600; }

/* tabs */
.wgm-side { min-width: 0; }
.wgm-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--wgm-card); border: 1px solid var(--wgm-line); border-radius: 12px; padding: 4px; position: sticky; top: var(--wgm-top); z-index: 3; }
.wgm-tab { appearance: none; border: 0; background: transparent; color: var(--wgm-fg); font: 600 14px/1 inherit; font-family: inherit; padding: 11px 4px; border-radius: 9px; cursor: pointer; min-height: 40px; }
.wgm-tab[aria-selected="true"] { background: var(--wgm-acc); color: var(--wgm-acc-fg); }
.wgm-panels { margin-top: 10px; }
.wgm-panel[hidden] { display: none !important; }
.wgm-card { background: var(--wgm-card); border: 1px solid var(--wgm-line); border-radius: 12px; padding: 12px; margin: 0 0 10px; }
.wgm-card[hidden] { display: none; }
.wgm-h { font-size: 16px; margin: 0 0 6px; font-weight: 700; }
.wgm-sub { font-size: 13px; color: var(--wgm-mut); margin: 4px 0 8px; }
.wgm-sub[hidden] { display: none; }

/* controls */
.wgm-btn, .wgm-chip, .wgm-ib { appearance: none; font-family: inherit; cursor: pointer; border: 1px solid var(--wgm-line); background: var(--wgm-bg); color: var(--wgm-fg); border-radius: 9px; }
.wgm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600; padding: 9px 14px; min-height: 40px; }
.wgm-btn svg, .wgm-ib svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.wgm-btn-p { background: var(--wgm-acc); border-color: var(--wgm-acc); color: var(--wgm-acc-fg); }
.wgm-btn-dl { font-size: 15px; padding: 11px 18px; }
.wgm-btn:hover, .wgm-chip:hover, .wgm-ib:hover { border-color: var(--wgm-acc); }
.wgm-btn:focus-visible, .wgm-chip:focus-visible, .wgm-ib:focus-visible, .wgm-tab:focus-visible, .wgm-part:focus-visible { outline: 2px solid var(--wgm-acc); outline-offset: 2px; }
.wgm-chip { font-size: 13px; font-weight: 600; padding: 7px 11px; min-height: 34px; border-radius: 999px; white-space: nowrap; }
.wgm-chip-s { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.wgm-chip.is-on { background: var(--wgm-acc); border-color: var(--wgm-acc); color: var(--wgm-acc-fg); }
.wgm-ib { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.wgm-ib-s { width: 34px; height: 34px; }
.wgm-ib.is-on { color: var(--wgm-acc); }
.wgm-ov .wgm-ib.is-on { color: var(--wgm-gold); }
.wgm-seg { display: flex; gap: 4px; flex-wrap: nowrap; }
.wgm-wrap { flex-wrap: wrap; }
.wgm-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.wgm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.wgm-row[hidden] { display: none; }
.wgm-row-l { font-size: 14px; font-weight: 600; }
.wgm-row-cb { justify-content: flex-start; flex-direction: row-reverse; flex-wrap: nowrap; }
.wgm-row-cb input { width: 22px; height: 22px; accent-color: var(--wgm-acc); }
.wgm input[type=text], .wgm input[type=search], .wgm-sel { font: 15px/1.2 inherit; font-family: inherit; color: var(--wgm-fg); background: var(--wgm-bg); border: 1px solid var(--wgm-line); border-radius: 9px; padding: 9px 10px; min-height: 40px; min-width: 0; flex: 1 1 180px; max-width: 100%; }
.wgm-color { width: 52px; height: 38px; border: 1px solid var(--wgm-line); border-radius: 9px; padding: 2px; background: var(--wgm-bg); }
.wgm-skinprev, .wgm-atlas { display: block; width: 128px; height: 128px; image-rendering: pixelated; image-rendering: crisp-edges; background: repeating-conic-gradient(#c9ced8 0% 25%, #f1f3f7 0% 50%) 0 0 / 16px 16px; border-radius: 6px; border: 1px solid var(--wgm-line); }
.wgm-atlas { width: 256px; height: 256px; max-width: 100%; height: auto; aspect-ratio: 1; }

/* sliders */
.wgm-sls { display: grid; grid-template-columns: 1fr; gap: 2px 18px; }
.wgm-sl { display: grid; grid-template-columns: minmax(96px, 38%) 1fr 64px; align-items: center; gap: 8px; min-height: 40px; }
.wgm-sl-l { font-size: 13.5px; font-weight: 600; }
.wgm-sl input[type=range] { width: 100%; min-width: 0; height: 32px; accent-color: var(--wgm-acc); margin: 0; }
.wgm-sl-v { font-size: 13px; color: var(--wgm-mut); text-align: right; font-variant-numeric: tabular-nums; }
.wgm-adjtitle { font-weight: 700; margin-bottom: 6px; color: var(--wgm-acc2); }

/* layers */
.wgm-layers { display: grid; gap: 6px; }
.wgm-layer { display: flex; align-items: center; gap: 4px; background: var(--wgm-bg); border: 1px solid var(--wgm-line); border-radius: 10px; padding: 4px; }
.wgm-layer.is-cur { border-color: var(--wgm-acc); box-shadow: 0 0 0 1px var(--wgm-acc) inset; }
.wgm-layer.is-hidden .wgm-layer-b { opacity: .5; }
.wgm-layer-b { appearance: none; border: 0; background: transparent; color: inherit; font-family: inherit; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 8px; text-align: left; flex: 1; min-width: 0; padding: 2px; cursor: pointer; }
.wgm-layer-th { grid-row: 1 / 3; width: 44px; height: 36px; border-radius: 6px; background: var(--wgm-card) center / contain no-repeat; }
.wgm-layer-n { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wgm-layer-m { font-size: 12px; color: var(--wgm-mut); }

/* library */
.wgm-libtools { display: grid; gap: 8px; margin-bottom: 10px; }
.wgm-cats { gap: 6px; }
.wgm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.wgm-part { appearance: none; font-family: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px; border: 1px solid var(--wgm-line); border-radius: 10px; background: var(--wgm-bg); text-align: left; min-width: 0; }
.wgm-part.is-cur { border-color: var(--wgm-acc); box-shadow: 0 0 0 2px var(--wgm-acc) inset; }
.wgm-part.is-bad { opacity: .45; }
.wgm-part-th { display: block; aspect-ratio: 5 / 4; border-radius: 7px; background: radial-gradient(circle at 50% 40%, #e9f6ff, #b8cbe0) center / contain no-repeat; }
.wgm-part.has-th .wgm-part-th { background-size: contain, cover; background-repeat: no-repeat; background-position: center; }
.wgm-part:not(.has-th) .wgm-part-th { animation: wgm-pulse 1.4s ease-in-out infinite; }
@keyframes wgm-pulse { 50% { opacity: .55; } }
.wgm-part-n { font-size: 13px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wgm-part-c { font-size: 11.5px; color: var(--wgm-mut); text-transform: capitalize; }
.wgm-libinfo { margin-top: 10px; }
.wgm-thumbstage { position: fixed; left: -4000px; top: 0; width: 120px; height: 96px; overflow: hidden; pointer-events: none; }

/* validator */
.wgm-issues { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.wgm-iss { padding: 6px 9px; border-radius: 8px; border-left: 4px solid var(--wgm-line); background: var(--wgm-bg); overflow-wrap: anywhere; }
.wgm-iss.is-error { border-color: var(--wgm-err); }
.wgm-iss.is-error b { color: var(--wgm-err); }
.wgm-iss.is-warn { border-color: var(--wgm-warn); }
.wgm-iss.is-warn b { color: var(--wgm-warn); }
.wgm-iss.is-info { border-color: var(--wgm-acc); }
.wgm-iss.is-ok { border-color: var(--wgm-ok); }
.wgm-iss.is-ok b { color: var(--wgm-ok); }

/* wide screens: preview left (sticky), controls right */
@media (min-width: 900px) {
  .wgm { grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); grid-template-rows: auto 1fr; column-gap: 16px; align-items: start; }
  .wgm-stagewrap { grid-column: 1; grid-row: 1; height: min(78vh, 640px); position: sticky; top: calc(var(--wgm-top) + 8px); }
  .wgm-status { grid-column: 1; grid-row: 2; }
  .wgm-side { grid-column: 2; grid-row: 1 / 3; }
  .wgm-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
}
@media (max-width: 380px) {
  .wgm-sl { grid-template-columns: 84px 1fr 52px; }
  .wgm-tab { font-size: 13px; }
}
