/* Studio layout. Colours and interface fonts come from Mellow UI.
   Artwork colours/fonts belong to the document and are never remapped by a theme. */
:root {
  font-family: var(--font);
  font-synthesis: none;
}
.board-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.board-controls select {
  flex: 1 1 180px;
  min-width: 0;
}
#artboards-form > .board-controls:last-child,
#outline-dialog form > .board-controls:last-child {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding: 12px 0;
  margin-bottom: 0;
  border-top: 1px solid var(--line);
}
#outline-preview {
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#outline-preview:empty {
  display: none;
}
#outline-preview svg {
  display: block;
  width: 100%;
  height: 180px;
}
.outline-preview-path {
  fill: var(--ink);
}
#outline-status,
#board-error,
#outline-dialog input {
  overflow-wrap: anywhere;
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.studio-skip {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 12px;
  background: var(--paper);
  color: var(--ink);
}
.studio-skip:focus {
  top: 18px;
}
#studio {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.studio-header {
  gap: 12px 20px;
}
.studio-header .mw-home {
  min-height: 40px;
  align-items: center;
}
.studio-header .mw-app {
  border-inline-start: 1px solid var(--line);
  padding-inline-start: 20px;
}
.studio-header .mw-app small {
  color: var(--ink-2);
}
.studio-header .mw-lang {
  min-height: 40px;
  color: var(--ink-2);
}
.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.commandbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.project-field {
  min-width: 0;
  flex: 1 1 180px;
  max-width: 260px;
}
#project-name {
  width: 100%;
  font-size: 15px;
}
.mode-picker {
  min-width: 164px;
  max-width: 180px;
}
.command-spacer {
  flex: 1;
}
.snap-toggle {
  font-size: 14px;
  color: var(--ink-2);
  padding: 0 8px;
  min-height: 42px;
}
.workspace {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 328px;
  flex: 1;
  min-height: 0;
}
.toolrail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.toolrail .btn {
  width: 54px;
  min-height: 60px;
  padding: 7px 2px;
  flex-direction: column;
  gap: 5px;
  border-color: transparent;
}
.toolrail svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toolrail small {
  font-size: 12px;
  line-height: 1.25;
  font-weight: 500;
}
.rail-divider {
  width: 30px;
  height: 1px;
  background: var(--line);
  margin: 6px;
}
.canvas-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.document-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.document-bar > span:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
#document-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#canvas-size-label {
  flex-shrink: 0;
  font-family: var(--font-num);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-2);
  flex-shrink: 0;
}
#canvas-viewport {
  position: relative;
  overflow: auto;
  min-height: 360px;
  height: calc(100dvh - 350px);
  max-height: 1100px;
  padding: 25px 38px;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  background-image: radial-gradient(var(--line) 0.7px, transparent 0.7px);
  background-size: 14px 14px;
  overscroll-behavior: contain;
  touch-action: none;
}
#artboard-shell {
  flex-shrink: 0;
  background: repeating-conic-gradient(
      var(--surface-2) 0% 25%,
      var(--paper) 0% 50%
    )
    50%/16px 16px;
  outline: 1px solid var(--line);
  position: relative;
  width: 500px;
  height: 500px;
}
#canvas {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
#canvas [data-layer]:not([data-locked="true"]) {
  cursor: move;
}
#canvas [data-handle] {
  cursor: nwse-resize;
}
#canvas [data-node],
#canvas[data-tool="pen"],
#canvas[data-tool="brush"],
#canvas[data-tool="rect"],
#canvas[data-tool="ellipse"] {
  cursor: crosshair;
}
#canvas[data-tool="text"] {
  cursor: text;
}
.empty-tip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: calc(100% - 32px);
  font-size: 14px;
  pointer-events: none;
}
.canvas-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--ink-2);
}
#tool-hint {
  flex: 1 1 240px;
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.zoom-controls .btn {
  min-width: 40px;
  padding: 6px 10px;
}
.zoom-controls output {
  min-width: 48px;
  text-align: center;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.guided-note {
  margin: 6px 20px 20px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.guided-note strong {
  font-size: 15px;
}
.guided-note p {
  font-size: 14px;
  color: var(--ink-2);
  margin: 5px 0 0;
}
.inspector {
  min-width: 0;
  border-left: 1px solid var(--line);
  max-height: calc(100dvh - 156px);
  overflow: auto;
  scrollbar-width: thin;
  background: var(--paper);
}
.properties-section {
  padding: 20px 18px 14px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.section-heading h1,
.section-heading h2 {
  font-size: 17px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-heading > span {
  font-size: 12px;
  color: var(--ink-2);
}
.field {
  gap: 6px;
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.field > input,
.field > select,
.field > textarea {
  width: 100%;
}
.field textarea {
  min-height: 85px;
}
.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 12px;
}
.field-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.color-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.color-row > input[type="text"] {
  width: 108px;
  font-family: var(--mono);
  font-size: 14px;
}
input[type="range"] {
  width: 100%;
  min-height: 40px;
  padding: 0;
  accent-color: var(--ink);
}
input[type="color"] {
  width: 42px;
  height: 42px;
  padding: 3px;
  cursor: pointer;
  background: var(--paper);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius);
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
  flex-shrink: 0;
}
.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 8px 0 14px;
  font-size: 14px;
}
.property-divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 16px 0;
}
.subheading {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 12px;
}
.property-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.property-buttons .btn {
  flex: 1 1 auto;
  font-size: 14px;
  padding: 8px;
}
.muted-note {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.65;
}
.alignment-panel,
.gradient-panel,
.layout-panel {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 4px;
}
.alignment-panel .property-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.alignment-panel .property-buttons:has([data-edit="distribute-x"]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.alignment-panel .btn {
  padding: 8px 4px;
  font-size: 13.5px;
}
.gradient-stop {
  display: flex;
  gap: 6px;
  align-items: end;
  margin: 12px 0;
}
.gradient-stop label {
  min-width: 0;
  flex: 1;
  color: var(--ink-2);
  font-size: 13px;
}
.gradient-stop input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 5px;
}
.gradient-stop .btn {
  padding: 6px;
  min-width: 40px;
}
.guide-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  align-items: center;
}
.guide-row label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.guide-row input {
  width: 100%;
}
.layers-section {
  border-top: 1px solid var(--line);
  padding: 18px 12px;
}
.layers-section .section-heading {
  padding: 0 6px;
}
.layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 6px 12px;
}
.layer-actions .btn {
  padding: 6px 10px;
  font-size: 14px;
}
.layer-actions .btn:last-child {
  margin-left: auto;
}
.layer-row {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  gap: 3px;
  margin: 4px 0;
  padding: 2px 4px;
}
.layer-row.selected {
  background: var(--surface);
  border-color: var(--ink-3);
}
.layer-row .btn {
  border-color: transparent;
  background: transparent;
  padding: 6px 4px;
  font-size: 13.5px;
}
.layer-select {
  min-width: 0;
  flex: 1;
  text-align: left;
  justify-content: flex-start;
}
.layer-select > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layer-thumb {
  display: grid;
  place-items: center;
  width: 28px;
  height: 32px;
  flex-shrink: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 16px;
}
.layer-select small {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 2px;
}
.layer-toggle {
  width: 40px;
  min-width: 40px;
  flex-shrink: 0;
}
.layer-row.is-hidden {
  opacity: 0.6;
}
.statusbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  color: var(--ink-2);
  font-size: 13px;
}
.statusbar .error {
  color: var(--bad);
}
.studio-footer {
  align-items: center;
  color: var(--ink-2);
  padding-block: 8px;
}
.studio-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}
.studio-footer .version {
  margin-inline-start: auto;
  font-family: var(--font-num);
}
#toast {
  max-width: min(580px, calc(100vw - 32px));
  line-height: 1.6;
  border-radius: var(--radius);
  z-index: 100;
}
dialog {
  max-height: calc(100dvh - 24px);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.dialog-heading h2 {
  margin: 6px 0 0;
  font-size: 24px;
}
.dialog-heading .btn {
  min-width: 40px;
  padding: 6px;
  font-size: 24px;
}
.eyebrow {
  font-size: 13px;
  color: var(--ink-2);
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.preset-grid .btn {
  display: flex;
  flex-direction: column;
  padding: 14px 6px;
  font-size: 14px;
}
.preset-grid small {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
}
.dialog-note {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
  margin: 16px 0 20px;
}
.btn.wide {
  width: 100%;
}
.export-size {
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius);
  font-family: var(--font-num);
}
.tutorial {
  padding-left: 24px;
}
.tutorial li {
  padding-left: 6px;
  margin-bottom: 20px;
  line-height: 1.7;
}
.tutorial b {
  font-size: 16px;
}
.tutorial p {
  color: var(--ink-2);
  font-size: 15px;
  margin: 6px 0;
}
details {
  border-top: 1px solid var(--line);
  padding: 14px 0;
  font-size: 15px;
  line-height: 1.75;
}
summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 40px;
  align-content: center;
}
details p {
  color: var(--ink-2);
  margin: 12px 0 0;
}
.expert-only {
  display: none;
}
body[data-mode="expert"] .expert-only {
  display: block;
}
body[data-mode="expert"] .expert-only.field-grid {
  display: grid;
}
body[data-mode="expert"] .guided-note {
  display: none;
}
body[data-mode="expert"] #canvas-viewport {
  height: calc(100dvh - 260px);
}
.export-busy {
  opacity: 0.6;
  pointer-events: none;
}
#photo-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
}
.photo-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 14px;
}
.photo-heading h2 {
  margin: 4px 0 0;
  font-size: 24px;
}
.photo-heading .btn {
  min-width: 40px;
}
.photo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 18px;
  border-bottom: 1px solid var(--line);
}
.photo-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 360px;
}
.photo-display {
  min-width: 0;
  padding: 24px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#photo-canvas {
  display: block;
  max-width: 100%;
  max-height: 50dvh;
  width: auto;
  height: auto;
  touch-action: none;
  background: repeating-conic-gradient(
      var(--surface-2) 0% 25%,
      var(--paper) 0% 50%
    )
    50%/16px 16px;
  cursor: crosshair;
}
#photo-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--ink);
}
#photo-progress[hidden] {
  display: none;
}
#photo-progress progress {
  width: min(240px, 100%);
  accent-color: var(--ink);
}
#photo-preview-status:empty {
  display: none;
}
#photo-status {
  width: 100%;
  max-width: 680px;
  min-height: 42px;
  margin: 16px 0 0;
  line-height: 1.6;
  font-size: 14px;
}
.photo-options {
  padding: 20px;
  border-left: 1px solid var(--line);
  max-height: 62dvh;
  overflow-y: auto;
}
.photo-actions,
.photo-tools,
#photo-detections {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.photo-tools {
  margin: 16px 0;
}
.photo-tools .btn {
  flex: 1 0 44%;
  font-size: 14px;
  padding: 8px;
}
#photo-detections .btn {
  font-size: 14px;
}
.photo-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  background: var(--paper);
}
#photo-info {
  color: var(--ink-2);
  font-size: 13.5px;
}
.photo-bottom > div {
  display: flex;
  gap: 8px;
}
#photo-trace-preview {
  max-width: 100%;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
}
#tone-curve {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  overflow: visible;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 16px 0;
}
#tone-curve circle {
  cursor: ns-resize;
}
[data-tone-output] {
  float: right;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 1100px) {
  .studio-header .mw-app small {
    display: none;
  }
  .workspace {
    grid-template-columns: 62px minmax(0, 1fr) 300px;
  }
  .toolrail .btn {
    width: 50px;
  }
  .commandbar {
    padding-inline: 14px;
  }
}
@media (max-width: 899px) {
  .workspace,
  .photo-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .toolrail {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
    gap: 4px;
  }
  .toolrail .btn {
    width: 46px;
    min-height: 58px;
  }
  .rail-divider {
    display: none;
  }
  .inspector {
    max-height: none;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .photo-options {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: none;
  }
  #canvas-viewport,
  body[data-mode="expert"] #canvas-viewport {
    height: 440px;
    min-height: 280px;
    max-height: 65dvh;
    padding: 20px;
  }
  #photo-canvas {
    max-height: 42dvh;
  }
}
@media (max-width: 600px) {
  .studio-header {
    gap: 12px;
  }
  .studio-header .mw-app {
    padding-inline-start: 12px;
  }
  .studio-header .mw-actions {
    width: 100%;
    justify-content: space-between;
  }
  .file-actions {
    flex: 1;
  }
  .file-actions .btn {
    font-size: 14px;
    padding: 8px 10px;
  }
  .commandbar {
    padding: 12px 14px;
    gap: 6px;
  }
  .project-field {
    flex: 1 1 100%;
    max-width: none;
  }
  .mode-picker {
    flex: 1;
    max-width: none;
  }
  .commandbar .btn {
    font-size: 14px;
    padding: 8px 10px;
  }
  .commandbar .command-spacer {
    display: none;
  }
  .document-bar {
    padding: 14px 16px 10px;
    flex-wrap: wrap;
  }
  .canvas-footer {
    padding: 12px 16px;
  }
  .guided-note {
    margin: 6px 16px 16px;
  }
  .statusbar {
    padding-inline: 16px;
  }
  .studio-footer .version {
    margin-inline-start: 0;
  }
  .preset-grid {
    grid-template-columns: 1fr;
  }
  .preset-grid .btn {
    flex-direction: row;
    justify-content: space-between;
  }
  #photo-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
  .photo-heading {
    padding: 16px;
  }
  .photo-tabs {
    padding: 0 16px 16px;
    gap: 6px;
  }
  .photo-tabs .btn {
    font-size: 14px;
    padding: 8px 10px;
  }
  .photo-display,
  .photo-options {
    padding: 16px;
  }
  .photo-bottom {
    padding: 12px 16px;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
  }
  .photo-bottom > div {
    margin-inline-start: auto;
  }
  .photo-bottom > span {
    flex: 1 1 100%;
  }
}
@media (pointer: coarse) {
  .btn,
  .btn.small,
  .layer-row .btn {
    min-height: 40px;
    min-width: 40px;
  }
  .btn.icon,
  .layer-toggle,
  .gradient-stop .btn,
  .guide-row .btn,
  .dialog-heading .btn {
    min-width: 40px;
  }
  .input,
  .select,
  .textarea {
    font-size: 16px;
  }
  .check,
  .field-inline,
  .snap-toggle {
    min-height: 40px;
  }
}
#print-report {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.pattern-dialog{width:min(680px,calc(100vw - 24px));max-height:90dvh;overflow:auto}.pattern-preview{display:block;width:100%;height:240px;background:var(--surface);border:1px solid var(--line);margin:12px 0}.pattern-dialog [hidden]{display:none!important}
