/* Мастерская. Основа (цвета, шрифт, котята, таблетки-кнопки, конверт) приходит из /style.css,
   здесь только то, чего нет на главной. У каждой комнаты цвет шёрстки её котёнка:
   холст персиковый (Персик), визитка дымчатая (Дымок), открытка зефирная (Зефирка). */

body.studio {
  background: var(--milk);
}

.studio [hidden] {
  display: none !important;
}

.view {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- кнопки ---------- */

.pill {
  justify-content: center;
  min-height: 2.75rem;
  color: var(--cocoa);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s;
}

.pill:active {
  transform: translateY(3px);
  box-shadow: none;
}

.pill:disabled {
  opacity: .55;
  cursor: default;
}

.pill__ic {
  display: flex;
  flex: none;
}

.pill svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: currentColor;
}

.pill--main {
  background: var(--rasp);
  color: var(--white);
}

.pill--big {
  min-height: 3.2rem;
  padding: .7rem 1.5rem;
  font-size: 1.05rem;
}

.pill--icon {
  flex: none;
  width: 2.75rem;
  padding: 0;
}

.pill--quiet {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--cocoa-soft);
  text-decoration: underline;
  text-underline-offset: .2em;
}

@media (hover: hover) {
  .pill:hover {
    background: var(--blush);
  }

  .pill--main:hover {
    background: #C22763;
  }

  .pill--quiet:hover {
    background: transparent;
    color: var(--cocoa);
  }
}

/* ---------- поля ---------- */

.field {
  display: grid;
  gap: .45rem;
  min-width: 0;
}

.field__label {
  padding: 0;
  font-weight: 700;
}

.field__hint {
  margin: 0;
  color: var(--cocoa-soft);
  font-size: .95rem;
  line-height: 1.4;
}

.field__hint:empty,
.field__error:empty {
  display: none;
}

.field__error,
.field__hint.is-bad {
  margin: 0;
  color: #B3261E;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.35;
}

.input {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: .6rem .85rem;
  border: 3px solid var(--cocoa);
  border-radius: 14px;
  background: var(--white);
  color: var(--cocoa);
  font: inherit;
  font-weight: 600;
  font-variation-settings: inherit;
  line-height: 1.4;
}

.input::placeholder {
  color: var(--cocoa-soft);
  opacity: .85;
}

textarea.input {
  min-height: 7rem;
  resize: vertical;
}

select.input {
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%235B2B3F' d='M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .8rem center;
  background-size: 1.1rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* ---------- сообщения и шторки ---------- */

.toasts {
  position: fixed;
  inset: auto 0 calc(1rem + env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  justify-items: center;
  gap: .5rem;
  width: auto;
  margin: 0;
  padding: 0 1rem;
  border: 0;
  background: none;
  overflow: visible;
  pointer-events: none;
}

.toasts:not(:popover-open):empty {
  display: none;
}

.toast {
  max-width: 28rem;
  margin: 0;
  padding: .6rem 1.1rem;
  border-radius: 18px;
  background: var(--cocoa);
  color: var(--milk);
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  animation: toast-in .3s var(--spring);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(.9);
  }
}

.sheet {
  width: min(100%, 30rem);
  max-width: 100%;
  max-height: 88vh;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 1.1rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom));
  border: 3px solid var(--cocoa);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--milk);
  color: var(--cocoa);
  overflow-y: auto;
}

.sheet[open] {
  animation: sheet-in .28s cubic-bezier(.2, .9, .3, 1);
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
}

.sheet::backdrop {
  background: rgb(91 43 63 / .45);
}

@media (min-width: 640px) {
  .sheet {
    margin: auto;
    border-bottom: 3px solid var(--cocoa);
    border-radius: 22px;
    box-shadow: 0 6px 0 var(--cocoa);
  }
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sheet__title {
  margin: 0;
  font-size: 1.5rem;
  text-align: left;
  overflow-wrap: anywhere;
}

.sheet__actions {
  display: grid;
  gap: .65rem;
  margin-top: 1rem;
}

.sheet__actions .pill {
  width: 100%;
  min-height: 3rem;
}

.sheet__note {
  margin: 0 0 .75rem;
}

.sheet__note a {
  color: var(--rasp);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sheet__art {
  display: block;
  max-width: 100%;
  max-height: 46vh;
  margin: 0 auto;
  border: 3px solid var(--cocoa);
  border-radius: 10px;
  background: var(--white);
}

.sheet__url {
  display: block;
  padding: .7rem 1rem;
  border: 3px dashed var(--rasp);
  border-radius: 14px;
  background: var(--white);
  color: var(--rasp);
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.picker,
.gal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: .6rem;
}

.picker {
  margin-top: 1rem;
}

.picker__item {
  aspect-ratio: 1;
  padding: 0;
  border: 3px solid var(--cocoa);
  border-radius: 10px;
  background: var(--white);
  overflow: hidden;
  cursor: pointer;
}

.picker__item img,
.gal__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- дверь ---------- */

.door-view,
.st-hero {
  background-color: var(--blush);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cg fill='%23FFC2D1' opacity='.55'%3E%3Cpath transform='translate(18 24) rotate(-14 12.8 12.8) scale(.1)' d='M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z'/%3E%3Cpath transform='translate(104 102) rotate(12 9 9) scale(.07)' d='M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z'/%3E%3C/g%3E%3C/svg%3E");
  text-align: center;
}

.door-view {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 1rem;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(3rem, 10vh, 6rem) 1.25rem 3rem;
}

.st-title {
  font-size: clamp(2.5rem, min(10.5vw, 13vh), 6rem);
}

.st-line {
  max-width: 32ch;
  margin: 0 auto;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  text-wrap: balance;
}

/* Соня сидит на коврике у двери */
.door__mat {
  --k: clamp(120px, 34vw, 170px);
  position: relative;
  margin-top: 4.75rem;
  padding: 0 2.2rem;
}

.door__mat::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: -.45rem;
  left: 0;
  height: 1.5rem;
  border: 3px solid var(--cocoa);
  border-radius: 50%;
  background: var(--peach);
}

.st-sonya .kitten__rise {
  animation: none;
}

.door__form {
  display: grid;
  gap: .6rem;
  width: min(100%, 22rem);
  margin-top: 1.25rem;
  text-align: left;
}

.door__row {
  display: flex;
  gap: .5rem;
}

.door__row .input {
  flex: 1;
  min-width: 0;
}

.door__peek[aria-pressed="true"] {
  background: var(--marsh);
}

.door__form .pill--big {
  margin-top: .25rem;
}

/* ---------- главный экран мастерской ---------- */

.st-hero {
  position: relative;
  padding: 5rem 1rem 0;
  overflow: hidden;
}

.st-hero .st-line {
  margin-top: 1.1rem;
}

/* три предмета на столе, из-за каждого выглядывает свой котёнок */
.tools {
  --k: clamp(72px, 21vw, 180px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(.35rem, 2.4vw, 3rem);
  margin-top: clamp(4.5rem, 11vw, 6rem);
  padding-bottom: 3rem;
}

.tool {
  position: relative;
  display: grid;
  justify-items: center;
  width: var(--k);
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.tool .tool__cat {
  z-index: 0;
  width: 82%;
  margin-bottom: -40%;
}

.tool__cat .kitten__rise,
.draw__cat .kitten__rise {
  animation: peek .7s var(--spring) both;
  animation-delay: calc(var(--i, 0) * 160ms + 450ms);
}

@keyframes peek {
  from {
    transform: translateY(27%);
  }
}

.tool__thing {
  --tilt: -3deg;
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  filter: drop-shadow(0 4px 0 var(--cocoa));
  transform: rotate(var(--tilt));
  transition: transform .25s var(--spring);
}

.tool--paper .tool__thing {
  width: 76%;
}

.tool--card .tool__thing {
  --tilt: 2.5deg;
}

.tool--laptop .tool__thing {
  --tilt: 1.5deg;
}

.tool .zzz {
  top: -6%;
  right: -4%;
  font-size: clamp(.7rem, 2.2vw, 1.1rem);
}

.tool--envelope .tool__thing {
  --tilt: -1.5deg;
}

.tool__thing svg,
.mini--post svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.tool__thing .o,
.mini--post .o {
  stroke: var(--cocoa);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool__name {
  position: relative;
  z-index: 1;
  margin-top: .9rem;
  padding-inline: clamp(.45rem, 1.8vw, 1rem);
  font-size: clamp(.74rem, 2.3vw, 1.05rem);
  white-space: nowrap;
}

.tool:active .tool__name {
  transform: translateY(3px);
  box-shadow: none;
}

@media (hover: hover) {
  .tool:hover .tool__thing {
    transform: rotate(0deg) translateY(-4px);
  }

  .tool:hover .tool__name {
    background: var(--blush);
  }
}

/* ---------- полка ---------- */

.shelf {
  position: relative;
  padding: clamp(3.75rem, 8vw, 5rem) 1rem 3.5rem;
  background: var(--milk);
  text-align: center;
}

/* кружевной край, как между полосами на главной */
.shelf::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 22px;
  background: radial-gradient(circle at 22px 0, var(--blush) 21px, transparent 22px) 50% 0 / 44px 22px repeat-x;
}

/* каждая строка работ стоит на своей доске: доска нарисована фоном, который повторяется с шагом в строку */
.shelf__rows,
.shelf__empty {
  --row: 9.75rem;
  --board: 15px;
  max-width: 58rem;
  margin: 0 auto;
}

.shelf__rows {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 0 1.1rem;
  padding: 0 1rem;
  border-radius: 0 0 5px 5px;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 calc(var(--row) - var(--board)),
    var(--cocoa) 0 calc(var(--row) - var(--board) + 3px),
    var(--peach) 0 calc(var(--row) - 3px),
    var(--cocoa) 0 var(--row)
  );
}

.shelf__empty {
  padding: 1rem 1rem calc(var(--board) + 1.25rem);
  border-radius: 0 0 5px 5px;
  background: linear-gradient(var(--cocoa) 0 3px, var(--peach) 0 calc(var(--board) - 3px), var(--cocoa) 0) bottom / 100% var(--board) no-repeat;
  color: var(--cocoa-soft);
  text-wrap: balance;
}

.frame {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: var(--row);
  padding: 0 0 var(--board);
  border: 0;
  background: none;
  cursor: pointer;
}

.frame > * {
  transform: rotate(var(--tilt));
  transform-origin: 50% 100%;
  transition: transform .2s var(--spring);
}

.frame > img {
  display: block;
  width: auto;
  height: 6.5rem;
  aspect-ratio: 1;
  padding: .28rem;
  border: 3px solid var(--cocoa);
  border-radius: 7px;
  background: var(--white);
  object-fit: cover;
}

.frame--tall > img {
  height: 7.6rem;
  aspect-ratio: 4 / 5;
}

.frame--wide > img {
  height: 5.6rem;
  aspect-ratio: 5 / 4;
}

.mini {
  display: flex;
}

.mini--card {
  align-items: center;
  gap: .45rem;
  width: 8.6rem;
  height: 5.3rem;
  padding: .55rem;
  border: 3px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.12;
  text-align: left;
  overflow: hidden;
}

.mini--card img,
.mini--card i {
  flex: none;
  width: 2.2rem;
  height: 2.2rem;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--tint);
  object-fit: cover;
}

.mini--card span {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.mini--post {
  width: 7.4rem;
}

/* страница на коде: окошко браузера с тремя точками */
.mini--code {
  flex-direction: column;
  width: 8.4rem;
  height: 5.6rem;
  border: 3px solid var(--cocoa);
  border-radius: 10px;
  background: var(--white);
  color: var(--cocoa);
  font-size: .8rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
  overflow: hidden;
}

.mini--code i {
  flex: none;
  height: 1.05rem;
  border-bottom: 3px solid var(--cocoa);
  background:
    radial-gradient(circle at .55rem 50%, var(--rasp) .2rem, transparent .22rem),
    radial-gradient(circle at 1.15rem 50%, var(--butter) .2rem, transparent .22rem),
    radial-gradient(circle at 1.75rem 50%, var(--marsh) .2rem, transparent .22rem),
    var(--cream);
}

.mini--code span {
  display: -webkit-box;
  margin: .4rem .5rem;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.mini--post .o {
  stroke-width: 8;
}

@media (hover: hover) {
  .frame:hover > * {
    transform: rotate(0deg) translateY(-5px);
  }
}

.frame.is-new > * {
  animation: frame-in .7s var(--spring) .2s both;
}

@keyframes frame-in {
  from {
    opacity: 0;
    transform: translateY(-3rem) rotate(8deg) scale(.7);
  }
}

.shelf__out {
  margin-top: 3rem;
}

/* ---------- холст ---------- */

body[data-view="draw"] {
  overflow: hidden;
  overscroll-behavior: none;
}

.draw {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template: "bar" auto "stage" minmax(0, 1fr) "tray" auto / minmax(0, 1fr);
  background: var(--peach-soft);
  -webkit-user-select: none;
  user-select: none;
}

.draw__bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: max(.6rem, env(safe-area-inset-top)) .75rem .5rem;
}

.draw__mid {
  display: flex;
  gap: .4rem;
}

.draw__stage {
  --k: clamp(64px, 16vw, 92px);
  grid-area: stage;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: calc(var(--k) * .68 + .35rem) 1rem 1.1rem;
  container-type: size;
}

/* лист занимает всё свободное место, сохраняя свои пропорции */
.draw__sheet {
  position: relative;
  width: min(100cqw, calc(100cqh * var(--ar)));
  aspect-ratio: var(--ar);
}

.draw__paper {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 10px;
  box-shadow: 0 0 0 3px var(--cocoa), 0 6px 0 3px var(--cocoa);
  overflow: hidden;
}

.draw__ink,
.draw__live {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.draw__live {
  cursor: crosshair;
  touch-action: none;
}

/* Персик выглядывает из-за верхнего края листа и следит за кисточкой */
.draw .draw__cat {
  position: absolute;
  right: 11%;
  bottom: calc(100% - var(--k) * .48);
  z-index: 0;
  cursor: default;
  pointer-events: none;
}

.draw__tray {
  position: relative;
  grid-area: tray;
  display: grid;
  gap: .4rem;
  min-width: 0;
  padding: .6rem .75rem calc(.55rem + env(safe-area-inset-bottom));
  border-top: 3px solid var(--cocoa);
  border-radius: 22px 22px 0 0;
  background: var(--milk);
}

.draw__tools {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .3rem;
}

.draw__tool {
  display: grid;
  justify-items: center;
  gap: .15rem;
  padding: .35rem .1rem .3rem;
  border: 3px solid transparent;
  border-radius: 14px;
  background: none;
  color: var(--cocoa);
  font-size: clamp(.68rem, 3.3vw, .8rem);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
}

.draw__toolic svg {
  display: block;
  width: 1.6rem;
  height: 1.6rem;
  fill: currentColor;
}

.draw__tool[aria-checked="true"] {
  border-color: var(--cocoa);
  background: var(--rasp);
  box-shadow: 0 3px 0 var(--cocoa);
  color: var(--white);
}

/* нижний ряд: слева кнопки толщины и цвета, дальше цвета или наклейки. Высота ряда не меняется,
   поэтому лист не прыгает, когда она переключает инструмент. */
.draw__ctx {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  min-height: 3.6rem;
}

.draw__ctxbtn {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 3px solid var(--cocoa);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 3px 0 var(--cocoa);
  cursor: pointer;
}

.draw__ctxbtn:active,
.draw__sizebtn[aria-expanded="true"],
.draw__inkbtn[aria-pressed="true"] {
  box-shadow: none;
  transform: translateY(3px);
}

.draw__sizebtn[aria-expanded="true"] {
  background: var(--marsh);
}

.draw__inkbtn {
  border-radius: 50%;
  background: var(--ink, var(--rasp));
}

.draw__hint {
  margin: 0;
  color: var(--cocoa-soft);
  font-size: .95rem;
  line-height: 1.3;
}

.draw__tray:not([data-mode^="stamp"]) .draw__inkbtn,
.draw__tray:not([data-mode="draw"], [data-mode="stamp-color"]) .draw__colors,
.draw__tray:not([data-mode="stamp"]) .draw__stickers,
.draw__tray:not([data-mode="erase"]) .draw__hint {
  display: none;
}

/* ползунок толщины всплывает над лотком */
.draw__sizer {
  position: absolute;
  right: .75rem;
  bottom: calc(100% + .6rem);
  left: .75rem;
  z-index: 3;
  display: none;
  align-items: center;
  gap: .6rem;
  padding: .35rem .9rem .35rem .4rem;
  border: 3px solid var(--cocoa);
  border-radius: 999px;
  background: var(--milk);
  box-shadow: 0 4px 0 var(--cocoa);
}

.draw__tray.is-sizing .draw__sizer {
  display: flex;
}

/* ряды цветов и наклеек листаются вбок */
.draw__row {
  flex: 1;
  display: flex;
  gap: .5rem;
  min-width: 0;
  margin-right: -.75rem;
  padding: .45rem .9rem .45rem .35rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.draw__row::-webkit-scrollbar {
  display: none;
}

.draw__color,
.draw__custom {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 3px solid var(--cocoa);
  border-radius: 50%;
  background: var(--c);
  cursor: pointer;
}

.draw__color[aria-checked="true"],
.draw__color[aria-pressed="true"],
.draw__custom.is-on {
  box-shadow: 0 0 0 3px var(--milk), 0 0 0 6px var(--rasp);
}

.draw__custom {
  background: conic-gradient(#E5484D, #FFD76A, #5DBB7A, #7CC4F2, #8B6FD0, #FF8FB0, #E5484D);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}

.draw__custom::-webkit-color-swatch-wrapper {
  padding: 0;
}

.draw__custom::-webkit-color-swatch {
  border: 0;
  opacity: 0;
}

.draw__custom::-moz-color-swatch {
  border: 0;
  opacity: 0;
}

.draw__papers {
  flex-wrap: wrap;
  margin: 0;
  padding: .45rem .4rem;
  overflow: visible;
}

.draw__sticker {
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: .3rem;
  border: 3px solid transparent;
  border-radius: 12px;
  background: none;
  cursor: pointer;
}

.draw__sticker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.draw__sticker .ic {
  fill: var(--ink, var(--rasp));
  stroke: var(--cocoa);
  stroke-width: 12;
  stroke-linejoin: round;
}

.draw__sticker[aria-checked="true"] {
  border-color: var(--cocoa);
  background: var(--blush);
}

.draw__dotbox {
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
}

.draw__dot {
  display: block;
  border: 2px solid var(--cocoa);
  border-radius: 50%;
}

.draw__range {
  flex: 1;
  min-width: 0;
  height: 2.75rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.draw__range::-webkit-slider-runnable-track {
  box-sizing: border-box;
  height: 1rem;
  border: 3px solid var(--cocoa);
  border-radius: 999px;
  background: var(--white);
}

.draw__range::-webkit-slider-thumb {
  box-sizing: border-box;
  width: 1.8rem;
  height: 1.8rem;
  margin-top: calc(-.4rem - 3px);
  border: 3px solid var(--cocoa);
  border-radius: 50%;
  background: var(--rasp);
  box-shadow: 0 2px 0 var(--cocoa);
  -webkit-appearance: none;
  appearance: none;
}

.draw__range::-moz-range-track {
  box-sizing: border-box;
  height: 1rem;
  border: 3px solid var(--cocoa);
  border-radius: 999px;
  background: var(--white);
}

.draw__range::-moz-range-thumb {
  box-sizing: border-box;
  width: 1.8rem;
  height: 1.8rem;
  border: 3px solid var(--cocoa);
  border-radius: 50%;
  background: var(--rasp);
}

/* выбор листа перед началом */
.chooser {
  display: grid;
  justify-items: center;
  gap: 1.75rem;
  text-align: center;
}

.chooser__title {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  font-weight: 800;
  font-variation-settings: "BNCE" 20, "INFM" 100;
  line-height: 1.1;
}

.chooser__row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(.9rem, 4vw, 2.25rem);
}

.chooser__paper {
  --tilt: -3deg;
  display: grid;
  justify-items: center;
  gap: .7rem;
  padding: .25rem;
  border: 0;
  background: none;
  color: var(--cocoa);
  font-weight: 700;
  cursor: pointer;
}

.chooser__paper--tall {
  --tilt: 2deg;
}

.chooser__paper--wide {
  --tilt: -1.5deg;
}

.chooser__paper i {
  display: block;
  height: clamp(4.6rem, 21vw, 8rem);
  aspect-ratio: var(--ar);
  border: 3px solid var(--cocoa);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 5px 0 var(--cocoa);
  transform: rotate(var(--tilt));
  transition: transform .2s var(--spring);
}

.chooser__paper:active i {
  box-shadow: none;
  transform: rotate(var(--tilt)) translateY(5px);
}

@media (hover: hover) {
  .chooser__paper:hover i {
    transform: rotate(0deg) translateY(-5px);
  }
}

/* на широком экране лоток с инструментами уезжает влево */
@media (min-width: 900px) and (min-height: 560px) {
  .draw {
    grid-template: "bar bar" auto "tray stage" minmax(0, 1fr) / 24.5rem minmax(0, 1fr);
  }

  .draw__tool {
    font-size: .72rem;
  }

  .draw__tray {
    align-content: start;
    gap: .9rem;
    margin: .5rem 0 1.1rem 1rem;
    padding: .9rem;
    border: 3px solid var(--cocoa);
    border-radius: 22px;
    box-shadow: 0 5px 0 var(--cocoa);
    overflow-y: auto;
  }

  /* места хватает: ползунок, цвета и наклейки видны сразу, кнопки-переключатели не нужны */
  .draw__sizer,
  .draw__tray.is-sizing .draw__sizer {
    position: static;
    display: flex;
    order: 3;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .draw__ctx {
    flex-direction: column;
    align-items: stretch;
  }

  .draw__tray .draw__ctxbtn {
    display: none;
  }

  .draw__tray[data-mode^="stamp"] .draw__colors,
  .draw__tray[data-mode^="stamp"] .draw__stickers {
    display: flex;
  }

  .draw__row {
    flex: none;
    flex-wrap: wrap;
    margin: 0;
    padding: .4rem;
    overflow: visible;
  }

  .draw__stickers {
    max-height: 12.5rem;
    overflow-y: auto;
  }
}

/* ---------- редактор визитки и открытки ---------- */

.edit {
  --room: var(--blush);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--room);
}

.edit--card {
  --room: var(--smoke-soft);
}

.edit--code {
  --room: var(--cream-soft);
}

.edit__bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: max(.6rem, env(safe-area-inset-top)) .75rem .6rem;
  background: var(--room);
}

.edit__saved {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--cocoa-soft);
  font-size: .9rem;
  line-height: 1.25;
  text-align: center;
}

.edit__cols {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: .25rem .9rem 2rem;
}

.edit__form {
  display: grid;
  align-content: start;
  gap: 1.15rem;
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
}

.edit__title {
  margin: .25rem 0 0;
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 800;
  font-variation-settings: "BNCE" 20, "INFM" 100;
  line-height: 1.1;
}

.edit__preview {
  display: none;
  justify-items: center;
  align-content: start;
}

.edit.is-look .edit__form {
  display: none;
}

.edit.is-look .edit__preview {
  display: grid;
}

.edit__look[aria-pressed="true"] {
  background: var(--marsh);
}

/* предпросмотр в рамке-телефоне */
.phone {
  width: min(100%, 24.5rem);
  height: min(46rem, calc(100vh - 12.5rem));
  height: min(46rem, calc(100dvh - 12.5rem));
  border: 4px solid var(--cocoa);
  border-radius: 28px;
  background: var(--white);
  box-shadow: 0 7px 0 var(--cocoa);
  overflow: hidden;
}

.phone__screen {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.edit__dock {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  padding: .7rem .9rem calc(.7rem + env(safe-area-inset-bottom));
  border-top: 3px solid var(--cocoa);
  background: var(--milk);
}

.edit__status {
  flex: 1 1 12rem;
  margin: 0;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.35;
}

.edit__status a {
  color: var(--rasp);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.edit__dock .pill {
  flex: 1 1 auto;
}

@media (min-width: 960px) {
  .edit__look {
    visibility: hidden;
  }

  .edit__cols {
    grid-template-columns: minmax(0, 36rem) minmax(0, 26rem);
    justify-content: center;
    gap: clamp(2rem, 5vw, 5rem);
  }

  .edit__form,
  .edit.is-look .edit__form {
    display: grid;
    margin: 0;
  }

  .edit__preview {
    position: sticky;
    top: 4.75rem;
    display: grid;
    align-self: start;
  }

  .edit__dock {
    justify-content: center;
  }

  .edit__status {
    flex: 0 1 auto;
  }

  .edit__dock .pill {
    flex: none;
  }
}

/* полоска бумаги с группой полей */
.strip {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1.1rem 1rem 1.25rem;
  border: 3px solid var(--cocoa);
  border-radius: 18px;
  background: var(--milk);
  box-shadow: 0 4px 0 var(--cocoa);
}

.strip__title {
  margin: 0;
  font-size: 1.35rem;
  text-align: left;
}

.strip > .pill {
  justify-self: start;
}

.radios {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.radios legend {
  margin-bottom: .55rem;
}

.radios__row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.radio {
  cursor: pointer;
}

.radio__face {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.75rem;
  padding: .4rem .9rem;
  border: 3px solid var(--cocoa);
  border-radius: 999px;
  background: var(--white);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
  transition: background-color .15s;
}

.radio input:checked + .radio__face {
  background: var(--rasp);
  box-shadow: 0 3px 0 var(--cocoa);
  color: var(--white);
}

.radio input:focus-visible + .radio__face {
  outline: 3px dashed var(--rasp);
  outline-offset: 3px;
}

.swatch {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg) 50%, var(--accent) 50%);
}

.radios--themes .radio__face,
.radios--cats .radio__face {
  padding-left: .55rem;
}

.radio__cat {
  display: flex;
  width: 2.1rem;
}

.radio__cat svg {
  display: block;
  width: 100%;
  height: auto;
}

.ava-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.ava-row__btns {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.ava,
.art {
  flex: none;
  width: 5rem;
  height: 5rem;
  border: 3px solid var(--cocoa);
  border-radius: 50%;
  background: var(--white);
  object-fit: cover;
}

.art {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 12px;
}

.ava--none,
.art--none {
  display: grid;
  place-items: center;
}

.ava--none svg,
.art--none svg {
  width: 2.4rem;
  height: 2.4rem;
  fill: var(--marsh);
}

/* списки ссылок и проектов: в каждой строке поля и кнопка «убрать» */
.rows {
  display: grid;
  gap: 1.1rem;
}

.rows:empty {
  display: none;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
}

.row > .pill--icon ~ *,
.row > .field__error {
  grid-column: 1 / -1;
}

.row + .row {
  padding-top: 1.1rem;
  border-top: 3px dotted var(--marsh);
}

/* поле для кода: здесь моноширинный шрифт по делу */
.code {
  min-height: 18rem;
  padding: .75rem .85rem;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .9rem;
  font-weight: 400;
  font-variation-settings: normal;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.run {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5rem .9rem;
  width: min(100%, 24.5rem);
  margin-bottom: 1rem;
}

.run .pill[aria-pressed="true"] {
  background: var(--marsh);
}

.run__note {
  flex: 1 1 10rem;
  margin: 0;
  color: var(--cocoa-soft);
  font-size: .9rem;
  line-height: 1.3;
}

.gal__item {
  position: relative;
  aspect-ratio: 1;
}

.gal__item img {
  border: 3px solid var(--cocoa);
  border-radius: 10px;
  background: var(--white);
}

.gal__x {
  position: absolute;
  top: -.55rem;
  right: -.55rem;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 3px solid var(--cocoa);
  border-radius: 50%;
  background: var(--milk);
  cursor: pointer;
}

/* палец попадает и мимо маленького крестика */
.gal__x::after {
  content: "";
  position: absolute;
  inset: -.5rem;
}

.gal__x svg {
  width: .95rem;
  height: .95rem;
  fill: var(--cocoa);
}

.slug {
  display: flex;
  align-items: center;
  border: 3px solid var(--cocoa);
  border-radius: 14px;
  background: var(--white);
  overflow: hidden;
}

.slug:focus-within {
  outline: 3px dashed var(--rasp);
  outline-offset: 2px;
}

.slug__site {
  padding-left: .85rem;
  color: var(--cocoa-soft);
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
}

.slug .input {
  min-width: 0;
  padding-left: .1rem;
  border: 0;
  border-radius: 0;
  outline: none;
}
