
#craft-editor {
  --studio-ink: var(--ink, #263e35);
  --studio-paper: var(--paper, #fffaf2);
  --studio-sage: var(--sage, #dce9d8);
  --studio-coral: #ad4538;
  --studio-line: #dfdbcd;
  --studio-note: #625e56;
  color: var(--studio-ink);
  line-height: 1.45;
  margin: 1.5rem 0 2.75rem;
  min-width: 0;
}
#craft-editor *, #craft-editor *::before, #craft-editor *::after { box-sizing: border-box; }
#craft-editor [hidden] { display: none !important; }
#craft-editor :is(button, select, input, summary, canvas):focus-visible {
  outline: 3px solid #a6493e;
  outline-offset: 2px;
}
#craft-editor button, #craft-editor input, #craft-editor select { font: inherit; }
#craft-editor button, #craft-editor .studio-import {
  appearance: none;
  background: #fffcf6;
  border: 1px solid var(--studio-line);
  border-radius: .65rem;
  color: var(--studio-ink);
  cursor: pointer;
  font-size: .84rem;
  font-weight: 680;
  line-height: 1.2;
  min-height: 2.35rem;
  padding: .45rem .65rem;
}
#craft-editor button:hover, #craft-editor .studio-import:hover {
  border-color: #9eac96;
  background: #f3f7ee;
}
#craft-editor button:disabled { cursor: default; opacity: .46; }
#craft-editor button.studio-primary { background: var(--studio-coral); border-color: var(--studio-coral); color: white; }
#craft-editor button.studio-primary:hover { background: #943c31; border-color: #943c31; }
.studio-shell {
  background: #fffdf8;
  border: 1px solid var(--studio-line);
  border-radius: 1.15rem;
  box-shadow: 0 14px 45px rgb(49 61 46 / 9%);
  isolation: isolate;
  overflow: clip;
}
.studio-top {
  align-items: center;
  background: #fcf7ea;
  border-bottom: 1px solid var(--studio-line);
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  padding: .8rem 1.1rem;
}
.studio-top-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .55rem; justify-content: flex-end; }
.studio-project { display: grid; flex: 1; gap: .25rem; max-width: 27rem; min-width: 11rem; }
.studio-project > span {
  color: var(--studio-note);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .1em;
}
#craft-editor .studio-project input {
  background: #fffdf7;
  border: 1px solid var(--studio-line);
  border-radius: .45rem;
  color: var(--studio-ink);
  font-size: .98rem;
  font-weight: 700;
  max-width: 100%;
  min-width: 0;
  padding: .38rem .54rem;
}
.studio-muted { color: var(--studio-note); font-size: .77rem; padding-right: .15rem; }
.studio-work {
  display: grid;
  grid-template-columns: minmax(12rem, .94fr) minmax(19rem, 2.5fr) minmax(12rem, .95fr);
  min-width: 0;
}
.studio-sources, .studio-materials {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-width: 0;
  padding: .8rem;
}
.studio-sources { border-right: 1px solid var(--studio-line); }
.studio-materials { border-left: 1px solid var(--studio-line); }
.studio-source-intro { display: grid; gap: .6rem; }
.studio-upload {
  align-content: center;
  background: #eaf1e3;
  border: 1px dashed #9eb092;
  border-radius: .8rem;
  color: var(--studio-ink);
  cursor: pointer;
  display: grid;
  gap: .25rem;
  min-height: 7.7rem;
  padding: .75rem .55rem;
  position: relative;
  text-align: center;
}
.studio-upload:hover, .studio-upload.is-drop, .studio-upload:focus-within { background: #dcead5; border-color: #677f61; }
.studio-upload-icon { font-size: 1.55rem; font-weight: 750; line-height: 1; }
.studio-upload strong { font-size: .9rem; }
.studio-upload small { color: #526552; font-size: .73rem; }
.studio-upload input, .studio-import input {
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
#studio-crop { background: #efe9db; border-radius: .58rem; cursor: move; display: block; height: auto; touch-action: none; width: 100%; }
.studio-samples { display: flex; gap: .3rem; flex-wrap: wrap; }
#craft-editor .studio-samples button { flex: 1 0 auto; font-size: .73rem; min-height: 2rem; padding: .35rem .42rem; }
.studio-small { color: var(--studio-note); font-size: .77rem; line-height: 1.45; margin: 0; }
.studio-details { border-top: 1px solid var(--studio-line); padding-top: .65rem; }
.studio-details > summary { font-size: .92rem; font-weight: 800; margin-bottom: .55rem; }
.studio-more { margin: .65rem 0; }
.studio-more > summary { color: var(--studio-note); cursor: pointer; font-size: .76rem; font-weight: 720; }
.studio-details summary, .studio-filet summary { cursor: pointer; }
.studio-field { color: var(--studio-ink); display: grid; font-size: .75rem; font-weight: 700; gap: .28rem; margin-top: .42rem; min-width: 0; }
.studio-field :is(input:not([type="checkbox"]), select) {
  accent-color: #597751;
  background-color: #fffdfa;
  border: 1px solid var(--studio-line);
  border-radius: .45rem;
  color: var(--studio-ink);
  max-width: 100%;
  min-height: 2.08rem;
  min-width: 0;
  padding: .22rem .38rem;
  width: 100%;
}
.studio-field input[type="range"] { border: 0; min-height: 1.2rem; padding: 0; }
.studio-check { align-items: center; color: var(--studio-note); display: flex; font-size: .74rem; font-weight: 650; gap: .35rem; margin: .34rem 0; }
.studio-check input { accent-color: #597751; flex-shrink: 0; margin: 0; }
.studio-dimensions { display: grid; gap: .42rem; grid-template-columns: 1fr 1fr; min-width: 0; }
.studio-apply { margin-top: .75rem; width: 100%; }
.studio-variants { border-top: 1px solid var(--studio-line); padding-top: .65rem; }
.studio-variants h3 { font-size: .87rem; margin: 0 0 .35rem; }
.studio-variants > button { width: 100%; }
.studio-variants > div { display: grid; gap: .38rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#craft-editor .studio-variants > div button { display: grid; font-size: .72rem; gap: .3rem; min-width: 0; padding: .25rem; }
.studio-variants img { aspect-ratio: 1; border-radius: .28rem; height: auto; image-rendering: pixelated; object-fit: contain; width: 100%; }
.studio-variants small { color: var(--studio-note); font-size: .66rem; }
.studio-desk { background: #f8f5ee; display: flex; flex-direction: column; min-height: 28.5rem; min-width: 0; }
.studio-tools {
  align-items: stretch;
  background: #fffdf8;
  border-bottom: 1px solid var(--studio-line);
  display: flex;
  flex-wrap: wrap;
  gap: .24rem;
  padding: .49rem .52rem;
}
#craft-editor .studio-tools button {
  align-items: center;
  display: inline-flex;
  flex-direction: column;
  flex: 1 0 2.1rem;
  font-size: 1.2rem;
  gap: .1rem;
  justify-content: center;
  min-height: 2.56rem;
  padding: .13rem .23rem;
}
#craft-editor .studio-tools button[data-action] { flex: 0 0 2rem; }
.studio-tools small { font-size: .64rem; font-weight: 680; text-align: center; }
#craft-editor .studio-tools button[aria-pressed="true"] {
  background: #e4eddd;
  border-color: #95aa8f;
  box-shadow: inset 0 0 0 1px #95aa8f;
}
.studio-tool-divider { border-left: 1px solid var(--studio-line); margin: .25rem .1rem; }
.studio-board {
  background-color: #f0ebdf;
  background-image: radial-gradient(#abac9870 .6px, transparent .8px);
  background-size: 12px 12px;
  flex: 1 0 auto;
  max-height: 520px;
  min-height: 385px;
  overflow: auto;
  overscroll-behavior: contain;
}
.studio-frame { display: grid; justify-items: center; min-height: 100%; min-width: 100%; padding: 20px; place-items: center; width: max-content; }
#studio-grid {
  background: #fffdf8;
  border: 1px solid #bdb6a7;
  box-shadow: 0 6px 19px rgb(54 51 44 / 12%);
  cursor: crosshair;
  display: block;
  height: auto;
  max-width: none;
  touch-action: none;
  width: 100%;
}
#studio-grid[data-tool="pan"] { cursor: grab; }
#studio-grid[data-tool="pan"]:active { cursor: grabbing; }
#studio-grid[data-tool="pick"] { cursor: copy; }
#studio-grid[data-tool="back-erase"] { cursor: crosshair; }
#craft-editor .studio-tools :is([data-tool="half-up"], [data-tool="half-down"], [data-tool="backstitch"], [data-tool="back-erase"]) {
  background: #f9f2e6;
}
#craft-editor .studio-tools :is([data-tool="half-up"], [data-tool="half-down"], [data-tool="backstitch"], [data-tool="back-erase"])[aria-pressed="true"] {
  background: #e4eddd;
}
.studio-view-actions {
  align-items: center;
  background: #fffdf8;
  border-top: 1px solid var(--studio-line);
  display: flex;
  flex-wrap: wrap;
  gap: .52rem .65rem;
  min-height: 3rem;
  padding: .4rem .6rem;
}
.studio-zoom { display: flex; gap: .2rem; margin-left: auto; }
#craft-editor .studio-zoom button { min-height: 1.9rem; padding: .17rem .42rem; }
.studio-coordinates { background: #fffdf8; color: var(--studio-note); font-size: .74rem; margin: 0; min-height: 1.8rem; padding: .12rem .6rem .42rem; }
.studio-side-heading { align-items: center; display: flex; gap: .5rem; justify-content: space-between; }
.studio-side-heading h3 { font-size: 1rem; margin: 0; }
#craft-editor .studio-side-heading button { min-height: 1.8rem; padding: .25rem .48rem; }
#studio-summary { color: var(--studio-note); font-size: .81rem; line-height: 1.43; margin: 0; }
.studio-swatches { display: flex; flex-wrap: wrap; gap: .29rem; }
#craft-editor .studio-swatches button {
  background: var(--swatch);
  border: 1px solid #a4a59a;
  border-radius: .44rem;
  height: 1.42rem;
  min-height: 1.42rem;
  min-width: 1.42rem;
  padding: 0;
  width: 1.42rem;
}
#craft-editor .studio-swatches button[aria-pressed="true"] { outline: 2px solid #375549; outline-offset: 1px; }
.studio-color-row { align-items: center; display: flex; gap: .35rem; }
.studio-material-list { display: grid; gap: .22rem; max-height: 18.2rem; overflow: auto; }
#craft-editor .studio-material-row {
  align-items: center;
  display: grid;
  font-size: .74rem;
  gap: .3rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 1.85rem;
  padding: .27rem .34rem;
  text-align: left;
}
#craft-editor .studio-material-row.is-selected { background: #edf4e8; border-color: #a4b398; }
.studio-color-chip {
  align-items: center;
  background: var(--swatch);
  border: 1px solid #a8a095;
  border-radius: .28rem;
  color: white;
  display: inline-flex;
  font-size: .68rem;
  height: 1rem;
  justify-content: center;
  text-shadow: 0 1px 3px black;
  width: 1rem;
}
.studio-material-row small { color: var(--studio-note); display: block; font-size: .65rem; font-weight: 520; }
.studio-material-actions { display: grid; gap: .23rem; grid-template-columns: 1fr 1fr; }
#craft-editor .studio-material-actions button { font-size: .7rem; min-height: 2rem; padding: .28rem .27rem; }
#craft-editor .studio-import { position: relative; text-align: center; }
#craft-editor .studio-import:focus-within { outline: 3px solid #a6493e; outline-offset: 2px; }
.studio-filet { background: #f0f5e9; border-top: 1px solid var(--studio-line); font-size: .87rem; padding: 1rem 1.15rem; }
.studio-filet summary { font-size: 1.03rem; font-weight: 770; }
.studio-filet p { margin: .65rem 0; }
.studio-rows { display: grid; gap: .4rem; list-style: none; margin: .65rem 0 0; max-height: 24rem; overflow-y: auto; padding: 0; }
.studio-rows li { background: #fffdf8; border: 1px solid var(--studio-line); border-radius: .45rem; display: grid; gap: .4rem; grid-template-columns: minmax(8rem, .6fr) 2fr; padding: .42rem .6rem; }
.studio-rows li > span:first-child { font-weight: 700; }
.studio-live {
  background: #253f36;
  border-radius: .7rem;
  bottom: 1.1rem;
  box-shadow: 0 6px 24px rgb(39 49 41 / 23%);
  color: white;
  font-size: .88rem;
  max-width: min(32rem, calc(100% - 2rem));
  padding: .75rem 1rem;
  position: fixed;
  right: 1.1rem;
  z-index: 200;
}
.studio-live.is-error { background: #884032; }
#craft-editor .studio-dialog {
  background: #fffdf8;
  border: 1px solid var(--studio-line);
  border-radius: 1rem;
  box-shadow: 0 15px 65px rgba(39, 56, 43, .25);
  color: var(--studio-ink);
  padding: 1.4rem;
  width: min(29rem, calc(100% - 1.5rem));
}
.studio-dialog::backdrop { background: rgb(38 50 44 / 38%); }
.studio-dialog h3 { font-size: 1.25rem; margin: 0 2rem .75rem 0; }
#craft-editor .studio-close { font-size: 1.25rem; min-height: 1.65rem; padding: .15rem .4rem; position: absolute; right: .8rem; top: .65rem; }
.studio-export-fields { display: grid; gap: .5rem; grid-template-columns: 1fr 1.4fr; margin-bottom: .85rem; }
.studio-export-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
#craft-editor [data-action="recolor-commit"] { margin-top: .75rem; }
@media (max-width: 1050px) {
  .studio-work { grid-template-columns: minmax(10rem, .87fr) minmax(16rem, 2fr) minmax(10rem, .8fr); }
  .studio-sources, .studio-materials { padding: .65rem; }
  .studio-tools small { display: none; }
  #craft-editor .studio-tools button { flex-basis: 1.7rem; min-height: 2rem; }
  #craft-editor .studio-tools button[data-action] { flex-basis: 1.7rem; }
}
@media (max-width: 760px) {
  .studio-work { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .studio-desk { grid-column: 1 / -1; grid-row: 2; min-height: 21rem; }
  .studio-sources, .studio-materials { border: 0; }
  .studio-materials { border-left: 1px solid var(--studio-line); }
  .studio-material-list { max-height: 11rem; }
  .studio-desk { border-top: 1px solid var(--studio-line); }
  .studio-top { align-items: start; flex-wrap: wrap; }
  .studio-top-actions { justify-content: start; }
  #craft-editor .studio-top button { min-height: 2.15rem; }
  .studio-board { min-height: 285px; }
}
@media (max-width: 380px) {
  .studio-top { display: grid; }
  .studio-top-actions .studio-muted { width: 100%; }
  .studio-sources, .studio-materials { padding: .52rem; }
  .studio-rows li { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .studio-work { grid-template-columns: minmax(0, 1fr); }
  .studio-sources { display: grid; gap: .65rem; grid-template-columns: minmax(9rem, 1fr) minmax(9rem, 1fr); }
  .studio-sources .studio-details { border: 0; padding-top: 0; }
  .studio-sources .studio-variants { grid-column: 1 / -1; }
  .studio-materials { border: 0; border-top: 1px solid var(--studio-line); grid-row: 3; }
}
@media (max-width: 370px) {
  .studio-sources { grid-template-columns: minmax(0, 1fr); }
}
