/* Стили виджета «Обрезать фото» (crop) — подключаются только на его странице */
.cr { container-type: inline-size; }
.cr__work { display: grid; gap: 16px; }
.cr__main { display: grid; gap: 12px; min-width: 0; }
.cr__stage {
  position: relative; height: clamp(300px, 62vh, 560px); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: #0d0e0f; cursor: grab;
  transition: border-color .15s, box-shadow .15s;
}
.cr__stage.is-busy { cursor: grabbing; }
.cr__stage.is-over { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.cr__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cr__box {
  position: absolute; box-sizing: border-box; cursor: move; outline: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.9), 0 0 0 9999px rgba(8,9,10,.6);
}
.cr__box:focus-visible { box-shadow: 0 0 0 2px var(--accent), 0 0 0 9999px rgba(8,9,10,.6); }
.cr__grid {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .55;
  background:
    linear-gradient(to right, transparent calc(33.333% - .5px), rgba(255,255,255,.8) calc(33.333% - .5px), rgba(255,255,255,.8) calc(33.333% + .5px), transparent calc(33.333% + .5px),
      transparent calc(66.666% - .5px), rgba(255,255,255,.8) calc(66.666% - .5px), rgba(255,255,255,.8) calc(66.666% + .5px), transparent calc(66.666% + .5px)),
    linear-gradient(to bottom, transparent calc(33.333% - .5px), rgba(255,255,255,.8) calc(33.333% - .5px), rgba(255,255,255,.8) calc(33.333% + .5px), transparent calc(33.333% + .5px),
      transparent calc(66.666% - .5px), rgba(255,255,255,.8) calc(66.666% - .5px), rgba(255,255,255,.8) calc(66.666% + .5px), transparent calc(66.666% + .5px));
}
.cr__box.is-circle { outline: 1px dashed rgba(255,255,255,.45); outline-offset: 0; }
.cr__h { position: absolute; width: 32px; height: 32px; z-index: 1; }
.cr__h::after { content: ""; position: absolute; border: 0 solid #fff; filter: drop-shadow(0 0 1px rgba(0,0,0,.6)); }
.cr__h[data-h="nw"] { left: -16px; top: -16px; cursor: nwse-resize; }
.cr__h[data-h="ne"] { right: -16px; top: -16px; cursor: nesw-resize; }
.cr__h[data-h="sw"] { left: -16px; bottom: -16px; cursor: nesw-resize; }
.cr__h[data-h="se"] { right: -16px; bottom: -16px; cursor: nwse-resize; }
.cr__h[data-h="nw"]::after { left: 13px; top: 13px; width: 16px; height: 16px; border-left-width: 3px; border-top-width: 3px; }
.cr__h[data-h="ne"]::after { right: 13px; top: 13px; width: 16px; height: 16px; border-right-width: 3px; border-top-width: 3px; }
.cr__h[data-h="sw"]::after { left: 13px; bottom: 13px; width: 16px; height: 16px; border-left-width: 3px; border-bottom-width: 3px; }
.cr__h[data-h="se"]::after { right: 13px; bottom: 13px; width: 16px; height: 16px; border-right-width: 3px; border-bottom-width: 3px; }
.cr__h[data-h="n"], .cr__h[data-h="s"] { left: 50%; margin-left: -16px; cursor: ns-resize; }
.cr__h[data-h="n"] { top: -16px; } .cr__h[data-h="s"] { bottom: -16px; }
.cr__h[data-h="e"], .cr__h[data-h="w"] { top: 50%; margin-top: -16px; cursor: ew-resize; }
.cr__h[data-h="e"] { right: -16px; } .cr__h[data-h="w"] { left: -16px; }
.cr__h[data-h="n"]::after, .cr__h[data-h="s"]::after { left: 7px; width: 18px; height: 0; border-top-width: 3px; top: 14.5px; }
.cr__h[data-h="e"]::after, .cr__h[data-h="w"]::after { top: 7px; height: 18px; width: 0; border-left-width: 3px; left: 14.5px; }
.cr__dim {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 2px 9px; border-radius: 999px; pointer-events: none;
  background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cr__tools { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.cr__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cr__ib { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.cr__ib svg { width: 20px; height: 20px; }
.cr__ib:hover { border-color: var(--green); color: var(--green); }
.cr__ib:focus-visible, .cr .chip:focus-visible, .cr .ik-seg button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.cr__small { padding: 8px 14px; font-size: 13.5px; }
.cr__btns .cr__small:first-of-type { margin-left: auto; }
.cr__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cr__chips .chip { cursor: pointer; font: inherit; font-size: 14px; }
.cr__more { font-size: 13.5px; color: var(--green); justify-self: start; }
.cr__avatars { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.cr__avatars figure { margin: 0; display: grid; justify-items: center; gap: 6px; }
.cr__avatars canvas { display: block; border-radius: 50%; background: var(--surface-2); }
.cr__avatars [data-av="40"] { width: 40px; height: 40px; }
.cr__avatars [data-av="80"] { width: 80px; height: 80px; }
.cr__avatars [data-av="160"] { width: 160px; height: 160px; }
.cr__avatars figcaption { font-size: 12.5px; color: var(--muted); }
.cr__bg { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.cr__bg input { width: 34px; height: 34px; padding: 0; border: 1px solid var(--border-2); border-radius: 8px; background: none; cursor: pointer; }
.cr__info { margin: 0; font-size: 15px; color: var(--text-strong); }
.cr__warn { font-size: 13.5px; color: var(--warn); }
.cr__out { background: var(--green-soft); border-radius: 0 0 var(--radius) var(--radius); }
.cr .ik-f input:disabled { opacity: .6; }

@container (min-width: 700px) {
  .cr__panel { grid-template-columns: 1fr 1fr; }
  .cr__panel .ik-opt + .ik-opt { border-top: 0; }
  .cr__panel .ik-opt:nth-child(1) { grid-column: 1 / -1; border-bottom: 1px solid var(--border); }
  .cr__panel .ik-opt:nth-child(3) { border-left: 1px solid var(--border); }
  .cr__panel .cr__out { grid-column: 1 / -1; border-top: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .cr__stage { height: clamp(300px, 58vh, 460px); }
  .cr__chips .chip { padding: 8px 12px; }
  .cr .ik-seg button { padding: 9px 12px; }
  .cr__out .btn { flex: 1 1 auto; justify-content: center; }
  .cr__avatars { gap: 12px; justify-content: space-around; }
  .cr__avatars [data-av="160"] { width: 120px; height: 120px; }
}
@media (hover: none) {
  .cr__h { width: 44px; height: 44px; }
  .cr__h[data-h="nw"], .cr__h[data-h="w"], .cr__h[data-h="sw"] { left: -22px; }
  .cr__h[data-h="ne"], .cr__h[data-h="e"], .cr__h[data-h="se"] { right: -22px; }
  .cr__h[data-h="nw"], .cr__h[data-h="n"], .cr__h[data-h="ne"] { top: -22px; }
  .cr__h[data-h="sw"], .cr__h[data-h="s"], .cr__h[data-h="se"] { bottom: -22px; }
  .cr__h[data-h="n"], .cr__h[data-h="s"] { margin-left: -22px; }
  .cr__h[data-h="e"], .cr__h[data-h="w"] { margin-top: -22px; }
  .cr__h[data-h="nw"]::after, .cr__h[data-h="sw"]::after { left: 19px; }
  .cr__h[data-h="ne"]::after, .cr__h[data-h="se"]::after { right: 19px; }
  .cr__h[data-h="nw"]::after, .cr__h[data-h="ne"]::after { top: 19px; }
  .cr__h[data-h="sw"]::after, .cr__h[data-h="se"]::after { bottom: 19px; }
  .cr__h[data-h="n"]::after, .cr__h[data-h="s"]::after { left: 13px; top: 20.5px; }
  .cr__h[data-h="e"]::after, .cr__h[data-h="w"]::after { top: 13px; left: 20.5px; }
}
.cr__panel .ik-opt { align-content: start; }
.cr .ik-seg { justify-self: start; }
.cr__avatars { flex-wrap: nowrap; gap: 14px; }
.cr__avatars figcaption { text-align: center; }
