body[data-page="home"] .home-heading { padding-block: clamp(25px, 4vw, 56px) 23px; }
.start-grid .start-card { min-height: 156px; padding: clamp(15px, 1.6vw, 23px); }
.start-grid .start-icon { margin-bottom: 15px; }
.start-grid .start-card strong { margin-bottom: 6px; }
.start-grid .start-description { margin: 0; line-height: 1.5; }
.home-projects { margin-top: clamp(24px, 3.1vw, 39px); }
.project-library-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.project-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.project-list .workspace-tile {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(30px, auto));
  min-height: 92px;
}
.project-list .workspace-thumb { grid-row: 1 / -1; height: 100%; min-height: 90px; padding: 8px; }
.project-list .tile-heading { align-self: end; padding: 0 58px 2px 13px; }
.project-list .tile-meta { padding: 3px 58px 8px 13px; }
.project-list .workspace-tile:disabled :is(.tile-heading, .tile-meta) { padding-right: 125px; }
.project-list .tile-open { display: none; }
.project-list :is(.project-menu,.project-restore) { top: 50%; transform: translateY(-50%); }
@media (max-width: 1120px) { .project-list { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 460px) {
  .project-list .workspace-tile { grid-template-columns: 66px minmax(0, 1fr); }
  .project-list .tile-heading { white-space: normal; overflow-wrap: anywhere; }
  .project-list .workspace-tile:disabled :is(.tile-heading, .tile-meta) { padding-right: 100px; }
}

.editor-layout {
  grid-template-columns: minmax(68px, 80px) minmax(0, 1fr) clamp(214px, 20vw, 290px);
  gap: clamp(10px, 1.35vw, 22px);
}
.editor-layout:has(.inspector[hidden]) { grid-template-columns: minmax(68px, 80px) minmax(0, 1fr); }
.editor-layout > .inspector[hidden] { display: none; }
.editor-toolbox {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 12px;
  padding: 9px 6px;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.editor-toolbox-label { color: var(--muted); font-size: 9px; text-align: center; }
.editor-toolbox .tools { display: grid; gap: 3px; }
.editor-toolbox .tools + .tools { border-top: 1px solid var(--line); padding-top: 8px; }
.editor-toolbox .tool { width: 100%; min-height: 42px; height: auto; gap: 3px; padding: 5px 1px; }
.editor-toolbox .tool::before { content: attr(aria-label); grid-row: 2; font-size: 8px; }
.editor-toolbox .tool::after { display: none; }
.editor-toolbar { height: auto; min-height: 51px; flex-wrap: wrap; }
#toggle-inspector[aria-expanded=true] { color: var(--primary); background: var(--soft); }
.editor-card .canvas-viewport { height: clamp(400px, 61vh, 880px); }
.editor-properties { border: 1px solid var(--line); border-radius: 10px; background: #fffdf9; overflow: hidden; }
.editor-properties summary { padding: 14px 11px; cursor: pointer; color: var(--ink); font-size: 12px; font-weight: 550; }
.editor-properties-body { padding: 0 10px 10px; display: grid; gap: 9px; }
.editor-properties .summary-panel { padding: 10px; }
.editor-properties .check-card { min-height: 55px; }
.editor-properties .tip-card { display: flex; }
.editor-description button { color: var(--primary); padding: 10px 6px; font-size: 12px; text-align: left; }
#editor-view { padding-bottom: 24px; }

@media (max-width: 730px) {
  .editor-layout, .editor-layout:has(.inspector[hidden]) { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .editor-toolbox { position: static; display: flex; flex-wrap: wrap; padding: 4px; gap: 3px; }
  .editor-toolbox-label { display: none; }
  .editor-toolbox .tools { display: flex; flex-wrap: wrap; gap: 2px; }
  .editor-toolbox .tools + .tools { padding: 0 0 0 4px; border-top: 0; border-left: 1px solid var(--line); }
  .editor-toolbox .tool { width: 33px; min-height: 38px; }
  .editor-toolbox .tool::before { display: none; }
  .editor-toolbar { padding: 5px 8px; min-height: 44px; }
  .editor-card .canvas-viewport { height: clamp(290px, 49vh, 440px); }
}
.embedded-editor { --sidebar: 0px; }
.embedded-editor .sidebar, .embedded-editor .breadcrumb { display: none; }
.embedded-editor .main { padding-inline: clamp(11px, 2.2vw, 25px); }
.embedded-editor .topbar { height: 55px; }
.embedded-editor .mobile-menu { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.embedded-editor .editor-card .canvas-viewport { height: clamp(280px, 48vw, 540px); }

:root[data-theme="poster"] .sidebar {
  background: #fff3db;
  box-shadow: 0 2px #bf8d8f66;
}
:root[data-theme="poster"] .sidebar .brand { color: var(--primary); }
:root[data-theme="poster"] .sidebar .brand-mark {
  background: var(--primary); color: #fff5db; border-radius: 50%;
}
:root[data-theme="poster"] .canvas-context {
  background: #e9effa;
}

.button, .theme-trigger, .grid-settings, .export-option { border-radius: 10px; }
.button { text-decoration: none; }
.button.primary {
  box-shadow: inset 0 1px 0 #ffffff33, 0 2px 4px color-mix(in srgb, var(--ink) 18%, transparent);
}
:is(.button.secondary, .theme-trigger, .grid-settings, .zoom-controls) {
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 8%, transparent);
}

:is(.button, .theme-trigger, .grid-settings, .avatar, .nav, .tool, .zoom-controls button,
  .tabs button, .project-filters button, .small-icon, .project-menu, .start-card,
  .workspace-tile, .theme-option, .export-option, .mobile-nav-item, .check-card, .modal-close) {
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.nav[aria-current="page"] {
  background: var(--soft);
  color: var(--ink);
  box-shadow: inset 3px 0 var(--primary);
}
.editor-toolbox .tool.active,
#toggle-inspector[aria-expanded="true"] {
  background: var(--soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--soft-border);
}
.tabs button[aria-selected="true"] {
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 16%, transparent);
}
.zoom-controls { border-radius: 8px; }
.zoom-controls button { border-radius: 6px; }

.start-grid .start-card {
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 8%, transparent);
}
.start-grid .start-primary {
  box-shadow: inset 0 1px 0 #ffffff33, 0 2px 5px color-mix(in srgb, var(--ink) 18%, transparent);
}
.start-grid .start-card::after {
  content: "→" / "";
  position: absolute;
  top: clamp(15px, 2vw, 25px);
  right: clamp(15px, 2vw, 25px);
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
  transition: transform 150ms ease, background-color 150ms ease;
}
.start-grid .start-primary::after {
  background: color-mix(in srgb, var(--primary) 82%, var(--primary-ink));
  color: var(--primary-ink);
}
.start-grid .start-card:hover { transform: none; }

@media (hover: hover) {
  :is(.button.secondary, .theme-trigger, .grid-settings, .project-menu, .theme-option,
    .export-option, .workspace-tile):not(:disabled):hover {
    background-color: var(--soft);
    border-color: var(--soft-border);
    color: var(--ink);
  }
  :is(.zoom-controls button, .project-filters button, .mobile-nav-item, .small-icon, .check-card):not(:disabled):hover {
    background-color: var(--soft);
    box-shadow: inset 0 0 0 1px var(--soft-border);
  }
  .tabs button:not([aria-selected="true"]):hover { background-color: #ffffff8c; }
  .start-grid .start-card:hover {
    border-color: var(--soft-border);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--ink) 11%, transparent);
  }
  .start-grid .start-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
  }
  .start-grid .start-card:hover::after { transform: translateX(2px); }
}

:is(.button, .theme-trigger, .grid-settings, .nav, .tool, .zoom-controls button,
  .tabs button, .project-filters button, .start-card, .workspace-tile,
  .project-menu, .theme-option, .export-option):not(:disabled):active {
  box-shadow: inset 0 1px 4px color-mix(in srgb, var(--ink) 20%, transparent);
}
.start-grid .start-card:active::after { transform: none; }
:is(.button, .start-card, .workspace-tile, .nav, .tool, .theme-option,
  .theme-trigger, .grid-settings, .avatar, .icon-btn, .small-icon, .zoom-controls button,
  .tabs button, .project-filters button, .mobile-nav-item, .project-menu, .check-card,
  .export-option, .modal-close):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
:is(.button, .tool, .zoom-controls button):disabled {
  opacity: .5;
  cursor: default;
  box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
  :is(.button, .theme-trigger, .grid-settings, .avatar, .nav, .tool, .zoom-controls button,
    .tabs button, .project-filters button, .small-icon, .project-menu, .start-card,
    .workspace-tile, .theme-option, .export-option, .mobile-nav-item, .check-card, .modal-close),
  .start-grid .start-card::after { transition: none; }
  .start-grid .start-card:hover::after { transform: none; }
}

.home-heading h1, .workspace-section-heading h2 {
  font-family: var(--font-title);
  font-weight: 500;
  letter-spacing: -.022em;
  line-height: 1.15;
}
.home-heading h1 { font-size: clamp(2.375rem, 3.2vw, 3.25rem); }
.workspace-section-heading h2 { font-size: clamp(1.5rem, 2vw, 1.875rem); }
.modal-header h2 { font-family: var(--font-ui); font-weight: 550; line-height: 1.2; }
.start-grid .start-card strong { font-size: 1.1875rem; font-weight: 550; line-height: 1.25; }
.tile-heading { font-size: 1.0625rem; font-weight: 550; line-height: 1.35; }
.tile-meta, .workspace-more, .workspace-footnote { font-size: .875rem; line-height: 1.45; }
.tile-meta, .summary-panel dd, .zoom-controls, #yarn-result { font-variant-numeric: tabular-nums; }
@media (min-width: 1001px) { .sidebar .nav { font-size: 1rem; } }
button, input, textarea, select { font-family: inherit; }
:root {
  --bg: #f8f5f0;
  --ink: #342f2a;
  --muted: #665d53;
  --primary: #70553e;
  --green: var(--primary);
  --accent: var(--primary);
  --primary-hover: #57412f;
  --accent-text: #594632;
  --primary-ink: #fff;
  --soft: #eee7de;
  --accent-soft: var(--soft);
  --soft-border: #cec2b4;
  --line: #dbd3c8;
  --canvas: #efebe5;
  --canvas-label: #60574d;
}
.sidebar, .start-grid .start-card, .workspace-tile, dialog { background-color: #fffdf9; }
.start-grid .start-card { border-radius: 12px; box-shadow: none; }
.start-grid .start-card::after { background: transparent; color: var(--muted); }
.start-grid .start-description { font-size: 1rem; color: var(--muted); }
.start-grid .start-icon { background: var(--soft); color: var(--primary); }
.home-heading h1 { margin: 0; }
@media (min-width: 731px) {
  body[data-page="home"]:not(.embedded-editor) .topbar { display: none; }
}
.workspace-view .workspace-empty {
  min-height: 76px;
  padding: 18px 22px;
  justify-content: flex-start;
  background: transparent;
  border: 0;
  border-block: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
}
@media (max-width: 630px) {
  .start-grid .start-card { padding: 14px; min-height: 132px; }
}

a.button.secondary { color: var(--ink); }

.modal-header { gap: 16px; }
.modal-header > div { min-width: 0; }
.modal-header h2 { margin: 0; overflow-wrap: anywhere; }
.modal-close, .small-icon, .zoom-controls button,
.knit-controls button, .knit-inline-actions :is(#knit-back, #knit-forward),
.color-row .edit-color, .color-row .delete-color, .project-menu, .avatar {
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}
.modal-header .modal-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
}
.modal-close svg, .small-icon svg, .project-menu svg,
.zoom-controls svg, .knit-controls svg, .knit-inline-actions svg,
.color-row .edit-color svg { display: block; width: 16px; height: 16px; }
.modal-close svg { width: 18px; height: 18px; stroke-width: 2; }
.small-icon { min-width: 32px; min-height: 32px; }
.grid-settings svg:last-child:not(:first-child) { width: 14px; height: 14px; }
.form-row > .field { min-width: 0; }
.form-row > .field > :is(input, select):last-child { margin-top: auto; }
dialog[open]:not(.guide-modal):not(.palette-removal-dialog) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90dvh;
}
dialog .modal-header { flex: none; }
dialog:not(.guide-modal):not(.palette-removal-dialog) #modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  margin: -4px;
}
#modal.mobile-menu-sheet {
  position: fixed;
  inset: auto 0 max(10px, env(safe-area-inset-bottom));
  width: min(410px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 14px 14px;
}
#modal.mobile-menu-sheet::backdrop {
  background: rgb(31 26 22 / 36%);
  backdrop-filter: blur(2px);
}
#modal.mobile-menu-sheet[open] {
  max-height: min(90dvh, calc(100dvh - max(10px, env(safe-area-inset-bottom)) - 10px));
}
.mobile-menu-sheet .modal-header { margin: 0 0 8px; padding-inline: 10px 0; }
.mobile-menu-sheet .modal-header h2 { font-size: 1.25rem; letter-spacing: 0; }
.mobile-menu-sheet .modal-header .modal-close { flex-basis: 44px; width: 44px; height: 44px; }
.mobile-menu-sheet .mobile-menu-group { display: grid; gap: 2px; }
.mobile-menu-group + .mobile-menu-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.mobile-menu-sheet .mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  font: 500 1rem/1.25 var(--font-ui);
  text-align: start;
}
.mobile-menu-sheet .mobile-nav-item span { color: inherit; }
.mobile-menu-sheet .mobile-nav-item svg { width: 18px; height: 18px; flex: none; stroke: var(--muted); }
.mobile-menu-sheet .mobile-nav-item[aria-current="page"] {
  background: var(--soft);
  border-color: var(--line);
  color: var(--primary);
  font-weight: 650;
}
.mobile-menu-sheet .mobile-nav-item[aria-current="page"] svg { stroke: currentColor; }
.mobile-menu-sheet .mobile-nav-item:focus-visible { outline-offset: -3px; }

.upload-area svg { stroke: var(--primary); }
.upload-area small { color: var(--muted); font-size: 12px; }
.export-option { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; }
.export-option small { font-size: 12px; line-height: 1.45; }
@media (max-width: 400px) {
  .export-grid { grid-template-columns: minmax(0, 1fr); }
  .export-option { padding: 12px 14px; }
  .export-option small { margin-top: 3px; }
}

/* Keep the chart close to its controls, including when a project has a long name. */
body[data-page="editor"] .topbar { height: 52px; }
.editor-return-actions { gap: 4px 16px; align-items: center; }
.editor-return-actions .back-to-workspace { margin: 0; padding: 8px 0; }
.editor-return-actions + .project-heading { padding-block: 8px 14px; }
.project-heading .title-row { margin-top: 0; }
.project-heading #project-title {
  max-width: none; min-width: 0; font-size: clamp(20px, 1.6vw, 26px);
  font-weight: 500; letter-spacing: -.015em; line-height: 1.25; white-space: nowrap;
}
.project-heading #project-title:focus { white-space: normal; overflow-wrap: anywhere; }
.project-heading p { margin: 5px 0 0; }
.canvas-footer { flex-wrap: wrap; gap: 5px 14px; height: auto; min-height: 38px; }
.canvas-footer .canvas-badge { position: static; border: 0; padding: 0; background: transparent; font-size: 11px; }
.editor-toolbar { container-type: inline-size; }
.editor-toolbar .zoom-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 5px;
  max-width: 100%;
  margin: 0;
  border: 0;
  box-shadow: none;
}
.editor-toolbar .zoom-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: auto;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .8125rem;
  line-height: 1.2;
  text-wrap: balance;
}
.zoom-step-label { display: none; }
@media (max-width: 730px), (pointer: coarse) {
  .editor-toolbar .zoom-controls button { min-width: 44px; min-height: 44px; }
  .zoom-step-label { display: inline; }
}
@container (max-width: 460px) {
  .editor-toolbar .zoom-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex-basis: 100%;
  }
  .editor-toolbar .zoom-controls button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 6px;
    font-size: .875rem;
  }
  .zoom-step-label { display: inline; }
}
.editor-layout { grid-template-columns: 96px minmax(0,1fr) clamp(214px,20vw,290px); }
.editor-layout:has(.inspector[hidden]) { grid-template-columns: 96px minmax(0,1fr); }
.editor-toolbox .tool::before { font-size: 11px; line-height: 1.25; }
.editor-toolbox-label { font-size: 11px; }
@media (max-width: 730px) {
  .editor-layout, .editor-layout:has(.inspector[hidden]) { grid-template-columns: minmax(0,1fr); }
  .editor-toolbar { gap: 5px; }
  .editor-toolbar .toolbar-space { display: none; }
  .project-heading { gap: 8px; }
  .editor-return-actions { padding-block: 6px; }
}

#fabric-sample { display: block; margin: 12px auto; width: auto; height: auto; max-width: 100%; max-height: 65vh; }
.custom-stitch-mark { display:flex; align-items:center; gap:10px; color:var(--muted); }
.custom-stitch-mark svg { width:32px; height:32px; background:var(--soft); }
#add-stitch { min-height:36px; }

/* Keep focus on the boundary of the field, including composite search fields. */
.workspace-search > svg {
  width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted);
  stroke-width: 1.7; stroke-linecap: round;
}
.workspace-search:focus-within, .project-sort select:focus-visible, .field select:focus-visible {
  border-color: var(--primary); outline: 1px solid var(--primary); outline-offset: -1px;
}
.workspace-search input:focus { outline: 0; }
.project-sort { gap: 12px; }
.project-sort select { min-inline-size: 10.75em; }
.project-sort select, .field select { font-family: inherit; font-size: 14px; min-height: 42px; }

/* Keep native form semantics, keyboard navigation and type-ahead. */
@supports (appearance: base-select) and selector(::picker(select)) {
  select, ::picker(select) { appearance: base-select; }
  select {
    align-items: center; gap: 12px; cursor: pointer; text-align: start;
  }
  select::picker-icon {
    content: ''; width: 7px; height: 7px; margin: -3px 3px 0 auto;
    border: solid var(--muted); border-width: 0 1.5px 1.5px 0;
    rotate: 45deg;
  }
  select:open::picker-icon { rotate: 225deg; margin-block: 4px 0; }
  select:open { border-color: var(--primary); }
  ::picker(select) {
    box-sizing: border-box; min-inline-size: anchor-size(width);
    max-inline-size: calc(100vw - 24px); max-block-size: min(320px, 55vh);
    overflow-y: auto; overscroll-behavior: contain; margin-block: 4px;
    padding: 4px; background: #fff; color: var(--ink);
    border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 6px 20px #352a2018;
  }
  select option {
    display: flex; align-items: center; gap: 10px; min-height: 36px;
    padding: 7px 10px; border-radius: 6px; font: inherit; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; cursor: pointer;
  }
  select option::checkmark { order: 1; margin-inline-start: auto; color: var(--primary); }
  select option:checked { background: var(--soft); color: var(--ink); }
  select option:hover, select option:focus-visible { background: #f4f0ea; }
  select option:focus-visible { outline: 1px solid var(--primary); outline-offset: -1px; }
  select option:disabled { opacity: .55; cursor: default; }
  @media (max-width: 730px), (pointer: coarse) {
    select option { min-height: 44px; }
  }
}
@media (forced-colors: active) {
  .workspace-search:focus-within, .field select:focus-visible, .project-sort select:focus-visible {
    outline: 2px solid Highlight; outline-offset: 0;
  }
}

#modal-status { flex: none; margin: 12px 0 0; padding: 10px 12px; font-size: .875rem;
 line-height: 1.45; color: var(--ink); background: var(--soft); border-radius: 7px; }
#modal-status:empty { display: none; }

.canvas-context { height: auto; min-height: 40px; padding-block: 4px; flex-wrap: wrap; }
.canvas-context #edit-lines { margin-inline-start: auto; border: 1px solid var(--line);
 background: #fffdf9; color: var(--ink); border-radius: 7px; padding: 6px 12px; min-height: 32px; font-size: .875rem; }
.canvas-context #edit-lines:hover:enabled { background: var(--soft); }
@media (pointer: coarse) { .canvas-context #edit-lines { min-height: 44px; } }

#modal-body:has(#line-axis) .field, #line-result, #line-direction { font-size: .875rem; }
#modal-body :is(#line-number, #line-count) { font-size: 1rem; }
#modal-body :is(#line-number, #line-count):focus-visible {
 border-color: var(--primary); outline: 1px solid var(--primary); outline-offset: -1px;
}

#line-cable-warning:not(:empty) {
 margin: 12px 0; padding: 10px 14px; border-inline-start: 3px solid var(--primary);
 color: var(--ink); background: #f6eee2; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere;
}
#line-cable-warning:empty { display: none; }

.editor-properties summary, .heading-actions .button, .panel-title h2,
.tabs button, .field, .color-name, .summary-panel dl>div { font-size: .875rem; }
.canvas-context, .canvas-footer, .canvas-footer button, .color-code, .palette-hint,
.workspace-section-heading p, .back-to-workspace, .check-card small { font-size: .8125rem; }
.modal-description, .instructions { font-size: .9375rem; line-height: 1.55; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#chart:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }

.sidebar .nav:not([aria-current="page"]) {
  background: transparent;
  box-shadow: none;
}
@media (hover: hover) {
  .sidebar .nav:not([aria-current="page"]):hover {
    background: color-mix(in srgb, var(--soft) 55%, transparent);
    color: var(--ink);
  }
}
.editor-toolbox .tool[aria-pressed="true"] {
  color: var(--ink);
  background: var(--soft);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.editor-toolbox .tool:not(:disabled):active {
  background: var(--soft-border);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.tile-knitting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  flex-wrap: wrap;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}
.tile-knitting .button { min-height: 44px; padding: 6px 11px; font-size: .875rem; }
.project-list .project-card:has(.tile-knitting) .project-menu { top: 10px; transform: none; }

.quick-palette, .knit-step-label, #knit-dock { display: none; }
@media (max-width: 730px) {
  .editor-toolbox .tools { gap: 3px; }
  .editor-toolbox .tool { width: 44px; min-height: 44px; }
  .editor-toolbar :is(.grid-settings, .zoom-controls button) { min-height: 44px; }
  .palette-panel .color-row :is(.edit-color,.delete-color),
  .palette-panel .small-icon, .modal-header .modal-close { min-width: 44px; min-height: 44px; }
  .quick-palette:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-bottom: 1px solid var(--line);
  }
  #quick-colors { display: flex; gap: 4px; flex: none; }
  #quick-colors button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid transparent;
    border-radius: 8px;
  }
  #quick-colors button::before {
    content: "";
    width: 23px;
    height: 23px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--swatch);
  }
  #quick-colors button[aria-pressed=true], #quick-colors button:active {
    border-color: var(--primary);
    background: var(--soft);
  }
  #quick-color-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8125rem; }
  .knitting .quick-palette:not([hidden]) { display: none; }

  html:not(.embedded-editor) body.knitting[data-page=editor] {
    display: grid;
    grid-template-rows: minmax(0,1fr) auto;
    height: 100dvh;
    overflow: hidden;
  }
  html:not(.embedded-editor) body.knitting[data-page=editor] > .main {
    grid-row: 1;
    min-height: 0;
    overflow-y: auto;
  }
  html:not(.embedded-editor) body.knitting[data-page=editor] > #knit-dock {
    display: block;
    grid-row: 2;
    min-width: 0;
  }
  .knitting :is(.editor-toolbox, .canvas-context, .editor-project-actions) { display: none; }
  #knit-dock .knit-inline { display: grid; gap: 6px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  #knit-dock .knit-inline[hidden] { display: none; }
  #knit-dock .knit-inline strong { font-size: .875rem; font-weight: 650; }
  #knit-dock .knit-inline-actions { flex-wrap: wrap; gap: 4px; justify-content: flex-start; }
  #knit-dock .knit-inline-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    gap: 4px;
    padding: 0 7px;
    font-size: .75rem;
  }
  #knit-dock .knit-step-label { display: inline; }
}

.project-library-actions.workspace-trash-actions { display: none; }
.workspace-trash-actions:has(> button:not([hidden])) { display: flex; margin-block: 0 14px; }
#confirm-empty-trash { background: #9c4937; border-color: #9c4937; color: #fff; }
#confirm-empty-trash:hover { background: #793728; border-color: #793728; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes panel-enter {
    from { opacity: 0; translate: 0 4px; }
    to { opacity: 1; translate: 0 0; }
  }
  .editor-properties[open] > .editor-properties-body {
    animation: panel-enter 150ms ease-out;
  }
  .toast {
    transition: opacity 150ms ease-out, transform 150ms ease-out;
  }

  @supports (overlay: auto) and (transition-behavior: allow-discrete) {
    #modal {
      --modal-offset: 6px;
      opacity: 0;
      translate: 0 var(--modal-offset);
      transition: opacity 120ms ease-out, translate 120ms ease-out, display 120ms, overlay 120ms;
      transition-behavior: allow-discrete;
    }
    #modal.mobile-menu-sheet { --modal-offset: 12px; }
    #modal[open] {
      opacity: 1;
      translate: 0 0;
      transition-duration: 170ms;
    }
    #modal::backdrop {
      opacity: 0;
      transition: opacity 120ms ease-out, display 120ms, overlay 120ms;
      transition-behavior: allow-discrete;
    }
    #modal[open]::backdrop { opacity: 1; transition-duration: 170ms; }
    #modal:not([open]), #modal:not([open])::backdrop { pointer-events: none; }

    @starting-style {
      #modal[open] { opacity: 0; translate: 0 var(--modal-offset); }
      #modal[open]::backdrop { opacity: 0; }
    }
  }
  @supports not ((overlay: auto) and (transition-behavior: allow-discrete)) {
    #modal[open] { animation: panel-enter 150ms ease-out; }
  }
}
