/* ✅ 모바일 환경 (768px 이하) 설정 */
@media (max-width: 768px) {

    /* 1. 내비게이션 바텀바 */
    #cmt_bottom_bar {
        display: none;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 44px;
        background: #ffffff;
        border-top: 1px solid #eeeeee;
        box-shadow: none;
        z-index: 1003;
        align-items: stretch;
        justify-content: stretch;
        cursor: default;
    }

    #cmt_bottom_bar.visible {
        display: flex !important;
    }

    /* 2. 버튼 공통 */
    .nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: 11px;
        font-weight: 600;
        color: #555555;
        border: none;
        background: none;
        cursor: pointer;
        padding: 7px 0 6px 0;
        transition: color 0.15s, background 0.15s;
        -webkit-tap-highlight-color: transparent;
        outline: none;
    }

    .nav-btn i {
        font-size: 17px;
        color: #6b788d;
        transition: color 0.15s;
    }

    /* 버튼 사이 구분선 */
    .nav-btn + .nav-btn {
        border-left: 1px solid #eeeeee;
    }

    /* 탭 활성 상태 */
    .nav-btn:active,
    .nav-btn.active {
        background: rgba(0, 0, 0, 0.04);
        color: #0894b8;
    }
    .nav-btn:active i,
    .nav-btn.active i {
        color: #0894b8;
    }

    /* 3. 배경 오버레이 */
    #cmt_sheet_overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1001;
    }
    #cmt_sheet_overlay.visible { display: block; }

    /* 4. 댓글 바텀 시트 본체 */
    #cmt_bottom_sheet {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: #ffffff;
        border-radius: 16px 16px 0 0;
        z-index: 1002;
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }
    #cmt_bottom_sheet.open { transform: translateY(0); }

    /* 5. 시트 상단 헤더 */
    #cmt_sheet_header {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 16px;
        border-bottom: 1px solid #eeeeee;
    }
    #cmt_sheet_handle {
        width: 36px;
        height: 4px;
        background: #dddddd;
        border-radius: 10px;
    }

    /* 6. 시트 내부 콘텐츠 영역 */
    #cmt_sheet_content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 7. 다크모드 */
    .darkmode #cmt_bottom_bar {
        background: #1a1a1a;
        border-top-color: #333333;
        box-shadow: none;
    }
    .darkmode .nav-btn { color: #cccccc; }
    .darkmode .nav-btn i { color: #0894b8; }
    .darkmode .nav-btn + .nav-btn { border-left-color: #333333; }
    .darkmode .nav-btn:active,
    .darkmode .nav-btn.active { background: rgba(255,255,255,0.06); }

    .darkmode #cmt_bottom_sheet { background: #1e1e1e; }
    .darkmode #cmt_sheet_handle { background: #444444; }

    /* 8. 플레이어 전체화면 - 헤더 고정 (JS fixed 방식) */
    /* 삭제 — #yt_fs_header 관련 스타일 전체 제거 */

    /* 재생목록 마지막 곡 하단 라인 */
    #youtube-playlist .yt-playlist-items {
        border-bottom: 1px solid #eeeeee;
    }
    .darkmode #youtube-playlist .yt-playlist-items {
        border-bottom: 1px solid #333333;
    }

    /* 댓글 등록 버튼이 바텀바에 가리지 않도록 마지막 요소 하단 여백 */
    #comment .cmt_write,
    #comment .cmt_paging:last-child,
    #comment > *:last-child {
        margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    /* 9. 플레이어 상단 고정 */
    #youtube-player-container.is-sticky {
        position: fixed !important;
        top: 0; left: 0; right: 0;
        z-index: 2000;
        background: #000000;
    }
}

/* 기본 상태(PC 등 769px 이상)에서는 보이지 않게 숨김 */
.mobile-only {
    display: none !important;
}