/* Interface fonts, served by Petlya itself: no visitor's address goes to a font
   service (Fontsource builds of Golos Text, Manrope and Caveat, SIL OFL 1.1). */

@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(fonts/golos-text-cyrillic-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(fonts/golos-text-cyrillic-wght-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(fonts/golos-text-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(fonts/golos-text-latin-wght-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/manrope-cyrillic-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/manrope-cyrillic-wght-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/manrope-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/manrope-latin-wght-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src:
    url(fonts/caveat-cyrillic-ext-500-normal.woff2) format('woff2'),
    url(fonts/caveat-cyrillic-ext-500-normal.woff) format('woff');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src:
    url(fonts/caveat-cyrillic-500-normal.woff2) format('woff2'),
    url(fonts/caveat-cyrillic-500-normal.woff) format('woff');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src:
    url(fonts/caveat-latin-ext-500-normal.woff2) format('woff2'),
    url(fonts/caveat-latin-ext-500-normal.woff) format('woff');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src:
    url(fonts/caveat-latin-500-normal.woff2) format('woff2'),
    url(fonts/caveat-latin-500-normal.woff) format('woff');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --paper: #f6f5f0;
  --ink: #303d34;
  --green: #405e4a;
  --muted: #899087;
  --line: #e7e8df;
  /* The one cold colour: frames of a selection and «Зеркало», never a yarn. */
  --blue: #2f6fd0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Golos Text', sans-serif;
  font-size: 13px;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
}
button,
input {
  outline-offset: 4px;
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid #6f8a65;
}
button {
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  filter: brightness(0.96);
}
i {
  display: inline-flex;
  flex-shrink: 0;
}
i svg {
  width: 17px;
  height: 17px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: #8d957f;
  font-weight: 600;
}
.outline,
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 6px;
  padding: 12px 17px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid #dcded3;
  background: transparent;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
  padding: 13px 20px;
}
h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 18px;
  display: flex;
  justify-content: space-between;
}
h2 span {
  font-size: 9px;
  font-weight: 400;
  color: #a3a896;
}
label {
  display: block;
  font-size: 10px;
  color: #888e81;
  margin: 0 0 7px;
}
input:not([type='color'], [type='checkbox'], [type='radio'], [type='range'], [type='hidden'], [type='file']) {
  width: 100%;
  border: 1px solid #e2e4db;
  border-radius: 5px;
  background: white;
  padding: 10px;
  color: var(--ink);
  font-size: 12px;
}
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  padding: 6px;
  border-radius: 4px;
  width: 29px;
  height: 29px;
  font-size: 22px;
}
.iconbtn:hover {
  background: #edf0e6;
}
canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
  max-width: none;
}
dialog {
  border: 1px solid #dde2d4;
  border-radius: 12px;
  padding: 28px;
  width: min(560px, 94vw);
  color: var(--ink);
  box-shadow: 0 20px 100px #24361e35;
}
dialog::backdrop {
  background: #28352360;
  backdrop-filter: blur(4px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-head h2 {
  font-size: 22px;
  font-family: Manrope, sans-serif;
  margin: 7px 0;
}
dialog p {
  font-size: 12px;
  line-height: 1.9;
}
.dialog-note {
  color: #8d9584;
  font-size: 10px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.project-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  margin: 9px 0;
}
.project-open {
  flex: 1;
  background: none;
  border: 0;
  text-align: start;
  padding: 5px;
  font-size: 13px;
}
.project-open small {
  display: block;
  color: #8d9883;
  font-size: 10px;
  margin-top: 5px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #354d3b;
  color: white;
  border-radius: 7px;
  box-shadow: 0 5px 20px #0002;
  padding: 12px 20px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 10;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
/* A message with a button («Вернуть») takes taps while it shows. */
#toast.show.with-action {
  pointer-events: auto;
}
#toast .toast-action {
  margin: -8px -10px -8px 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #f4d58d;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
#toast .toast-action:focus-visible {
  outline: 2px solid white;
  outline-offset: 1px;
}
@media (pointer: coarse) {
  #toast .toast-action {
    min-height: 44px;
  }
}
@media (max-width: 650px) {
  .eyebrow {
    font-size: 8px;
  }
  h2 {
    margin-bottom: 13px;
  }
}
select {
  width: 100%;
  border: 1px solid #e2e4db;
  border-radius: 5px;
  background: white;
  padding: 10px;
  color: var(--ink);
  font: inherit;
}
.text-settings {
  display: grid;
  grid-template-columns: 1.3fr 1fr 70px;
  gap: 13px;
  margin: 18px 0;
}
.text-settings > div {
  min-width: 0;
}
.text-settings select {
  font-size: 12px;
  height: 37px;
}
.text-settings input[type='color'] {
  width: 100%;
  height: 37px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px;
  cursor: pointer;
}
.text-position {
  grid-template-columns: 1fr 1fr;
}
.text-preview {
  overflow: auto;
  padding: 15px;
  background: #f0f1e9;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 90px;
  max-height: 240px;
}
.text-preview canvas {
  margin: auto;
  cursor: default;
}
.text-error {
  color: #a64f46 !important;
}
#textPlacementBar:not([hidden]) {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 18px;
  border: 1px solid #bac7ad;
  background: #fcfff5;
  box-shadow: 0 6px 30px #30442730;
  border-radius: 9px;
  max-width: 94vw;
  width: max-content;
  font-size: 12px;
}
#textPlacementBar .outline {
  white-space: nowrap;
  padding: 8px;
}
.tool-placement {
  background: #e9eee3 !important;
  outline: 1px solid #7e926e;
}
@media (max-width: 650px) {
  .text-settings {
    gap: 8px;
    grid-template-columns: 1.2fr 1fr 55px;
  }
  .text-settings label {
    font-size: 9px;
  }
  #textPlacementBar:not([hidden]) {
    font-size: 10px;
    gap: 8px;
    padding: 10px;
  }
  .text-position {
    grid-template-columns: 1fr 1fr;
  }
}

#imageDialog {
  width: min(1000px, 96vw);
  max-height: 94dvh;
  overflow: auto;
}
#imageDialog input[type='number'] {
  width: 100%;
  border: 1px solid #e2e4db;
  border-radius: 5px;
  background: white;
  padding: 10px;
  color: var(--ink);
  font-size: 12px;
}
.image-upload {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}
#imageFilename {
  font-size: 10px;
  color: #89947e;
  overflow-wrap: anywhere;
}
.image-layout {
  display: grid;
  grid-template-columns: 215px minmax(0, 1fr);
  gap: 24px;
  margin-top: 6px;
}
.image-controls > label:not(.image-check) {
  margin-top: 18px;
}
.image-controls select {
  font-size: 11px;
}
.image-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: #67785b;
  line-height: 1.5;
  cursor: pointer;
  margin: 15px 0;
}
.image-check input {
  accent-color: var(--green);
  margin: 0;
  flex-shrink: 0;
}
.image-field-note {
  font-size: 9px;
  line-height: 1.7;
  color: #939d88;
  margin: 8px 0;
}
.image-result {
  min-width: 0;
  padding-top: 18px;
}
.image-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.image-previews figure {
  margin: 0;
  min-width: 0;
}
.image-previews figcaption {
  font-size: 11px;
  min-height: 29px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 9px;
}
.image-previews figcaption .image-check {
  margin: 0;
  white-space: nowrap;
  font-size: 9px;
}
.image-preview-box {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background-color: white;
  background-image:
    linear-gradient(45deg, #e9ece4 25%, transparent 25%),
    linear-gradient(-45deg, #e9ece4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e9ece4 75%),
    linear-gradient(-45deg, transparent 75%, #e9ece4 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
}
.image-preview-box canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default;
}
#imagePreview {
  image-rendering: pixelated;
}
#imageInfo {
  min-height: 38px;
  margin-top: 16px;
}
.image-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 160px;
  overflow: auto;
}
.image-palette span {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f3f5ed;
  padding: 4px 5px;
  border-radius: 4px;
  font-size: 9px;
  color: #75836b;
}
.image-palette b {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #0001;
  display: inline-block;
}
.image-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.image-loading #imagePreview {
  opacity: 0.4;
}
@media (max-width: 750px) {
  .image-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .image-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 15px;
  }
  .image-controls > .text-settings {
    margin: 10px 0;
    grid-column: 1/-1;
  }
  .image-controls > label:not(.image-check) {
    margin: 10px 0 0;
  }
  .image-controls > .image-field-note {
    grid-column: 1/-1;
    margin: 0;
  }
  .image-controls > select,
  .image-controls > input[type='number'] {
    align-self: start;
  }
  .image-preview-box {
    height: 230px;
  }
  .image-result {
    padding: 5px 0;
  }
  .image-previews {
    gap: 9px;
  }
  .image-controls > .image-check {
    margin: 10px 0;
  }
  .image-upload {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .image-previews figcaption {
    flex-wrap: wrap;
    font-size: 10px;
  }
  .image-actions {
    margin-top: 15px;
  }
  #imageDialog {
    padding: 20px;
  }
  .image-controls > label[for='imageColors'] {
    grid-column: 1;
  }
  .image-controls > #imageColors {
    grid-column: 2;
    grid-row: auto;
  }
  .image-controls > label[for='imageDetail'] {
    grid-column: 1;
  }
  .image-controls > #imageDetail {
    grid-column: 2;
  }
  .image-controls > label[for='imageDestination'] {
    grid-column: 1;
  }
  .image-controls > #imageDestination {
    grid-column: 2;
  }
}
@media (max-width: 420px) {
  .image-preview-box {
    height: 180px;
  }
}
[hidden] {
  display: none !important;
}
.saved-colors-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #77866b;
  margin: 20px 0 12px;
}
.saved-colors-head small {
  font-size: 8px;
  color: #a0a98f;
}
.saved-colors {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.saved-color {
  border: 1px solid #dbe1d2;
  border-radius: 7px;
  position: relative;
  width: 100%;
  height: 31px;
  background: #f7f8f1;
  font-size: 14px;
  color: #839475;
}
.saved-color.empty {
  border-style: dashed;
}
.saved-color.selected:after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1.5px solid #738363;
  border-radius: 9px;
}
.saved-color small {
  position: absolute;
  bottom: 1px;
  right: 3px;
  background: #ffffffdc;
  border-radius: 2px;
  min-width: 9px;
  font-size: 8px;
  color: #5d7150;
}
.text-color-trigger {
  height: 37px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 5px;
  font-size: 9px;
}
.text-color-trigger span {
  width: 15px;
  height: 24px;
  display: block;
  background: #405e4a;
  border: 1px solid #0001;
  border-radius: 3px;
}
.image-transform-tools {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
}
.image-transform-tools label {
  margin: 0;
  text-align: center;
  font-size: 10px;
}
.image-transform-tools input[type='range'] {
  grid-column: 1/-1;
  width: 100%;
  accent-color: var(--green);
  padding: 0 !important;
  margin: 5px 0 8px;
}
.image-transform-tools .outline {
  grid-column: 1/-1;
  padding: 7px;
  font-size: 9px;
}
#imageOriginal {
  touch-action: none;
  cursor: grab;
  outline-offset: -3px;
}
#imageOriginal.dragging {
  cursor: grabbing;
}
.image-transform-tools output {
  font-variant-numeric: tabular-nums;
}
#imagePreview {
  transition: opacity 0.08s;
}
.image-loading #imagePreview {
  opacity: 0.7;
}
@media (max-width: 650px) {
  .saved-colors {
    gap: 7px;
  }
  .saved-color {
    height: 27px;
  }
  .saved-colors-head {
    font-size: 9px;
  }
  .saved-colors-head small {
    font-size: 7px;
  }
  .image-transform-tools label {
    font-size: 9px;
  }
  .text-color-trigger {
    font-size: 0;
  }
  .text-color-trigger span {
    width: 100%;
  }
}
@keyframes sync-turn {
  to {
    transform: rotate(360deg);
  }
}

.image-color-mode {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 17px 0 0;
  grid-column: 1/-1;
}
.image-color-mode legend {
  font-size: 10px;
  color: #7b896f;
  padding: 0 4px;
}
.image-color-mode .image-check {
  margin: 7px 0;
}
.image-color-mode input {
  accent-color: var(--green);
}
#imageMonoOptions {
  grid-column: 1/-1;
  border: 1px solid #dce4d1;
  background: #f7f9f1;
  border-radius: 7px;
  padding: 12px;
  margin-top: 12px;
}
#imageMonoOptions > label {
  margin-top: 13px;
}
#imageMonoOptions select {
  margin-bottom: 5px;
  font-size: 10px;
}
.image-mono-color {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid #dce4d1;
  border-radius: 5px;
  background: white;
  font-size: 10px;
}
.image-mono-color span:first-child {
  width: 25px;
  height: 25px;
  border: 1px solid #0001;
  border-radius: 4px;
}
.image-mono-color strong {
  font-size: 10px;
  font-weight: 500;
}
.image-mono-color span:last-child {
  margin-inline-start: auto;
  color: #8a977e;
  font-size: 9px;
}
#imageThresholdOptions label {
  margin-top: 13px;
}
#imageMonoThreshold {
  width: 100%;
  accent-color: var(--green);
  padding: 0 !important;
}
#imageMonoThresholdValue {
  float: right;
}

@font-face {
  font-family: PetlyaArial;
  src:
    local('Arial'),
    url('fonts/LiberationSans.ttf') format('truetype');
}
@font-face {
  font-family: PetlyaVerdana;
  src:
    local('Verdana'),
    url('fonts/DejaVuSans.ttf') format('truetype');
}
@font-face {
  font-family: PetlyaPixel;
  src: url('fonts/tiny5-latin-400-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}
@font-face {
  font-family: PetlyaPixel;
  src: url('fonts/tiny5-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  font-display: swap;
}
@font-face {
  font-family: PetlyaPixelBold;
  src: url('fonts/press-start-2p-latin-400-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}
@font-face {
  font-family: PetlyaPixelBold;
  src: url('fonts/press-start-2p-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  font-display: swap;
}
@font-face {
  font-family: PetlyaPixelMedium;
  src: url('fonts/galmuri9-latin-cyrillic.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: PetlyaPixelTall;
  src: url('fonts/galmuri11-latin-cyrillic.woff2') format('woff2');
  font-display: swap;
}
.image-controls,
.image-controls > * {
  min-width: 0;
}
.image-color-mode {
  min-inline-size: 0;
  max-width: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.image-color-mode legend {
  max-width: 100%;
  white-space: normal;
}
.image-color-mode .image-check {
  display: flex;
  width: 100%;
  min-width: 0;
  gap: 9px;
  margin: 0;
  line-height: 1.55;
}
.image-color-mode input[type='radio'] {
  appearance: auto;
  width: 17px !important;
  height: 17px;
  min-width: 17px;
  flex: 0 0 17px;
  padding: 0 !important;
  margin: 0;
  border: 0;
}
.image-color-mode label span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
#imagePaletteOptions {
  grid-column: 1/-1;
  margin-top: 15px;
}
#imagePaletteOptions label {
  margin-top: 0;
}
#imagePaletteOptions select {
  margin-bottom: 10px;
}
.chosen-image-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 150px;
  overflow: auto;
}
.chosen-image-color {
  display: flex;
  gap: 0;
  align-items: center;
  border: 1px solid #d9e2ce;
  border-radius: 5px;
  background: white;
  overflow: hidden;
}
.chosen-image-color button {
  border: 0;
  background: none;
  min-width: 26px;
  min-height: 30px;
  padding: 5px;
}
.chosen-image-color .color-dot {
  width: 20px;
  height: 20px;
  display: block;
  border-radius: 3px;
  border: 1px solid #0001;
}
.chosen-image-color .remove-color {
  border-inline-start: 1px solid #e2e8da;
  color: #89957c;
  font-size: 16px;
}
.palette-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.palette-edit-actions .outline {
  font-size: 9px;
  padding: 8px;
}
#imagePalette button {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #dde5d4;
  border-radius: 4px;
  background: #f5f8ee;
  padding: 5px;
  color: #6c7c5d;
  font-size: 10px;
}
#imagePalette button b {
  width: 17px;
  height: 17px;
  border-radius: 3px;
  border: 1px solid #0001;
  display: block;
}
.canvas-viewport {
  touch-action: none;
  overscroll-behavior: contain;
  position: relative;
}
.canvas-viewport canvas {
  touch-action: none;
}
.text-preview {
  height: 300px;
  max-height: 400px;
  display: block;
  overflow: auto;
}
#textPreview {
  margin: auto;
  cursor: grab;
}
.preview-zoom-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.preview-zoom-tools output {
  min-width: 45px;
  text-align: center;
  font-size: 10px;
  color: #7c8c6d;
}
.preview-zoom-tools button {
  font-size: 16px;
  border: 1px solid #dce4d1;
  background: #fff;
  border-radius: 4px;
  min-width: 28px;
  height: 27px;
  cursor: pointer;
}
.preview-zoom-tools .reset-view {
  font-size: 9px;
  padding: 0 8px;
}
.text-placement-ready {
  outline: 1px solid #9bb18b;
}
#textPlacementBar {
  flex-wrap: wrap;
  justify-content: center;
}
#textPlacementBar > span {
  width: 100%;
  text-align: center;
}
#textPlacementBar .primary {
  padding: 9px 13px;
  font-size: 11px;
}
@media (max-width: 650px) {
  .text-preview {
    height: 260px;
  }
  .image-color-mode {
    padding: 10px 12px;
    gap: 10px;
  }
  .image-color-mode .image-check {
    font-size: 11px;
  }
  .image-color-mode legend {
    font-size: 10px;
  }
  #textPlacementBar:not([hidden]) {
    max-width: 96vw;
    width: 350px;
    gap: 6px;
    font-size: 9px;
  }
  #textPlacementBar .outline,
  #textPlacementBar .primary {
    font-size: 9px;
    padding: 8px;
  }
  .image-controls > fieldset {
    grid-column: 1/-1;
  }
}
.canvas-viewport:not(#imageOriginalViewport) {
  display: block;
  overflow: auto;
  padding: 8px;
}
.canvas-viewport:not(#imageOriginalViewport) > canvas {
  display: block;
  max-width: none;
  max-height: none;
  margin: auto;
  image-rendering: pixelated;
}
#imageOriginalViewport {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}
#imageOriginalViewport > canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.preview-zoom-tools {
  flex-wrap: wrap;
  max-width: 100%;
  gap: 6px;
}
.preview-zoom-tools > * {
  flex-shrink: 0;
}
@media (max-width: 750px) {
  .preview-zoom-tools .reset-view {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    white-space: normal;
    line-height: 1.3;
  }
  .image-transform-tools {
    grid-template-columns: 26px minmax(0, 1fr) 26px;
  }
  .image-transform-tools label {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
/* Native single-finger scrolling stays available; two-finger zoom belongs to
   the canvas controllers. Do not include pinch-zoom in this touch-action. */
@media (any-pointer: coarse) {
  html,
  body {
    touch-action: pan-x pan-y;
  }
}
#borderDialog {
  width: min(860px, 96vw);
  max-height: 94dvh;
  overflow: auto;
}
.border-patterns {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin: 17px 0 22px;
}
.border-pattern {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 1px solid #dce3d4;
  border-radius: 7px;
  background: #fff;
  padding: 12px 7px;
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}
.border-pattern[aria-pressed='true'] {
  border-color: var(--green);
  background: #edf2e6;
  box-shadow: 0 0 0 1px var(--green);
}
.border-pattern canvas {
  display: block;
  width: 94px;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  pointer-events: none;
}
.border-pattern span {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.border-settings {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px 22px;
  margin-bottom: 18px;
}
.border-settings > div {
  min-width: 0;
}
.border-settings label {
  line-height: 1.6;
}
.border-settings select {
  font-size: 11px;
  padding: 10px 7px;
  min-width: 0;
}
#borderWidthValue {
  float: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--green);
}
#borderWidth {
  width: 100%;
  padding: 0;
  margin: 9px 0;
  height: 25px;
  accent-color: var(--green);
  cursor: ew-resize;
}
.border-color {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #dce3d4;
  background: #fff;
  border-radius: 5px;
  padding: 8px 10px;
  width: 100%;
  min-height: 39px;
  font-size: 11px;
}
#borderColorChip {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  border: 1px solid #0001;
  border-radius: 4px;
}
.border-color strong {
  font-weight: 500;
}
.border-color > span:last-child {
  margin-inline-start: auto;
  color: #819272;
  font-size: 10px;
}
.border-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.border-preview-heading label {
  margin: 0;
}
.border-preview {
  height: 340px;
  max-height: 50dvh;
  background: #eef0e7;
  border: 1px solid var(--line);
  border-radius: 6px;
}
#borderInfo {
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

@media (max-width: 650px) {
  .border-patterns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .border-pattern {
    flex-direction: row;
    text-align: start;
    padding: 10px;
    gap: 9px;
    min-height: 67px;
    font-size: 10px;
  }
  .border-pattern canvas {
    width: 54px;
    flex: 0 0 54px;
  }
  .border-pattern span {
    min-width: 0;
    justify-content: flex-start;
  }
  .border-settings {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }
  .border-preview {
    height: 280px;
  }
  .border-settings select {
    font-size: 12px;
  }
  .border-preview-heading > label {
    font-size: 11px;
  }
  #borderDialog {
    padding: 20px;
  }
}
@media (max-width: 360px) {
  .border-pattern {
    padding: 7px;
    gap: 6px;
    font-size: 9px;
  }
  .border-pattern canvas {
    width: 43px;
    flex-basis: 43px;
  }
}
