/* Portrait crop modal — modern, dark-themed lightbox with the user's
   image on a 312×420 stage and the HOI4 portrait zone guide overlaid. */

.pc-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: pc-fade 0.15s ease-out;
}
@keyframes pc-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pc-panel {
  position: relative;
  background: linear-gradient(180deg, #1e2024 0%, #15171a 100%);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 24px 28px;
  max-width: 640px;
  width: 100%;
  color: var(--text);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pc-header h2 {
  margin: 0 0 6px;
  font-family: var(--font-title);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 700;
}
.pc-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
  letter-spacing: 0.3px;
}
.pc-hint b { color: #6dc6cc; }   /* matches the cyan "Face" zone */

.pc-stage-wrap {
  display: flex;
  justify-content: center;
}
.pc-stage {
  position: relative;
  overflow: hidden;
  background: #0a0b0d;
  border: 1px solid var(--panel-border);
  cursor: grab;
  user-select: none;
}
.pc-stage:active { cursor: grabbing; }

.pc-image {
  position: absolute;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.pc-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  opacity: 0.55;
  mix-blend-mode: normal;
}

.pc-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pc-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.pc-zoom-slider {
  width: 150px;
  accent-color: #ff9c2e;
}
.pc-helper-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
}

.pc-controls button {
  background: #1b1d20;
  color: var(--text);
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  font: inherit;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.pc-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pc-controls button.primary {
  background: linear-gradient(180deg, #ff9c2e 0%, #e8801a 100%);
  color: #15171a;
  border-color: #ff9c2e;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.pc-controls button.primary:hover {
  filter: brightness(1.08);
  color: #15171a;
}

/* ── Mobile crop modal ─────────────────────────────────────────────────
   On phones the 312×420 stage barely fits with the default 24px panel
   padding + 20px modal margin. Shrink the chrome, make the panel
   full-width, and enlarge every button to a finger-friendly 44px. */
@media (max-width: 720px) {
  .pc-modal { padding: 8px; align-items: flex-start; }
  .pc-panel {
    padding: 14px 14px 16px;
    gap: 12px;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pc-header h2 { font-size: 16px; letter-spacing: 1.5px; }
  .pc-hint { font-size: 11px; }
  /* Stage itself stays at its exact 312×420 — the drag/zoom math
     in portrait-crop.js assumes pixel-accurate dimensions. If the
     viewport is narrower than that (rare — iPhone SE is 320px), the
     wrapper scrolls horizontally instead. */
  .pc-stage-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pc-controls {
    gap: 8px;
    flex-wrap: wrap;
  }
  .pc-zoom { flex: 1 1 100%; }
  .pc-zoom-slider {
    flex: 1;
    width: auto;
    min-height: 40px;
  }
  .pc-controls button {
    padding: 12px 16px;
    font-size: 12px;
    min-height: 44px;
    flex: 1 1 auto;
  }
  .pc-controls button.primary { flex: 1 1 100%; }
}
