/* =========================================================
   캔버스 영역
========================================================= */

.canvasFrame {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 15px;
}

.canvasWrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

canvas {
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    max-width: 100%;
    border: 1px solid var(--line);
}


/* =========================================================
   선택 박스 / 핸들
========================================================= */

.bbox {
    position: absolute;
    width: 0;
    height: 0;
    border: 2px solid rgba(43, 108, 255, 0.95);
    border-radius: var(--radius-sm);

    display: none;
    background: transparent;
    pointer-events: auto;
}

.bbox .h {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: #fff;
    border: 2px solid rgba(43, 108, 255, 0.95);
    pointer-events: auto;
}

.bbox .h.nw {
    left: -8px;
    top: -8px;
    cursor: nwse-resize;
}

.bbox .h.ne {
    right: -8px;
    top: -8px;
    cursor: nesw-resize;
}

.bbox .h.sw {
    left: -8px;
    bottom: -8px;
    cursor: nesw-resize;
}

.bbox .h.se {
    right: -8px;
    bottom: -8px;
    cursor: nwse-resize;
}


/* =========================================================
   회전 핸들
========================================================= */

.bbox .rotLine {
    position: absolute;
    left: 50%;
    top: -14px;
    transform: translateX(-50%);
    width: 2px;
    height: 14px;
    background: rgba(43, 108, 255, 0.55);
    pointer-events: none;
}

.bbox .rot {
    position: absolute;
    left: 50%;
    top: -34px;
    transform: translateX(-50%);

    width: 22px;
    height: 22px;
    border-radius: 8px;

    background: #fff;
    border: 1px solid rgba(43, 108, 255, 0.95);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12);

    cursor: grab;

    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M4.5 12a7.5 7.5 0 0 1 12.9-5.1' stroke='%232b6cff' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M18 4v4h-4' stroke='%232b6cff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M19.5 12a7.5 7.5 0 0 1-12.9 5.1' stroke='%232b6cff' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M6 20v-4h4' stroke='%232b6cff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.bbox .rot:active {
    cursor: grabbing;
}


/* =========================================================
   터치 / 선택 방지
========================================================= */

#canvasWrap,
#designCanvas,
#bbox,
#bbox .h,
#rotHandle {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   파일 업로드 영역
========================================================= */

.uploadRow {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
}

.fileBtn {
    min-width: 120px;
    height: 44px;
    width: auto;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-weight: 700;
    white-space: nowrap;
}

.fileName {
    font-size: var(--fs-13);
    color: #667085;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.uploadGuide {
    flex: 1;
    font-size: var(--fs-12);
    color: var(--muted);
    line-height: 1.55;
}

.uploadGuide div {
    display: block;
}

.dangerBtn {
    width: auto;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    font-weight: 700;

    background: #fff;
    color: var(--bad);
    border: 1px solid var(--line);
}

.dangerBtn:hover {
    border-color: var(--bad);
    background: rgba(217, 45, 32, 0.06);
}

.dangerBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}


/* =========================================================
   배경 색상 선택
========================================================= */

.colorPick {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#bgPickBtn.ghostBtn {
    width: auto;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.colorSwatch {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #ffffff;
}

.colorValue {
    font-size: var(--fs-13);
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.pickrMount {
    position: relative;
    display: inline-block;
    width: 0;
    height: 0;
}

.pcr-button,
.pcr-button::after {
    pointer-events: none !important;
}

.colorPick.isLocked {
    opacity: 0.55;
    pointer-events: none;
}


/* =========================================================
   가운데 액션 버튼 바
========================================================= */

.editorActionBar {
    margin-top: 14px;
    display: flex;
}

.editorActionBar button {
    width: 100%;
}


/* =========================================================
   업로드 / 색상 영역 내부 정리
========================================================= */

.canvasControlRow {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}