.portrait-progress { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: #30203b55; border-radius: inherit; }
.portrait-progress-card { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%; padding: 22px; border-radius: 18px; background: #fffafcf5; color: #604872; text-align: center; box-shadow: 0 8px 28px #251b3433; }
.portrait-progress-card small { font-size: 12px; line-height: 1.6; }
.portrait-spinner { width: 30px; height: 30px; border: 3px solid #e4d9ef; border-top-color: #9674c6; border-radius: 50%; animation: portrait-spin 1s linear infinite; }
@keyframes portrait-spin { to { transform: rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { .portrait-spinner { animation: none; } }
.image-stage {
  background: #f5f1e9;
  border: 1px solid #eee6db;
  border-radius: 17px;
}
.image-stage > #canvas {
  display: block;
  box-shadow: 0 5px 18px #57453716;
}
.compare-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 15px;
}
.compare-switch {
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid #e7dced;
  background: #f7f2fa;
  border-radius: 16px;
}
.compare-switch button {
  min-height: 44px;
  padding: 10px 22px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  color: #7c698c;
  background: transparent;
  cursor: pointer;
}
.compare-switch button[aria-pressed="true"] {
  background: #9674c6;
  color: #fff;
  box-shadow: 0 3px 7px #8361ac25;
}
.compare-switch button:disabled { opacity: .45; cursor: default; }
#compareStatus { margin: 0; font-size: 12px; line-height: 1.6; color: #7f7388; flex: 1; min-width: 150px; }
.enhance-effect { position: absolute; overflow: hidden; pointer-events: none; z-index: 2; }
.image-stage #transitionCanvas { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: fill; }
.enhance-shine { position: absolute; inset: -25%; opacity: 0; background: radial-gradient(ellipse, #fff8dfd9 0%, #ffcfef80 22%, #b986ee40 42%, transparent 65%); transform: scale(.1); }
.is-running #transitionCanvas { animation: photo-reveal 3000ms ease-in-out both; }
.is-running .enhance-shine { animation: photo-bloom 3000ms ease-out both; }
#sparkleParticles { position: absolute; inset: 0; }
.portrait-sparkle { position: absolute; top: 50%; left: 50%; opacity: 0; line-height: 1; font-family: Arial, sans-serif; font-size: var(--size); color: #fff2ac; text-shadow: 0 1px 3px #68458acc, 0 0 9px #fff, 0 0 20px #efbdff; will-change: transform, opacity; }
.portrait-sparkle:nth-child(3n) { color: #f6bdff; }
.is-running .portrait-sparkle { animation: sparkle-spread 2750ms cubic-bezier(.15,.5,.35,1) var(--delay) both; }
.sparkle-core { position: absolute; left: 50%; top: 50%; font: 76px/1 Arial,sans-serif; color: #fff1b5; opacity: 0; text-shadow: 0 0 6px #fff,0 0 22px #aa6cca; }
.is-running .sparkle-core { animation: sparkle-core 1700ms ease-out both; }
.sparkle-ring { position: absolute; left: 50%; top: 50%; width: 45%; aspect-ratio: 1; border: 3px solid #ffe8bf; border-radius: 50%; box-shadow: 0 0 12px #fff5, inset 0 0 12px #fff5; opacity: 0; }
.is-running .sparkle-ring { animation: sparkle-ring 2700ms ease-out both; }
.is-running .ring-two { animation-delay: 200ms; border-color: #edd1ff; }
.enhance-ready { outline: 3px solid #c9a5e5; outline-offset: -3px; }
.enhance-effect.is-running::after { content: '✦ 보정 완료'; position: absolute; bottom: 6%; left: 50%; transform: translateX(-50%); background: #6e4994eb; color: #fff; padding: 8px 16px; border-radius: 22px; font-size: 14px; white-space: nowrap; }
@keyframes sparkle-core { 0% { transform: translate(-50%,-50%) scale(.15) rotate(-30deg); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(-50%,-50%) scale(1.35) rotate(65deg); opacity: 0; } }
@keyframes sparkle-ring { 0% { transform: translate(-50%,-50%) scale(.05); opacity: 0; } 18% { opacity: .85; } 100% { transform: translate(-50%,-50%) scale(2.8); opacity: 0; } }
@keyframes photo-reveal { 0%, 22% { opacity: 1; } 82%, 100% { opacity: 0; } }
@keyframes photo-bloom { 0% { transform: scale(.12); opacity: 0; } 24% { opacity: .7; } 65% { opacity: .42; } 100% { transform: scale(1.65); opacity: 0; } }
@keyframes sparkle-spread { 0% { transform: translate(-50%,-50%) scale(.15); opacity: 0; } 14% { opacity: .95; } 65% { opacity: .8; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.45) rotate(var(--turn)); opacity: 0; } }
.is-editing .trust-row,.is-editing .info-grid,.is-editing .faq,.is-editing .hero-intro,.is-editing .hero > .page-doodle,.is-editing .guide-link,.is-editing a[href="#guide"] { display: none !important; }
.is-editing .hero { padding: 0; }
.is-editing .workspace { scroll-margin-top: 80px; }
.undo-portrait { position: sticky; top: 76px; z-index: 6; margin: 0 0 12px; border: 1px solid #d7cbe4; border-radius: 12px; padding: 11px 16px; background: #fffafc; color: #655073; cursor: pointer; }
.undo-portrait:disabled { opacity: .5; cursor: default; }
#downloadDialog { position: fixed; inset: 0; margin: auto; width: min(420px,calc(100% - 32px)); max-height: 90dvh; border: 1px solid #e4d7ec; border-radius: 22px; padding: 24px; color: #51415f; background: #fffafc; box-shadow: 0 16px 60px #32213b40; }
#downloadDialog::backdrop { background: #24183080; }
#downloadDialog p { line-height: 1.7; }
.download-actions { display: flex; justify-content: flex-end; gap: 10px; }
.download-actions button { padding: 12px 20px; border: 0; border-radius: 12px; cursor: pointer; }
#confirmDownload { background: #9674c6; color: white; }
#confirmDownload:disabled { opacity: .5; }
.portrait-intro { color: #796286; font-size: 14px; margin: 0 0 10px; }
.portrait-status { min-height: 3em; padding: 12px 14px; margin: 12px 0; border-radius: 14px; background: #f3edf9; color: #705187; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.portrait-strength { margin-top: 14px; }
.portrait-strength strong { float: right; color: #8b62b3; }
.portrait-strength input { display: block; width: 100%; min-height: 36px; accent-color: #9674c6; }
.portrait-strength input:disabled { opacity: .4; }
.strength-scale { display: flex; justify-content: space-between; font-size: 12px; color: #897c90; }
.auto-enhance .hint { font-size: 12px; line-height: 1.7; }
.shape-controls { padding: 12px; background: #fff8f0; border: 1px solid #f2e4d7; border-radius: 14px; margin: 14px 0; }
.shape-heading { margin: 0; color: #816377; font-size: 14px; }
.is-preparing { box-shadow: 0 0 0 4px #caaef54d,0 0 20px #b59bdd80; }
.face-options { margin: 12px 0 20px; padding: 12px; background: #faf7fe; border: 1px solid #e9e0f4; border-radius: 14px; }
.face-options .check-label { line-height: 1.5; align-items: flex-start; }
.face-options input[type=checkbox] { flex-shrink: 0; margin-top: 3px !important; }
.face-selection-controls { padding: 14px; margin-bottom: 14px; background: #f3edfb; color: #655279; border-radius: 16px; }
.face-selection-controls p { margin: 0 0 12px; font-size: 13px; line-height: 1.7; }
.face-selection-controls > div { display: flex; flex-wrap: wrap; gap: 8px; }
.face-selection-controls button { min-height: 44px; border: 1px solid #d9caeb; background: #fff; color: #735990; border-radius: 12px; padding: 10px 16px; font: inherit; cursor: pointer; }
.face-selection-controls #applyFaceRegion { background: #8866b7; color: #fff; flex: 1; }
.crop-box.face-selection { border-color: #b590d9; box-shadow: 0 0 0 9999px #352a4159; }
.crop-box.face-selection::before { content: '얼굴 영역'; position: absolute; left: 10px; top: 10px; padding: 5px 10px; color: #fff; background: #70518ddd; border-radius: 8px; font-size: 12px; pointer-events: none; }
.crop-box.face-selection:focus-visible { outline: 3px solid #ffd682; outline-offset: 4px; }
.face-selection .crop-handle { width: 28px; height: 28px; border-color: #9674c6; }
@media(max-width:700px) {
  .compare-toolbar { align-items: stretch; gap: 8px; }
  .compare-switch { flex: 1 0 100%; }
  .compare-switch button { flex: 1; }
  #compareStatus { flex: 1 0 100%; font-size: 12px; min-height: 38px; }
  .image-meta { flex-wrap: wrap; gap: 7px 12px; }
}
@media(prefers-reduced-motion:reduce) {
  .is-running #transitionCanvas,.is-running .enhance-shine,.is-running .portrait-sparkle,.is-running .sparkle-core,.is-running .sparkle-ring { animation: none; }
  .enhance-effect { display: none; }
}
