/* Full-screen photo cropper. */

html.pc-open {
  overflow: hidden;
}

.pc-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(600px 300px at 90% 0%, rgba(123, 107, 234, .28), transparent),
    radial-gradient(500px 300px at 0% 100%, rgba(47, 169, 109, .18), transparent),
    #0a0d1b;
  color: #fff;
  font-family: inherit;
  opacity: 0;
  transition: opacity .2s ease;
  overscroll-behavior: contain;
  touch-action: none;
}

.pc-overlay.is-open {
  opacity: 1;
}

.pc-overlay.is-leaving {
  opacity: 0;
}

.pc-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 14px 10px;
}

.pc-top h2 {
  margin: 0;
  font-size: 1.05em;
  font-weight: 800;
  text-align: center;
}

.pc-top-actions {
  display: flex;
  gap: 6px;
}

.pc-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 21px;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.1), background .2s ease;
}

.pc-icon:hover {
  background: rgba(255, 255, 255, .16);
  transform: translateY(-2px);
}

.pc-icon[aria-pressed="false"] {
  opacity: .55;
}

.pc-stage {
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.pc-stage:active {
  cursor: grabbing;
}

.pc-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
}

/* everything outside the square is dimmed with one huge shadow */
.pc-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 6px;
  box-shadow:
    0 0 0 9999px rgba(6, 8, 20, .68),
    0 0 24px rgba(123, 107, 234, .5);
  pointer-events: none;
}

.pc-frame span {
  position: absolute;
  opacity: 0;
  background: rgba(255, 255, 255, .5);
  transition: opacity .2s ease;
}

.pc-frame.is-grid span {
  opacity: 1;
}

.pc-frame span:nth-child(1),
.pc-frame span:nth-child(2) {
  top: 0;
  bottom: 0;
  width: 1px;
}

.pc-frame span:nth-child(1) {
  left: 33.33%;
}

.pc-frame span:nth-child(2) {
  left: 66.66%;
}

.pc-frame span:nth-child(3),
.pc-frame span:nth-child(4) {
  left: 0;
  right: 0;
  height: 1px;
}

.pc-frame span:nth-child(3) {
  top: 33.33%;
}

.pc-frame span:nth-child(4) {
  top: 66.66%;
}

.pc-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: rgba(10, 13, 27, .75);
  font-weight: 700;
}

.pc-loading[hidden] {
  display: none;
}

.pc-loading i {
  font-size: 34px;
  animation: pcSpin 1s linear infinite;
}

@keyframes pcSpin {
  to {
    transform: rotate(360deg);
  }
}

.pc-bottom {
  display: grid;
  gap: 12px;
  padding: 12px 18px max(16px, env(safe-area-inset-bottom));
}

.pc-hint {
  margin: 0;
  color: rgba(255, 255, 255, .78);
  font-size: .92em;
  font-weight: 600;
  line-height: 1.8;
  text-align: center;
}

.pc-zoom {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  width: 100%;
  margin-inline: auto;
  font-size: 22px;
}

.pc-zoom input {
  width: 100%;
  height: 32px;
  accent-color: #8f84f0;
  cursor: pointer;
}

.pc-confirm {
  position: relative;
  overflow: hidden;
  max-width: 520px;
  width: 100%;
  min-height: 54px;
  margin-inline: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #7b6bea, #5069dc);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1.05em;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(80, 105, 220, .4);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.1), opacity .2s ease;
}

.pc-confirm:hover:not(:disabled) {
  transform: translateY(-2px);
}

.pc-confirm:disabled {
  opacity: .5;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .pc-overlay,
  .pc-loading i {
    transition: none;
    animation: none;
  }
}
