/* Публичная 1/1 канва. Рисовалка та же, что в закрытой студии,
   переодетая в общий стиль сайта. */

.studio { padding-bottom: 50px; }

.lede { line-height: 1.65; max-width: 62ch; margin: 0 0 24px; }

.studio-grid {
  display: grid;
  gap: 26px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  align-items: start;
}

.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.swatch {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  box-shadow: inset 0 0 0 var(--line) var(--hair);
  cursor: pointer;
}

.swatch.active { box-shadow: inset 0 0 0 var(--line) var(--ink); outline: var(--line) solid var(--pink); outline-offset: 2px; }
.swatch.erase { background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 14px 14px; }

.stage { position: relative; width: 100%; max-width: 560px; background: var(--paper); line-height: 0; }

canvas.draw { display: block; width: 100%; height: auto; touch-action: none; }

#grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
  background-size: calc(100% / 50) calc(100% / 50);
  box-shadow: inset 0 0 0 var(--line) var(--yellow);
}

#grid.off { background-image: none; }

.stage.drawing canvas.draw { -webkit-user-select: none; user-select: none; }

.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; max-width: 560px; }

.side { display: grid; gap: 22px; }

.signblock { display: grid; gap: 10px; padding: 18px; box-shadow: inset 0 0 0 var(--line) var(--lime); }

.lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }

.handle-line { display: flex; align-items: stretch; }

.handle-line .at {
  display: grid;
  place-items: center;
  padding: 0 10px;
  background: var(--pink);
  font-weight: 700;
}

.handle-line .field { flex: 1; }

.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.55; }

.result { margin: 0; font-size: 13px; min-height: 1.3em; line-height: 1.5; }
.result.ok { color: var(--ink); background: var(--lime); padding: 8px 10px; }
.result.bad { color: var(--ink); background: var(--yellow); padding: 8px 10px; }

.refgrid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.refgrid canvas {
  width: 64px;
  height: 64px;
  background: var(--paper);
  box-shadow: inset 0 0 0 var(--line) var(--cyan);
}

@media (max-width: 860px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Подтверждение отправки — в стиле сайта, вместо системного confirm. */

.confirm {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.94);
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
}

.confirm.hidden { display: none !important; }

.confirm-inner {
  width: min(380px, 100%);
  background: var(--paper);
  box-shadow: inset 0 0 0 var(--line) var(--pink);
  padding: 22px;
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.confirm-inner h3 {
  margin: 0;
  font-size: 18px;
  text-transform: uppercase;
}

.confirm-art {
  width: 160px;
  height: 160px;
  background: var(--paper);
  box-shadow: inset 0 0 0 var(--line) var(--yellow);
}

.confirm-who { margin: 0; font-size: 13px; }
.confirm-who b { color: var(--pink); }
.confirm .hint { text-align: center; }
.confirm .btnrow { margin-top: 4px; justify-content: center; }

/* Галерея под холстом: последние работы с канвы, картинка + X-хэндл. */

.community { margin-top: 8px; }

.community-grid {
  display: grid;
  gap: 12px 10px;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 14px;
}

.community-item {
  display: grid;
  gap: 5px;
  justify-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
}

.community-item .pix {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: var(--paper);
  box-shadow: inset 0 0 0 var(--line) var(--cyan);
}

.community-item:nth-child(5n + 2) .pix { box-shadow: inset 0 0 0 var(--line) var(--lime); }
.community-item:nth-child(5n + 3) .pix { box-shadow: inset 0 0 0 var(--line) var(--yellow); }
.community-item:nth-child(5n + 4) .pix { box-shadow: inset 0 0 0 var(--line) var(--pink); }

.community-item .who {
  font-size: 11px;
  color: var(--pink);
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.community-item:hover .who { text-decoration: underline; }

@media (max-width: 720px) {
  .community-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 420px) {
  .community-grid { grid-template-columns: repeat(2, 1fr); }
}
