/* Editor shell: the canvas fills the window, tools live in one panel
   (a rail on wide screens, a bottom bar on phones), rare settings in sheets. */
html,
body {
  height: 100%;
}
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  font-size: 14px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Top bar */
.topbar {
  flex: 0 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: #fbfaf6;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 10;
}
.brand {
  text-decoration: none;
  color: var(--ink);
  font-family: Manrope, sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  flex: none;
}
.brand {
  display: inline-flex;
  align-items: center;
}
.brand-logo {
  width: 30px;
  height: 30px;
  flex: none;
  display: block;
  margin-inline-end: 9px;
}
.brand-dot {
  color: #bd7b65;
}
.project-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline-start: 16px;
  border-inline-start: 1px solid #e1e3d8;
}
.project-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  border: 0;
  background: none;
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--ink);
}
.project-title:hover {
  background: #f0f1ea;
}
.project-title strong {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-title i {
  flex: none;
}
.project-title i svg {
  width: 15px;
  height: 15px;
  color: #6b7268;
}
.size-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #e1e3d8;
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  font-size: 12px;
  color: #4b5649;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.size-chip i svg {
  width: 14px;
  height: 14px;
}
.save-info {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #5d6a5b;
  white-space: nowrap;
  min-width: 0;
}
.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7da36f;
  flex: none;
}
.sync-offline .save-dot {
  background: #bf9d60;
}
.save-info small {
  font-size: 11px;
  color: #7b8475;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
#syncNow {
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: #73866b;
}
.syncing {
  animation: sync-turn 1.2s linear infinite;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.round-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e1e3d8;
  background: #fff;
  font-weight: 600;
  color: var(--ink);
}
.friendly-ui .header-actions .outline,
.friendly-ui .header-actions .primary {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  gap: 8px;
}
.header-actions .outline {
  background: #fff;
}
.export-wrap {
  position: relative;
}
.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 40px #35472925;
  padding: 14px;
}
.dropdown strong {
  font-size: 12px;
  display: block;
  margin: 0 4px 10px;
}
.dropdown button,
.dropdown .sign-in-again {
  display: block;
  text-align: start;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 0;
  background: #f7f8f2;
  border-radius: 9px;
  margin-bottom: 7px;
  font-size: 13px;
}
.dropdown .sign-in-again {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}
.dropdown .sign-in-again[hidden] {
  display: none;
}
.dropdown button span,
.dropdown .sign-in-again span {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: #6b7268;
  margin-top: 2px;
}
.dropdown label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 4px 0;
  font-size: 12px;
  color: var(--ink);
}
.account-label {
  font-size: 11px;
  color: #5d6a5b;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-label:empty {
  display: none;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e9ecdf;
  border: 1px solid #dfe3d7;
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: none;
}
.account-wrap {
  position: relative;
  flex: none;
}
.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 3px;
  border: 0;
  background: none;
  border-radius: 999px;
}
.account-btn .avatar {
  font-weight: 600;
  color: var(--green);
}
.account-btn:hover .avatar,
.account-btn[aria-expanded='true'] .avatar {
  background: #dfe5d3;
  border-color: #cfd6c3;
}
.account-btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.account-menu {
  width: 280px;
}
.account-who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 4px 6px;
}
.account-who .avatar {
  width: 40px;
  height: 40px;
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
}
.account-who div {
  min-width: 0;
}
.account-who small {
  display: block;
  font-size: 11px;
  color: #6b7268;
}
.dropdown .account-who strong {
  margin: 2px 0 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-btn .avatar svg {
  width: 20px;
  height: 20px;
}
.account-guest {
  display: grid;
  gap: 8px;
  margin: 0 4px 4px;
}
.dropdown .account-guest strong {
  margin: 0;
  font-size: 14px;
}
.account-guest p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #6b7268;
}
/* A plain button inside the menu, not one of the square header buttons of a narrow screen. */
.friendly-ui .header-actions .account-guest .primary {
  justify-self: start;
  width: auto;
  height: auto;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  text-decoration: none;
}
.account-sync {
  margin: 0 4px 12px;
  font-size: 11.5px;
  color: #6b7268;
}
.dropdown button.danger {
  color: #a64f46;
}
.signout-dialog {
  max-width: 440px;
}
.signout-warning {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 12px;
  background: #fbeee9;
  color: #8c3f35;
  font-size: 12.5px;
  line-height: 1.55;
}
.signout-dialog .dialog-actions {
  margin-top: 18px;
}
.friendly-ui .signout-dialog .danger-fill {
  background: #a64f46;
  border-color: #a64f46;
}

/* Workspace */
.workspace {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  background: #efeee7;
}
#workbench[inert] {
  opacity: 0.7;
}
.canvas-area {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  padding: 28px 28px 76px 132px;
  overscroll-behavior: contain;
}
.canvas-area.touch-panning {
  cursor: grabbing;
}
.canvas-stage {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.canvas-wrap {
  flex-shrink: 0;
  padding: 22px;
  background: #fffefa;
  border-radius: 6px;
  box-shadow: 0 10px 40px #303d341a;
}
.greeting {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 560px;
  font-family: Caveat, cursive;
  font-size: 26px;
  line-height: 1.2;
  color: #4f6350;
  text-wrap: balance;
}
.greeting-loop {
  width: 30px;
  height: 23px;
  flex: none;
  color: #c77168;
  margin-top: 5px;
}

/* Tool rail */
.toolbar {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 84px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  scrollbar-width: none;
  box-sizing: border-box;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #e3e5da;
  border-radius: 18px;
  box-shadow: 0 8px 28px #303d3414;
}
.tool {
  width: 68px;
  min-height: 58px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px solid transparent;
  background: transparent;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.2;
  color: #4b5649;
  padding: 6px 2px;
}
.tool:hover {
  background: #f3f4ee;
}
.tool i svg {
  width: 22px;
  height: 22px;
}
.tool.active {
  border-color: #6f8a65;
  background: #eef3ea;
  color: #2f4637;
  font-weight: 500;
}
.toolbar-divider {
  width: 48px;
  height: 1px;
  background: var(--line);
  margin: 4px 0;
  flex: none;
}
.colour-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: none;
}
.colour-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 4.5px #c9cdbf;
}
.recent-colors {
  display: flex;
  gap: 6px;
}
.recent-colors:empty {
  display: none;
}
.recent-color {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #0000001a;
}
.add-tool {
  background: #f2f1ea;
}
.add-icon {
  display: grid;
  place-items: center;
}
.history {
  display: flex;
  gap: 2px;
  flex: none;
}
.history .iconbtn {
  width: 34px;
  height: 36px;
  border-radius: 8px;
  color: #4b5649;
}
.history .iconbtn i svg {
  width: 18px;
  height: 18px;
}

/* Status and view controls over the canvas */
.canvas-status {
  position: absolute;
  left: 132px;
  bottom: 22px;
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #6b7268;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.view-controls {
  position: absolute;
  right: 20px;
  bottom: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #fff;
  border: 1px solid #e3e5da;
  border-radius: 999px;
  box-shadow: 0 6px 20px #303d3414;
}
.view-controls .iconbtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
}
#zoomReset {
  min-width: 54px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.grid-wrap {
  display: flex;
}
.grid-toggle {
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #6b7268;
}
.grid-toggle i svg {
  width: 20px;
  height: 20px;
}
.grid-toggle.on {
  background: #eef3ea;
  color: #2f4637;
}
.grid-toggle[aria-expanded='true'] {
  background: #e2ebdd;
}
.grid-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 20;
  width: 244px;
  box-sizing: border-box;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 40px #35472930;
}
.grid-menu[hidden] {
  display: none;
}
.grid-menu strong {
  font-size: 13px;
  font-weight: 600;
}
.grid-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 3px;
  background: #efeee7;
  border-radius: 10px;
}
.grid-steps button {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  color: #4b5649;
}
.grid-steps button[aria-checked='true'] {
  background: #fff;
  box-shadow: 0 1px 3px #303d3426;
  color: var(--ink);
  font-weight: 600;
}
.grid-numbers {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  cursor: pointer;
}
.grid-numbers input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.grid-numbers .switch {
  flex: none;
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #c9cdbf;
  transition: background 0.15s;
}
.grid-numbers .switch::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px #0003;
  transition: transform 0.15s;
}
.grid-numbers input:checked + .switch {
  background: var(--green);
}
.grid-numbers input:checked + .switch::after {
  transform: translateX(16px);
}
.grid-numbers input:focus-visible + .switch {
  outline: 3px solid #7e9d6a;
  outline-offset: 2px;
}
.grid-menu small {
  font-size: 11px;
  line-height: 1.4;
  color: #6b7268;
}

/* Cell numbers on the canvas edges; red marks the last row and column */
.canvas-area.with-numbers .canvas-wrap {
  padding: 34px 22px 22px 38px;
}
.rulers {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.rulers[hidden],
.ruler-corner[hidden],
.ruler-jump[hidden] {
  display: none;
}
.ruler {
  position: absolute;
  overflow: hidden;
  font-size: 11px;
  line-height: 18px;
  color: #5d6a5b;
  font-variant-numeric: tabular-nums;
}
.ruler.pinned,
.ruler-corner {
  background: #fbfaf6f2;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.ruler-top.pinned {
  border-bottom: 1px solid #e3e5da;
  box-shadow: 0 2px 8px #303d340f;
}
.ruler-left.pinned {
  border-inline-end: 1px solid #e3e5da;
  box-shadow: 2px 0 8px #303d340f;
}
.ruler-corner {
  position: absolute;
}
.ruler span {
  position: absolute;
  white-space: nowrap;
  border-radius: 4px;
  font-weight: 500;
}
.ruler-top span {
  bottom: 2px;
  transform: translateX(-50%);
}
.ruler-left span {
  transform: translate(-50%, -50%);
}
.ruler span.major {
  color: #303d34;
  font-weight: 700;
}
.ruler span.last,
.ruler span.hover {
  padding: 0 4px;
  color: #fff;
  font-weight: 700;
}
.ruler span.last {
  background: #c8372d;
}
.ruler span.hover {
  background: #3c5947;
}
.ruler-jump {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 18px;
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  background: #c8372d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ruler-jump.vertical {
  flex-direction: column;
  justify-content: center;
  height: auto;
  padding: 4px 0;
  gap: 0;
  line-height: 1.1;
}
.workspace:has(.rulers:not([hidden])) .canvas-status {
  left: 150px;
}
.view-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 4px;
}
.migration-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: min(600px, calc(100% - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid #d9e1ca;
  background: #edf2e3;
  border-radius: 14px;
  box-shadow: 0 6px 20px #303d3414;
}
.migration-banner > div {
  min-width: 0;
}
.migration-banner strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}
.migration-banner span {
  display: block;
  font-size: 12px;
  color: #5d6a5b;
  line-height: 1.5;
}
.migration-banner .outline {
  flex-shrink: 0;
  background: #fff;
}

/* Popovers: colour and "Добавить" */
.popover-sheet {
  position: fixed;
  inset: auto;
  left: 120px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid #e3e5da;
  box-shadow: 0 18px 50px #24361e30;
}
.friendly-ui .popover-sheet {
  border-radius: 20px;
  padding: 16px 18px 18px;
}
.popover-sheet::backdrop {
  background: transparent;
  backdrop-filter: none;
}
.sheet-handle {
  display: none;
}
.colour-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.friendly-ui .colour-head h2 {
  margin: 0;
  font-size: 16px;
  display: block;
}
.colour-head strong {
  display: block;
  font-size: 12px;
  color: #5d6a5b;
  font-weight: 500;
  letter-spacing: 0.4px;
  margin-top: 2px;
}
.friendly-ui .colour-head .iconbtn {
  margin-inline-start: auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0efe8;
  font-size: 20px;
}
.colour-current {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 4.5px #c9cdbf;
  flex: none;
}
#colorPanel .palette {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
#colorPanel .swatch {
  aspect-ratio: 1;
  width: 100%;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #00000014;
}
#colorPanel .swatch.selected {
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 5px var(--green);
}
#colorPanel .saved-colors-head {
  margin: 18px 0 10px;
  font-size: 13px;
  color: var(--ink);
}
#colorPanel .saved-colors-head small {
  font-size: 11px;
  color: #6b7268;
}
#savedColors {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
#savedColors .saved-color {
  aspect-ratio: 1;
  height: auto;
  border-radius: 50%;
  font-size: 16px;
}
#savedColors .saved-color.selected:after {
  border-radius: 50%;
}
#savedColors .saved-color small {
  display: none;
}
.colour-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.friendly-ui .colour-actions .outline {
  flex: 1;
  min-height: 44px;
  padding: 8px;
  font-size: 13px;
  background: #fff;
  gap: 8px;
}
.wheel-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(#e05a5a, #e0c25a, #6fbf6a, #5ab3e0, #7a6ae0, #e05ab8, #e05a5a);
  flex: none;
}
/* Saved colours: + keeps the current colour; right click or a long press opens
   «Заменить текущим · Убрать» under the slots. */
#savedColors .saved-color {
  -webkit-touch-callout: none;
  user-select: none;
}
#savedColors .saved-color.empty:not(:empty) {
  border-color: #b9bfb2;
  color: var(--green);
}
#savedColors .saved-color.editing {
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 5px #c9483f;
}
.slot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.slot-actions-chip {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #00000014;
  flex: none;
}
.friendly-ui .slot-actions .outline {
  flex: 1;
  min-height: 40px;
  padding: 6px 8px;
  font-size: 12px;
  background: #fff;
}
.friendly-ui .slot-actions .iconbtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0efe8;
  font-size: 18px;
  flex: none;
}
.colour-note {
  margin: 8px 0 0;
  min-height: 0;
  font-size: 12px;
  color: #5d6a5b;
}
.colour-note:empty {
  display: none;
}
/* «Свой цвет»: the wheel folds out inside the panel, no second window. */
.friendly-ui .custom-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  font-size: 13px;
  font-weight: 550;
  text-align: start;
}
.custom-toggle > span:nth-child(2) {
  flex: 1;
}
.custom-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #6b7268;
  border-bottom: 1.5px solid #6b7268;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s;
}
.custom-toggle[aria-expanded='true'] .custom-chevron {
  transform: rotate(-135deg) translate(-2px, 0);
}
.custom-colour:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}
#colorWheel {
  width: 140px;
  height: 140px;
  flex: none;
  touch-action: none;
  cursor: crosshair;
  border-radius: 50%;
  /* Held, it grows twice as big; colors.js sets the origin to keep it on screen. */
  position: relative;
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s;
}
#colorWheel.zoomed {
  z-index: 2;
  transform: scale(2);
  box-shadow: 0 6px 18px #24361e40;
}
#colorPanel.wheel-zoomed {
  overflow: visible;
}
.custom-values {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friendly-ui .custom-values label {
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-size: 12px;
  color: #4d564c;
}
.custom-values input[type='range'] {
  width: 100%;
  margin: 0 0 6px;
  accent-color: var(--green);
}
.friendly-ui .custom-values #colorHexInput {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  font-family: ui-monospace, monospace;
}
.colour-error {
  margin: 0;
  font-size: 12px;
  color: #b0423a;
}
.colour-error:empty {
  display: none;
}
.insert-sheet {
  width: 320px;
}
.insert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.insert-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #e3e5da;
  border-radius: 14px;
  background: #fff;
  text-align: start;
  min-height: 64px;
  color: var(--ink);
}
.insert-item:hover {
  background: #f7f8f2;
}
.insert-glyph {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #eef3ea;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--green);
  font-weight: 600;
  flex: none;
}
.insert-glyph i svg {
  width: 22px;
  height: 22px;
}
.insert-item strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.insert-item small {
  display: block;
  font-size: 12px;
  color: #5d6a5b;
  margin-top: 2px;
}
.tool-placement {
  background: #e9eee3 !important;
  outline: 1px solid #7e926e;
}

/* "Схема": name, size, clear */
#schemeDialog {
  width: min(460px, 94vw);
}
.friendly-ui #schemeDialog #name {
  font-size: 16px;
  min-height: 46px;
  border-radius: 10px;
}
.sheet-subhead {
  font-size: 13px;
  font-weight: 600;
  margin: 22px 0 10px;
}
.friendly-ui .ui-presets {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}
.ui-size-preset[aria-pressed='true'] {
  border: 2px solid #708960;
  background: var(--ui-soft);
}
.steppers {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.stepper {
  flex: 1;
  min-width: 0;
}
.stepper-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--ui-stroke);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.stepper-control .step {
  width: 44px;
  height: 46px;
  border: 0;
  background: #f6f7f2;
  font-size: 20px;
  flex: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.friendly-ui .stepper-control input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 0;
  border-radius: 0;
  text-align: center;
  font-size: 17px;
  padding: 0;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.stepper-control input::-webkit-inner-spin-button,
.stepper-control input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.steppers .times {
  padding-bottom: 13px;
  color: #a0a592;
}
.size-preview {
  display: grid;
  place-items: center;
  margin-top: 14px;
  padding: 10px;
  background: #efeee7;
  border-radius: 12px;
}
#sizePreview {
  width: 170px;
  height: 170px;
  cursor: default;
}
.danger {
  color: #a64f46;
}
.friendly-ui .new-project {
  width: 100%;
  margin: 0 0 6px;
}

@media (max-width: 1000px) {
  .save-info small,
  .account-label,
  .header-actions .label {
    display: none;
  }
  .friendly-ui .header-actions .outline,
  .friendly-ui .header-actions .primary {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
  }
}
@media (max-width: 700px) {
  .topbar {
    height: 64px;
    padding: 0 10px 0 14px;
    gap: 8px;
  }
  .brand {
    font-size: 22px;
  }
  .brand-full,
  .brand-dot {
    display: none;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
    margin-inline-end: 0;
  }
  .project-meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    align-content: center;
    column-gap: 8px;
    row-gap: 2px;
    padding-inline-start: 0;
    border: 0;
  }
  .project-title {
    grid-column: 1/-1;
    padding: 2px 0;
    gap: 4px;
  }
  .project-title i svg {
    width: 14px;
    height: 14px;
  }
  .size-chip {
    border: 0;
    background: none;
    padding: 0;
    font-size: 11px;
    color: #5d6a5b;
  }
  .size-chip i,
  .size-unit {
    display: none;
  }
  .save-info {
    margin: 0;
    font-size: 11px;
    gap: 5px;
  }
  #saveStatus {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .account-btn {
    padding: 0;
    min-height: 34px;
  }
  .account-btn .avatar {
    width: 32px;
    height: 32px;
  }
  .save-dot {
    width: 5px;
    height: 5px;
  }
  .header-actions {
    gap: 6px;
  }
  .round-btn {
    width: 34px;
    height: 34px;
  }
  .dropdown {
    right: -4px;
  }
  .workspace {
    flex-direction: column;
  }
  .toolbar {
    position: static;
    transform: none;
    order: 3;
    width: auto;
    max-height: none;
    overflow: visible;
    flex-direction: row;
    justify-content: space-around;
    align-items: flex-start;
    gap: 2px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  }
  .toolbar-divider,
  .recent-colors {
    display: none;
  }
  .tool {
    width: auto;
    flex: 1;
    max-width: 64px;
    min-height: 58px;
    font-size: 10.5px;
    border-radius: 14px;
  }
  .colour-tool {
    flex: 1;
    max-width: 64px;
  }
  .colour-tool .tool {
    width: 100%;
    max-width: none;
  }
  .colour-dot {
    width: 26px;
    height: 26px;
    box-shadow:
      0 0 0 2px #fff,
      0 0 0 3.5px #c9cdbf;
  }
  .add-tool {
    background: transparent;
  }
  .add-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
  }
  .add-icon svg {
    width: 17px !important;
    height: 17px !important;
  }
  .history {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 5;
    padding: 3px;
    background: #fff;
    border: 1px solid #e3e5da;
    border-radius: 999px;
    box-shadow: 0 4px 14px #303d3414;
  }
  .history .iconbtn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
  .canvas-area {
    order: 1;
    padding: 68px 12px 20px;
  }
  .canvas-wrap {
    padding: 12px;
  }
  .canvas-area.with-numbers .canvas-wrap {
    padding: 22px 10px 10px 28px;
  }
  .ruler {
    font-size: 9.5px;
    line-height: 15px;
  }
  .ruler-jump {
    height: 16px;
    font-size: 9.5px;
    padding: 0 4px;
  }
  .grid-menu {
    bottom: auto;
    top: calc(100% + 10px);
  }
  .grid-steps button {
    height: 38px;
  }
  .ruler-top-pinned .history,
  .ruler-top-pinned .view-controls {
    top: 28px;
  }
  .greeting {
    font-size: 22px;
    padding: 0 10px;
    gap: 10px;
  }
  .greeting-loop {
    width: 26px;
    height: 20px;
    margin-top: 3px;
  }
  .canvas-status,
  #zoomIn,
  #zoomOut,
  .view-divider {
    display: none;
  }
  .view-controls {
    top: 12px;
    bottom: auto;
    right: 12px;
    padding: 3px;
  }
  .grid-toggle,
  #zoomReset {
    height: 40px;
  }
  .grid-toggle {
    width: 40px;
  }
  .migration-banner {
    top: 66px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .popover-sheet,
  .insert-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    max-height: 85dvh;
    border-width: 1px 0 0;
  }
  .friendly-ui .popover-sheet {
    border-radius: 22px 22px 0 0;
    padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  }
  .popover-sheet::backdrop {
    background: #24302766;
  }
  /* The handle is a full-width strip at the top for the finger, with the bar
     drawn inside it; it stays on top while the sheet scrolls (sheet-swipe.js). */
  .sheet-handle {
    display: block;
    position: sticky;
    top: -10px;
    z-index: 2;
    height: 27px;
    margin: -10px -20px 0;
    background: #fff;
    touch-action: none;
    cursor: grab;
  }
  .sheet-handle::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    width: 40px;
    height: 5px;
    margin-left: -20px;
    border-radius: 3px;
    background: #d9dccf;
  }
  .popover-sheet > .sheet-grip {
    touch-action: none;
  }
  .popover-sheet.sheet-dragging {
    user-select: none;
  }
  .popover-sheet.sheet-dragging .sheet-handle {
    cursor: grabbing;
  }
  .popover-sheet.sheet-dragging .sheet-handle::before {
    background: #b9bfae;
  }
  .popover-sheet::backdrop {
    opacity: var(--sheet-fade, 1);
  }
  .friendly-ui .ui-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Brush and eraser popover: tips, stamps, own stamps and the stamp editor */
.tool {
  position: relative;
}
.brush-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 20px;
  height: 20px;
  padding: 2px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #e1e3d8;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: #303d34;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.brush-badge .brush-icon {
  width: 14px;
  height: 14px;
}
.brush-sheet {
  width: 368px;
}
.brush-sheet.erasing .brush-icon,
.brush-sheet.erasing .brush-dot {
  opacity: 0.55;
}
.brush-icon {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.brush-shapes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.brush-shape {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 2px 7px;
  border: 1.5px solid #e3e5da;
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font-size: 10.5px;
  line-height: 1.2;
  text-align: center;
}
.brush-shape:hover {
  background: #f7f8f2;
}
.brush-shape .brush-icon {
  width: 30px;
  height: 30px;
}
.brush-dot {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}
.brush-dot:before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #303d34;
}
.brush-shape[aria-pressed='true'],
.brush-slot[aria-pressed='true'] {
  border-color: #6f8a65;
  background: #eef3ea;
}
.brush-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.brush-slot {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid #e3e5da;
  border-radius: 12px;
  background: #fff;
  color: #899087;
  font-size: 20px;
}
.brush-slot.empty {
  border-style: dashed;
  background: transparent;
}
.brush-slot .brush-icon {
  width: 66%;
  height: 66%;
}
.brush-slot-edit {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #e1e3d8;
  background: #fff;
  color: #303d34;
  font-size: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.brush-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.brush-row > label,
.brush-row > span {
  flex: none;
  width: 84px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.friendly-ui .brush-row input[type='range'] {
  flex: 1;
  width: auto;
}
.brush-row output {
  min-width: 44px;
  text-align: end;
  font-size: 12px;
  color: #5d6a5b;
  font-variant-numeric: tabular-nums;
}
.brush-seg {
  flex: 1;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: #f0efe8;
  min-width: 0;
}
.brush-seg button {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink);
  font-size: 12px;
  padding: 4px 2px;
}
.brush-seg button[aria-pressed='true'] {
  background: #fff;
  box-shadow: 0 1px 3px #303d3424;
  font-weight: 600;
}
.brush-hint {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #5d6a5b;
}
.brush-hint:empty {
  display: none;
}
.brush-editor-size {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}
.brush-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5d6a5b;
}
.brush-step button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #e1e3d8;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  touch-action: manipulation;
}
.brush-step b {
  min-width: 20px;
  text-align: center;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.brush-grid-wrap {
  display: grid;
  place-items: center;
  padding: 10px;
  background: #efeee7;
  border-radius: 12px;
  overflow: auto;
}
#brushGrid {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: none;
  cursor: pointer;
  border-radius: 3px;
}
.brush-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.friendly-ui .brush-editor-actions > button {
  flex: 1;
  min-height: 42px;
  padding: 8px 6px;
}
@media (max-width: 1000px) {
  .brush-sheet {
    width: 100%;
    overflow-y: auto;
  }
  .brush-badge {
    top: 2px;
    right: 2px;
  }
}
.new-sheet .new-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}
.new-sheet .new-kinds,
.new-sheet .new-fabrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}
.new-sheet .new-fabrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.new-sheet .new-kind {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 10px;
  min-height: 64px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: start;
}
.new-sheet .new-kind canvas {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--ui-stroke);
}
.new-sheet .new-kind span {
  display: flex;
  flex-direction: column;
}
.new-sheet .new-kind small {
  width: auto;
  font-weight: 400;
}
.new-sheet .new-fabric {
  min-height: 52px;
  font-size: 12px;
  font-weight: 600;
}
.new-sheet .new-size {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.new-sheet .new-size label {
  flex: 1;
}
.new-sheet .new-size span {
  padding-bottom: 12px;
  color: #a0a592;
}
.new-sheet .new-borders {
  margin: 10px -3px 12px;
}
.new-sheet .new-borders .border-pattern {
  flex: 0 0 118px;
  min-height: 110px;
}
.new-sheet #newBorderChip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #0002;
}
.new-sheet .sheet-subhead small {
  font-weight: 400;
  color: #819272;
}
@media (max-width: 650px) {
  .new-sheet .new-presets,
  .new-sheet .new-fabrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.new-sheet #newPreview {
  width: 150px;
  height: 150px;
}
/* Копия: a floating bar under the canvas while the tool is active. */
#selectionBar:not([hidden]) {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border: 1px solid #d9ddd2;
  background: #fffffff2;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px #30442726;
  border-radius: 16px;
  max-width: min(94vw, 760px);
  width: max-content;
  font-size: 13px;
}
#selectionInfo {
  color: #4b5a44;
}
.selection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#selectionBar[data-mode='select'] .selection-actions[data-mode='paste'],
#selectionBar[data-mode='paste'] .selection-actions[data-mode='select'] {
  display: none;
}
#selectionBar button {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  min-height: 36px;
}
#selectionBar button[hidden] {
  display: none;
}
.selection-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.selection-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
}
@media (max-width: 700px) {
  #selectionBar:not([hidden]) {
    bottom: calc(84px + env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-width: none;
    padding: 8px;
    gap: 6px;
    font-size: 12px;
  }
  #selectionInfo {
    width: 100%;
    text-align: center;
  }
  #selectionBar button {
    padding: 8px 10px;
    font-size: 12px;
    min-height: 40px;
  }
  #rotateClip span,
  #flipClipH span,
  #flipClipV span {
    display: none;
  }
  #rotateClip,
  #flipClipH,
  #flipClipV {
    font-size: 18px !important;
    min-width: 44px;
  }
  .selection-check {
    width: 100%;
    justify-content: center;
    order: -1;
  }
}
body.selection-open #toast {
  bottom: var(--toast-lift, 24px);
}
.title-input {
  min-width: 0;
  width: min(280px, 40vw);
  padding: 7px 10px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
}
@media (max-width: 700px) {
  .title-input {
    grid-column: 1/-1;
    width: 100%;
  }
}
/* Текст and Рамка: the insert shows on the canvas, its settings live in a bar below. */
:is(#textBar, #borderBar, #imageBar, #tileBar):not([hidden]) {
  position: fixed;
  bottom: calc(18px + var(--keyboard, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  padding: 10px 14px;
  border: 1px solid #d9ddd2;
  background: #fffffff2;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px #30442726;
  border-radius: 18px;
  max-width: min(96vw, 900px);
  width: max-content;
  font-size: 13px;
}
:is(#textInfo, #borderInfo, #imageBarInfo, #tileInfo) {
  width: 100%;
  text-align: center;
  color: #4b5a44;
}
:is(#textInfo, #borderInfo, #imageBarInfo, #tileInfo).text-error {
  color: #a64f46;
}
.text-bar-row,
.text-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
:is(#textBar, #borderBar, #imageBar, #tileBar) button {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  min-height: 38px;
}
#textValue {
  width: 200px;
  min-width: 0;
  min-height: 38px;
  max-height: 96px;
  resize: none;
  padding: 8px 11px;
  border: 1.5px solid #8ea07f;
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  line-height: 1.3;
  background: #fff;
  color: var(--ink);
  overflow-y: auto;
}
#textValue:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px #40604a22;
}
.text-pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.text-pop-btn[aria-expanded='true'] {
  background: #e9eee3 !important;
  border-color: #708960 !important;
}
.text-font-sample {
  font-size: 17px;
  line-height: 1;
}
.text-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 3px #d4d9cc;
  flex: none;
}
:is(#textBar, #borderBar, #imageBar, #tileBar) .text-size {
  border-radius: 10px;
}
:is(#textBar, #borderBar, #imageBar, #tileBar) .text-size .step {
  width: 34px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 18px;
  border-radius: 0;
}
:is(#textBar, #borderBar, #imageBar, #tileBar) .text-size input {
  width: 42px;
  height: 38px;
  border: 0;
  border-radius: 0;
  text-align: center;
  font-size: 15px;
  padding: 0;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.text-pop:not([hidden]) {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: min(760px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d9ddd2;
  background: #fff;
  box-shadow: 0 10px 34px #30442730;
  border-radius: 16px;
}
.text-pop h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #6f776d;
}
.text-pop .ui-colour-row {
  margin: 0;
}
.text-pop-note {
  margin: 0;
  font-size: 12px;
  color: #7c8574;
  line-height: 1.4;
}
#textMorePop:not([hidden]) {
  width: min(340px, 96vw);
}
#textMorePop .text-position {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
#textMorePop label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #6f776d;
}
#textMorePop input {
  height: 40px;
  border: 1px solid #d9ddd2;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 16px;
  color: var(--ink);
}
#chooseTextColor,
#chooseBorderColor {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#chooseTextColor span,
#chooseBorderColor span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #0002;
}
body:is(.text-open, .border-open, .image-open, .tile-open) #selectionBar {
  display: none !important;
}
body.text-open #toast {
  bottom: var(--text-toast-lift, 24px);
}
body.border-open #toast {
  bottom: var(--border-toast-lift, 24px);
}
#borderPatternIcon {
  width: 40px;
  height: 32px;
  image-rendering: pixelated;
  flex: none;
}
.border-modes {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: #eef1e8;
}
.border-modes .ui-segment {
  min-height: 32px !important;
  padding: 5px 12px !important;
}
#borderPatternPop .border-patterns {
  display: flex;
  grid-template-columns: none;
  margin: 0;
  overflow-x: auto;
  gap: 8px;
  padding: 3px 3px 8px;
}
#borderPatternPop .border-pattern {
  flex: 0 0 124px;
  font-size: 12px;
  line-height: 1.25;
  flex-direction: column;
  text-align: center;
  min-height: 0;
  padding: 8px 6px;
  gap: 6px;
}
#borderPatternPop .border-pattern canvas {
  width: 84px;
  flex: none;
}
#borderPatternPop .border-pattern span {
  min-height: 30px;
  white-space: normal;
}
#borderMorePop:not([hidden]) {
  width: min(420px, 96vw);
}
@media (max-width: 700px) {
  :is(#textBar, #borderBar, #imageBar, #tileBar):not([hidden]) {
    bottom: max(calc(84px + env(safe-area-inset-bottom)), calc(var(--keyboard, 0px) + 8px));
    width: calc(100vw - 16px);
    max-width: none;
    padding: 10px;
    gap: 8px;
    font-size: 12px;
  }
  .text-bar-row {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  #textValue {
    width: 100%;
    font-size: 16px;
  }
  .text-btn-label {
    display: none;
  }
  #textColorBtn,
  #textMoreBtn,
  #borderColorBtn,
  #borderMoreBtn {
    min-width: 44px;
    justify-content: center;
    font-size: 18px !important;
  }
  .text-bar-actions {
    width: 100%;
  }
  #placeText,
  #applyBorder {
    flex: 1;
    min-height: 46px !important;
    font-size: 15px !important;
  }
  #finishText,
  #cancelBorder {
    min-height: 46px !important;
    font-size: 15px !important;
    padding: 8px 18px !important;
  }
  .text-pop:not([hidden]) {
    width: 100%;
    left: 0;
    transform: none;
  }
  .text-pop .ui-font-strip {
    flex-wrap: nowrap;
  }
}
/* Размер полотна: the size chip opens this editor right in the header. */
.size-editor:not([hidden]) {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 8px;
  border: 1.5px solid #8ea07f;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px #3044271a;
  flex: none;
}
body.size-open .size-chip {
  display: none;
}
body.size-open .save-info {
  visibility: hidden;
}
.size-label {
  font-size: 11px;
  color: #6f776d;
}
.size-times {
  color: #9aa08f;
  font-size: 12px;
}
.size-editor .stepper-control {
  height: 36px;
  border-radius: 10px;
}
.size-editor .stepper-control .step {
  width: 30px;
  height: 36px;
  font-size: 17px;
}
.size-editor .stepper-control input {
  width: 44px;
  height: 36px;
  border: 0;
  border-radius: 0;
  padding: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.size-captions {
  display: none;
}
.size-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.size-btn {
  height: 36px;
  padding: 0 11px;
  border: 1px solid #dcdfd3;
  border-radius: 10px;
  background: #fff;
  font:
    500 13px 'Golos Text',
    sans-serif;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}
.size-btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.size-btn.danger {
  color: #a64f46;
}
.size-btn i svg {
  width: 17px;
  height: 17px;
}
.size-btn[aria-expanded='true'] {
  background: #e9eee3;
  border-color: #708960;
}
.size-cancel-label {
  display: none;
}
.size-hint {
  position: absolute;
  left: 10px;
  top: calc(100% + 6px);
  font-size: 12px;
  color: #4b5a44;
  white-space: nowrap;
  background: #fffffff2;
  border: 1px solid #e1e3d8;
  border-radius: 8px;
  padding: 3px 9px;
  box-shadow: 0 3px 10px #30442714;
  pointer-events: none;
}
.size-hint.size-hint-crop {
  color: #a64f46;
}
.size-presets {
  display: none;
}
.size-presets.open {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 100px);
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid #d9ddd2;
  border-radius: 14px;
  box-shadow: 0 10px 30px #30442730;
}
.size-presets.open ~ .size-hint {
  display: none;
}
.size-presets .ui-size-preset {
  min-height: 0;
  padding: 10px 4px;
  font-size: 12px;
  flex-direction: column;
  flex-wrap: nowrap;
}
.size-presets .ui-size-preset small {
  font-size: 11px;
}
body.size-open #workbench {
  padding-top: var(--size-strip, 0px);
}
@media (max-width: 700px) {
  body.size-open .size-chip {
    display: flex;
    background: #e9eee3;
    border: 1px solid #708960;
    border-radius: 999px;
    padding: 1px 8px;
  }
  .size-editor:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(64px + env(safe-area-inset-top, 0px));
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px 8px;
    padding: 10px 12px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: #fbfaf6;
    box-shadow: 0 10px 24px #30442718;
  }
  .size-label,
  #sizePresetsBtn {
    display: none;
  }
  .size-times {
    align-self: center;
  }
  .size-editor .stepper-control {
    height: 44px;
  }
  .size-editor .stepper-control .step {
    width: 38px;
    height: 44px;
  }
  .size-editor .stepper-control input {
    width: 100%;
    height: 44px;
    font-size: 17px;
  }
  .size-captions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    grid-column: 1/-1;
    margin-top: -4px;
    font-size: 11px;
    color: #6f776d;
    text-align: center;
  }
  .size-presets,
  .size-presets.open {
    position: static;
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
  }
  .size-presets .ui-size-preset {
    padding: 7px 2px;
    font-size: 11px;
    gap: 3px;
  }
  .size-presets .ui-size-preset small {
    font-size: 10px;
  }
  .size-hint {
    position: static;
    grid-column: 1/-1;
    text-align: center;
    white-space: normal;
    border: 0;
    background: none;
    box-shadow: none;
    padding: 0;
  }
  .size-presets.open ~ .size-hint {
    display: block;
  }
  .size-actions {
    grid-column: 1/-1;
  }
  .size-btn {
    height: 46px;
    font-size: 15px;
    border-radius: 12px;
  }
  #resize {
    flex: 1;
  }
  #cancelSize {
    padding: 0 16px;
  }
  .size-cancel-label {
    display: inline;
  }
  #cancelSize {
    font-size: 0;
  }
  #cancelSize .size-cancel-label {
    font-size: 15px;
  }
}

/* Save status: text on a computer, one icon with a tap tip on a phone. */
.save-icon,
.save-tip {
  display: none;
}
@media (max-width: 700px) {
  .save-info {
    position: static;
  }
  .save-info .save-dot,
  #saveStatus,
  #saveLocation,
  #syncNow {
    display: none;
  }
  .save-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: none;
    color: #5f8a55;
    flex: none;
  }
  .save-icon svg {
    width: 22px;
    height: 22px;
  }
  .save-icon[data-state='saving'] {
    color: #73866b;
  }
  .save-icon[data-state='saving'] svg {
    animation: save-pulse 1.2s ease-in-out infinite;
  }
  .save-icon[data-state='offline'] {
    color: #b38a3f;
  }
  .save-icon[data-state='error'] {
    color: #b4483d;
    background: #fbe9e6;
  }
  .save-icon[aria-expanded='true'] {
    background: #e7ecdf;
  }
  .save-tip:not([hidden]) {
    display: block;
    position: fixed;
    left: 12px;
    right: 12px;
    z-index: 60;
    white-space: normal;
    background: #fff;
    border: 1px solid #dfe3d6;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(38, 51, 42, 0.16);
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.45;
    color: #26332a;
  }
  .save-tip::before {
    content: '';
    position: absolute;
    top: -7px;
    left: var(--arrow, 120px);
    width: 12px;
    height: 12px;
    background: #fff;
    border-inline-start: 1px solid #dfe3d6;
    border-top: 1px solid #dfe3d6;
    transform: rotate(45deg);
  }
  .save-tip b {
    display: block;
    font-size: 15px;
    margin-bottom: 3px;
  }
  .save-tip p {
    margin: 0;
    color: #5d6a5b;
  }
  .save-tip button {
    margin-top: 10px;
    border: 1px solid #dfe3d6;
    background: #f6f6f1;
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    color: #3c5947;
  }
}
@keyframes save-pulse {
  50% {
    transform: translateY(-2px);
    opacity: 0.6;
  }
}
@media (prefers-reduced-motion: reduce) {
  .save-icon svg {
    animation: none !important;
  }
}

/* Картинка: the pattern floats on the canvas, the bar holds the main settings,
   «Настроить» is a side panel on a computer and a half-screen sheet on a phone. */
body.image-open #toast {
  bottom: var(--image-toast-lift, 24px);
}
#imageBar .image-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
#imageBar[data-mode='place'] [data-for='crop'],
#imageBar[data-mode='crop'] [data-for='place'] {
  display: none !important;
}
#imageBar .image-styles .ui-segment[aria-pressed='true'],
#imageBar .image-crop-shapes .ui-segment[aria-pressed='true'] {
  background: #fff;
  box-shadow: 0 1px 4px #30442722;
  color: var(--ink);
}
.image-size-range,
.image-scale-range {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5d6a5b;
}
#imageSizeRange,
#imageBar #imageScale {
  width: 150px;
  accent-color: #3c5947;
}
#imageSizeValue {
  min-width: 62px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.image-colors-step {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5d6a5b;
}
.image-colors-step[hidden] {
  display: none;
}
#imageCropBtn[aria-pressed='true'] {
  background: #e9eee3 !important;
  border-color: #708960 !important;
}
#imageDialog.image-panel:not([hidden]) {
  position: fixed;
  z-index: 20;
  top: 76px;
  right: 12px;
  bottom: max(18px, var(--image-toast-lift, 18px));
  width: min(380px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border: 1px solid #d9ddd2;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 40px #30442733;
  overflow: hidden;
}
#imageDialog .image-layout {
  display: block;
}
#imageDialog .image-controls {
  width: 100%;
}
#imageDialog .image-previews,
#imageDialog .ui-image-views,
#imageDialog .ui-image-empty,
#imageDialog .ui-image-styles,
#imageDialog #imageInfo,
#imageDialog .image-transform-tools {
  display: none !important;
}
#imageDialog .image-result {
  position: static !important;
}
#imageDialog .image-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
#imageDialog #imageFilename {
  font-size: 12px;
  color: #7b8475;
}
body.image-panel-open:is(.image-open, .tile-open) #workbench {
  padding-inline-end: 400px;
}
@media (max-width: 700px) {
  #imageBar .image-bar-row {
    width: 100%;
    justify-content: space-between;
  }
  #imageBar .image-styles,
  #imageBar .image-crop-shapes {
    width: 100%;
    justify-content: stretch;
  }
  #imageBar .image-styles .ui-segment,
  #imageBar .image-crop-shapes .ui-segment {
    flex: 1;
  }
  .image-size-range {
    flex: 1;
    min-width: 0;
  }
  #imageSizeRange,
  #imageBar #imageScale {
    flex: 1;
    width: auto;
    min-width: 0;
  }
  .image-scale-range {
    flex: 1;
  }
  #imageCropBtn,
  #imageMoreBtn {
    min-width: 44px;
    justify-content: center;
    font-size: 18px !important;
  }
  #placeImage,
  #cropDone {
    flex: 1;
    min-height: 46px !important;
    font-size: 15px !important;
  }
  #finishImage {
    min-height: 46px !important;
    font-size: 15px !important;
    padding: 8px 18px !important;
  }
  #imageDialog.image-panel:not([hidden]) {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: min(56dvh, 560px);
    border-radius: 20px 20px 0 0;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    z-index: 30;
  }
  body.image-panel-open:is(.image-open, .tile-open) #workbench {
    padding-inline-end: 0;
    padding-bottom: calc(min(56dvh, 560px) - 80px);
  }
  body.image-panel-open:is(.image-open, .tile-open) .toolbar {
    visibility: hidden;
  }
  body.image-panel-open :is(#imageBar, #tileBar) {
    display: none !important;
  }
}

/* Заливка узором: the tile repeats over the canvas, the bar holds the layout,
   size and gap, «Ещё» the rest; «Картинка» opens the picture's own panel. */
body.tile-open #toast {
  bottom: var(--tile-toast-lift, 24px);
}
#tileBar:not([hidden]) {
  max-width: min(96vw, 1080px);
}
#tileBar .image-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
#tileBar .text-bar-actions {
  flex-wrap: wrap;
  justify-content: center;
}
#tileBar[data-mode='place'] [data-for='crop'],
#tileBar[data-mode='crop'] [data-for='place'],
#tileBar:not([data-source='image']) [data-only='image'],
#tileBar:not([data-source='draw']) [data-only='draw'],
#tileBar[data-source='draw'] [data-only='ready'] {
  display: none !important;
}
/* «Свой узор»: width × height of the motif, two steppers. */
.tile-motif-size {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6f776d;
}
#tileBar .ui-segment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
#tileBar .ui-segment[aria-pressed='true'],
#tileMorePop .ui-segment[aria-pressed='true'] {
  background: #fff;
  box-shadow: 0 1px 4px #30442722;
  color: var(--ink);
}
#tileBar .ui-segment svg,
.insert-glyph [data-icon='tile'] svg,
.insert-glyph [data-icon='tile-draw'] svg,
#tileClip svg {
  width: 18px;
  height: 18px;
  flex: none;
}
#tileClip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#tileSizeRange,
#tileBar #imageScale {
  width: 150px;
  accent-color: #3c5947;
}
#tileSizeValue {
  min-width: 62px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
#tileCropBtn[aria-pressed='true'] {
  background: #e9eee3 !important;
  border-color: #708960 !important;
}
.tile-spacer {
  width: 8px;
}
#tileMorePop:not([hidden]) {
  width: min(360px, 96vw);
  max-height: min(70dvh, 560px);
  overflow-y: auto;
}
#tileMorePop .border-modes {
  display: flex;
}
#tileMorePop .border-modes .ui-segment {
  flex: 1;
}
#tileMorePop .ui-segment:disabled {
  opacity: 0.45;
}
#tileShiftBox:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #6f776d;
}
.tile-field[hidden] {
  display: none;
}
.tile-field input {
  height: 40px;
  border: 1px solid #d9ddd2;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 16px;
  color: var(--ink);
}
.tile-buttons {
  display: flex;
  gap: 8px;
}
.tile-buttons button {
  flex: 1;
}
/* A tile fill covers the canvas, so the picture's own place and destination are hidden. */
body.tile-open #imageDialog :is(#imagePosition, .ui-image-destination) {
  display: none !important;
}
body.image-panel-open.tile-open #tileBar:not([hidden]) {
  left: calc(50% - 200px);
  max-width: calc(100vw - 440px);
}
@media (max-width: 700px) {
  #tileBar .image-bar-row {
    width: 100%;
    justify-content: space-between;
  }
  #tileBar .tile-layouts {
    width: 100%;
  }
  #tileBar .tile-layouts .ui-segment {
    flex: 1;
    justify-content: center;
  }
  #tileBar .image-size-range {
    flex: 1;
    min-width: 0;
  }
  #tileSizeRange,
  #tileBar #imageScale {
    flex: 1;
    width: auto;
    min-width: 0;
  }
  #tileBar .text-bar-actions {
    width: 100%;
    flex-wrap: nowrap;
  }
  #tileBar[data-source='draw'] .tile-gap {
    display: none;
  }
  .tile-motif-size {
    width: 100%;
    justify-content: center;
  }
  #tileCropBtn,
  #tilePictureBtn,
  #tileEditBtn,
  #tileMoreBtn {
    min-width: 40px;
    padding: 0 !important;
    justify-content: center;
    font-size: 18px !important;
  }
  .tile-spacer {
    display: none;
  }
  #applyTile,
  #tileCropDone {
    flex: 1;
    min-width: 0;
    min-height: 46px !important;
    font-size: 14px !important;
    padding: 8px 6px !important;
  }
  #cancelTile {
    min-height: 46px !important;
    font-size: 14px !important;
    padding: 8px 10px !important;
  }
  #tileMorePop:not([hidden]) {
    max-height: calc(100dvh - 360px);
  }
}

/* Tools and modes made for another kind of canvas (app.js showKind). */
[data-other-kind] {
  display: none !important;
}

/* Language: the last line of «Мои схемы», written in both languages so anyone finds it. */
.language-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #e2e5dd);
  font-size: 13px;
  color: var(--muted, #6b7468);
}
.language-pick select {
  font: inherit;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line, #d9ddd3);
  background: var(--paper, #fff);
  color: inherit;
}
/* «Помогать улучшать Петлю» under the language: usage statistics, on unless switched off (analytics.js). */
.analytics-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted, #6b7468);
}
.analytics-pick b {
  display: block;
  font-weight: 600;
  color: var(--ink, #263027);
}
.analytics-pick small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
}
.analytics-pick input {
  flex: none;
  width: 40px;
  height: 24px;
  margin: 0;
  accent-color: var(--green);
}
/* Вязание: the pattern is read-only, the knitter marks where she stopped. The
   tools step aside and the bar takes their place; the canvas leaves room for it. */
body:is(.knitting, .stitching) :is(.toolbar, .history, .title-edit, #sizeBtn i) {
  display: none !important;
}
body:is(.knitting, .stitching) :is(#projectTitleBtn, #sizeBtn) {
  pointer-events: none;
}
body:is(.knitting, .stitching) .canvas-area {
  padding-left: 28px;
  padding-bottom: var(--knit-space, 200px);
}
body:is(.knitting, .stitching) #toast {
  bottom: var(--knit-space, 24px);
}
#progressBtn[aria-pressed='true'] {
  background: #e9eee3;
  border-color: var(--green);
  color: var(--green);
}
#knitBar:not([hidden]),
#stitchBar:not([hidden]) {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  width: min(96vw, 640px);
  padding: 12px 14px;
  border: 1px solid #d9ddd2;
  background: #fffffff2;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px #30442726;
  border-radius: 18px;
  font-size: 13px;
  color: var(--ink);
}
.knit-main,
.knit-confirm {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.knit-main[hidden],
.knit-confirm[hidden] {
  display: none;
}
.knit-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.knit-info strong,
.knit-confirm strong {
  font:
    700 17px Manrope,
    'Golos Text',
    sans-serif;
  white-space: nowrap;
}
#knitDir {
  color: #4b5a44;
  white-space: nowrap;
}
#knitShare {
  margin-inline-start: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.knit-meter {
  height: 6px;
  border-radius: 9px;
  background: #eceee6;
  overflow: hidden;
}
.knit-meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 9px;
  transition: width 0.15s;
}
.knit-runs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  padding: 3px 2px;
  margin: -3px -2px;
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
#knitRunsLabel {
  color: var(--muted);
  white-space: nowrap;
}
#knitRuns {
  display: flex;
  gap: 6px;
}
.knit-run {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 5px;
  border-radius: 999px;
  background: #f3f4ee;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.knit-run i {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px #0000001f;
}
.knit-run:first-child {
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--green);
}
.knit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#knitBar button,
#stitchBar .knit-actions button {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  min-height: 38px;
}
#knitBar .primary,
#stitchBar .primary {
  flex: 1;
  font-weight: 600;
}
#knitBar .knit-axis {
  margin: 0;
  flex: none;
}
#knitBar .knit-axis .ui-segment {
  min-height: 32px;
  padding: 4px 12px;
}
#knitBack {
  min-width: 42px;
  font-size: 17px !important;
}
.knit-confirm span {
  color: #4b5a44;
}
.knit-more:not([hidden]) {
  position: absolute;
  inset-inline-end: 0;
  bottom: calc(100% + 10px);
  width: 360px;
  max-height: calc(100vh - 200px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #d9ddd2;
  border-radius: 16px;
  box-shadow: 0 10px 34px #3044272e;
}
.knit-more h3 {
  margin: 0;
  font:
    700 14px Manrope,
    sans-serif;
}
.knit-more .ui-segments {
  margin: 0;
}
.knit-more .ui-segment {
  min-height: 36px;
  padding: 6px 8px;
  font-size: 13px;
}
.knit-label {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.knit-history {
  display: flex;
  flex-direction: column;
  border: 1px solid #e7e8df;
  border-radius: 12px;
  overflow: hidden;
}
.knit-history > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid #eef0e8;
}
.knit-history > div:first-child {
  border-top: 0;
  background: #f3f6ef;
}
.knit-history span::first-letter {
  text-transform: uppercase;
}
.knit-history small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.knit-history em {
  margin-inline-start: auto;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}
#knitBar .knit-history button {
  margin-inline-start: auto;
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--green);
  font-weight: 600;
}
.knit-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.knit-switch input {
  width: 40px;
  height: 24px;
  margin: 0;
  accent-color: var(--green);
}
#knitReset {
  align-self: flex-start;
  color: #a64f46;
  border-color: #e6c9c4;
}
/* Counters (knit.js): the repeat and her own in one row that scrolls sideways.
   The picked one wraps its name in − and +, like a stepper; «+ Счётчик» is a
   dashed chip at the end, like an empty slot of «Мои кисти». */
.knit-counters {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 2px;
  margin: -2px;
}
.knit-counters::-webkit-scrollbar {
  display: none;
}
.knit-counter {
  flex: none;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e2e5dd;
  border-radius: 12px;
  background: #fff;
}
.knit-counter.picked {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green);
  background: #eef3ea;
}
#knitBar .knit-counter button {
  min-height: 36px;
  border: 0;
  background: none;
  border-radius: 11px;
}
#knitBar .knit-counter-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
}
#knitBar .picked .knit-counter-label {
  padding-inline: 6px;
}
.knit-counter-text {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.knit-counter-name {
  max-width: 11em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.knit-counter-label b {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.knit-counter-label small {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.knit-of-short {
  display: none;
}
#knitBar .knit-counter-step {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--green);
}
@media (hover: hover) {
  #knitBar .knit-counter-step:not(:disabled):hover {
    background: #dfe8d8;
  }
}
#knitBar .knit-counter-add {
  flex: none;
  min-height: 38px;
  border: 1.5px dashed #c9d3bf;
  background: transparent;
  color: var(--green);
  font-weight: 600;
}
.knit-counter-pop:not([hidden]) {
  inset-inline: 0 auto;
  width: 340px;
}
.knit-counter-own:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.knit-counter-own .knit-label {
  margin-top: 0;
}
.friendly-ui #knitCounterName {
  margin: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--ui-stroke);
  border-radius: 10px;
  font-size: 15px;
}
.knit-counter-cycle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.knit-counter-cycle .stepper-control {
  flex: none;
  width: 132px;
}
#knitBar .knit-counter-cycle .step {
  width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  border-radius: 0;
  font-size: 18px;
}
.friendly-ui .knit-counter-cycle .stepper-control input {
  height: 40px;
}
.knit-counter-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.knit-counter-pop .knit-actions {
  justify-content: space-between;
  margin-top: 4px;
}
#knitBar .knit-counter-pop .primary {
  flex: none;
  min-width: 96px;
}
#knitCounterRemove {
  color: #a64f46;
  border-color: #e6c9c4;
}
@media (max-width: 700px) {
  body:is(.knitting, .stitching) .canvas-area {
    padding-left: 12px;
  }
  #knitBar:not([hidden]),
  #stitchBar:not([hidden]) {
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    padding: 12px 10px 10px;
  }
  .knit-info strong,
  .knit-confirm strong {
    font-size: 16px;
    white-space: normal;
  }
  .knit-actions {
    flex-wrap: wrap;
  }
  #knitBar button,
  #stitchBar .knit-actions button {
    min-height: 46px;
    font-size: 15px;
  }
  #knitBack,
  #knitMoreBtn {
    min-width: 46px;
    justify-content: center;
    padding: 8px !important;
  }
  #knitNext {
    flex: 1 1 40% !important;
  }
  #knitBar .knit-axis {
    order: 5;
    flex: 1 1 55%;
  }
  #knitBar .knit-axis .ui-segment {
    min-height: 38px;
    font-size: 14px;
  }
  #knitDone {
    order: 6;
  }
  .knit-more:not([hidden]) {
    width: auto;
    inset-inline: 0;
    max-height: calc(100vh - 170px);
  }
  /* For a finger: − and + of the picked counter are both 44 px. */
  #knitBar .knit-counter button {
    min-height: 44px;
    font-size: 15px;
  }
  #knitBar .knit-counter-label {
    padding: 4px 10px;
  }
  #knitBar .picked .knit-counter-label {
    padding-inline: 4px;
  }
  #knitBar .knit-counter-step {
    width: 44px;
    min-width: 44px;
    height: 44px;
    font-size: 20px;
  }
  #knitBar .knit-counter-add {
    min-height: 46px;
  }
  .knit-of-long {
    display: none;
  }
  .knit-of-short {
    display: inline;
  }
  .knit-counter-name {
    max-width: 7.5em;
  }
  /* The counter settings for a finger too: the name and − / + are 44 px. */
  .friendly-ui #knitCounterName {
    min-height: 44px;
  }
  #knitBar .knit-counter-cycle .step {
    width: 44px;
    min-height: 44px;
    height: 44px;
  }
  .friendly-ui .knit-counter-cycle .stepper-control input {
    height: 44px;
  }
  .knit-counter-cycle .stepper-control {
    width: 140px;
  }
}
/* «Пряжа»: the second tab of the colour panel (yarn.js). In yarn mode the
   palette, «Мои цвета» and the wheel step aside; «Перекрасить всё» stays. */
.colour-tabs:not([hidden]) {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: #f0efe8;
  border-radius: 999px;
}
.friendly-ui .colour-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6b7268;
  font-size: 14px;
  font-weight: 500;
}
.friendly-ui .colour-tabs button[aria-selected='true'] {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 4px #0000001f;
}
#colorPanel.yarn-mode
  :is(#palette, .saved-colors-head, #savedColors, #slotActions, #customToggle, #customColour) {
  display: none;
}
.colour-head .yarn-name {
  display: block;
  font-size: 12px;
  color: var(--ink);
  margin-top: 2px;
}
.colour-head .yarn-name[hidden] {
  display: none;
}
.yarn-view:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.friendly-ui .yarn-line-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: start;
}
.yarn-line-btn > span:first-child {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.yarn-line-btn b,
.yarn-line b {
  font-size: 14px;
  font-weight: 600;
}
.yarn-line-btn small,
.yarn-line small {
  font-size: 12px;
  color: #6b7268;
}
.yarn-line-btn[aria-expanded='true'] .custom-chevron {
  transform: rotate(-135deg) translate(-2px, 0);
}
.yarn-lines:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friendly-ui #colorPanel .yarn-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: start;
}
.yarn-line small {
  grid-column: 1;
}
.yarn-line-dots {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
}
.yarn-line-dots span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
}
.yarn-line-dots span + span {
  margin-inline-start: -5px;
}
.friendly-ui #colorPanel .yarn-line.selected {
  background: #eef3ea;
  border-color: var(--green);
}
.friendly-ui .yarn-search {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  font-size: 14px;
  box-sizing: border-box;
}
.yarn-swatches {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 6px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.friendly-ui .yarn-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  min-height: 0;
}
.yarn-swatch span {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #00000014;
  box-sizing: border-box;
}
.yarn-swatch small {
  font-size: 11px;
  color: #4f574d;
}
.yarn-swatch.selected span {
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 5px var(--green);
}
.yarn-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: #6b7268;
}
/* Search beside «Кружки | Список»; the list shows every colour's name. */
.yarn-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.yarn-tools .yarn-search {
  flex: 1;
  min-width: 0;
}
.yarn-layout {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #f0efe8;
  border-radius: 999px;
  flex: none;
}
.friendly-ui .yarn-layout button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6b7268;
  font-size: 12px;
}
.friendly-ui .yarn-layout button[aria-pressed='true'] {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px #0000001f;
}
.yarn-swatch em {
  display: none;
}
.yarn-swatches.as-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}
.friendly-ui .yarn-swatches.as-list .yarn-swatch {
  flex-direction: row;
  gap: 12px;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 10px;
  text-align: start;
}
.yarn-swatches.as-list .yarn-swatch span {
  width: 32px;
  flex: none;
}
.yarn-swatches.as-list .yarn-swatch small {
  width: 44px;
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.yarn-swatches.as-list .yarn-swatch em {
  display: block;
  flex: 1;
  min-width: 0;
  font-style: normal;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yarn-swatches.as-list .yarn-swatch.selected {
  background: #eef3ea;
}
.yarn-swatches.as-list .yarn-swatch.selected span {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--green);
}
.colour-head .yarn-name.preview {
  color: var(--green);
}
.yarn-swatch {
  -webkit-touch-callout: none;
  user-select: none;
}

/* «В схеме»: the legend tab of the colour panel (legend.js). */
.used-view:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.used-summary {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.used-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
}
.friendly-ui .used-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: start;
}
.used-row[aria-pressed='true'] {
  background: #eef3ea;
}
.used-dot {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #0002;
}
.used-row > span:not(.used-dot) {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.used-row b {
  font-size: 14px;
  color: var(--ink);
}
.used-row small {
  font-size: 12px;
  color: #6b7268;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.used-row em {
  flex: none;
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* «Стежок» at the top of the brush panel, for cross-stitch only (cross-stitch-tools.js). */
#brushStitchRow:not([hidden]) {
  margin-bottom: 6px;
}
.brush-hint.stitch-hint {
  margin: 0 0 14px;
}
#brushStitch button {
  font-size: 15px;
}
#brushStitch button[data-v='back'] {
  flex: 2;
  font-size: 12px;
}

/* Вышивать (stitch-progress.js): the knitting bar's look, with a row of threads. */
#stitchBar:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
#stitchShare {
  margin-inline-start: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stitch-threads {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  margin: -2px;
  scrollbar-width: none;
}
.friendly-ui #stitchBar .stitch-thread {
  flex: none;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 7px;
  align-items: center;
  min-height: 44px;
  padding: 5px 10px 5px 6px;
  border: 1px solid #e2e5dd;
  border-radius: 12px;
  background: #fff;
  text-align: start;
}
.stitch-thread i {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #0000001f;
}
.stitch-thread i.all {
  background: conic-gradient(#c77168, #e5b8a8, #718769, #405e4a, #c77168);
}
.stitch-thread b {
  font-size: 13px;
  line-height: 1.1;
}
.stitch-thread small {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.friendly-ui #stitchBar .stitch-thread[aria-pressed='true'] {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green);
  background: #eef3ea;
}
.stitching-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.yarn-note a {
  color: var(--green);
}

/* «Статистика» for Yuriy (stats.js): a wide sheet with seven sections. */
:root {
  --stats-up: #3f7a52;
  --stats-down: #a64f46;
}
.stats-open {
  width: 100%;
  margin-top: 12px;
}
.stats-sheet {
  width: min(980px, 96vw);
  max-height: 92vh;
}
.stats-tabs {
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stats-tabs .ui-segment {
  flex: 1 0 auto;
  white-space: nowrap;
}
.stats-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.stats-filters #statsDays {
  flex: 1 1 100%;
}
.stats-filters select {
  width: auto;
  flex: 1 1 150px;
}
.stats-filters select,
.stats-heat-controls select {
  font: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  color: inherit;
  max-width: 100%;
}
.stats-own {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.stats-own input {
  width: 34px;
  height: 20px;
  margin: 0;
  accent-color: var(--green);
}
.stats-status:not(:empty) {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f1e8;
  color: var(--muted);
}
.stats-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0;
}
.stats-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.stats-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stats-tile span {
  color: var(--muted);
  font-size: 12px;
}
.stats-tile b {
  font-family: Manrope, sans-serif;
  font-size: 24px;
}
.stats-tile small {
  font-size: 11px;
  color: var(--muted);
}
.stats-tile small.up {
  color: var(--stats-up);
  font-weight: 600;
}
.stats-tile small.down {
  color: var(--stats-down);
  font-weight: 600;
}
.stats-chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.stats-line .axis {
  stroke: var(--line);
}
.stats-line .area {
  fill: #405e4a14;
}
.stats-line .stroke {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-linejoin: round;
}
.stats-line .note {
  fill: var(--muted);
  font-size: 11px;
}
.stats-shares {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 22px;
  margin-top: 14px;
}
.stats-share h4 {
  margin: 6px 0;
  font-size: 12px;
}
.stats-bar {
  display: grid;
  grid-template-columns: 1fr 90px 40px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
}
.stats-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-bar i {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--green);
  min-width: 2px;
}
.stats-bar b {
  text-align: right;
  font-weight: 600;
}
.stats-empty {
  color: var(--muted);
}
.stats-heat-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.stats-heat-controls .ui-segments {
  flex: 1 1 220px;
}
.stats-heat {
  position: relative;
  margin: 8px auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #eef0e8;
}
.stats-heat.phone {
  width: min(320px, 100%);
}
.stats-heat img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(0.7) brightness(1.04);
}
.stats-heat canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  cursor: default;
}
.stats-targets {
  margin: 4px 0;
  padding-left: 22px;
  font-size: 12px;
}
.stats-targets li {
  padding: 3px 0;
}
.stats-targets li b {
  float: right;
}
.stats-table-wrap {
  overflow-x: auto;
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.stats-table th,
.stats-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.stats-table th {
  color: var(--muted);
  font-weight: 500;
}
.stats-table .num {
  text-align: right;
}
.stats-table .code {
  font-family: ui-monospace, monospace;
}
.stats-who {
  margin-top: 16px;
  max-width: 360px;
}
.stats-funnel {
  display: grid;
  gap: 6px;
  margin: 12px 0 6px;
}
.stats-step {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr 90px 70px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.stats-step i {
  display: block;
  height: 22px;
  border-radius: 6px;
  background: var(--green);
  min-width: 2px;
}
.stats-step b {
  text-align: right;
  font-weight: 600;
}
.stats-step small {
  color: var(--stats-down);
  font-size: 11px;
}
.stats-bar-cell {
  min-width: 120px;
}
.stats-bar-cell i {
  display: inline-block;
  vertical-align: middle;
  height: 8px;
  border-radius: 4px;
  background: var(--green);
  min-width: 2px;
  max-width: calc(100% - 48px);
  margin-right: 8px;
}
.stats-heat-cell {
  background: rgb(64 94 74 / calc(var(--share, 0) * 0.55));
}
.stats-heat-cell.waiting {
  color: var(--muted);
  font-style: italic;
}
.stats-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.stats-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
}
@media (max-width: 700px) {
  .stats-step {
    grid-template-columns: 1fr 84px;
    gap: 2px 10px;
  }
  .stats-step i {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 14px;
  }
  .stats-step small {
    grid-column: 1 / -1;
  }
  .stats-sheet {
    padding: 20px 16px;
  }
  .stats-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats-tabs {
    justify-content: flex-start;
  }
  .stats-bar-cell {
    min-width: 96px;
  }
  .stats-tile b {
    font-size: 20px;
  }
  .stats-filters select {
    flex: 1 1 140px;
  }
}

/* «Заливка»: «Цветом | Узором» on top, then the colour options or the pattern sources (fill.js). */
.fill-sheet {
  width: 360px;
}
.fill-kind {
  margin: 4px 0 14px;
}
.fill-kind button {
  min-height: 40px;
  font-size: 14px;
}
.fill-sheet .brush-row {
  margin-top: 0;
}
.fill-sheet .colour-actions {
  margin-top: 14px;
}
.fill-sheet .colour-actions .outline {
  width: 100%;
}

/* The eraser's shapes fold under «Формы ластика» (brushes.js). */
.toggle-note {
  font-size: 12px;
  font-weight: 400;
  color: #899087;
}
.eraser-forms + .brush-forms {
  margin-top: 12px;
}

/* On a phone the help moves from the header into «Мои схемы». */
.help-in-projects {
  display: none;
}
@media (max-width: 700px) {
  .topbar #help {
    display: none;
  }
  .friendly-ui .help-in-projects {
    display: block;
    width: 100%;
    margin-top: 12px;
  }
  /* The tile fill keeps its main button whole: the gap lives in «Ещё». */
  #tileBar .tile-gap,
  .tile-drag-hint {
    display: none;
  }
  .fill-sheet {
    width: 100%;
  }
  /* Small buttons in one row, «Залить полотно» and «Отмена» in the next. */
  #tileBar .text-bar-actions[data-for='place'] {
    flex-wrap: wrap;
  }
  #tileBar .text-bar-actions[data-for='place'] .text-pop-btn {
    flex: 1;
  }
  #applyTile {
    flex: 1 1 60% !important;
  }
}

/* «новое» on a new button for its first weeks (new-badge.js); a dot on the toolbar. */
.new-badge {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #f2e6c9;
  color: #7a5a1c;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: middle;
}
.insert-item .new-badge {
  margin-inline-start: auto;
  align-self: flex-start;
}
.new-badge.dot {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  background: #d9a441;
  box-shadow: 0 0 0 2px #fff;
}

/* Схема из PDF или фото (doc-follow.js, doc-chart.js): the page stands where
   the canvas is, the drawing tools step aside, the bar of «Вязать» follows
   the row; page thumbnails on the right of a computer screen. */
body.doc-open
  :is(
    .toolbar,
    #migrationBanner,
    .canvas-area,
    .canvas-status,
    .view-controls,
    .rulers,
    #projectTitleBtn,
    #sizeBtn,
    #sizeEditor,
    .save-info,
    #progressBtn,
    .export-wrap
  ) {
  display: none !important;
}
.doc-name {
  min-width: 0;
  padding: 8px 6px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-tag {
  cursor: default;
}
body.doc-open #toast {
  bottom: var(--doc-space, 24px);
}
.doc-view:not([hidden]) {
  flex: 1;
  min-width: 0;
  display: flex;
  position: relative;
}
.doc-area {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  padding: 18px 28px var(--doc-space, 200px);
  overscroll-behavior: contain;
}
.doc-area.touch-panning {
  cursor: grabbing;
}
.doc-stage {
  margin: 0 auto;
  position: relative;
}
#docCanvas {
  display: block;
  background: #fff;
  box-shadow: 0 10px 40px #303d341a;
  border-radius: 2px;
  cursor: grab;
}
.doc-loading {
  position: absolute;
  inset: 40px 0 auto;
  text-align: center;
  color: var(--muted);
}
.doc-loading[hidden] {
  display: none;
}
.doc-pages:not([hidden]) {
  flex: none;
  width: 112px;
  overflow-y: auto;
  padding: 18px 12px var(--doc-space, 200px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.doc-pages button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 12px;
}
.doc-pages button canvas {
  width: 84px;
  height: 110px;
  background: #fff;
  box-shadow: 0 2px 10px #303d341a;
  border-radius: 3px;
}
.doc-pages button[aria-current='true'] {
  border-color: var(--green);
  color: var(--green);
  font-weight: 600;
}
.doc-zoom {
  position: absolute;
  right: 20px;
  bottom: 16px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #fff;
  border: 1px solid #e3e5da;
  border-radius: 999px;
  box-shadow: 0 6px 20px #303d3414;
}
.doc-zoom .iconbtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
}
#docZoomReset {
  min-width: 54px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
#docBar:not([hidden]),
#docGridBar:not([hidden]) {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  width: min(96vw, 640px);
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid #d9ddd2;
  background: #fffffff2;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px #30442726;
  border-radius: 18px;
  font-size: 13px;
  color: var(--ink);
}
#docBar:not([hidden]) {
  overflow: visible;
}
.doc-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.doc-info strong,
.doc-step > strong {
  font:
    700 17px Manrope,
    'Golos Text',
    sans-serif;
}
.doc-info strong {
  white-space: nowrap;
}
#docDone {
  color: var(--muted);
  white-space: nowrap;
}
#docPageNote {
  margin-inline-start: auto;
  color: var(--muted);
  white-space: nowrap;
}
.doc-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f5ef;
  color: #4b5a44;
  line-height: 1.45;
}
.doc-found:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 6px 12px;
  border-radius: 12px;
  background: #e9eee3;
  color: #3c5a34;
  font-weight: 600;
}
#docFoundText {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
}
#docFoundGo {
  flex: none;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 10px;
  min-height: 34px;
}
#docFoundOff {
  flex: none;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  font-size: 18px;
}
.doc-panel-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.doc-panel-row .ui-segments {
  margin: 0;
  flex: 1 1 180px;
}
.doc-panel-row .ui-segment {
  min-height: 34px;
  padding: 4px 10px;
  font-size: 13px;
}
.doc-panel-row .stepper-control {
  width: 136px;
  flex: none;
}
.doc-panel-row .stepper-control .step {
  width: 38px;
  height: 36px;
}
.friendly-ui .doc-panel-row .stepper-control input {
  height: 36px;
  font-size: 15px;
}
.doc-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.doc-actions {
  flex-wrap: nowrap;
}
#docBar .knit-actions button,
#docGridBar .knit-actions button,
.doc-panel-row > button {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  min-height: 38px;
}
#docBar .primary,
#docGridBar .knit-actions .primary {
  flex: 1;
  font-weight: 600;
}
#docBack {
  min-width: 42px;
  font-size: 17px !important;
}
#docMoreBtn {
  order: 3;
}
.doc-tools {
  display: flex;
  gap: 8px;
  order: 2;
}
.doc-tools button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.doc-tools i svg {
  width: 15px;
  height: 15px;
}
.doc-tools button[aria-pressed='true'] {
  background: #e9eee3;
  border-color: var(--green);
  color: var(--green);
}
.doc-more:not([hidden]) {
  gap: 10px;
}
.doc-make {
  font-weight: 600;
}
.doc-page-step:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
}
.doc-page-step span,
#docGridPageNow {
  flex: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.doc-step:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.doc-step p {
  margin: 0;
  color: #4b5a44;
  line-height: 1.5;
}
.doc-grid-pages:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f5ef;
}
.doc-page-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.doc-page-chip {
  min-width: 36px;
  min-height: 34px;
  border: 1px solid #d9ddd2;
  border-radius: 9px;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.doc-page-chip[aria-pressed='true'] {
  background: #e9eee3;
  border-color: var(--green);
  color: var(--green);
  font-weight: 600;
}
.doc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 132px;
  overflow-y: auto;
  padding: 2px;
}
.doc-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px 4px 5px;
  border: 1px solid #e1e3d8;
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.doc-legend-chip i {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px #0000001f;
}
.doc-legend-icon {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}
/* «Мои схемы»: a chart from a PDF or a photo among the patterns. */
.doc-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.doc-open-btn i svg {
  width: 18px;
  height: 18px;
}
.doc-thumb {
  object-fit: contain;
  background: #fff;
  image-rendering: auto;
}
.doc-pill {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef0e8;
  color: #5d6a5b;
  font-size: 10.5px;
  font-weight: 600;
  vertical-align: 1px;
}
@media (max-width: 700px) {
  .doc-name {
    grid-column: 1/-1;
    padding: 2px 0;
  }
  .doc-tag {
    border: 0;
    background: none;
    padding: 0;
    font-size: 11px;
    color: #5d6a5b;
  }
  .doc-view:not([hidden]) {
    flex-direction: column;
  }
  .doc-area {
    padding: 10px 10px var(--doc-space, 200px);
  }
  .doc-pages:not([hidden]) {
    display: none;
  }
  .doc-zoom {
    top: 10px;
    bottom: auto;
    right: 10px;
  }
  .doc-zoom .iconbtn {
    display: none;
  }
  #docBar:not([hidden]),
  #docGridBar:not([hidden]) {
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    padding: 12px 10px 10px;
  }
  .doc-actions {
    flex-wrap: wrap;
  }
  #docBar .knit-actions button,
  #docGridBar .knit-actions button {
    min-height: 46px;
    font-size: 15px;
  }
  #docNext {
    flex: 1 1 40% !important;
    min-height: 56px !important;
    font-size: 17px !important;
  }
  #docBack,
  #docMoreBtn {
    min-width: 46px;
    justify-content: center;
    padding: 8px !important;
  }
  #docMoreBtn .text-btn-label {
    display: none;
  }
  #docMoreBtn {
    order: 1;
  }
  .doc-tools {
    order: 5;
    flex: 1 1 100%;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: #edf1e8;
  }
  .doc-tools button {
    flex: 1;
    justify-content: center;
    border-color: transparent;
    background: transparent;
  }
  .doc-tools button[aria-pressed='true'] {
    background: #fff;
  }
  .doc-more:not([hidden]) {
    width: auto;
    inset-inline: 0;
    max-height: calc(100dvh - 170px);
  }
  .doc-legend {
    max-height: 96px;
  }
}
/* «Конфиденциальность · Условия использования»: plain links at the bottom of
   «Мои схемы», the account menu and «Аккаунт и данные» (no pill, Yuriy's decision). */
.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line, #e2e5dd);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted, #6b7468);
}
.legal-links a,
.analytics-pick a,
.consent-card a {
  color: var(--green);
  text-underline-offset: 3px;
}
.account-menu .legal-links {
  gap: 2px 6px;
  margin: 6px 0 0;
  padding-top: 10px;
  font-size: 12px;
}
.dropdown button[data-new] {
  position: relative;
}
.dropdown button > .new-badge {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  display: inline-block;
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  color: #7a5a1c;
}

/* The card under the greeting that asks once about statistics (analytics.js):
   «Нет, спасибо» on the left, «Да, помогать» on the right and green. */
.consent-card {
  width: min(560px, 100%);
  padding: 18px 20px;
  border: 1px solid #dfe5d6;
  border-radius: 16px;
  background: #eef1e6;
  color: var(--ink);
}
.consent-card h2 {
  display: block;
  margin: 0 0 6px;
  font-family: Manrope, sans-serif;
  font-size: 16px;
  font-weight: 700;
}
.consent-card p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #5d6a5b;
}
.consent-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.consent-actions .outline {
  background: #fffefa;
}

/* «Аккаунт и данные» (account-data.js). */
.account-dialog,
.delete-dialog {
  max-width: 460px;
}
.account-dialog .account-who {
  margin: 0 0 12px;
}
.account-dialog .account-who strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
.account-facts {
  display: grid;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}
.account-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.account-facts dt {
  color: #6b7268;
}
.account-facts dd {
  margin: 0;
  font-weight: 600;
}
.account-part {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line, #e2e5dd);
}
.account-part h3 {
  margin: 0 0 4px;
  font-size: 14px;
}
.account-part p {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #6b7268;
}
.account-export,
.account-part .outline {
  width: 100%;
  text-decoration: none;
  color: var(--ink);
}
.account-export i {
  display: inline-flex;
  width: 18px;
  height: 18px;
}
.account-part .danger-outline {
  color: #a64f46;
  border-color: #e3bdb6;
}
.account-pending {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fbeee9;
  color: #8c3f35;
}
.account-pending p {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
}
.account-pending .primary {
  width: 100%;
}
.delete-lists {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.delete-lists > div {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.5;
}
.delete-lists ul {
  margin: 4px 0 0;
  padding-inline-start: 18px;
}
.delete-goes {
  background: #fbeee9;
  color: #8c3f35;
}
.delete-stays {
  background: #edf1e6;
  color: #3f5a44;
}
.delete-confirm {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-size: 12.5px;
  color: #6b7268;
}
.delete-confirm input {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #dcded3;
  border-radius: 11px;
  background: #fff;
  font-size: 15px;
}
.delete-dialog .danger-fill {
  background: #a64f46;
  border-color: #a64f46;
}
.delete-dialog .dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
/* «Экспорт»: sections «Поделиться», «Скачать картинку», «Скачать схему». The
   title of an item and its «новое» share the first line, the note the second. */
.export-menu {
  width: 270px;
}
.export-menu button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
}
.export-menu button > span:not(.new-badge) {
  grid-column: 1 / -1;
  grid-row: 2;
}
.export-menu button > .new-badge {
  grid-row: 1;
  grid-column: 2;
  justify-self: start;
}
.dropdown .export-file-head {
  margin-top: 16px;
}

/* «Ссылка на схему» (share.js): a panel under «Экспорт» with the link, how it
   works and «Закрыть ссылку». Its own buttons: the header's would turn square. */
.share-panel {
  width: min(380px, calc(100vw - 16px));
  padding: 14px 16px 16px;
}
.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.dropdown .share-head strong {
  margin: 0;
  font:
    600 15px Manrope,
    'Golos Text',
    sans-serif;
}
.dropdown .share-x {
  flex: none;
  width: 32px;
  min-height: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: #f0f1ea;
  font-size: 17px;
  text-align: center;
}
.share-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
.share-body p {
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5649;
}
#shareGuest p {
  margin-top: 0;
}
.share-error {
  color: #8c3f35;
}
.share-row {
  display: flex;
  gap: 8px;
}
.share-row input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #dfe3d7;
  border-radius: 10px;
  background: #f7f8f2;
  font:
    13px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: var(--ink);
}
.dropdown .share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid #dcded3;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.dropdown .share-btn.main {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.dropdown .share-btn[hidden] {
  display: none;
}
#shareSend {
  width: 100%;
  margin-top: 8px;
}
.share-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.share-foot[hidden] {
  display: none;
}
.share-foot small,
.share-older-row span {
  font-size: 11.5px;
  color: #6b7268;
}
.dropdown .share-revoke {
  display: inline;
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 0;
  background: none;
  color: #a64f46;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.share-older {
  margin-top: 6px;
  font-size: 12px;
  color: #4b5649;
}
.share-older summary {
  cursor: pointer;
  min-height: 36px;
  display: flex;
  align-items: center;
}
.share-older-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Someone else's pattern from a link: read-only like «Вязать», a «по ссылке»
   tag by the name and a card with «Сохранить себе»; «Вязать» waits for the copy. Until the
   pattern arrives (or when the link does not open) only the card shows. */
.shared-tag {
  flex: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eceee6;
  color: #5d6a5b;
  font-size: 11.5px;
  white-space: nowrap;
}
.shared-tag[hidden] {
  display: none;
}
body.shared-view :is(.toolbar, .history, .title-edit, #sizeBtn i, .save-info, #progressBtn) {
  display: none !important;
}
body.shared-view :is(#projectTitleBtn, #sizeBtn) {
  pointer-events: none;
}
body.shared-view .canvas-area {
  padding-left: 28px;
  padding-bottom: var(--shared-space, 220px);
}
body.shared-view #toast {
  bottom: var(--shared-space, 24px);
}
body.shared-loading :is(.canvas-stage, .view-controls, .rulers, .ruler-jump, .canvas-status, .project-meta) {
  visibility: hidden;
}
.shared-card:not([hidden]) {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  display: grid;
  gap: 8px;
  width: min(96vw, 560px);
  padding: 16px 18px;
  border: 1px solid #d9ddd2;
  background: #fffffff2;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px #30442726;
  border-radius: 18px;
  color: var(--ink);
}
.shared-card strong {
  font:
    600 16px Manrope,
    'Golos Text',
    sans-serif;
  overflow-wrap: anywhere;
}
.shared-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #4b5649;
}
.shared-card p[hidden] {
  display: none;
}
.shared-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.shared-actions [hidden] {
  display: none !important;
}
.shared-actions a.primary {
  text-decoration: none;
}
.shared-card .shared-about {
  margin-inline-start: auto;
  border: 0;
  background: none;
  padding: 8px 0;
  font-size: 13px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 700px) {
  .export-menu {
    width: min(300px, calc(100vw - 16px));
  }
  /* The export button is not at the edge of a phone: the panel takes the width. */
  .share-panel {
    position: fixed;
    top: 70px;
    left: 8px;
    right: 8px;
    width: auto;
  }
  .shared-tag {
    grid-row: 2;
    grid-column: 2;
    justify-self: start;
    font-size: 11px;
    padding: 1px 8px;
  }
  body.shared-view .canvas-area {
    padding-left: 12px;
  }
  .shared-card:not([hidden]) {
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    padding: 14px 14px 12px;
  }
  .shared-actions :is(.primary, .outline) {
    flex: 1 1 40%;
    min-height: 46px;
    font-size: 15px;
  }
  .shared-card .shared-about {
    display: none;
  }
}
@media (max-width: 360px) {
  /* No room beside the size: the card says where the pattern came from. */
  .shared-tag {
    display: none;
  }
}
/* Nothing behind it yet (or the link did not open): the card stands in the middle. */
body.shared-loading .shared-card:not([hidden]) {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
}

/* The first minutes (welcome.js): «бета» at the logo and its panel. */
.beta-wrap {
  position: relative;
  flex: none;
  margin-inline-start: -8px;
}
.beta-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #cfdcc8;
  background: #eef3ea;
  color: var(--green);
  font:
    600 11px/1 'Golos Text',
    sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
}
/* A finger finds it even where it is small (the phone), not the logo link under it. */
.beta-pill::before {
  content: '';
  position: absolute;
  inset: -6px -6px;
}
.beta-pill:hover,
.beta-pill[aria-expanded='true'] {
  background: #e2eadb;
}
.beta-panel {
  position: absolute;
  inset-inline-start: -40px;
  top: calc(100% + 12px);
  z-index: 30;
  width: 360px;
  padding: 16px 18px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 40px #35472925;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
}
.beta-panel[hidden],
.beta-actions[hidden],
.beta-info[hidden],
.beta-buttons [hidden] {
  display: none;
}
.beta-panel strong {
  display: block;
  margin-inline-end: 36px;
  margin-bottom: 6px;
  font:
    600 16px/1.3 Manrope,
    sans-serif;
}
.beta-panel p {
  margin: 0 0 10px;
  color: #4c5a50;
}
.beta-close {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
}
.beta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.beta-buttons .primary,
.beta-buttons .outline {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13.5px;
  text-decoration: none;
}
.beta-info {
  display: block;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* «Написать нам» inside the «бета» panel (feedback.js). */
.beta-panel {
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.feedback-form[hidden],
.feedback-sent[hidden],
.feedback-images[hidden],
.feedback-reply[hidden],
.feedback-email[hidden],
.feedback-email-input[hidden],
.feedback-error[hidden],
.feedback-add[hidden],
#betaMain[hidden] {
  display: none;
}
.feedback-form {
  display: grid;
  gap: 10px;
}
.feedback-form strong,
.feedback-sent strong {
  margin-bottom: 0;
}
.feedback-back {
  justify-self: start;
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.feedback-back:hover {
  color: var(--green);
}
.feedback-kinds {
  width: 100%;
}
.feedback-kinds .ui-segment {
  flex: 1 1 0;
}
.feedback-form textarea,
.feedback-email-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 14px;
}
.feedback-form textarea {
  min-height: 96px;
  resize: vertical;
}
.feedback-images {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.feedback-thumbs {
  display: contents;
}
.feedback-add {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px dashed #b9c8b2;
  border-radius: 999px;
  color: var(--green);
  font-weight: 600;
  cursor: pointer;
}
.feedback-add input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.feedback-add:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.feedback-note,
.feedback-email small,
.feedback-attach small,
.feedback-auto,
.feedback-send span {
  color: var(--muted);
  font-size: 12px;
}
.feedback-thumb {
  position: relative;
  width: 48px;
  height: 48px;
}
.feedback-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.feedback-thumb-remove {
  position: absolute;
  top: -8px;
  inset-inline-end: -8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.feedback-reply {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}
.feedback-reply b {
  overflow-wrap: anywhere;
}
.feedback-link {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--green);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.feedback-email {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: -4px;
}
.feedback-attach {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.feedback-attach input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--green);
}
.feedback-attach small {
  display: block;
}
.beta-panel .feedback-auto {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.beta-panel .feedback-error {
  margin: 0;
  color: #a64f46;
}
.feedback-send {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.feedback-send .primary {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 12px;
}
.feedback-check {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: #eef3ea;
  color: var(--green);
  font-weight: 700;
}
.help-feedback {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.help-feedback span {
  color: var(--muted);
  font-size: 13px;
}
.help-feedback .primary {
  margin-top: 8px;
  min-height: 42px;
  border-radius: 12px;
}

/* «Как вам Петля?» where «Это Петля» stands (feedback.js). */
.ask-answers[hidden] {
  display: none;
}
.ask-more {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}
.ask-card .welcome-link {
  display: inline;
}

/* «Отзывы» for Yuriy (feedback.js). */
.inbox-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.inbox-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #a64f46;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}
.inbox-count[hidden],
#inboxList[hidden],
.inbox-open-item[hidden] {
  display: none;
}
.inbox-sheet {
  width: min(720px, 96vw);
}
#inboxShow .ui-segment {
  white-space: nowrap;
}
.inbox-items {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.inbox-items:empty {
  display: none;
}
.inbox-items li + li {
  border-top: 1px solid var(--line);
}
.inbox-item {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px 12px 28px;
  border: 0;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.inbox-item:hover {
  background: #f7f8f4;
}
.inbox-item.unread::before {
  content: '';
  position: absolute;
  inset-inline-start: 11px;
  top: 19px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.inbox-item.unread .inbox-text {
  font-weight: 600;
}
.inbox-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.inbox-time,
.inbox-meta,
.inbox-sub {
  color: var(--muted);
  font-size: 12px;
}
.inbox-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.inbox-chip {
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef3ea;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}
.inbox-chip-bug {
  background: #f8e5e2;
  color: #a64f46;
}
.inbox-chip-rating {
  background: #f6ead0;
  color: #85612a;
}
.inbox-open-item {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}
.inbox-open-item .inbox-head {
  justify-content: flex-start;
}
.inbox-who {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.inbox-sub,
.inbox-full {
  margin: 0;
}
.inbox-full {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.inbox-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.inbox-images img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.inbox-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 4px 0;
  font-size: 13px;
}
.inbox-facts dt {
  color: var(--muted);
}
.inbox-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inbox-actions > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 140px;
  min-height: 44px;
  border-radius: 12px;
  text-decoration: none;
}
.inbox-actions .primary {
  flex-basis: 100%;
}

/* «Это Петля»: once, where a context panel stands; goes with the first stroke. */
.welcome-card {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 25;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 180px));
  padding: 18px 20px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 44px rgba(48, 61, 52, 0.18);
  color: var(--ink);
}
.welcome-card[hidden] {
  display: none;
}
.welcome-card h2 {
  margin: 0 0 6px;
  padding-inline-end: 40px;
  font:
    600 17px/1.3 Manrope,
    sans-serif;
}
.welcome-card p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: #4c5a50;
}
.welcome-card p[hidden] {
  display: none;
}
.welcome-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
}
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.welcome-actions .primary,
.welcome-actions .outline {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 14px;
}
.welcome-link {
  margin-inline-start: auto;
  border: 0;
  background: none;
  padding: 8px 4px;
  color: var(--green);
  font:
    600 14px 'Golos Text',
    sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* «пример» at the name of the guest's example (welcome.js). */
.example-tag {
  flex: none;
  padding: 1px 8px;
  border-radius: 8px;
  background: #efeee6;
  color: #6f776d;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
}
.example-tag[hidden] {
  display: none;
}
.welcome-knit {
  white-space: nowrap;
}
.welcome-icon svg {
  width: 16px;
  height: 16px;
  margin-inline-end: 2px;
  vertical-align: -3px;
}

/* «Войти» for a guest at the top of «Мои схемы» (cloud.js startGuest). */
.guest-card {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #d6e1d0;
  border-radius: 14px;
  background: #f4f7f1;
}
.guest-card[hidden] {
  display: none;
}
.guest-card strong {
  font-size: 14px;
}
.guest-card p {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.4;
  color: #5d6a5b;
}
.guest-card .primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 42px;
  border-radius: 12px;
  text-decoration: none;
}
.language-auto {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.language-auto[hidden],
.save-tip-sign-in[hidden] {
  display: none;
}
.save-tip-sign-in {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
@media (max-width: 700px) {
  .beta-wrap {
    position: absolute;
    inset-inline-start: 12px;
    top: 44px;
    margin: 0;
    z-index: 2;
  }
  .beta-pill {
    min-height: 16px;
    padding: 0 5px;
    font-size: 9.5px;
    background: #f4f7f1;
  }
  .beta-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 72px;
    width: auto;
  }
  /* Under the name on a phone, between the size and the save icon. */
  .project-meta {
    grid-template-columns: auto auto minmax(0, 1fr);
  }
  .example-tag {
    grid-row: 2;
    grid-column: 2;
    justify-self: start;
    font-size: 10.5px;
  }
  .welcome-card {
    left: 10px;
    right: 10px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    border-radius: 20px;
    padding: 16px 16px 14px;
  }
  .welcome-actions .primary,
  .welcome-actions .outline {
    padding: 0 12px;
    font-size: 13.5px;
  }
  .welcome-wide,
  .welcome-link {
    display: none;
  }
  .ask-card .welcome-link {
    display: inline;
  }
  .beta-panel {
    max-height: calc(100dvh - 82px);
  }
}
@media (max-width: 359px) {
  /* The narrowest phones keep the name and the buttons; the tag gives way. */
  .example-tag {
    display: none;
  }
}

/* «Установить Петлю»: the item in the account menu, the sheet with steps and
   the one reminder above the toolbar (install.js). Phones only. */
.account-btn > .new-badge.dot {
  top: 0;
  right: 0;
}
.account-menu:has(.install-item:not([hidden])) {
  width: 300px;
}
.dropdown .install-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 7px;
  padding: 12px;
  background: #f4f6ef;
  border-radius: 14px;
}
.dropdown #guestWho:not([hidden]) ~ .install-item {
  position: relative;
  margin: 26px 0 0;
}
.dropdown #guestWho:not([hidden]) ~ .install-item::before {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: -14px;
  border-top: 1px solid var(--line);
}
.dropdown .install-item[hidden] {
  display: none;
}
.dropdown .install-item .insert-glyph {
  display: grid;
  width: 40px;
  height: 40px;
  margin: 0;
  background: #e6ede0;
}
.dropdown .install-item-text {
  display: block;
  margin: 0;
}
.dropdown .install-item-text b {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.dropdown .install-item-text small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: #5d6a5b;
  line-height: 1.35;
}
.dropdown .install-item .new-badge {
  display: inline-block;
  margin: 0 0 0 6px;
  color: #7a5a1c;
  font-size: 10px;
}
.install-sheet {
  width: 380px;
}
.install-intro {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #5d6a5b;
}
.install-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.install-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #e3e5da;
  border-radius: 14px;
}
.install-step b {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.install-step small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: #5d6a5b;
  line-height: 1.35;
}
.install-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 11px;
}
.insert-glyph[data-glyph] svg {
  width: 22px;
  height: 22px;
}
.insert-glyph[data-glyph='dots'] svg {
  stroke-width: 3.2;
}
.install-note {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f6f5ef;
  border: 1px solid #e8e6dc;
  font-size: 12.5px;
  line-height: 1.45;
  color: #4b5a44;
}
.install-note[hidden] {
  display: none;
}
.install-note i {
  flex: none;
  color: #6b7268;
}
.install-note i svg {
  width: 20px;
  height: 20px;
}
.install-sheet .install-note p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
}
.install-note b {
  color: var(--ink);
}
.install-note a {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}
.install-note a[hidden] {
  display: none;
}
.install-reminder {
  display: none;
}
@media (max-width: 700px) {
  .install-sheet {
    width: 100%;
  }
  .install-reminder:not([hidden]) {
    order: 2;
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 4px 14px;
    margin: 0 10px 10px;
    padding: 14px;
    border: 1px solid #e3e5da;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 8px 30px #30442718;
  }
  .install-reminder-logo svg {
    display: block;
    width: 52px;
    height: 52px;
  }
  .install-reminder-text strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
  }
  .install-reminder-text p {
    margin: 4px 0 0;
    font-size: 13.5px;
    line-height: 1.4;
    color: #5d6a5b;
  }
  #installReminderClose {
    align-self: start;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f1ea;
    font-size: 18px;
  }
  .install-reminder-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
  }
  .install-reminder-actions .primary {
    flex: none;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
  }
  .install-reminder-actions small {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.35;
    color: #6b7268;
  }
  .install-reminder-actions small i svg {
    width: 16px;
    height: 16px;
    flex: none;
  }
}

/* «Зеркало» (mirror.js): a row at the top of the brush and eraser panel, a
   pill over the canvas while it is on, and a blue mark on the brush button.
   Blue, like the frame of a selection: the one cold colour, never a yarn. */
#mirrorChoice i svg {
  width: 20px;
  height: 20px;
}
#brushMirrorRow {
  margin-bottom: 14px;
}
#brushMirrorRow > span {
  line-height: 1.3;
}
#brushMirrorRow .new-badge {
  margin-inline-start: 0;
}
.brush-hint.mirror-hint {
  margin: -6px 0 14px;
}
.mirror-centre {
  display: block;
  margin-top: 8px;
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
}
.mirror-centre[hidden] {
  display: none;
}
/* The handles that drag an axis: a blue triangle on the edge of the canvas,
   pointing at the axis, in a larger invisible target for the finger. */
.mirror-handle {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: ew-resize;
  touch-action: none;
}
.mirror-handle-y {
  cursor: ns-resize;
}
.mirror-handle[hidden] {
  display: none;
}
.mirror-handle i {
  width: 0;
  height: 0;
  border: 8px solid transparent;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
}
.mirror-handle-x i {
  border-top: 12px solid var(--blue);
  border-bottom: 0;
}
.mirror-handle-x {
  place-items: end center;
}
.mirror-handle-x.below {
  place-items: start center;
}
.mirror-handle-x.below i {
  border-top: 0;
  border-bottom: 12px solid var(--blue);
}
.mirror-handle-y i {
  border-left: 12px solid var(--blue);
  border-right: 0;
}
.mirror-handle-y {
  place-items: center end;
}
.mirror-handle:hover i,
.mirror-handle.dragging i {
  transform: scale(1.25);
}
.mirror-handle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  border-radius: 6px;
}
.mirror-pill {
  position: absolute;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 16px);
  min-height: 34px;
  padding: 4px 6px 4px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: start;
  box-shadow: 0 4px 14px #2f6fd040;
  cursor: pointer;
}
.mirror-pill[hidden] {
  display: none;
}
.mirror-pill-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff33;
  font-size: 15px;
  line-height: 1;
}
.mirror-badge {
  position: absolute;
  top: 4px;
  left: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #fff;
}
.mirror-badge[hidden] {
  display: none;
}
.mirror-badge svg {
  width: 14px;
  height: 14px;
}
@media (max-width: 700px) {
  .mirror-pill {
    min-height: 44px;
    font-size: 14px;
  }
  .mirror-handle {
    width: 44px;
    height: 44px;
  }
  .mirror-centre {
    min-height: 44px;
  }
  .mirror-badge {
    top: 2px;
    left: 2px;
  }
}
