        /* 기본 설정 */
        * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }
        body { background-color: #f2f2f2; display: flex; justify-content: center; height: 100vh; overflow: hidden; }
        ul { list-style: none; }
        button { cursor: pointer; border: none; outline: none; background: none; }
        input { outline: none; }

        #app { width: 100%; max-width: 420px; height: 100%; background: #fff; position: relative; display: flex; flex-direction: column; box-shadow: 0 0 20px rgba(0,0,0,0.1); overflow: hidden; }
        .view { display: none; flex-direction: column; height: 100%; width: 100%; position: absolute; top: 0; left: 0; background: #fff; }
        .view.active { display: flex; }

        /* --- 🚀 스플래시 뷰 --- */
        #splash-view { justify-content: center; align-items: center; background: #6E026F; color: #fff; z-index: 9999; }
        .splash-logo { font-size: 72px; margin-bottom: 15px; animation: pulse 1.5s infinite; }
        .splash-title { font-size: 24px; font-weight: 300; letter-spacing: 3px; animation: fadeIn 1s ease-in; }
        @keyframes pulse { 0% { transform: scale(0.95); opacity: 0.8; } 50% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(0.95); opacity: 0.8; } }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

        /* --- 🚀 로그인 뷰 (퍼플 테마) --- */
        #login-view { justify-content: center; align-items: center; background: #6E026F; padding: 20px; text-align: center; }
        .login-header-logo { font-size: 56px; color: #fff; margin-bottom: 25px; } /* 박스 바깥의 흰색 로고 */
        .login-box { background: #fff; padding: 40px 30px; border-radius: 16px; width: 100%; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: slideUp 0.4s ease-out; }
        .login-input { width: 100%; padding: 14px; border: 1px solid #e5e5e5; border-radius: 8px; margin-bottom: 12px; font-size: 15px; transition: border 0.2s; }
        .login-input:focus { border-color: #6E026F; } /* 포커스 시 퍼플색 테두리 */
        .login-btn { width: 100%; padding: 15px; background: #6E026F; color: #fff; font-weight: bold; border-radius: 8px; font-size: 16px; transition: background 0.2s; margin-top: 10px; }
        .login-btn:hover { background: #550156; }

        /* --- 메인 화면 (헤더 & 리스트) --- */
        .header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; height: 60px; background: #fff; border-bottom: 1px solid #f2f2f2; }
        .header h1 { font-size: 22px; font-weight: bold; color: #191919; }
        .header-actions button { font-size: 20px; color: #191919; margin-left: 15px; }
        .main-content { flex: 1; overflow-y: auto; background: #fff; }
        
        .list-item { display: flex; align-items: center; padding: 12px 20px; transition: background 0.2s; cursor: pointer; }
        .list-item:hover { background: #f9f9f9; }
        .avatar { width: 44px; height: 44px; border-radius: 18px; background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #64748b; margin-right: 15px; flex-shrink: 0; font-size: 16px; overflow: hidden; background-size: cover; background-position: center; }
        .item-info { flex: 1; overflow: hidden; }
        .item-name { font-size: 16px; font-weight: 500; color: #191919; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .item-sub { font-size: 13px; color: #8b8b8b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

        .my-profile-section { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; cursor: pointer; transition: background 0.2s; }
        .my-profile-section:hover { background: #f9f9f9; }
        .my-profile-section .avatar { width: 56px; height: 56px; border-radius: 22px; font-size: 20px; }
        .my-profile-section .item-name { font-size: 18px; font-weight: bold; }

        /* 하단 탭 (4개로 확장) */
        .tab-bar { display: flex; background: #f9f9f9; border-top: 1px solid #e5e5e5; height: 60px; }
        .tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #b2b2b2; font-size: 24px; transition: 0.2s; cursor: pointer; }
        .tab-item.active { color: #191919; }

        /* --- 설정 탭 전용 스타일 --- */
        #list-settings { background: #f2f2f2; min-height: 100%; }
        .settings-group { margin-top: 10px; background: #fff; border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; }
        .settings-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #f2f2f2; cursor: pointer; }
        .settings-item:last-child { border-bottom: none; }
        .settings-item i.icon { width: 24px; color: #8b8b8b; text-align: center; margin-right: 10px; }
        .toggle-btn { padding: 4px 12px; border-radius: 15px; font-size: 12px; font-weight: bold; color: #fff; transition: 0.2s; }
        .toggle-btn.on { background: #2ecc71; }
        .toggle-btn.off { background: #e74c3c; }

        /* --- 채팅방 화면 --- */
        #chat-view { z-index: 100; background: #B2C7D9; }
        .chat-header { background: #B2C7D9; color: #191919; display: flex; align-items: center; padding: 0 15px; height: 50px; }
        .chat-header button { font-size: 20px; color: #191919; margin-right: 15px; }
        .chat-header h2 { font-size: 16px; font-weight: 500; }
        
        .chat-messages { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 10px; }
        .sys-msg { text-align: center; margin: 10px 0; }
        .sys-msg span { background: rgba(0,0,0,0.1); color: #fff; padding: 4px 12px; border-radius: 12px; font-size: 12px; }
        
        .msg-row { display: flex; align-items: flex-start; margin-bottom: 5px; }
        .msg-row.me { flex-direction: row-reverse; }
        .msg-avatar { width: 36px; height: 36px; border-radius: 14px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; margin: 0 8px; flex-shrink: 0; background-size: cover; background-position: center; }
        .msg-info { display: flex; flex-direction: column; max-width: 70%; }
        .msg-row.me .msg-info { align-items: flex-end; }
        .msg-sender { font-size: 12px; color: #4A5568; margin-bottom: 4px; padding-left: 4px; }
        .msg-row.me .msg-sender { display: none; }
        .msg-bubble { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-break: break-all; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
        .msg-row.other .msg-bubble { background: #fff; color: #191919; border-top-left-radius: 4px; }
        .msg-row.me .msg-bubble { background: #FEE500; color: #191919; border-top-right-radius: 4px; }

        /* Aura 회원 인증 배지 */
        .badge-aura {
            background: #6E026F; /* 로고와 같은 퍼플색 */
            color: #fff;
            font-size: 10px;
            padding: 2px 5px;
            border-radius: 4px;
            margin-left: 5px;
            font-weight: bold;
            vertical-align: middle;
        }

        /* 문자용 연락처 초대 버튼 */
        .btn-invite-mini {
            font-size: 11px;
            padding: 4px 10px;
            border: 1px solid #6E026F;
            color: #6E026F;
            background: #fff;
            border-radius: 12px;
            cursor: pointer;
            margin-right: 15px;
        }

        .btn-invite-mini:hover {
            background: #6E026F;
            color: #fff;
        }

        /* --- 🚀 채팅 입력창 스타일 (수정됨) --- */
        .chat-input-area { background: #fff; display: flex; align-items: center; padding: 10px; min-height: 50px; border-top: 1px solid #e5e5e5; z-index: 101; position: relative; }
        
        /* 1번, 2번에 들어갈 투명한 회색 아이콘 버튼 */
        .icon-btn { width: 36px; height: 36px; background: transparent; color: #8b8b8b; font-size: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; }
        
        /* 회색 입력창 래퍼 (이 안에 텍스트칸과 스마일 버튼이 들어감) */
        .input-wrapper { flex: 1; display: flex; align-items: center; background: #f2f2f2; border-radius: 20px; padding: 0 10px 0 15px; margin: 0 10px; height: 40px; }
        .input-wrapper input { flex: 1; border: none; background: transparent; font-size: 15px; outline: none; height: 100%; min-width: 0; padding: 0; margin: 0; }
        
        /* 기존 전송 버튼 (id를 명시해서 얘만 노란색 동그라미로 만듦) */
        .chat-input-area #chat-send-btn { width: 36px; height: 36px; border-radius: 50%; background: #FEE500; color: #3A1D1D; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: 0.2s; flex-shrink: 0; }
        .chat-input-area #chat-send-btn:disabled { background: #e5e5e5; color: #b2b2b2; }

        /* --- 🚀 하단 서랍 메뉴 (+ 및 이모티콘) --- */
        .chat-bottom-menu { display: none; height: 220px; background: #fff; padding: 20px; overflow-y: auto; border-top: 1px solid #e5e5e5; }
        .chat-bottom-menu.active { display: block; animation: slideUpMenu 0.2s ease-out; }
        @keyframes slideUpMenu { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
        
        .attach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; text-align: center; }
        .attach-item { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
        .attach-icon { width: 50px; height: 50px; border-radius: 50%; color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
        .attach-item span { font-size: 12px; color: #333; }

        .emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 15px; font-size: 28px; text-align: center; cursor: pointer; }
        .emoji-grid span { transition: transform 0.1s; display: inline-block; }
        .emoji-grid span:active { transform: scale(0.8); }
        

        /* --- 🚀 채팅방 우측 햄버거 메뉴 (서랍) 스타일 --- */
        #chat-menu-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 300; display: none; justify-content: flex-end; }
        .chat-menu-panel { width: 80%; max-width: 280px; height: 100%; background: #fff; display: flex; flex-direction: column; animation: slideLeft 0.25s ease-out; box-shadow: -5px 0 15px rgba(0,0,0,0.1); }
        @keyframes slideLeft { from { transform: translateX(100%); } to { transform: translateX(0); } }
        .chat-menu-header { padding: 20px; font-size: 16px; font-weight: bold; border-bottom: 1px solid #f2f2f2; }
        .chat-menu-list { flex: 1; overflow-y: auto; }
        .chat-menu-footer { padding: 15px 20px; border-top: 1px solid #f2f2f2; cursor: pointer; transition: background 0.2s; color: #e74c3c; display: flex; align-items: center; gap: 10px; font-weight: 500; }
        .chat-menu-footer:hover { background: #f9f9f9; }

        /* --- 프로필 모달 --- */
        .modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 200; display: none; justify-content: center; align-items: flex-end; }
        .profile-box { background: #fff; width: 100%; border-top-left-radius: 20px; border-top-right-radius: 20px; padding: 30px 20px 40px; text-align: center; position: relative; animation: slideUp 0.3s ease-out; }
        @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
        .profile-close-btn { position: absolute; top: 15px; right: 20px; font-size: 24px; color: #8b8b8b; }
        .profile-modal-avatar { width: 80px; height: 80px; border-radius: 30px; background: #e2e8f0; color: #64748b; font-size: 32px; font-weight: bold; display: flex; align-items: center; justify-content: center; margin: 0 auto 15px; background-size: cover; background-position: center; }
        .profile-modal-name { font-size: 20px; font-weight: bold; color: #191919; margin-bottom: 5px; }
        .profile-modal-status { font-size: 14px; color: #8b8b8b; margin-bottom: 25px; }
        .profile-actions { display: flex; justify-content: center; gap: 15px; }
        .profile-action-btn { flex: 1; padding: 15px; background: #f2f2f2; border-radius: 12px; font-size: 14px; font-weight: 500; color: #191919; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: background 0.2s; }

/* ============================================================
   🚀 반응형 웹 (PC & 모바일 분할 레이아웃)
   ============================================================ */

/* 📱 1. 모바일 화면 (너비 767px 이하일 때) */
@media screen and (max-width: 767px) {
    #app {
        max-width: 100%; /* 좌우 꽉 차게 */
        height: 100vh;   /* 상하 꽉 차게 */
        border-radius: 0; /* 모바일은 모서리 둥글기 제거 */
    }
}

/* 💻 2. PC 화면 (너비 768px 이상일 때) */
@media screen and (min-width: 768px) {
    body {
        background-color: #d1d5db; /* PC 모니터에서 눈이 편한 짙은 배경 */
    }
    
    #app {
        max-width: 1000px; /* PC에서는 넓게 펼침 (카카오톡 PC버전 느낌) */
        width: 95%;
        height: 90vh; /* 위아래 여백을 살짝 띄워줌 */
        border-radius: 16px;
        flex-direction: row; /* 🚀 핵심: 좌우 2단 분할 배치 */
        overflow: hidden;
    }

    /* 좌측 메뉴 및 친구/대화목록 영역 */
    #main-view {
        position: relative;
        width: 380px; /* 좌측은 스마트폰 너비만큼 고정 */
        min-width: 380px;
        border-right: 1px solid #cbd5e1;
        display: flex !important; /* PC에선 무조건 항상 표시 */
        z-index: 10;
    }

    /* 우측 채팅방 영역 */
    #chat-view {
        position: relative;
        flex: 1; /* 남은 우측 공간을 100% 채움 */
        display: flex !important; /* PC에선 무조건 항상 표시 */
        z-index: 5;
    }

    /* PC에서는 우측에 방이 항상 떠있으므로 '뒤로가기' 버튼 숨김 */
    .chat-header button[onclick="closeChat()"] {
        display: none; 
    }

    /* 화면을 완전히 덮어야 하는 스플래시, 로그인, 팝업창은 전체 화면으로 강제 확장 */
    #splash-view, #login-view, .modal-overlay {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        z-index: 9999; 
    }
}