/* SkinMC-inspired full-page floating editor chrome */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body.smc-page {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink, #6b3d5c);
  background: var(--pink-pale, #fff0f8);
}

body.smc-page {
  display: flex;
  flex-direction: column;
}

body.smc-page > .site-nav {
  position: relative;
  z-index: 120;
  flex: 0 0 auto;
}

body.smc-page > .site-footer {
  display: none;
}

.smc-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 0;
}

/* Crawlable intro ? kept out of the full-bleed editor layout */
body.smc-page > .editor-seo-intro {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ?? Stage fills the page ?? */
.smc-stage {
  position: absolute;
  inset: 0;
  display: grid;
  background: #b4d4ef;
}

.smc-stage[data-view="split"] {
  grid-template-columns: 1fr 1fr;
}

.smc-stage[data-view="2d"] .smc-pane-3d,
.smc-stage[data-view="3d"] .smc-pane-2d {
  display: none;
}

.smc-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.smc-pane-2d {
  background:
    radial-gradient(circle at 50% 40%, #ffffff 0%, #eef2f7 55%, #dbe3ee 100%);
}

.editor-canvas-stack {
  position: relative;
  width: min(92vmin, 640px);
  height: min(92vmin, 640px);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  background: var(--surface-input, #fff);
}

.editor-canvas-stack canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  /* tool cursor applied via JS */
}

#skin-overlay {
  pointer-events: none;
}

.editor-3d-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  touch-action: none;
}

.editor-3d-host.is-env {
  background: #b4d4ef;
}

.editor-3d-host:not(.is-env) {
  background:
    radial-gradient(ellipse at 50% 28%, #ffffff 0%, transparent 50%),
    linear-gradient(180deg, #f4f7fb 0%, #dfe8f2 55%, #c8d4e4 100%);
}

.editor-3d-host.is-orbit:active {
  cursor: grabbing !important;
}

.editor-3d-host.is-paint-hover {
  outline: 2px solid var(--pink-hot, #ff5eae);
  outline-offset: -2px;
}

.editor-3d-host .mc-viewer-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  pointer-events: auto;
}

/* ?? Floating chrome ?? */
.smc-chrome {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.smc-chrome > * {
  pointer-events: auto;
}

.smc-pill,
.smc-card {
  background: var(--surface-glass, rgba(255, 240, 248, 0.92));
  backdrop-filter: blur(10px);
  border: 2px solid var(--pink-soft, #ffc8e8);
  box-shadow: 0 8px 24px rgba(107, 61, 92, 0.12);
}

.smc-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
}

.smc-card {
  border-radius: 22px;
  padding: 0.85rem;
}

.smc-top-left {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 30;
}

.smc-top-right {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: flex;
  gap: 0.5rem;
  z-index: 30;
}

.smc-view-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.smc-view-switch {
  display: inline-flex;
  align-items: stretch;
  background: var(--surface-glass, rgba(255, 240, 248, 0.95));
  border: 1.5px solid var(--pink-soft, #ffc8e8);
  border-radius: 999px;
  padding: 0.12rem;
  gap: 0.1rem;
}

.smc-view-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font: 600 0.72rem "IBM Plex Sans", sans-serif;
  letter-spacing: 0.02em;
  color: var(--ink-muted, #9a6b88);
  cursor: pointer;
  min-width: 2.4rem;
}

.smc-view-btn:hover {
  color: var(--pink-hot, #ff5eae);
}

.smc-view-btn.is-active {
  background: var(--surface-input, #fff);
  color: var(--ink, #6b3d5c);
  box-shadow: 0 1px 4px rgba(107, 61, 92, 0.16);
}

.smc-brand-label {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--pink-hot, #ff5eae);
  padding: 0 0.35rem;
}

.smc-autosave-chip {
  font: 500 0.65rem "IBM Plex Mono", monospace;
  color: var(--ink, #6b3d5c);
  background: var(--pink-soft, #ffc8e8);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  white-space: nowrap;
}

.smc-hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--ink-muted, #9a6b88);
}

.smc-section-label {
  margin: 0.55rem 0 0.25rem;
  font: 600 0.68rem "IBM Plex Sans", sans-serif;
  color: var(--ink-muted, #9a6b88);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.smc-layer-seg {
  width: 100%;
  margin-top: 0.25rem;
}

.smc-layer-seg .smc-seg-btn {
  flex: 1;
}

.smc-drop-active .smc-stage {
  outline: 3px dashed var(--pink-hot, #ff5eae);
  outline-offset: -8px;
}

.smc-divider {
  width: 1px;
  height: 1.4rem;
  background: rgba(15, 23, 42, 0.12);
  margin: 0 0.15rem;
}

.smc-undo-label {
  font-size: 0.72rem;
  color: var(--ink-muted, #9a6b88);
  margin-left: 0.15rem;
}

.smc-icon-btn,
.editor-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.05rem;
  height: 2.05rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #374151;
  cursor: pointer;
  padding: 0;
}

.smc-icon-btn:hover,
.editor-tool:hover {
  background: rgba(255, 94, 174, 0.12);
  color: var(--pink-hot, #ff5eae);
}

.smc-icon-btn.is-active,
.editor-tool.is-active {
  background: rgba(255, 94, 174, 0.2);
  color: var(--pink-hot, #ff5eae);
}

.smc-icon-btn img,
.editor-tool img {
  display: block;
  width: 18px;
  height: 18px;
}

.smc-toolbelt .editor-tool img,
.smc-toolbelt .smc-icon-btn img {
  width: 20px;
  height: 20px;
}

.smc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: 500 0.82rem "IBM Plex Sans", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.smc-btn img {
  display: block;
}

.smc-btn.ghost {
  background: var(--surface-2, #f3f4f6);
  color: #111827;
}

.smc-btn.ghost:hover {
  background: var(--surface-hover, #e5e7eb);
}

.smc-btn.primary {
  background: var(--pink-hot, #ff5eae);
  color: var(--on-accent, #fff);
}

.smc-btn.primary:hover {
  background: #e84a9a;
}

.smc-seg {
  display: inline-flex;
  background: var(--surface-2, #f3f4f6);
  border-radius: 999px;
  padding: 0.15rem;
  gap: 0.1rem;
}

.smc-seg-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font: 500 0.72rem "IBM Plex Sans", sans-serif;
  color: var(--ink-muted, #9a6b88);
  cursor: pointer;
}

.smc-seg-btn.is-active {
  background: var(--surface-input, #fff);
  color: #111827;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.smc-toolbelt {
  position: absolute;
  top: 4.6rem;
  left: 0.85rem;
  bottom: auto;
  height: fit-content;
  max-height: calc(100% - 5.5rem);
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  padding: 0.35rem;
  gap: 0.12rem;
  border-radius: 999px;
  z-index: 28;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.smc-tool-sep {
  display: block;
  width: 1.4rem;
  height: 1px;
  margin: 0.2rem 0;
  background: var(--pink-soft, #ffc8e8);
  flex: 0 0 auto;
}

.smc-mobile-only {
  display: none !important;
}

.smc-colorwheel {
  /* legacy left-dock styles unused ? wheel lives in right panel */
}

.smc-pane-3d {
  position: relative;
}

.smc-iro-picker {
  width: 100%;
  display: grid;
  justify-items: stretch;
}

.smc-iro-picker .IroColorPicker {
  width: 100% !important;
  display: grid !important;
  gap: 0.55rem;
  justify-items: center;
}

.smc-iro-picker .IroWheel,
.smc-iro-picker .IroSlider {
  margin: 0 !important;
}

.smc-iro-picker .IroWheel {
  width: 100% !important;
  max-width: 100%;
}

.smc-iro-picker svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.smc-brush-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(107, 61, 92, 0.55), inset 0 0 0 1px rgba(255, 94, 174, 0.35);
  border-radius: 2px;
  transform: translate(-50%, -50%);
  background: rgba(255, 94, 174, 0.12);
  will-change: left, top, width, height;
}

.smc-eyedropper-loupe {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  padding: 0.35rem;
  border-radius: 12px;
  background: var(--surface-glass, rgba(255, 240, 248, 0.95));
  border: 2px solid var(--pink-soft, #ffc8e8);
  box-shadow: 0 8px 20px rgba(107, 61, 92, 0.2);
  transform: translate(16px, 16px);
}

.smc-eyedropper-loupe canvas {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  border-radius: 8px;
  border: 1px solid rgba(107, 61, 92, 0.2);
  background: var(--surface-input, #fff);
}

.smc-eyedropper-hex {
  font: 600 0.72rem "IBM Plex Mono", monospace;
  color: var(--ink, #6b3d5c);
}

.smc-wheel-wrap {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--pink-soft, #ffc8e8);
  background: var(--surface-input, #fff);
  padding: 0;
}

.smc-color-block canvas#color-wheel {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  border-radius: 0;
  cursor: crosshair;
  touch-action: none;
  background: var(--surface-input, #fff);
  border: 0;
  display: block;
}

.smc-value-slider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.smc-slider-label {
  flex: 0 0 auto;
  min-width: 2.8rem;
  font-size: 0.72rem;
  color: var(--ink-muted, #9a6b88);
}

.smc-value-slider input[type="range"] {
  flex: 1;
  width: auto;
  min-width: 0;
}

.smc-camera-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.smc-wheel-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.smc-wheel-swatch {
  flex: 1;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--swatch, #ff5eae);
  border: 2px solid var(--pink-soft, #ffc8e8);
}

.smc-settings {
  position: fixed;
  top: 4.2rem;
  bottom: auto;
  left: max(0.75rem, 4.35rem);
  width: min(300px, calc(100vw - 1.5rem));
  max-height: min(78dvh, calc(100dvh - 5rem));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 55;
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem 1rem;
  align-content: start;
}

.smc-settings-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: -0.15rem 0 0.15rem;
}

.smc-settings-head strong {
  font: 600 0.9rem "IBM Plex Sans", sans-serif;
  color: var(--ink, #6b3d5c);
}

.smc-settings-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.smc-env-controls {
  display: grid;
  gap: 0.55rem;
}

.smc-env-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.smc-env-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.smc-project-tabs {
  width: 100%;
  margin: 0.35rem 0;
}

.smc-project-tabs .smc-seg-btn {
  flex: 1;
  text-align: center;
  padding: 0.28rem 0.35rem;
}

/* Custom tooltips */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 0.55rem);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink, #6b3d5c);
  color: var(--on-accent, #fff);
  font: 500 0.72rem "IBM Plex Sans", sans-serif;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 80;
  box-shadow: 0 4px 12px rgba(107, 61, 92, 0.25);
}

.smc-toolbelt [data-tip]::after,
.smc-top-left [data-tip]::after {
  left: calc(100% + 0.55rem);
  top: 50%;
  transform: translateY(-50%);
}

.smc-top-right [data-tip]::after {
  left: auto;
  right: calc(100% + 0.55rem);
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
}

.smc-slider {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--ink-muted, #9a6b88);
}

.smc-slider input[type="range"] {
  width: 5.5rem;
  height: 12px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(107, 61, 92, 0.2);
  background: linear-gradient(90deg, var(--pink-hot, #ff5eae), var(--pink-soft, #ffc8e8));
  accent-color: var(--pink-hot, #ff5eae);
}

.smc-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(107, 61, 92, 0.75);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.smc-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(107, 61, 92, 0.75);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.smc-size-inline input[type="range"] {
  width: 4.5rem;
}

.smc-pane-3d {
  position: relative;
}

.smc-view-gizmo {
  /* Bottom-left of the 3D stage — clear of top chrome + right color panel */
  position: absolute;
  top: auto;
  right: auto;
  bottom: 1rem;
  left: 1rem;
  z-index: 18;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: rgba(107, 61, 92, 0.65);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.smc-view-gizmo:hover,
.smc-view-gizmo:focus-visible {
  transform: scale(1.06);
  border-color: var(--pink-hot, #ff5eae);
}

.editor-3d-loader .page-transition-dots span {
  background: var(--pink-hot, #ff5eae);
}

.smc-num {
  width: 2.6rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.2rem 0.3rem;
  font: 500 0.72rem "IBM Plex Mono", monospace;
  text-align: center;
}

.smc-unit {
  font-size: 0.68rem;
  color: #9ca3af;
}

.smc-minimap {
  position: absolute;
  left: 0.85rem;
  bottom: 0.85rem;
  width: min(260px, calc(100vw - 1.7rem));
  z-index: 26;
}

.smc-card-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
}

.smc-tab {
  flex: 1;
  border: 0;
  background: var(--surface-2, #f3f4f6);
  border-radius: 999px;
  padding: 0.4rem;
  font: 500 0.78rem "IBM Plex Sans", sans-serif;
  color: var(--ink-muted, #9a6b88);
  cursor: pointer;
}

.smc-tab.is-active {
  background: var(--pink-hot, #ff5eae);
  color: var(--on-accent, #fff);
}

.smc-view-modes {
  width: 100%;
  margin-bottom: 0.55rem;
}

.smc-view-modes .smc-seg-btn {
  flex: 1;
  text-align: center;
}

.smc-minimap-body {
  display: grid;
  gap: 0.45rem;
}

#minimap-canvas {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--surface-input, #fff);
  image-rendering: pixelated;
  border: 1px solid #e5e7eb;
}

.smc-pose-row,
.smc-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.smc-chip {
  border: 0;
  background: var(--surface-2, #f3f4f6);
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  font: 500 0.68rem "IBM Plex Sans", sans-serif;
  color: #374151;
  cursor: pointer;
}

.smc-chip:hover {
  background: var(--pink-soft, #ffc8e8);
  color: var(--pink-hot, #ff5eae);
}

.smc-file-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.smc-drop {
  display: grid;
  place-items: center;
  min-height: 8rem;
  border: 1.5px dashed #d1d5db;
  border-radius: 12px;
  color: #9ca3af;
  font-size: 0.78rem;
  cursor: pointer;
}

#reference-img {
  width: 100%;
  border-radius: 12px;
}

.smc-right {
  position: absolute;
  top: 4.6rem;
  right: 0.85rem;
  bottom: 0.85rem;
  width: min(280px, calc(100vw - 1.7rem));
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 26;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem 0.8rem 1.15rem;
  align-content: start;
}

.smc-right > * {
  flex: 0 0 auto;
}

.smc-wheel-wrap {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--pink-soft, #ffc8e8);
  background: var(--surface-input, #fff);
  padding: 0;
}

.smc-color-block {
  display: grid;
  gap: 0.45rem;
}

.smc-layers {
  display: grid;
  gap: 0.4rem;
  padding: 0.55rem 0.6rem;
  border-radius: 14px;
  background: var(--surface-panel, rgba(255, 247, 252, 0.9));
  border: 1.5px solid var(--pink-soft, #ffc8e8);
}

.smc-layers-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.smc-layers-title {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font: 600 0.78rem "IBM Plex Sans", sans-serif;
  color: var(--ink, #6b3d5c);
}

.smc-layers-count {
  margin-left: auto;
  font: 0.65rem "IBM Plex Mono", monospace;
  color: var(--ink-muted, #9a6b88);
}

.smc-layers-actions {
  display: inline-flex;
  gap: 0.15rem;
}

.smc-layers-actions .smc-icon-btn {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.smc-layers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
  max-height: 11rem;
  overflow: auto;
}

.smc-layer-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr 1.2rem 1.2rem;
  gap: 0.15rem;
  align-items: center;
  border-radius: 10px;
  padding: 0.15rem;
  border: 1px solid transparent;
}

.smc-layer-row.is-active {
  background: var(--surface-input, #fff);
  border-color: var(--pink-soft, #ffc8e8);
  box-shadow: 0 1px 4px rgba(107, 61, 92, 0.1);
}

.smc-layer-vis,
.smc-layer-move,
.smc-layer-select {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink, #6b3d5c);
  padding: 0;
}

.smc-layer-select {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  text-align: left;
  font: 500 0.72rem "IBM Plex Sans", sans-serif;
}

.smc-layer-thumb {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 4px;
  border: 1px solid #e8d5e0;
  background: #fff center / cover no-repeat;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.smc-layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smc-layer-move {
  font-size: 0.7rem;
  opacity: 0.55;
}

.smc-layer-move:hover {
  opacity: 1;
  color: var(--pink-hot, #ff5eae);
}

.smc-color-well {
  position: relative;
  display: block;
  width: 100%;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--pink-soft, #ffc8e8);
}

.smc-color-preview {
  display: block;
  width: 100%;
  aspect-ratio: 1.15;
  border-radius: 14px;
  background: conic-gradient(from 0deg, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  position: relative;
  overflow: hidden;
}

.smc-color-preview::after {
  content: "";
  position: absolute;
  inset: 22% 26%;
  border-radius: 50%;
  background: var(--swatch, #ff5eae);
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(107, 61, 92, 0.25);
}

.smc-color-well #color-picker {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}

.editor-shade-row {
  display: flex;
  gap: 0.35rem;
}

.editor-mc-palette,
.editor-color-history {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.editor-swatch {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 5px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  cursor: pointer;
  padding: 0;
}

.smc-hex {
  display: grid;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--ink-muted, #9a6b88);
}

.smc-hex input,
.smc-field select:not(.rc-select-native),
.smc-field input[type="text"] {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: 500 0.85rem "IBM Plex Mono", monospace;
  background: var(--surface-input, #fff);
}

/* Hide native select before/after rc-select enhancement (avoids double dropdown UI) */
.smc-field select.rc-enhance {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0);
}

.smc-toggles {
  display: grid;
  gap: 0.55rem;
}

.smc-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.6rem;
  cursor: pointer;
  user-select: none;
  font: 500 0.82rem "IBM Plex Sans", sans-serif;
  color: var(--ink, #6b3d5c);
}

.smc-switch-text {
  min-width: 0;
  line-height: 1.3;
}

.smc-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.smc-switch-ui {
  position: relative;
  flex: 0 0 auto;
  width: 2.65rem;
  height: 1.45rem;
  border-radius: 999px;
  border: 1.5px solid var(--pink-soft, #ffc8e8);
  background: #ead6e0;
  box-shadow: inset 0 1px 2px rgba(107, 61, 92, 0.12);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.smc-switch-ui::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 2px;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(107, 61, 92, 0.28);
  transition: transform 0.18s ease;
}

.smc-switch input:checked + .smc-switch-ui {
  background: var(--pink-hot, #ff5eae);
  border-color: var(--pink-hot, #ff5eae);
}

.smc-switch input:checked + .smc-switch-ui::after {
  transform: translateX(1.15rem);
}

.smc-switch input:focus-visible + .smc-switch-ui {
  box-shadow: 0 0 0 3px rgba(255, 94, 174, 0.28);
}

.smc-switch:active .smc-switch-ui::after {
  transform: scale(0.96);
}

.smc-switch input:checked:active + .smc-switch-ui::after {
  transform: translateX(1.15rem) scale(0.96);
}

.smc-right .rc-select {
  width: 100%;
  min-width: 0;
}

.smc-right .rc-select-trigger {
  min-height: 2.35rem;
  border-radius: 12px;
}

.rc-select {
  position: relative;
  display: block;
}

.rc-select-native {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0);
}

.rc-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: 500 0.85rem "IBM Plex Sans", sans-serif;
  background: var(--surface-input, #fff);
  color: var(--ink, #6b3d5c);
  cursor: pointer;
  text-align: left;
}

.rc-select-trigger:focus-visible {
  outline: 2px solid var(--pink-hot, #ff5eae);
  outline-offset: 2px;
}

.rc-select-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: var(--surface, #fff);
  box-shadow: 0 10px 28px rgba(107, 61, 92, 0.14);
  max-height: 14rem;
  overflow: auto;
}

.rc-select-option {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  font: 500 0.82rem "IBM Plex Sans", sans-serif;
}

.rc-select-option.is-selected,
.rc-select-option:hover {
  background: var(--pink-pale, #fff0f8);
  color: var(--ink, #6b3d5c);
}

.smc-settings .rc-select {
  width: 100%;
  min-width: 0;
}

.smc-settings .rc-select-trigger {
  min-height: 2.35rem;
  border-radius: 12px;
}

.smc-parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.smc-part-col {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.smc-part-label {
  font-size: 0.72rem;
  color: var(--ink-muted, #9a6b88);
  font-weight: 500;
}

.smc-figure {
  width: 88px;
  height: auto;
  overflow: visible;
}

.smc-limb {
  fill: #d1d5db;
  stroke: #9ca3af;
  stroke-width: 0.6;
  cursor: pointer;
  transition: fill 0.12s ease;
}

.smc-limb:hover {
  fill: var(--pink-soft, #ffc8e8);
}

.smc-limb.is-on {
  fill: var(--pink, #ff8ec8);
  stroke: var(--pink-hot, #ff5eae);
}

.smc-limb.is-active {
  fill: var(--pink-hot, #ff5eae);
  stroke: var(--ink, #6b3d5c);
  stroke-width: 1.2;
}

.smc-limb.is-off {
  fill: #e8e0e6;
  stroke: #c4b3be;
  opacity: 0.4;
  stroke-dasharray: 2 1.5;
}

.smc-figure.overlay .smc-limb.is-on {
  fill: #9ad4f5;
  stroke: #3b9fd9;
}

.smc-figure.overlay .smc-limb.is-off {
  fill: #d9eaf5;
  stroke: #a8c8dc;
  opacity: 0.4;
}

.smc-ctx {
  position: fixed;
  z-index: 200;
  min-width: 11.5rem;
  padding: 0.35rem;
  border-radius: 14px;
  background: var(--surface-glass, rgba(255, 240, 248, 0.97));
  border: 2px solid var(--pink-soft, #ffc8e8);
  box-shadow: 0 12px 32px rgba(107, 61, 92, 0.22);
  display: grid;
  gap: 0.1rem;
}

.smc-ctx[hidden] {
  display: none !important;
}

.smc-ctx button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: 500 0.78rem "IBM Plex Sans", sans-serif;
  color: var(--ink, #6b3d5c);
  cursor: pointer;
  text-align: left;
}

.smc-ctx button:hover {
  background: rgba(255, 94, 174, 0.14);
  color: var(--pink-hot, #ff5eae);
}

.smc-ctx button kbd {
  font: 0.65rem "IBM Plex Mono", monospace;
  color: var(--ink-muted, #9a6b88);
  border: 1px solid var(--pink-soft, #ffc8e8);
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
}

.smc-ctx hr {
  border: 0;
  border-top: 1px solid var(--pink-soft, #ffc8e8);
  margin: 0.2rem 0.25rem;
}

.smc-field {
  display: grid;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--ink-muted, #9a6b88);
}

.smc-field > .rc-select {
  width: 100%;
}

.smc-projects {
  position: absolute;
  top: 4.6rem;
  right: calc(0.85rem + min(280px, calc(100vw - 1.7rem)) + 0.55rem);
  width: min(260px, 70vw);
  max-height: calc(100dvh - 5.5rem);
  overflow: auto;
  z-index: 27;
}

.smc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.smc-status {
  margin: 0;
  font: 0.68rem "IBM Plex Mono", monospace;
  color: #9ca3af;
}

.editor-project-list {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.editor-project-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.4rem 0.5rem;
  font: 0.68rem "IBM Plex Mono", monospace;
}

.editor-project-list button {
  border: 0;
  background: transparent;
  color: var(--pink-hot, #ff5eae);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.editor-project-grid {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.55rem;
}

.editor-project-card {
  display: grid;
  gap: 0.35rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.45rem;
  background: var(--surface-input, #fff);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.editor-project-card:hover,
.editor-project-card:focus-visible {
  border-color: var(--pink-hot, #ff5eae);
  box-shadow: 0 6px 18px rgba(255, 94, 174, 0.12);
  outline: none;
}

.editor-project-thumb {
  position: relative;
  aspect-ratio: 11 / 14;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #dff3ff 0%, #e8f8ef 100%);
}

.editor-project-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
}

.editor-project-thumb .skin-scribble-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0.7;
  pointer-events: none;
  z-index: 1;
  color: var(--pink-hot, #ff5eae);
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.editor-project-thumb.skin-thumb-loading img {
  opacity: 0;
}

.editor-project-thumb:not(.skin-thumb-loading) .skin-scribble-loader {
  opacity: 0;
  visibility: hidden;
}

.editor-project-title {
  margin: 0;
  font: 600 0.68rem "IBM Plex Sans", sans-serif;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-project-when {
  margin: 0;
  font: 0.58rem "IBM Plex Mono", monospace;
  color: #9ca3af;
}

.editor-3d-loader {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  gap: 0.65rem;
  justify-items: center;
  background: linear-gradient(180deg, #dff3ff 0%, #e8f8ef 72%);
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.editor-3d-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.editor-3d-loader .skin-scribble-svg {
  width: min(220px, 62vw);
  height: auto;
  color: var(--pink-hot, #ff5eae);
}

.editor-3d-loader-label {
  font: 0.72rem "IBM Plex Mono", monospace;
  color: var(--ink-muted, #9a6b88);
}

.smc-pane-3d {
  position: relative;
}

.editor-publish-preview-wrap {
  display: grid;
  gap: 0.35rem;
  margin: 0.65rem 0;
}

.editor-publish-preview {
  min-height: 220px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #dff3ff 0%, #e8f8ef 100%);
  border: 1px solid #e5e7eb;
}

.smc-publish-dialog {
  max-width: 26rem;
}

.smc-publish-actions {
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.smc-cloud-save-btn {
  width: 100%;
  margin-bottom: 0.55rem;
}

.smc-dialog {
  border: 0;
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  max-width: 28rem;
  margin: auto;
  position: fixed;
  inset: 0;
  width: calc(100% - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
}

.smc-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.smc-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.smc-dialog-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.smc-dialog-form {
  display: grid;
  gap: 0.45rem;
}

.smc-dialog-row {
  display: flex;
  gap: 0.45rem;
}

.smc-dialog-row input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}

.contribution-close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--ink-muted, #9a6b88);
}

.editor-shortcuts-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #4b5563;
  line-height: 1.55;
  font-size: 0.88rem;
}

.editor-shortcuts-list kbd {
  font: 0.72rem "IBM Plex Mono", monospace;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  background: var(--surface-2, #f9fafb);
}

.editor-mobile-rail {
  display: none;
}

.smc-sheet-backdrop {
  display: none;
}

.smc-sheet-handle {
  display: none;
}

.smc-check.compact {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0 0.35rem;
}

@media (max-height: 820px) {
  .smc-right {
    top: 4.1rem;
    bottom: 0.55rem;
  }

  .smc-figure {
    width: 72px;
  }
}

/* ?? Touch / canvas ?? */
.editor-canvas-stack,
.editor-3d-host,
.editor-3d-host .mc-viewer-canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -moz-user-select: none;
}

/* ?? Tablet ?? */
@media (max-width: 1100px) {
  .smc-right {
    width: min(260px, calc(100vw - 5rem));
  }
}

/* ?? Tablet (iPad portrait / small landscape) ?? */
@media (max-width: 1024px) and (min-width: 768px) {
  body.smc-page {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  body.smc-page .smc-shell {
    min-height: 0;
    flex: 1;
  }

  .smc-right {
    width: min(248px, 34vw);
    top: 3.6rem;
    bottom: 0.65rem;
    right: 0.65rem;
  }

  .smc-toolbelt {
    display: flex;
    top: 3.6rem;
    left: 0.65rem;
    bottom: auto;
    height: fit-content;
    max-height: calc(100% - 4.2rem);
  }

  .editor-mobile-rail {
    display: none;
  }

  .smc-top-left {
    top: 0.5rem;
    left: 0.5rem;
    max-width: calc(100vw - 10rem);
  }

  .smc-top-right {
    top: 0.5rem;
    right: 0.5rem;
  }

  .smc-mobile-only {
    display: none !important;
  }

  .smc-stage[data-view="split"] {
    grid-template-columns: 1fr 1fr;
  }

  .editor-canvas-stack {
    width: min(88vmin, 480px);
    height: min(88vmin, 480px);
  }
}

/* ?? Phone ?? */
@media (max-width: 767px) {
  body.smc-page {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  body.smc-page .site-nav {
    width: calc(100% - 1rem);
    margin: 0.4rem auto 0;
    border-radius: 14px;
  }

  body.smc-page .smc-shell {
    min-height: 0;
    flex: 1;
  }

  .smc-stage {
    inset: 0;
    padding-bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px));
  }

  .smc-stage[data-view="split"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .editor-canvas-stack {
    width: min(92vw, 92vmin, 520px);
    height: min(92vw, 92vmin, 520px);
  }

  .smc-top-left {
    top: 0.5rem;
    left: 0.5rem;
    max-width: calc(100vw - 7.5rem);
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.35rem 0.45rem;
  }

  .smc-brand-label,
  .smc-top-left .smc-autosave-chip,
  .smc-top-left .smc-size-inline span:first-child,
  .smc-top-left .smc-unit,
  #btn-shortcuts {
    display: none;
  }

  .smc-top-left .smc-size-inline {
    gap: 0.2rem;
  }

  .smc-top-left .smc-num {
    width: 2.4rem;
  }

  .smc-top-right {
    top: 0.5rem;
    right: 0.5rem;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
  }

  .smc-view-pill,
  .smc-save-pill {
    padding: 0.3rem;
  }

  .smc-btn-label {
    display: none;
  }

  .smc-mobile-only {
    display: inline-grid !important;
  }

  .smc-save-pill .smc-btn {
    padding: 0.45rem;
  }

  /* Desktop left toolbelt hidden ? use bottom rail */
  .smc-toolbelt {
    display: none;
  }

  .smc-settings {
    left: 0.5rem;
    right: 0.5rem;
    top: auto;
    bottom: 0;
    width: auto;
    max-height: min(78dvh, 620px);
    overflow: auto;
    z-index: 52;
    border-radius: 18px 18px 0 0;
    padding: 0.85rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(107, 61, 92, 0.2);
  }

  .smc-settings-head {
    display: flex;
    position: sticky;
    top: -0.15rem;
    z-index: 2;
    margin: 0 0 0.35rem;
    padding-bottom: 0.45rem;
    background: inherit;
  }

  /* Right panel becomes a bottom sheet */
  .smc-right {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-height: min(78dvh, 640px);
    margin: 0;
    border-radius: 18px 18px 0 0;
    z-index: 50;
    transform: translateY(110%);
    transition: transform 0.22s ease;
    padding: 0.75rem 0.9rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(107, 61, 92, 0.2);
    overflow-y: auto;
  }

  .smc-right.is-open {
    transform: translateY(0);
  }

  .smc-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.15rem 0.15rem 0.45rem;
    font: 600 0.8rem "IBM Plex Sans", sans-serif;
    color: var(--ink, #6b3d5c);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 2;
  }

  .smc-sheet-handle[hidden] {
    display: flex !important;
  }

  .smc-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(40, 20, 35, 0.35);
    z-index: 48;
    border: 0;
    padding: 0;
  }

  .smc-sheet-backdrop[hidden] {
    display: none !important;
  }

  .smc-wheel-wrap {
    width: 100%;
  }

  .smc-projects {
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    top: 4.5rem;
    width: auto;
    max-height: calc(100dvh - 10rem);
    z-index: 46;
  }

  .editor-mobile-rail {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 0.45rem 0.55rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
    background: var(--surface-glass, rgba(255, 247, 252, 0.96));
    border-top: 1.5px solid var(--pink-soft, #ffc8e8);
    box-shadow: 0 -8px 24px rgba(107, 61, 92, 0.12);
    backdrop-filter: blur(8px);
  }

  .smc-view-gizmo {
    bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    left: 0.65rem;
  }

  .editor-mobile-tools {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.1rem;
  }

  .editor-mobile-tools::-webkit-scrollbar {
    display: none;
  }

  .editor-mobile-tools .editor-tool {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 44px;
    min-height: 44px;
  }

  .editor-mobile-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .editor-mobile-actions .smc-icon-btn {
    width: 2.6rem;
    height: 2.6rem;
    min-width: 44px;
    min-height: 44px;
  }

  .smc-mobile-panel-btn {
    margin-left: auto;
    min-height: 44px;
    padding: 0.45rem 0.9rem;
  }

  .smc-size-mobile {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    min-width: 5.5rem;
    flex: 0 0 auto;
  }

  .smc-size-mobile input[type="range"] {
    width: 4.5rem;
    accent-color: var(--pink-hot, #ff5eae);
  }

  .smc-size-mobile-val {
    font: 600 0.68rem "IBM Plex Mono", monospace;
    color: var(--ink-muted, #9a6b88);
    min-width: 1rem;
    text-align: center;
  }

  .smc-icon-btn,
  .editor-tool,
  .smc-view-btn,
  .smc-seg-btn,
  .smc-chip {
    min-width: 40px;
    min-height: 40px;
  }

  .smc-ctx {
    max-width: calc(100vw - 1rem);
  }

  body.smc-sheet-open {
    overflow: hidden;
  }
}

@media (max-width: 520px) {
  .smc-top-right .smc-view-switch .smc-view-btn {
    padding: 0.32rem 0.45rem;
    min-width: 2rem;
    font-size: 0.68rem;
  }

  #btn-fullscreen,
  #btn-zoom-in,
  #btn-zoom-out {
    display: none;
  }

  .smc-parts {
    justify-content: space-around;
  }

  .smc-figure {
    width: 72px;
  }
}


/* Dark mode ? black & white, easier on the eyes */
html[data-theme="dark"] body.smc-page {
  background: #0a0a0a;
  color: #f2f2f2;
}

html[data-theme="dark"] .smc-hint,
html[data-theme="dark"] .smc-section-label,
html[data-theme="dark"] .smc-size-mobile-val,
html[data-theme="dark"] .smc-view-btn {
  color: #b0b0b0;
}

html[data-theme="dark"] .smc-switch {
  color: #f2f2f2;
}

html[data-theme="dark"] .smc-switch-ui {
  background: #333;
  border-color: #555;
}

html[data-theme="dark"] .smc-switch input:checked + .smc-switch-ui {
  background: #f5f5f5;
  border-color: #f5f5f5;
}

html[data-theme="dark"] .smc-switch input:checked + .smc-switch-ui::after {
  background: #111;
}

html[data-theme="dark"] .smc-view-btn.is-active {
  background: #1a1a1a;
  color: #f5f5f5;
}

html[data-theme="dark"] .smc-view-btn:hover {
  color: #ffffff;
}

html[data-theme="dark"] .smc-pill,
html[data-theme="dark"] .smc-card,
html[data-theme="dark"] .smc-btn,
html[data-theme="dark"] .smc-chip,
html[data-theme="dark"] .editor-tool,
html[data-theme="dark"] .smc-icon-btn,
html[data-theme="dark"] .smc-seg-btn,
html[data-theme="dark"] .smc-layer-btn,
html[data-theme="dark"] .smc-palette-swatch,
html[data-theme="dark"] .smc-recent-swatch,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] select {
  background: #141414;
  color: #f0f0f0;
  border-color: #2e2e2e;
}

html[data-theme="dark"] .smc-btn.is-primary,
html[data-theme="dark"] .smc-btn--primary,
html[data-theme="dark"] .smc-btn.primary {
  background: #f0f0f0;
  color: #0a0a0a;
  border-color: #f0f0f0;
}

html[data-theme="dark"] .smc-btn:hover,
html[data-theme="dark"] .editor-tool:hover,
html[data-theme="dark"] .smc-icon-btn:hover {
  background: #1e1e1e;
}

html[data-theme="dark"] .editor-tool.is-active,
html[data-theme="dark"] .smc-seg-btn.is-active,
html[data-theme="dark"] .smc-layer-btn.is-active {
  background: #2a2a2a;
  color: #ffffff;
  border-color: #5a5a5a;
}

html[data-theme="dark"] .smc-startup-gate {
  background: rgba(0, 0, 0, 0.68);
}

html[data-theme="dark"] .smc-dialog,
html[data-theme="dark"] .smc-modal-panel,
html[data-theme="dark"] .smc-export-panel,
html[data-theme="dark"] .smc-startup-dialog {
  background: #121212;
  color: #f2f2f2;
  border-color: #2a2a2a;
}

html[data-theme="dark"] .smc-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

html[data-theme="dark"] input::placeholder {
  color: #777;
  opacity: 1;
}

html[data-theme="dark"] .editor-mobile-rail {
  background: rgba(18, 18, 18, 0.94);
  border-top-color: #2a2a2a;
}

html[data-theme="dark"] .smc-brand-label {
  color: #ffffff;
}

html[data-theme="dark"] .smc-startup-card {
  border-color: #333;
  color: #111;
}

html[data-theme="dark"] .smc-wheel-wrap,
html[data-theme="dark"] .smc-color-block canvas#color-wheel {
  background: #0a0a0a;
  border-color: #333;
}
/* ?? UX overhaul: HSV sliders, shapes flyout, startup, env ?? */
.smc-hsv-slider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.smc-hsv-slider input[type="range"] {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 12px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(107, 61, 92, 0.2);
  background: #eee;
}

.smc-hsv-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(107, 61, 92, 0.75);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.smc-tool-flyout-wrap {
  position: relative;
  display: inline-flex;
}

.smc-tool-flyout {
  position: absolute;
  left: calc(100% + 0.35rem);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.3rem;
  border-radius: 12px;
  background: var(--surface-glass, rgba(255, 255, 255, 0.94));
  border: 1.5px solid var(--pink-soft, #ffc8e8);
  box-shadow: 0 8px 24px rgba(107, 61, 92, 0.14);
  z-index: 40;
}

.smc-tool-flyout .editor-tool {
  width: 2.2rem;
  height: 2.2rem;
}

.smc-env-controls {
  display: grid;
  gap: 0.4rem;
}

.smc-env-controls .smc-color-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.smc-env-controls .smc-color-field input[type="color"] {
  width: 2.4rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid rgba(107, 61, 92, 0.25);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.smc-env-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.smc-startup-gate {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
}

.smc-startup-gate[hidden] {
  display: none !important;
}

.smc-startup-dialog {
  width: min(520px, calc(100% - 1.5rem));
  max-height: calc(100% - 1.5rem);
  overflow: auto;
  margin: 0;
  position: relative;
  inset: auto;
  border: 0;
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.smc-startup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.smc-startup-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 4px 14px rgba(107, 61, 92, 0.08);
}

.smc-startup-card-wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.smc-startup-card-wide strong,
.smc-startup-card-wide span {
  display: block;
}

.smc-startup-pastel-mint { background: linear-gradient(160deg, #e8f8ef 0%, #f4fffb 100%); }
.smc-startup-pastel-peach { background: linear-gradient(160deg, #ffe8d6 0%, #fff6ee 100%); }
.smc-startup-pastel-sky { background: linear-gradient(160deg, #e3f2ff 0%, #f5fbff 100%); }
.smc-startup-pastel-lilac { background: linear-gradient(160deg, #f0e6ff 0%, #faf6ff 100%); }
.smc-startup-pastel-butter { background: linear-gradient(160deg, #fff4c8 0%, #fffceb 100%); }
.smc-startup-pastel-rose { background: linear-gradient(160deg, #ffe4f0 0%, #fff5fa 100%); }
.smc-startup-pastel-sage { background: linear-gradient(160deg, #e6f2e4 0%, #f5faf4 100%); }

.smc-startup-card:hover,
.smc-startup-card:focus-visible {
  border-color: var(--pink-hot, #ff5eae);
  box-shadow: 0 8px 22px rgba(255, 94, 174, 0.16);
  transform: translateY(-1px);
  outline: none;
}

.smc-startup-preview {
  width: 72px;
  height: 92px;
  border-radius: 14px;
  margin-bottom: 0.35rem;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(107, 61, 92, 0.08);
  overflow: hidden;
  background: transparent;
}

.smc-startup-thumb-wrap {
  display: grid;
  place-items: center;
}

.smc-startup-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.smc-startup-thumb.is-loading {
  opacity: 0.35;
}

.smc-startup-thumb.is-ready {
  opacity: 1;
}

.smc-startup-face {
  image-rendering: pixelated;
  background-color: #c6e2ff;
  background-size: 800% 800%;
  background-position: -100% -100%;
  background-repeat: no-repeat;
}

.smc-startup-blank {
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  position: relative;
}

.smc-startup-blank::after {
  content: "";
  position: absolute;
  inset: 14px 20px 10px;
  border: 2px dashed rgba(107, 61, 92, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
}

.smc-startup-blank-slim::after {
  inset: 14px 22px 10px;
}

.smc-startup-icon {
  display: grid;
  place-content: center;
  background: rgba(255, 255, 255, 0.65);
}

.smc-startup-icon img {
  opacity: 0.75;
}

.smc-startup-card strong {
  font: 600 0.92rem "IBM Plex Sans", sans-serif;
}

.smc-startup-card span:not(.smc-startup-preview) {
  font-size: 0.72rem;
  color: var(--ink-muted, #9a6b88);
}

.smc-recent-label {
  margin: 0.35rem 0 0.2rem;
}

.editor-mc-palette {
  display: none !important;
}

.smc-layers {
  display: none !important;
}
