/* ===================================
   BLANK BOXES ([] CONVERSION) - 완전 정리된 버전
   =================================== */
/* 블랭크박스 내부의 선택 가능한 텍스트 */
.blank-text {
    opacity: 0 !important;
    font-size: 1px !important;
    color: transparent !important;
    pointer-events: none !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.blank-box {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 1.2em !important;
    min-height: 1.2em !important;
    max-height: 1.2em !important;
    border: 0.08em solid var(--primary) !important;
    border-radius: 0.25em !important;
    background: white !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    position: relative !important;
    z-index: 1 !important;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    box-sizing: border-box !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    margin: 0 0.15em !important;
    padding: 0 0.1em !important;
    color: var(--primary);
}

/* 드래그 선택 시 블랭크박스 스타일 */
.blank-box::selection {
    background: rgba(99, 102, 241, 0.4) !important;
    color: white !important;
}

.blank-box::-moz-selection {
    background: rgba(99, 102, 241, 0.4) !important;
    color: white !important;
}

/* 드래그 중 블랭크박스 향상된 시각적 피드백 */
.blank-box.selecting {
    background: rgba(99, 102, 241, 0.1) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.1em rgba(99, 102, 241, 0.3) !important;
}

/* 블랭크박스가 선택 범위에 포함될 때 */
.blank-box.in-selection {
    outline: 2px solid rgba(99, 102, 241, 0.6) !important;
    outline-offset: 1px !important;
    background: rgba(99, 102, 241, 0.15) !important;
    z-index: 2 !important;
}

/* 스타일이 적용된 blank-box는 인라인 색상 사용 */
.blank-box[data-styled="true"] {
    color: inherit !important;
}

/* 각 크기별 가로 크기 */
.blank-box.space-1 { width: 2.5em !important; }
.blank-box.space-2 { width: 3.5em !important; }
.blank-box.space-3 { width: 5em !important; }
.blank-box.space-4 { width: 6.5em !important; }
.blank-box.space-5-plus { width: 8em !important; }

/* span 내부의 blank-box 정렬 */
span .blank-box {
    vertical-align: baseline;
    top: 0;
    margin-bottom: 0;
}

/* 스타일이 적용된 span 내부의 blank-box */
.pattern-display span .blank-box,
.examples-display span .blank-box {
    vertical-align: baseline;
    line-height: 1;
    top: 0;
}

/* Hover 효과 - 클릭 가능함을 명확히 표시 */
.blank-box:hover {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 0.1em rgba(99, 102, 241, 0.2);
    transform: scale(1.05);
    z-index: 2;
    cursor: pointer;
}

/* 클릭된 블랭크박스 강조 */
.blank-box:active {
    transform: scale(0.98);
    box-shadow: 0 0 0 0.15em rgba(99, 102, 241, 0.4);
}

/* 선택된 상태 */
.blank-box[data-selected="true"] {
    outline: 0.1em solid var(--primary);
    outline-offset: 0.1em;
    z-index: 2;
}

/* 부모 요소별 정확한 정렬 */
.pattern-display .blank-box,
.examples-display .blank-box {
    vertical-align: baseline;
    z-index: 1;
}

/* 텍스트와 blank-box 정렬 */
.pattern-display,
.examples-display {
    line-height: 1.3;
}

.pattern-display span,
.examples-display span {
    vertical-align: baseline;
    line-height: 1.3;
    z-index: 0;
}

.pattern-display span span,
.examples-display span span {
    vertical-align: baseline;
    line-height: inherit;
    z-index: 0;
}

/* 최종 보정 */
span[style] .blank-box {
    vertical-align: baseline !important;
    top: 0 !important;
    z-index: 1 !important;
}