/* --- 빌드 뷰어 페이지 레이아웃 --- */
.build-header-info {
    margin-bottom: 2rem;
    padding: 20px;
    background-color: #2a2a2a;
    border-radius: 8px;
    border: 1px solid #444;
}

.build-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.author-name {
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 15px;
}

.build-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #aaa;
    border-top: 1px solid #444;
    padding-top: 15px;
}

/* [수정] 빌드 설명 스타일 */
.build-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #444;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #ddd;
    /* white-space: pre-wrap; <-- 이 줄을 삭제하여 마크다운 스타일이 적용되도록 합니다. */
    word-break: break-word; /* 긴 단어 줄바꿈 */
}

/* [신규] 빌드 설명 마크다운 렌더링 스타일 */
.build-description h1,
.build-description h2,
.build-description h3,
.build-description h4 {
    font-family: 'MuseumCulturalFoundationClassic', sans-serif;
    color: #00aaff;
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    line-height: 1.4;
}
.build-description h2 { font-size: 1.5em; }
.build-description h4 { font-size: 1.1em; }

.build-description p {
    margin-bottom: 1.2em;
}

.build-description ul,
.build-description ol {
    margin-bottom: 1.2em;
    padding-left: 2em;
}

.build-description li {
    margin-bottom: 0.5em;
}

.build-description strong {
    color: #f1c40f;
    font-weight: 500;
}

.build-description hr {
    border: none;
    border-top: 1px solid #444;
    margin: 2em 0;
}

.timestamps span {
    margin-right: 20px;
}

.action-buttons button {
    padding: 8px 16px;
    font-size: 0.9rem;
    border: 1px solid #555;
    background-color: #333;
    color: #ccc;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}

/* [수정] 버튼 그룹 및 드롭다운 컨테이너 스타일 */
.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons .dropdown {
    position: relative;
}

.action-buttons button:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.action-buttons button.delete-btn:hover {
    background-color: #e74c3c;
    border-color: #e74c3c;
}

.build-viewer-main-content {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.build-viewer-portrait-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.build-viewer-portrait {
    width: 100%;
    height: auto;
}

.build-viewer-content-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.build-viewer-section h4 {
    font-size: 1.2rem;
    color: #00aaff;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #4f545c;
}

.build-viewer-starting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* [수정] 2x2 그리드 적용 */
.build-viewer-memory-essence-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.item-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #2a2a2a;
    padding: 12px;
    border-radius: 5px;
    border-left: 4px solid #555;
}

/* [수정] 빈 슬롯 스타일 */
.item-box.empty {
    min-height: 84px;
    /* 내용 있는 박스와 높이 유사하게 */
    border-left-color: #555;
    /* 기본 테두리 색상 */
}

.constellation-slot-item.empty {
    min-height: 84px;
    background-color: #2a2a2a;
}

.item-box-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-box-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.item-box-header-text {
    display: flex;
    flex-direction: column;
}

.item-box-name {
    font-size: 1rem;
    font-weight: bold;
}

.item-box-desc {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #ccc;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.sprite-icon {
    height: 1.1em;
    vertical-align: bottom;
    margin: 0 1px;
}

.memory-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.essence-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 20px;
}

/* [신규] 추가 정보 스타일 */
.cooldown-info,
.cost-info {
    font-size: 0.8rem;
    color: #aaa;
}

/* [신규] 희귀도 테두리 스타일 */
.item-box.rarity-border-Common {
    border-left-color: #e4f0f1;
}

.item-box.rarity-border-Rare {
    border-left-color: #35fbfd;
}

.item-box.rarity-border-Epic {
    border-left-color: #c85ef9;
}

.item-box.rarity-border-Legendary {
    border-left-color: #fe3e35;
}

.item-box.rarity-border-Unique,
.item-box.rarity-border-Character,
.item-box.rarity-border-Identity {
    border-left-color: #f1b050;
}

/* 별자리 */
.build-viewer-constellation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.constellation-slot-item {
    background-color: #2a2a2a;
    padding: 12px;
    border-radius: 5px;
    border-left: 4px solid #555;
}

.constellation-slot-item .item-box-header .item-icon-wrapper {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.constellation-slot-item .star-icon-tint {
    width: 100%;
    height: 100%;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* [신규] 별자리 카테고리 테두리 스타일 */
.constellation-slot-item.category-border-Destruction {
    border-left-color: #c03B2b;
}

.constellation-slot-item.category-border-Life {
    border-left-color: #27ae60;
}

.constellation-slot-item.category-border-Imagination {
    border-left-color: #2980b9;
}

.constellation-slot-item.category-border-Flexible {
    border-left-color: #f39c12;
}


/* 모바일 반응형 */
@media (max-width: 768px) {

    /* 가로폭 확장 */
    .content {
        padding: 0 15px;
    }

    /* display: contents로 레이아웃 래퍼를 제거하여 자식 요소가 전체 너비를 사용하도록 함 */
    .build-viewer-main-content {
        display: contents;
    }

    /* 포트레이트 */
    #build-container .build-viewer-portrait-wrapper {
        display: flex;
        justify-content: center;
        margin-top: 1.5rem;
        /* 헤더와의 간격 */
        margin-bottom: 1.5rem;
        /* 시작기억과의 간격 */
    }

    #build-container .build-viewer-portrait {
        width: 160px;
        height: 160px;
        border-radius: 50%;
        object-fit: cover;
    }

    /* 시작기억 1열 */
    #build-container .build-viewer-starting-grid {
        grid-template-columns: 1fr;
    }

    /* 기억&정수 1열 */
    #build-container .build-viewer-memory-essence-grid {
        grid-template-columns: 1fr;
    }

    /* 별자리 1열 및 설명 표시 */
    #build-container .build-viewer-constellation-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    #build-container .constellation-slot-item {
        padding: 12px;
        border-left-width: 4px;
        min-height: 84px;
    }

    #build-container .constellation-slot-item .item-box-header {
        flex-direction: row;
        gap: 10px;
        text-align: left;
    }

    #build-container .constellation-slot-item .item-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    #build-container .constellation-slot-item .item-box-name {
        font-size: 1rem;
        line-height: 1.5;
    }

    #build-container .constellation-slot-item .cost-info {
        font-size: 0.8rem;
    }

    #build-container .constellation-slot-item .item-box-desc {
        display: block;
    }

    #build-container .build-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* [신규] 모바일 드롭다운 위치 수정 */
    #build-container .action-buttons .dropdown-content {
        left: 0;
        right: auto;
    }

    #build-container .timestamps {
        display: flex;
        flex-direction: column;
        gap: 4px;
        /* 항목 간 세로 간격 */
    }

    #build-container .timestamps span {
        margin-right: 0;
        /* 불필요해진 가로 간격 제거 */
    }
}

/* [신규] 하이라이트 및 범례 스타일 */
.item-box.highlight-dejavu,
.constellation-slot-item.highlight-dejavu {
    border-top: 2px solid #e67e22;
    border-right: 2px solid #e67e22;
    border-bottom: 2px solid #e67e22;
    box-shadow: 0 0 8px #e67e2266;
}

.item-box.highlight-core,
.constellation-slot-item.highlight-core {
    border-top: 2px solid #f1c40f;
    border-right: 2px solid #f1c40f;
    border-bottom: 2px solid #f1c40f;
    box-shadow: 0 0 8px #f1c40f66;
}

.template-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.template-section-header h4 {
    margin-bottom: 0;
}

.template-legend {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #ccc;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color-box {
    width: 13px;
    height: 13px;
    display: inline-block;
    border-radius: 2px;
}


.legend-color-box.dejavu {
    border: 2px solid #e67e22;
    border-radius: 4px;
}

.legend-color-box.core {
    border: 2px solid #f1c40f;
    border-radius: 4px;
}