/* GROTESK Studio — composed colour, portable projects and a persistent mobile canvas.
   This layer deliberately inherits the original paper / forest / acid tokens. */
:root {
  --studio-sheet: clamp(210px, 35dvh, 360px);
  --studio-dock: 64px;
  --editor-ease: cubic-bezier(0.2, 0, 0, 1);
}

/* Quiet application chrome leaves the poster as the strongest colour surface. */
body[data-view="studio"] .prompt { display: none; }
body:not([data-view="studio"]) .project-strip,
body:not([data-view="studio"]) .mobile-studio-nav { display: none; }
.studio { grid-template-columns: 232px minmax(0, 1fr) 320px; }
.project-strip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 8px 20px;
  border-block-end: 1px solid var(--line);
  background: var(--panel);
}
.project-name { flex: 1; min-width: 0; }
.project-name input,
input.project-name {
  display: block;
  width: 100%;
  max-width: 460px;
  min-width: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -.015em;
  text-overflow: ellipsis;
}
.project-name input:hover,
input.project-name:hover { border-color: var(--line); background: var(--paper); }
.project-name input:focus,
input.project-name:focus { background: var(--paper); border-color: var(--moss); }
.project-name label,
.project-name > small { display: block; font-size: 11px; color: var(--muted); padding-inline-start: 10px; }
.save-state { color: var(--muted); font-size: 12px; line-height: 1.35; white-space: nowrap; }
.save-state[data-state="saved"] { color: var(--moss); }
.save-state[data-state="error"] { color: var(--signal); }
.project-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.project-actions .btn { min-height: 36px; padding-inline: 11px; }
.st-bar { padding: 8px 14px; }
.st-status { min-width: 0; }
.st-status > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-center { background: var(--paper); }
.st-stage {
  padding: 26px;
  background-image: radial-gradient(circle, #1f241b17 .7px, transparent .7px);
  background-size: 12px 12px;
}
.st-art { box-shadow: 0 12px 30px #1f241b20, 0 1px 3px #1f241b1f; }
.st-hint { padding-block: 8px 10px; font-size: 11.5px; }
.st-tabs { padding-inline: 10px; }
.st-tabs button { flex: 1; padding-inline: 9px; font-size: 13px; }
.st-panel { padding: 18px 16px 36px; scrollbar-gutter: stable; }
.st-sec { padding: 16px 14px 18px; }
.st-sec h2 { align-items: flex-start; gap: 8px; }
.st-sec h2 small { font-size: 11px; text-align: end; }
.layers { gap: 5px; }
.layer[aria-pressed="true"] { background: #e4edcd; border-color: #b9c993; }
.layer-ops { margin-block-start: 18px; }

/* Search is a first action, rather than another small facet. */
.mood { margin-block: 12px 8px; }
.mood input { min-height: 44px; background: var(--panel); border-color: #b7bfaa; }
.mood input:focus-visible { outline-offset: 2px; }
.mood svg { top: 14px; }
.mood-note { line-height: 1.45; }
.fgroup summary { min-height: 42px; }
.f-foot { gap: 10px; }

/* Inspector sections keep advanced controls one deliberate disclosure away. */
.inspector-intro { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.inspector-intro strong { color: var(--ink); font-weight: 600; }
.panel-section { padding-block: 0 4px; margin-block-end: 16px; border-block-end: 1px solid var(--line-2); }
.panel-section > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding-block: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 620;
}
.panel-section > summary::-webkit-details-marker { display: none; }
.panel-section > summary::after {
  content: "+";
  flex: none;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 19px;
  line-height: 1;
  color: var(--muted);
}
.panel-section[open] > summary::after { content: "−"; }
.panel-section[open] > summary { margin-block-end: 10px; }
.panel-section > summary small { margin-inline-start: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
.panel-section .ctl:last-child { margin-block-end: 14px; }
.editor-notice {
  margin-block: 12px;
  padding: 11px 12px;
  border-inline-start: 3px solid var(--moss);
  border-radius: 0 var(--r) var(--r) 0;
  background: #e7eddc;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.editor-notice p { margin: 0; }
.editor-notice p + p { margin-block-start: 8px; }
.editor-notice[data-tone="error"],
.editor-notice.error { background: #f9e3dc; color: #7c2a18; border-color: var(--signal); }
.editor-notice .btn { margin-block-start: 10px; }

/* Gradient stops expose their actual position and preserve a 44px pointer target. */
:is(.gradient-editor, .gt-gradient) { display: grid; gap: 14px; margin-block: 12px 20px; }
:is(.gradient-editor, .gt-gradient) .ctl { margin: 0; }
:is(.gradient-rail, .gt-gradient-strip) {
  position: relative;
  height: 30px;
  margin: 10px 22px 18px;
  border-radius: 4px;
  border: 1px solid #1f241b33;
  isolation: isolate;
  touch-action: none;
}
:is(.gradient-rail, .gt-gradient-strip)::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px #ffffff40;
}
:is(.gradient-stop, .gt-stop) {
  position: absolute;
  top: 7px;
  width: 44px;
  height: 44px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  touch-action: none;
  cursor: ew-resize;
  z-index: 1;
}
:is(.gradient-stop, .gt-stop)::before {
  content: "";
  width: 17px;
  height: 24px;
  border: 2px solid var(--panel);
  border-radius: 4px;
  background: var(--stop-color, var(--c, var(--ink)));
  box-shadow: 0 0 0 1px #1f241b88, 0 2px 5px #1f241b22;
}
:is(.gradient-stop, .gt-stop)[aria-pressed="true"],
:is(.gradient-stop, .gt-stop).active { z-index: 2; }
:is(.gradient-stop, .gt-stop)[aria-pressed="true"]::before,
:is(.gradient-stop, .gt-stop).active::before { outline: 2px solid var(--ink); outline-offset: 2px; }
:is(.gradient-stop, .gt-stop):focus-visible { outline-offset: 0; }
:is(.gradient-stop, .gt-stop) > span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
:is(.stop-controls, .gt-stop-row) { display: grid; grid-template-columns: 44px minmax(72px, 1fr) 68px 36px; gap: 6px; align-items: end; }
:is(.stop-controls, .gt-stop-row) label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 11px; }
:is(.stop-controls, .gt-stop-row) input { min-width: 0; width: 100%; height: 38px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
:is(.stop-controls, .gt-stop-row) input[type="text"],
:is(.stop-controls, .gt-stop-row) input[type="number"] { padding-inline: 7px; font-family: var(--mono); font-size: 12px; }
:is(.stop-controls, .gt-stop-row) input[type="color"] { padding: 4px; cursor: pointer; }
:is(.stop-controls, .gt-stop-row) input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
:is(.stop-controls, .gt-stop-row) input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
:is(.stop-controls, .gt-stop-row) > button { width: 36px; height: 38px; display: grid; place-items: center; border-radius: var(--r); color: var(--muted); }
:is(.stop-controls, .gt-stop-row) > button:hover { background: #f6ded6; color: #8d301f; }
:is(.gradient-editor, .gt-gradient) > .btn,
:is(.gradient-editor, .gt-gradient) > .link-btn { justify-self: start; }
:is(.gradient-presets, .gt-presets) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
:is(.gradient-preset, .gt-presets > button) {
  min-height: 44px;
  border: 1px solid #1f241b26;
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
  background: var(--gradient, var(--g, var(--sunk)));
}
:is(.gradient-preset, .gt-presets > button)::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px #ffffff2e; pointer-events: none; }
:is(.gradient-preset, .gt-presets > button)[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
:is(.gradient-preset, .gt-presets > button) span { display: block; position: relative; z-index: 1; padding: 6px; font-size: 10px; font-weight: 600; }

/* A palette describes a relationship between colours, not a set of loose swatches. */
:is(.palette-grid, .gt-palette-list) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-block: 14px 20px; }
:is(.palette-card, .gt-palette) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: start;
  background: var(--panel);
  overflow: hidden;
}
:is(.palette-card, .gt-palette):hover { border-color: #8f9d7b; }
:is(.palette-card, .gt-palette)[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: var(--paper); }
.palette-colors { display: flex; flex: none; height: 46px; border-radius: 3px; overflow: hidden; outline: 1px solid #0000000d; outline-offset: -1px; }
.palette-colors > * { flex: 1; background: var(--c); }
.palette-colors > :first-child { flex: 2; }
:is(.palette-card, .gt-palette) > b,
:is(.palette-card, .gt-palette) > strong,
:is(.palette-card, .gt-palette) > span:not(.palette-colors) { display: block; padding: 9px 4px 5px; font-size: 11.5px; font-weight: 600; line-height: 1.35; }
:is(.palette-card, .gt-palette) > small { display: block; padding: 0 4px 5px; color: var(--muted); font-size: 10.5px; }
:is(.palette-card, .gt-palette) .palette-colors span { padding: 0; }
.spray-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 12px 16px; }
.spray-presets button { flex: 1; min-width: 70px; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); font-size: 12px; }
.spray-presets button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--panel); }

/* Decision dialogs put comparable previews and the final action together. */
:is(.dialog-wide, .gt-dialog) { width: min(920px, calc(100vw - 32px)); }
:is(.dialog-wide, .gt-dialog) .dlg { width: 100%; }
:is(.dialog-wide, .gt-dialog) .dlg-head { align-items: flex-start; padding: 20px 22px 16px; }
:is(.dialog-wide, .gt-dialog) .dlg-head h2 { font-size: 23px; line-height: 1.2; letter-spacing: -.035em; }
:is(.dialog-wide, .gt-dialog) .dlg-body { padding-inline: 22px; }
:is(.dialog-actions, .gt-dialog-actions) { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 20px; border-block-start: 1px solid var(--line); background: var(--panel); }
:is(.dialog-actions, .gt-dialog-actions) > p { flex: 1; margin: 0; color: var(--muted); font-size: 12px; }
:is(.variant-locks, .gt-locks) { display: flex; gap: 10px 18px; align-items: center; flex-wrap: wrap; margin-block: 0 18px; padding: 12px 14px; background: var(--paper); border-radius: var(--r); }
:is(.variant-locks, .gt-locks) label { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 12.5px; }
:is(.variant-locks, .gt-locks) > span,
:is(.variant-locks, .gt-locks) > small { color: var(--muted); font-size: 12px; }
:is(.variant-locks, .gt-locks) input { accent-color: var(--moss); }
:is(.variant-grid, .gt-variant-grid) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
:is(.variant-card, .gt-variant) { display: flex; flex-direction: column; min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); text-align: start; }
:is(.variant-card, .gt-variant):hover { border-color: #869571; }
:is(.variant-card, .gt-variant)[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
:is(.variant-card, .gt-variant) canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: contain; border-radius: 3px; background: var(--sunk); outline: 1px solid #00000012; outline-offset: -1px; }
:is(.variant-card, .gt-variant) > span,
:is(.variant-card, .gt-variant) > b,
:is(.variant-card, .gt-variant) > strong { display: block; margin: 10px 5px 4px; font-size: 13px; font-weight: 600; line-height: 1.35; }
:is(.variant-card, .gt-variant) > small { margin: 0 5px 6px; color: var(--muted); font-size: 12px; }
:is(.variant-card, .gt-variant) .btn { margin: 10px 3px 3px; }
:is(.export-options, .gt-export-options) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; margin-block: 16px 20px; }
:is(.export-options, .gt-export-options) > label { display: grid; gap: 7px; min-width: 0; color: var(--ink-2); font-size: 13px; }
:is(.export-options, .gt-export-options) select,
:is(.export-options, .gt-export-options) input:not([type="checkbox"]) { min-width: 0; width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--paper); }
:is(.export-options, .gt-export-options) .switch-line { grid-column: 1 / -1; display: flex; }
:is(.export-options, .gt-export-options) output { font-family: var(--mono); font-size: 12px; }
#dlg-missing-fonts .dlg-body { overflow-wrap: anywhere; }
#dlg-missing-fonts li { padding-block: 6px; }
#dlg-projects .project-actions { justify-content: flex-end; flex-wrap: wrap; }
.mobile-studio-nav { display: none; }

/* Press feedback is brief and limited to infrequent preset choices. */
:is(.palette-card, .gt-palette),
:is(.gradient-preset, .gt-presets > button),
:is(.variant-card, .gt-variant) { transition: border-color 120ms var(--editor-ease), background-color 120ms var(--editor-ease), scale 120ms var(--editor-ease); }
:is(.palette-card, .gt-palette):active,
:is(.gradient-preset, .gt-presets > button):active { scale: .96; }

@media (min-width: 941px) and (max-width: 1120px) {
  .studio { grid-template-columns: 212px minmax(0, 1fr) 300px; }
  .st-sec { padding-inline: 12px; }
  .st-panel { padding-inline: 12px; }
  .st-bar { gap: 5px; padding-inline: 10px; }
  .st-bar .btn { padding-inline: 9px; }
  .st-bar .st-status { display: none; }
  .st-hint { font-size: 11px; }
}

/* The compact workbench is a viewport, with independently scrolling inspectors.
   The dock changes panes; it never pushes the canvas outside the viewport. */
@media (max-width: 940px) {
  body[data-view="studio"] { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
  body[data-view="studio"] .app { height: 100dvh; min-height: 0; overflow: hidden; padding-block-end: calc(var(--studio-dock) + env(safe-area-inset-bottom, 0px)); }
  body[data-view="studio"] .top { position: relative; height: 60px; min-height: 60px; }
  .project-strip { min-height: 56px; padding: 6px 12px; gap: 8px; }
  .project-name input,
  input.project-name { min-height: 42px; font-size: 16px; padding-inline: 7px; }
  .project-name > small,
  .project-name label { padding-inline-start: 7px; }
  .project-actions .btn { min-width: 44px; min-height: 44px; }
  .save-state { max-width: 110px; white-space: normal; font-size: 11px; }
  body[data-view="studio"] .studio { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) var(--studio-sheet); min-height: 0; overflow: hidden; }
  body[data-view="studio"] .st-center { grid-area: 1 / 1; order: initial; min-height: 0; overflow: hidden; }
  body[data-view="studio"] .st-stage { flex: 1; min-height: 0; height: auto; padding: 17px 25px; }
  body[data-view="studio"] .st-bar { flex: none; min-height: 52px; flex-wrap: nowrap; gap: 4px; padding: 4px 12px; }
  body[data-view="studio"] .st-bar .btn,
  body[data-view="studio"] .st-bar .icon-btn { min-height: 44px; }
  body[data-view="studio"] .st-bar .icon-btn { width: 44px; height: 44px; flex: none; }
  body[data-view="studio"] .st-hint { display: none; }
  body[data-view="studio"] .st-right,
  body[data-view="studio"] .st-left { grid-area: 2 / 1; order: initial; min-height: 0; max-height: none; border: 0; border-block-start: 1px solid #bec8af; border-radius: 14px 14px 0 0; background: var(--panel); overflow: hidden; }
  body[data-view="studio"] .st-right { display: flex; }
  body[data-view="studio"] .st-left { display: none; }
  body[data-view="studio"] .studio[data-mobile-panel="layers"] .st-left { display: block; overflow-y: auto; }
  body[data-view="studio"] .studio[data-mobile-panel="layers"] .st-right { display: none; }
  body[data-view="studio"] .st-tabs { display: none; }
  body[data-view="studio"] .st-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 17px 18px 28px; overscroll-behavior: contain; scrollbar-gutter: stable; }
  body[data-view="studio"] .st-panel > .inspector-intro { font-size: 13px; }
  body[data-view="studio"] .st-left .st-sec { padding-inline: 18px; }
  body[data-view="studio"] .st-left .st-sec:first-child { padding-block-start: 18px; }
  .st-left .templates { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-left .tpl span { min-height: 36px; padding-block: 9px; }
  .layer { min-height: 52px; grid-template-columns: 30px minmax(0, 1fr) 44px; }
  .layer .vis { width: 44px; height: 44px; }
  .mobile-studio-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 35;
    min-height: calc(var(--studio-dock) + env(safe-area-inset-bottom, 0px));
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    gap: 6px;
    background: var(--ink);
    color: #dfe5d2;
    border-block-start: 1px solid #ffffff16;
  }
  .mobile-studio-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; padding: 4px 6px; border-radius: 6px; font-size: 11px; font-weight: 550; line-height: 1.2; }
  .mobile-studio-nav button svg { width: 20px; height: 20px; }
  .mobile-studio-nav button[aria-pressed="true"] { background: var(--acid); color: var(--acid-ink); }
  .mobile-studio-nav button:focus-visible { outline-color: var(--acid); }
  .mobile-studio-nav button[aria-pressed="true"]:focus-visible { outline-color: var(--panel); }
  body[data-view="studio"] .toast { bottom: calc(var(--studio-dock) + env(safe-area-inset-bottom, 0px) + 14px); }
  .inspector-intro { margin-block-end: 14px; }
  .ctl select,
  .ctl input[type="text"],
  .ctl input[type="number"],
  .ctl textarea { font-size: 16px; }
  .ctl select,
  .ctl input[type="text"],
  .ctl input[type="number"] { min-height: 44px; }
  .ctl textarea { min-height: 90px; }
  .ctl input[type="range"] { min-height: 32px; }
  .ctl .seg { display: flex; }
  .ctl .seg button { flex: 1; min-height: 44px; }
  :is(.stop-controls, .gt-stop-row) { grid-template-columns: 44px minmax(80px, 1fr) 78px 44px; gap: 8px; }
  :is(.stop-controls, .gt-stop-row) input,
  :is(.stop-controls, .gt-stop-row) > button { height: 44px; }
  :is(.stop-controls, .gt-stop-row) > button { width: 44px; }
  :is(.stop-controls, .gt-stop-row) input[type="text"],
  :is(.stop-controls, .gt-stop-row) input[type="number"] { font-size: 16px; padding-inline: 7px; }
  :is(.gradient-editor, .gt-gradient) { gap: 16px; }
  :is(.gradient-presets, .gt-presets) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  :is(.gradient-preset, .gt-presets > button) { min-height: 48px; }
  :is(.palette-grid, .gt-palette-list) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .palette-colors { height: 52px; }
  :is(.palette-card, .gt-palette) > b,
  :is(.palette-card, .gt-palette) > strong,
  :is(.palette-card, .gt-palette) > span:not(.palette-colors) { font-size: 12px; }
  .spray-presets button,
  .panel-section > summary,
  .layer-ops .btn,
  .add-row .btn { min-height: 44px; }
  .swatches { gap: 8px; }
  .swatches button,
  .swatches input[type="color"] { width: 36px; height: 36px; }
  :is(.dialog-wide, .gt-dialog) .dlg-head { padding: 18px 16px 14px; }
  :is(.dialog-wide, .gt-dialog) .dlg-body { padding-inline: 16px; }
  :is(.dialog-actions, .gt-dialog-actions) { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  :is(.dialog-actions, .gt-dialog-actions) .btn { min-height: 44px; }
  .dlg-head .icon-btn { min-width: 44px; min-height: 44px; }
  :is(.variant-locks, .gt-locks) label { min-height: 32px; }
  :is(.variant-grid, .gt-variant-grid) { gap: 12px; }
  :is(.variant-card, .gt-variant) { padding: 5px; border-radius: 8px; }
  :is(.variant-card, .gt-variant) > span,
  :is(.variant-card, .gt-variant) > b,
  :is(.variant-card, .gt-variant) > strong { font-size: 12px; }
  :is(.export-options, .gt-export-options) select,
  :is(.export-options, .gt-export-options) input:not([type="checkbox"]) { min-height: 44px; font-size: 16px; }
  .mood input,
  .fp-top input { font-size: 16px; }
}

@media (max-width: 520px) {
  .project-strip { gap: 6px; padding-inline: 10px; }
  .project-strip .project-actions .lbl { display: none; }
  .project-strip .save-state { max-width: 84px; font-size: 10.5px; }
  body[data-view="studio"] .st-bar .st-status { display: none; }
  body[data-view="studio"] .st-bar { padding-inline: 9px; }
  body[data-view="studio"] .st-bar .btn { padding-inline: 10px; }
  body[data-view="studio"] .st-panel { padding-inline: 14px; }
  :is(.palette-grid, .gt-palette-list) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-left .templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(.dialog-wide, .gt-dialog) .dlg-head h2 { font-size: 20px; }
  :is(.dialog-actions, .gt-dialog-actions) .btn.primary { flex: 1; }
  :is(.variant-locks, .gt-locks) { gap: 6px 12px; padding: 10px; }
  :is(.variant-locks, .gt-locks) > span { flex-basis: 100%; }
  :is(.variant-grid, .gt-variant-grid) { gap: 10px; }
  :is(.variant-card, .gt-variant) > small { font-size: 11px; }
}

/* On short landscape screens the inspector moves beside, rather than over, the art. */
@media (max-width: 940px) and (max-height: 590px) and (orientation: landscape) {
  body[data-view="studio"] .top { min-height: 52px; height: 52px; }
  .project-strip { min-height: 48px; padding-block: 3px; }
  body[data-view="studio"] .studio { grid-template-columns: minmax(0, 1fr) minmax(260px, 40%); grid-template-rows: minmax(0, 1fr); }
  body[data-view="studio"] .st-right,
  body[data-view="studio"] .st-left { grid-area: 1 / 2; border-radius: 0; border-block-start: 0; border-inline-start: 1px solid var(--line); }
  body[data-view="studio"] .st-stage { padding: 14px 24px; }
  :is(.palette-grid, .gt-palette-list) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-studio-nav button { flex-direction: row; gap: 8px; min-height: 42px; }
  .mobile-studio-nav { --studio-dock: 54px; min-height: calc(54px + env(safe-area-inset-bottom, 0px)); }
  body[data-view="studio"] .app { --studio-dock: 54px; }
}

@media (hover: none) and (pointer: coarse) {
  .chip { min-height: 44px; }
  .row-act button,
  .icon-btn,
  .pill-btn { min-width: 44px; min-height: 44px; }
  .switch-line { min-height: 44px; }
  .fgroup summary { min-height: 48px; }
  .selbox i::before { content: ""; position: absolute; inset: -15px; border-radius: 50%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  :is(.palette-card, .gt-palette),
  :is(.gradient-preset, .gt-presets > button),
  :is(.variant-card, .gt-variant),
  .filters,
  .switch,
  .switch::after,
  .fgroup summary::after { transition: none !important; }
  :is(.palette-card, .gt-palette):active,
  :is(.gradient-preset, .gt-presets > button):active { scale: 1; }
}

/* Imported projects and missing-font recovery share the editor's native dialogs. */
.list.fit-samples .sample { white-space: nowrap; display: block; -webkit-line-clamp: unset; }
.project-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.project-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.project-card h3 { margin: 0 0 5px; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.project-card-preview { display: grid; place-items: center; min-height: 110px; padding: 16px; margin-block-end: 13px; border-radius: 4px; overflow: hidden; line-height: 1.1; text-align: center; outline: 1px solid #0000000d; outline-offset: -1px; }
.project-card-preview canvas { display: block; width: 100%; height: auto; }
.project-card-meta { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.project-card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.project-card-actions .btn { min-height: 36px; }
.missing-font-row { display: grid; gap: 7px; padding-block: 15px; border-block-end: 1px solid var(--line-2); }
.missing-font-row strong { font-size: 15px; }
.missing-font-row small { color: var(--muted); font-size: 12px; }
.missing-font-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-block-start: 5px; }
.missing-font-actions select { flex: 1; min-width: 120px; min-height: 38px; padding-inline: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.project-error { padding: 10px 12px; border-radius: var(--r); background: #f9e3dc; color: #7c2a18; font-size: 13px; }
.gt-gradient-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gt-gradient-row > label { flex: 1; min-width: 90px; }
.gt-stops-list { display: grid; gap: 10px; }
.gt-stop.is-active { z-index: 3; }
.gt-stop.is-active::before { outline: 2px solid var(--ink); outline-offset: 2px; }
.gt-spray-fields { display: grid; gap: 15px; margin-block: 18px; }
.gt-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; min-width: 0; font-size: 12.5px; }
.gt-field output { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.gt-field input[type=range] { grid-column: 1 / -1; width: 100%; }
.gt-note { margin: 8px 0 16px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.gt-dialog { max-height: calc(100dvh - 40px); overflow: auto; }
.gt-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; border-block-end: 1px solid var(--line); }
.gt-dialog-head h2 { margin: 0; font-size: 23px; line-height: 1.2; letter-spacing: -.035em; }
.gt-dialog-head p { margin: 7px 0 0; max-width: 58ch; color: var(--muted); font-size: 13px; }
.gt-dialog-head button { flex: none; }
.gt-dialog-body { padding: 18px 22px 24px; }
.gt-dialog-actions { position: sticky; bottom: 0; z-index: 2; }
.gt-variant-preview { width: 100%; min-width: 0; }
@media (max-width: 940px) {
  .project-card-actions .btn, .missing-font-actions .btn, .missing-font-actions select { min-height: 44px; }
  .missing-font-actions select { font-size: 16px; }
  .gt-dialog-head { padding: 18px 16px 14px; }
  .gt-dialog-head .icon-btn { min-width: 44px; min-height: 44px; }
  .gt-dialog-body { padding: 16px 16px 20px; }
  .gt-gradient-row input, .gt-gradient-row select { font-size: 16px; min-height: 44px; }
  .gt-field input[type=range] { min-height: 32px; }
}
@media (max-width: 520px) {
  .project-list { grid-template-columns: minmax(0, 1fr); }
  .gt-dialog-head h2 { font-size: 20px; }
}
@media (hover: none) and (pointer: coarse) {
  .btn, .btn.small, .seg button, .tabs button, .modes a { min-height: 44px; }
  .modes a { display: inline-flex; align-items: center; }
  .swatches button, .swatches input[type="color"] { width: 44px; height: 44px; }
  .menu button { min-height: 44px; }
}

/* Final DOM integration: named projects, native canvas handles and creative tools. */
.project-identity { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; flex: 1; min-width: 0; }
.project-kicker { grid-column: 1; grid-row: 1 / 3; color: var(--moss); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; white-space: nowrap; }
.project-identity input.project-name { grid-column: 2; width: 100%; max-width: 480px; min-height: 32px; padding-block: 4px; }
.project-identity .save-state { grid-column: 2; max-width: none; padding-inline-start: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.render-notice { flex: none; max-height: 96px; overflow-y: auto; margin: 8px 14px 0; }
.selbox button[data-h] { position: absolute; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; pointer-events: auto; touch-action: none; }
.selbox button[data-h]::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--acid); }
.selbox button[data-h="scale"] { right: -22px; bottom: -22px; cursor: nwse-resize; }
.selbox button[data-h="rotate"] { left: calc(50% - 22px); top: -44px; cursor: grab; }
.selbox button[data-h="rotate"]::after { content: ""; position: absolute; width: 1.5px; height: 16px; left: 21px; top: 29px; background: var(--acid); }
.selbox button[data-h]:focus-visible { outline: 2px solid var(--acid); outline-offset: 1px; box-shadow: 0 0 0 4px var(--ink); }
.mobile-studio-nav button > span[aria-hidden="true"] { height: 20px; display: grid; place-items: center; font-size: 18px; line-height: 1; font-weight: 600; }
.gt-gradient { gap: 12px; }
.gt-gradient > .gt-note { margin: 0; font-size: 11.5px; }
.gt-gradient-row { flex-wrap: nowrap; min-width: 0; }
.gt-gradient-row > label { flex: none; min-width: 0; color: var(--muted); font-size: 12px; }
.gt-gradient-row > select { flex: 1; min-width: 0; }
.gt-gradient-row input[type="text"], .gt-gradient-row select { height: 38px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); padding-inline: 9px; font-size: 12px; }
.gt-gradient-row input[type="text"] { width: 100%; min-width: 0; flex: 1; }
.gt-gradient-row > .btn { flex: none; }
.gt-gradient .gt-position { position: relative; display: block; }
.gt-position input[type="number"] { width: 100%; padding-inline-end: 18px; appearance: textfield; -moz-appearance: textfield; }
.gt-position input[type="number"]::-webkit-inner-spin-button,
.gt-position input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.gt-position > span { position: absolute; inset-inline-end: 7px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 11px; pointer-events: none; }
.gt-stop-row input[aria-invalid="true"] { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); background: #fff2ed; }
.gt-stop-row input[aria-invalid="true"]:focus-visible { outline-color: var(--signal); }
.gt-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gt-presets > button { display: flex; flex-direction: column; gap: 6px; min-height: 0; padding: 4px; border-color: var(--line); background: var(--panel); text-align: start; }
.gt-presets > button > span { display: block; width: 100%; height: 30px; padding: 0; border-radius: 3px; box-shadow: inset 0 0 0 1px #0000000d; }
.gt-presets > button > small { padding: 0 2px 3px; color: var(--ink-2); font-size: 10px; line-height: 1.3; }
.gt-custom-presets { display: grid; gap: 6px; }
.gt-custom-presets > div { display: flex; min-width: 0; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.gt-custom-preset { display: flex; flex: 1; min-width: 0; align-items: center; gap: 8px; padding-inline: 4px; font-size: 12px; text-align: start; overflow-wrap: anywhere; }
.gt-custom-preset > i { display: block; width: 34px; height: 26px; flex: none; border-radius: 3px; box-shadow: inset 0 0 0 1px #0000000d; }
.gt-remove { display: grid; place-items: center; width: 36px; min-height: 36px; flex: none; border-radius: 4px; color: var(--muted); font-size: 20px; }
.gt-remove:not(:disabled):hover { color: #7c2a18; background: #f6ded6; }
.gt-field { display: block; }
.gt-field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-block-end: 7px; }
.gt-field output { flex: none; }
.gt-field input[type="range"] { display: block; width: 100%; margin-inline: 0; }
.gt-spray-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 12px 16px; }
.gt-spray-presets .btn { flex: 1; min-width: 74px; padding-inline: 9px; font-size: 11.5px; white-space: normal; }
.gt-palette > .gt-palette-colors { display: flex; height: 48px; flex: none; padding: 0; border-radius: 3px; overflow: hidden; box-shadow: inset 0 0 0 1px #0000000d; }
.gt-palette-colors > i { display: block; flex: 1; }
.gt-palette-colors > i:first-child { flex: 2; }
.gt-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.gt-check input[type="checkbox"] { width: 16px; height: 16px; flex: none; margin: 1px 0 0; accent-color: var(--moss); }
.gt-locks { min-inline-size: 0; border: 1px solid var(--line); padding-block: 10px 12px; }
.gt-locks legend { padding-inline: 5px; color: var(--muted); font-size: 11.5px; }
.gt-locks label { font-size: 12px; }
.gt-dialog-head .eyebrow { display: block; margin-block-end: 5px; color: var(--moss); font-family: var(--mono); font-size: 10px; letter-spacing: .045em; }
.gt-variant-preview { position: relative; }
.gt-variant-number { position: absolute; top: 10px; inset-inline-start: 10px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--acid); font-family: var(--mono); font-size: 10px; }
.gt-variant-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px 5px 5px; }
.gt-variant-controls label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 11px; }
.gt-variant-controls select { min-width: 0; width: 100%; height: 36px; border: 1px solid var(--line); border-radius: var(--r); padding-inline: 6px; background: var(--panel); color: var(--ink); font-size: 12px; }
.gt-variant-controls > .gt-note { grid-column: 1 / -1; margin: 0; font-size: 11px; }
.gt-variant-controls > .btn { grid-column: 1 / -1; min-width: 0; margin: 0; padding-inline: 8px; white-space: normal; }
.gt-export-dialog { width: min(780px, calc(100vw - 32px)); }
.gt-export-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .85fr); align-items: start; gap: 26px; }
.gt-export-preview { display: grid; place-items: center; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: repeating-conic-gradient(var(--paper) 0% 25%,var(--panel) 0% 50%) 0 0 / 16px 16px; }
.gt-export-preview canvas { display: block; max-width: 100%; max-height: 48dvh; width: auto; height: auto; box-shadow: 0 6px 18px #1f241b18; }
.gt-export-options { display: flex; flex-direction: column; gap: 18px; margin: 0; }
.gt-export-options fieldset { display: grid; min-inline-size: 0; gap: 8px; margin: 0; padding: 0; border: 0; }
.gt-export-options legend { margin-block-end: 10px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.gt-export-options .gt-export-size { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.gt-export-size:has(input:checked) { background: #e4edcd; border-color: #a6b78a; }
.gt-export-options .gt-export-size input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; border: 0; flex: none; accent-color: var(--moss); }
.gt-export-size > span { font-size: 13px; font-weight: 550; }
.gt-export-size small { display: block; margin-block-start: 4px; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); }
.gt-export-options > .gt-check { display: flex; flex-direction: row; font-size: 12.5px; }
.gt-export-options .gt-note { margin: 0; }
.gt-export-options input[type="checkbox"] { min-height: 0; }
.missing-font-row h3 { margin: 0; font-size: 15px; }
.missing-font-row .project-card-meta { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 940px) {
  .project-identity { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .project-kicker { display: none; }
  .project-identity input.project-name { grid-column: 1; min-height: 44px; padding: 5px 7px 0; font-size: 16px; }
  .project-identity .save-state { grid-column: 1; padding-inline-start: 7px; padding-block-end: 3px; max-width: none; font-size: 10px; }
  .gt-gradient-row input[type="text"], .gt-gradient-row select { min-height: 44px; font-size: 16px; }
  .gt-gradient-row > .btn { min-height: 44px; }
  .gt-spray-presets .btn { min-height: 44px; font-size: 12px; }
  .gt-remove { width: 44px; min-height: 44px; }
  .gt-check { min-height: 44px; align-items: center; font-size: 13px; }
  .gt-variant-controls select { min-height: 44px; font-size: 16px; }
  .gt-export-options .gt-check { align-items: center; }
}
@media (max-width: 620px) {
  .gt-variant-controls { grid-template-columns: minmax(0, 1fr); }
  .gt-variant-controls > .btn { font-size: 12px; }
  .gt-export-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .gt-export-preview { padding: 12px; }
  .gt-export-preview canvas { max-height: 26dvh; max-width: 100%; }
  .gt-export-options fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gt-export-options legend { grid-column: 1 / -1; }
  .gt-export-options .gt-export-size { padding: 10px; min-height: 68px; }
  .gt-export-size > span { font-size: 12px; }
}
@media (max-width: 940px) and (max-height: 590px) and (orientation: landscape) {
  .project-identity { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; }
  .project-identity .save-state { grid-column: 2; grid-row: 1; padding: 0; }
  .project-identity input.project-name { padding-block: 5px; }
}
@media (max-width: 940px) and (max-height: 590px) and (orientation: landscape) {
  .gt-stop-row { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; }
  .gt-stop-row > input[type="color"] { grid-area: 1 / 1; width: 44px; }
  .gt-stop-row > input[type="text"] { grid-area: 1 / 2; font-size: 16px; }
  .gt-stop-row > .gt-position { grid-area: 2 / 1 / 3 / 3; }
  .gt-stop-row > .gt-position input { font-size: 16px; }
  .gt-stop-row > button { grid-area: 1 / 3 / 3 / 4; width: 44px; align-self: start; }
}
