/* 에차 페이지 전용: body.etcha-page 시 레이아웃 적용 */
body.etcha-page {
    overflow: hidden;
    height: 100vh;
    box-sizing: border-box;
}
body.etcha-page .container {
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
}
body.etcha-page .main-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}
body.etcha-page .bbs-header {
    flex-shrink: 0;
}
.etcha-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 40px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    box-sizing: border-box;
}
.etcha-oeka-wrap {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}
.etcha-oeka-wrap .oeka-canvas-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.chat-container {
    flex-shrink: 0;
    width: 300px;
    height: 578px;
    display: flex;
    flex-direction: column;
    border: 2px outset #ccc;
    background: #c0c0c0;
    padding: 10px;
}

/* 데스크톱 기본 높이: 캔버스/채팅 높이 통일 */
@media (min-width: 901px) {
    .etcha-oeka-wrap .oeka-canvas-panel {
        min-height: 620px;
    }
    .chat-container {
        height: 620px;
    }
}
.chat-header {
    font-weight: bold;
    text-align: center;
    padding-bottom: 5px;
    border-bottom: 2px inset #777;
    margin-bottom: 10px;
}
.chat-messages {
    flex-grow: 1;
    background: #fff;
    border: 2px inset #777;
    padding: 10px;
    overflow-y: scroll;
    margin-bottom: 10px;
    font-size: 13px;
}
.chat-messages p { margin: 0 0 5px 0; line-height: 1.4; }
.chat-messages .user { font-weight: bold; color: #000080; }
.chat-input-area { display: flex; flex-direction: column; gap: 5px; }
.chat-input-area input, .chat-input-area textarea {
    width: 100%; border: 2px inset #777; padding: 3px; box-sizing: border-box; font-family: inherit;
}
.chat-input-area button {
    padding: 5px; border: 2px outset #f0f0f0; background: #c0c0c0; font-weight: bold; cursor: pointer;
}
.chat-input-area button:active { border-style: inset; }
.etcha-mobile-menu-link { display: none; }

/* 모바일: 캔버스는 플로팅 전체화면으로만 사용. 진입 시 툴 영역은 버튼만 노출 */
.etcha-oeka-placeholder {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}
.etcha-oeka-open-btn {
    display: none;
}
@media (max-width: 900px) {
    .etcha-mobile-menu-link { display: inline-block; margin-bottom: 8px; padding: 6px 12px; background: #c0c0c0; border: 2px outset #f0f0f0; color: #333; text-decoration: none; font-weight: bold; border-radius: 4px; }
    body.etcha-page { overflow: auto; height: auto; min-height: 100vh; }
    body.etcha-page .container { max-height: none; overflow: visible; }
    body.etcha-page .main-content { overflow: visible; }
    .etcha-container { flex-direction: column; }
    .chat-container { width: 100%; max-width: 100%; height: 200px; }

    .etcha-oeka-placeholder {
        min-height: 120px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #e0e0e0;
        border: 2px outset #ccc;
        padding: 16px;
    }
    .etcha-oeka-placeholder .etcha-oeka-wrap {
        display: none !important;
    }
    .etcha-oeka-open-btn {
        display: inline-block;
        padding: 12px 24px;
        font-size: 16px;
        font-weight: bold;
        background: #c0c0c0;
        border: 2px outset #f0f0f0;
        color: #333;
        cursor: pointer;
        border-radius: 4px;
    }
    .etcha-oeka-open-btn:active {
        border-style: inset;
        background: #b0b0b0;
    }
}

/* 전체화면 플로팅 오에카 레이어 */
.etcha-oeka-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #e0e0e0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.etcha-oeka-fullscreen-overlay .etcha-oeka-wrap {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex !important;
    overflow: hidden;
}

/* 모바일 나가기 버튼 (팔레트 하단 추가) */
.etcha-mobile-exit-btn {
    margin-top: 8px;
    width: 100%;
    padding: 6px 0;
    background: #ffdddd;
    border: 2px outset #f0f0f0;
    color: #d00;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
}
.etcha-mobile-exit-btn:active {
    border-style: inset;
    background: #ffcccc;
}
