.skin-editor-page {
  background: var(--bg);
  height: calc(100dvh - var(--header-h));
  max-height: calc(100dvh - var(--header-h));
  padding: 6px 0 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.skin-editor-layout {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 1100px;
  width: 100%;
  display: flex;
}

.skin-editor-title {
  margin: 0;
  padding: 8px 10px 4px;
  font-family: var(--font-ten);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: normal;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--green-light);
  text-shadow: 2px 2px 0 #2b4a14;
}

.skin-editor-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid #1b1b1b;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}

.skin-editor-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  align-items: stretch;
}

.skin-viewport-col {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.skin-editor-toolbar {
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 2px solid #1b1b1b;
  background: #3a3938;
}

.skin-viewport-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #3a3938;
}

#skin-editor-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.skin-controls-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  border-left: 2px solid #1b1b1b;
  background: #2c2b2a;
}

.skin-body-rail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 6px;
  background: #323130;
}

.skin-body-group span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}

.skin-body-map {
  position: relative;
  width: 76px;
  height: 142px;
  margin: 0 auto;
}

.skin-bodypart {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.skin-bodypart:hover {
  border-color: var(--green-light);
}

.skin-bodypart.is-on {
  border-color: var(--green-light);
  background: rgba(108, 195, 73, 0.22);
  box-shadow: 0 0 0 1px rgba(108, 195, 73, 0.35);
}

.skin-bodypart:not(.is-on) {
  opacity: 0.35;
}

.skin-bodypart.head {
  top: 2px;
  left: 24px;
  width: 28px;
  height: 28px;
}

.skin-bodypart.torso {
  top: 34px;
  left: 22px;
  width: 32px;
  height: 42px;
}

.skin-bodypart.arm_left {
  top: 34px;
  left: 4px;
  width: 14px;
  height: 42px;
}

.skin-bodypart.arm_right {
  top: 34px;
  right: 4px;
  width: 14px;
  height: 42px;
}

.skin-bodypart.leg_left {
  top: 80px;
  left: 22px;
  width: 14px;
  height: 46px;
}

.skin-bodypart.leg_right {
  top: 80px;
  right: 22px;
  width: 14px;
  height: 46px;
}

.skin-body-mobile {
  display: none;
  padding: 8px 10px;
  border-bottom: 2px solid #1b1b1b;
}

.skin-body-mobile .mc-btn {
  width: 100%;
}

.skin-body-overlay {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.skin-body-overlay.is-open {
  display: block;
}

.skin-body-overlay .skin-body-group + .skin-body-group {
  margin-top: 10px;
}

.skin-tools {
  padding: 8px;
  border-top: 2px solid #1b1b1b;
}

.skin-tools ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skin-tool {
  appearance: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #3a3938;
  color: #fff;
  border: 2px solid #1b1b1b;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.skin-tool:hover {
  background: #454443;
}

.skin-tool.is-on {
  background: var(--green);
  border-color: #1f3f12;
  box-shadow: inset 0 -2px 0 #2d5016;
}

.skin-tool.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.skin-tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skin-tooltip {
  position: fixed;
  z-index: 10000;
  padding: 5px 8px;
  background: #1b1b1b;
  color: #fff;
  border: 2px solid #3a3938;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-8px);
  transition: opacity 0.12s ease;
}

.skin-tooltip.is-on {
  opacity: 1;
}

.skin-controls-row {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 8px;
  border-top: 2px solid #1b1b1b;
}

.skin-color-active-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.skin-active-swatch {
  appearance: none;
  width: 40px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid #1b1b1b;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.skin-active-swatch:hover,
.skin-active-swatch[aria-expanded='true'] {
  outline: 2px solid var(--green-light);
  outline-offset: 1px;
}

#skin-open-picker {
  flex: 1;
  min-width: 0;
}

.skin-recent-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 28px;
}

.skin-recent-swatch {
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid #1b1b1b;
  cursor: pointer;
}

.skin-recent-swatch.is-active {
  outline: 2px solid var(--green-light);
  outline-offset: 1px;
}

.skin-recent-swatch.is-empty {
  background:
    linear-gradient(45deg, #3a3938 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(-45deg, #3a3938 25%, transparent 25%) 0 4px / 8px 8px,
    linear-gradient(45deg, transparent 75%, #3a3938 75%) 4px -4px / 8px 8px,
    linear-gradient(-45deg, transparent 75%, #3a3938 75%) 4px 0 / 8px 8px,
    #2a2928;
  cursor: default;
  pointer-events: none;
}

.skin-editor-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 8px 10px;
  border-top: 2px solid #1b1b1b;
}

.skin-editor-options label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skin-editor-options select {
  width: 100%;
  min-height: 30px;
  padding: 3px 6px;
  background: #3a3938;
  color: #fff;
  border: 2px solid #1b1b1b;
  font: inherit;
  font-size: 13px;
}

#skin-grid-btn {
  grid-column: 1 / -1;
  width: 100%;
}

.skin-env-controls {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}

.skin-bg-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skin-ground-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.skin-ground-options .mc-btn {
  width: 100%;
  min-width: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#skin-clouds-btn {
  width: 100%;
}

#skin-clouds-btn:disabled,
#skin-clouds-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 860px) {
  .skin-editor-page {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .skin-editor-main {
    grid-template-columns: 1fr;
  }

  .skin-viewport-col {
    min-height: 280px;
    height: min(52vh, 420px);
  }

  .skin-editor-card {
    min-height: 0;
  }

  .skin-controls-col {
    border-left: 0;
    border-top: 2px solid #1b1b1b;
    overflow: visible;
  }

  .skin-body-rail {
    display: none;
  }

  .skin-body-mobile {
    display: block;
  }
}
