html.pc-open,
html.pc-open body {
  overflow: hidden;
}

.pc-modal[hidden],
.pc-modal [hidden],
.pc-thumb[hidden] {
  display: none !important;
}

.pc-modal {
  --pc-primary: var(--primary, #1e4a7c);
  --pc-ok: #2e7d32;
  --pc-warn: #9a6700;
  --pc-error: #c62828;
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 27, 59, 0.55);
  font-family: inherit;
}

.pc-panel {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.pc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e3e7eb;
}

.pc-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--strong, #42474e);
}

.pc-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6f7881;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.pc-close:hover,
.pc-close:focus-visible {
  background: #eff1f3;
}

.pc-body {
  padding: 20px;
  overflow-y: auto;
}

.pc-subtitle {
  margin: 0 0 16px;
  color: #6f7881;
  font-size: 0.9375rem;
}

.pc-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pc-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px;
  border: 1.5px solid #d5dbe1;
  border-radius: 10px;
  background: #fff;
  color: var(--pc-primary);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
}

.pc-choice:hover,
.pc-choice:focus-visible {
  border-color: var(--pc-primary);
  background: #f4f7fb;
  outline: none;
}

.pc-choice__icon {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eaf0f7;
}

.pc-choice__label {
  font-weight: 600;
  color: #021b3b;
}

.pc-choice__hint {
  font-size: 0.8125rem;
  color: #6f7881;
}

.pc-tips {
  margin: 16px 0 0;
  padding: 12px 16px 12px 32px;
  border-radius: 8px;
  background: #f6f8fa;
  color: #42474e;
  font-size: 0.875rem;
  list-style: disc;
}

.pc-tips li + li {
  margin-top: 4px;
}

.pc-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: #0b1220;
}

.pc-modal[data-mode="id"] .pc-stage {
  aspect-ratio: 4 / 3;
}

.pc-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pc-stage--mirror .pc-video {
  transform: scaleX(-1);
}

.pc-guide {
  position: absolute;
  pointer-events: none;
  border: 3px dashed rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  transition: border-color 0.2s;
}

.pc-guide--oval {
  left: 50%;
  top: 42%;
  width: 40%;
  height: 54%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.pc-guide--card {
  left: 50%;
  top: 50%;
  width: 86%;
  aspect-ratio: 85.6 / 54;
  transform: translate(-50%, -50%);
  border-radius: 12px;
}

.pc-guide--ok {
  border-style: solid;
  border-color: #4caf50;
}

.pc-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-hint[data-state="ok"] {
  background: rgba(46, 125, 50, 0.9);
}

.pc-actions,
.pc-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.pc-tools {
  justify-content: center;
  margin-top: 12px;
}

.pc-actions .btn--primary {
  min-width: 140px;
}

.pc-step--busy {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 0;
}

.pc-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e3e7eb;
  border-top-color: var(--pc-primary);
  border-radius: 50%;
  animation: pc-spin 0.8s linear infinite;
}

.pc-busy-text {
  margin: 16px 0 0;
  color: #42474e;
}

@keyframes pc-spin {
  to {
    transform: rotate(360deg);
  }
}

.pc-preview {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-radius: 10px;
  background: repeating-conic-gradient(#f1f3f5 0% 25%, #fff 0% 50%) 50% / 20px 20px;
}

.pc-preview__img {
  display: block;
  max-width: 100%;
  max-height: 55vh;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.pc-preview--square .pc-preview__img {
  width: 280px;
  height: 280px;
  object-fit: cover;
}

.pc-messages {
  margin-top: 12px;
}

.pc-alert {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 4px solid;
  font-size: 0.875rem;
  line-height: 1.4;
}

.pc-alert--ok {
  border-color: var(--pc-ok);
  background: #edf7ee;
  color: #1b5e20;
}

.pc-alert--info {
  border-color: var(--pc-primary);
  background: #eaf0f7;
  color: #021b3b;
}

.pc-alert--warn {
  border-color: #e0a100;
  background: #fff8e1;
  color: #6d4c00;
}

.pc-alert--error {
  border-color: var(--pc-error);
  background: #fdecea;
  color: #8e1c1c;
}

.pc-step--choose > .pc-alert--error {
  margin-top: 16px;
}

.pc-crop-stage {
  width: 100%;
  height: min(60vh, 420px);
  background: #0b1220;
  border-radius: 10px;
  overflow: hidden;
}

.pc-crop-img {
  display: block;
  max-width: 100%;
}

.pc-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pc-thumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: #2e7d32;
}

.pc-thumb img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #d5dbe1;
}

.pc-thumb:not(.pc-thumb--square) img {
  width: 88px;
}

@media (max-width: 575.98px) {
  .pc-modal {
    padding: 0;
    align-items: stretch;
  }

  .pc-panel {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
  }

  .pc-body {
    padding: 16px;
    flex: 1;
  }

  .pc-actions {
    justify-content: stretch;
  }

  .pc-actions .btn {
    flex: 1 1 auto;
  }

  .pc-preview--square .pc-preview__img {
    width: 240px;
    height: 240px;
  }
}
