.imgCrop { pointer-events:none; display:none; justify-content:center; align-items:center; position:fixed; top:0; left:0; width:100%; height:100vh; z-index:40;}
.imgCrop.on { display:flex; pointer-events: all;}
.imgCrop > .bg { opacity: 1; pointer-events: none; transition: opacity .3s; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(0, 0, 0, 1); }

.imgCrop .container {
    display:none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* 확실한 중앙 정렬 */
    background: black;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 100%;
}
.imgCrop.on .container {display: block;}

.imgCrop h1 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
}

.imgCrop .upload-area {
    display:none;
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.imgCrop .upload-area.hidden {
    display: none;
}

.imgCrop input[type="file"] {
    display: none;
}

.imgCrop .upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.imgCrop .crop-container {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.imgCrop .crop-container.active {
    display: flex;
}

.imgCrop .previewBox { position:relative; overflow:hidden; }
.imgCrop .preview-area {
    width: 280px;
    height: 364px;
    margin: 0 auto;
    overflow: visible;
    position: relative;
    background: #000;
    touch-action:none;
}

.imgCrop .preview-area.large{
    height:498px;
}

.imgCrop .preview-area img {
    position: absolute;
    cursor: move;
    user-select: none;
    touch-action:none;
}

.imgCrop .crop-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1;
    pointer-events: none; /* 클릭/드래그 차단 X */

    /* 가운데 직사각형만 투명하게 뚫기 (mask + XOR) */
    mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;

    /* 구멍 위치/크기 = CSS 변수로 제어 */
    padding-left:  calc((100% - 280px) / 2);
    padding-right: calc((100% - 280px) / 2);
    padding-top: 4px;
    padding-bottom: 4px;
}

.imgCrop .crop-overlay::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 284px;  /* preview-area 크기 */
    height: 360px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2;
}

.imgCrop .crop-overlay.large::after {
    height:494px;
}


/* ㄱ자 모서리용 공통 스타일 */

.imgCrop .crop-overlay::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 280px;
    height: 360px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 3;
    box-sizing: border-box;
}


.imgCrop .crop-overlay .corner {
    position: absolute;
    width: 30px; /* ㄱ자 가로 길이 */
    height: 30px; /* ㄱ자 세로 길이 */
    border-color: #fff;
    border-style: solid;
    border-width: 3px;
    z-index: 3;
    pointer-events: none;
  }

  /* 각 모서리별 위치 지정 */
  .imgCrop .crop-overlay .corner.tl {
    top: calc(50% - 182px);
    left: calc(50% - 144.5px);
    border-right: none;
    border-bottom: none;
  }

  .imgCrop .crop-overlay .corner.tr {
    top: calc(50% - 182px);
    right: calc(50% - 144.5px);
    border-left: none;
    border-bottom: none;
  }

  .imgCrop .crop-overlay .corner.bl {
    bottom: calc(50% - 182px);
    left: calc(50% - 144.5px);
    border-right: none;
    border-top: none;
  }

  .imgCrop .crop-overlay .corner.br {
    bottom: calc(50% - 182px);
    right: calc(50% - 144.5px);
    border-left: none;
    border-top: none;
  }

  .imgCrop .crop-overlay.large::before {
    height: 498px;
    }

    .imgCrop .crop-overlay.large .corner.tl {
        top: calc(50% - 249px);
        left: calc(50% - 144.5px);
      }

      .imgCrop .crop-overlay.large .corner.tr {
        top: calc(50% - 249px);
        right: calc(50% - 144.5px);
      }

      .imgCrop .crop-overlay.large .corner.bl {
        bottom: calc(50% - 249px);
        left: calc(50% - 144.5px);
      }

      .imgCrop .crop-overlay.large .corner.br {
        bottom: calc(50% - 249px);
        right: calc(50% - 144.5px);
      }

.imgCrop .controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.imgCrop .control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.imgCrop .control-group.zoom {
    display:none;
}
.imgCrop .control-group label {
    min-width: 80px;
    font-weight: 600;
    color: #555;
}

.imgCrop input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.imgCrop input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.imgCrop input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.imgCrop .buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    position:fixed;
    bottom:20px;
    width:100%;
    max-width:540px;
    padding:0 20px;
}

.imgCrop button {
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.imgCrop button img {width: 50px; height: 50px;}


.imgCrop .result {
    display: none;
    text-align: center;
}

.imgCrop .result.active {
    display: block;
}

.imgCrop .result img {
    width: 200px;
    height: 257px;
    border-radius: 15px;
    border: 4px solid #667eea;
    margin: 20px 0;
}

.imgCrop .btn-new {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}


.rotate-buttons { display: flex; gap: 8px; }


.imgCrop .zoom_btns {display: block; position: absolute; left: calc(100% + 20px); bottom: 30px; z-index: 10; width: 40px;}
.imgCrop .zoom_btns > button { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.24);  padding: 0; text-align: center;}
.imgCrop .zoom_btns > button > span {font-family: 'Pretendard', sans-serif; color: #fff; font-size: 30px; font-weight: 200; line-height: 1.1;}
.imgCrop .zoom_btns > button + button {margin-top: 15px;}

@media screen and (max-width: 768px) {
    .imgCrop .zoom_btns {display: none;}
}
    