.pa-crop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.pa-crop-modal {
  width: 100%;
  max-width: 520px;
  background: var(--bg-mid);
  border: 1px solid var(--divider);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.pa-crop-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
}

.pa-crop-modal__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.pa-crop-modal__subtitle {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  word-break: break-all;
}

.pa-crop-modal__close {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
}

.pa-crop-modal__close:hover {
  color: var(--accent);
}

.pa-crop-modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.pa-crop-pad {
  position: relative;
  width: 100%;
  height: 320px;
  background: var(--pa-card-media);
  border: 1px solid var(--divider);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.pa-crop-pad__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.pa-crop-pad__placeholder {
  color: #333;
  font-size: 48px;
  line-height: 1;
}

.pa-crop-frame {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 1000px rgba(10, 10, 10, 0.55);
  cursor: grab;
}

.pa-crop-frame:active {
  cursor: grabbing;
}

/* Corner resize handles — small squares centered on each corner of the frame, each with its own
   diagonal resize cursor. stopPropagation on their own pointerdown (cropDrag.js) keeps a corner
   drag from also triggering the frame's own reposition drag. */
.pa-crop-frame__handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: 1.5px solid var(--bg-mid);
  border-radius: 2px;
}

.pa-crop-frame__handle[data-corner="nw"] {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.pa-crop-frame__handle[data-corner="ne"] {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.pa-crop-frame__handle[data-corner="sw"] {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.pa-crop-frame__handle[data-corner="se"] {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.pa-crop-size-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}

.pa-crop-size-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pa-crop-size-field__label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.pa-crop-size-field__input {
  width: 84px;
  height: 30px;
  box-sizing: border-box;
  background: var(--pa-field);
  border: 1px solid var(--pa-border);
  border-radius: 4px;
  padding: 0 10px;
  color: var(--pa-text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.pa-crop-size-field__input:focus {
  border-color: var(--accent);
  outline: none;
}

.pa-crop-size-field__input:disabled {
  opacity: 0.4;
}

.pa-crop-size-row__unit {
  padding-bottom: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
}

.pa-crop-modal__hint {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
}

.pa-crop-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--divider);
}

.pa-preview-modal {
  max-width: 720px;
}

.pa-preview-modal__body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pa-preview-modal__media {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
  background: var(--pa-card-media);
}

.pa-gopro-modal__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.pa-gopro-modal__message {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.pa-gopro-modal__message a {
  color: var(--accent);
}

.pa-gopro-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pa-gopro-modal__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.pa-gopro-modal__input {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
  background: var(--pa-field);
  border: 1px solid var(--pa-border);
  border-radius: 4px;
  padding: 0 12px;
  color: var(--pa-text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
}

.pa-gopro-modal__input:focus {
  border-color: var(--accent);
  outline: none;
}

.pa-gopro-modal__error {
  display: none;
  font-size: 11px;
  color: var(--danger);
}

.pa-gopro-modal__error[data-visible="true"] {
  display: block;
}

.pa-progress-modal {
  max-width: 360px;
}

.pa-progress-modal__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 24px;
  text-align: center;
}

.pa-progress-modal__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.pa-progress-modal__subtitle {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-tertiary);
}

.pa-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--divider);
  overflow: hidden;
}

.pa-progress-bar__fill {
  width: 35%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  animation: pa-progress-slide 1.1s ease-in-out infinite;
}

@keyframes pa-progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(385%);
  }
}
