:root {
    /* Premium Color Palette - Navy Theme */
    --primary: #1a365d;
    --primary-hover: #2a4365;
    --text-on-primary: #ffffff;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --border: #e2e8f0;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
* {
    scrollbar-width: none !important;    /* Firefox */
    -ms-overflow-style: none !important; /* IE, Edge */
}

*::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
    width: 0 !important;
    height: 0 !important;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* [추가] 스크롤바 숨기기 (기능은 유지) */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
    overflow-y: auto;
    /* 스크롤 기능은 활성화 */
}

/* [추가] Chrome, Safari, Opera에서 body 스크롤바 숨기기 */
body::-webkit-scrollbar {
    display: none;
}

/* [추가] 전체 레이아웃 컨테이너에서도 스크롤바 숨김 처리 */
#main-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#main-content::-webkit-scrollbar {
    display: none;
}

/* Layout */
.app-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0rem;
    padding: 0.8rem 10px;
}

.logo-area {
    font-size: 1.3rem;
    /* 긴 텍스트 고려하여 약간 축소 (기존 1.5rem) */
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.5px;
    cursor: pointer;
    /* 클릭 가능하므로 */
}

.logo-text {
    /* 모바일 대응 등 필요시 미디어 쿼리 추가 가능 */
    white-space: nowrap;
}


.user-pill {
    background: var(--surface);
    padding: 0.3rem 0.6rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    /* 간격 적절히 조정 */
    cursor: pointer;
    transition: transform 0.1s;
    border: 1px solid var(--border);
}

.nav-flag {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-profile-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.nav-profile-icon {
    font-size: 24px;
    color: #cbd5e1;
}

.user-name {
    color: var(--text-main);
    font-size: 0.9rem;
    padding-top: 1px;
    /* 텍스트 수직 보정 */
}

.user-pill:active {
    transform: scale(0.97);
}

.chat-room-item.editing-mode {
    background-color: #f0f9ff !important;
    border: 1px dashed #3b82f6 !important;
    opacity: 1;
}

.chat-room-item.editing-mode:hover {
    background-color: #e0f2fe !important;
    cursor: context-menu;
}

.btn-minimal {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s, border-color 0.2s !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-minimal.btn-outline {
    border: 1px solid #e2e8f0 !important;
    color: #64748b !important;
    background: white !important;
}

.btn-minimal.btn-active {
    background-color: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.btn-minimal:hover {
    background-color: #f1f5f9 !important;
    color: var(--text-main) !important;
    border-color: #cbd5e1 !important;
    transform: none !important;
}

.btn-minimal.btn-active:hover {
    background-color: var(--primary-hover) !important;
    color: white !important;
}

/* Login*/

/* 로그인 페이지 전용 스타일 */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 20px;
    padding: 40px 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    border: 1px solid #fff;
}

.login-logo i {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 15px;
    background: #eff6ff;
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.login-desc {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 40px;
    line-height: 1.5;
}

.btn-login-google {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #1e293b;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-login-google:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.btn-login-kakao {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #FEE500;
    color: #000;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-login-kakao:hover {
    background: #fdd835;
    transform: translateY(-1px);
}


/* Navigation */
.nav-tabs {
    display: flex;
    background: var(--surface);
    padding: 0;
    border-radius: 0;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    gap: 0.25rem;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    cursor: pointer;
    border-radius: 0;
    font-weight: 600;
    color: var(--text-sub);
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-item:hover {
    background-color: #f8fafc;
}

.nav-item.active {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Cards & Forms */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
    animation: slideUp 0.3s ease-out;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
}

input,
textarea,
select {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: var(--transition);
    background: #f8fafc;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
    background: white;
}

/* .card 내부에 있는 form-group만 타겟팅 */
.card .form-group {
    margin-bottom: 35px !important;
    display: flex;
    flex-direction: column;
}

/* 항목 추가 버튼과 하단 게시하기 버튼 사이의 간격 */
.card .form-group+.btn-primary {
    margin-top: 15px !important;
}

/* 라벨 아래에도 약간의 여백을 주면 더 깔끔합니다 */
.card .form-group label {
    margin-bottom: 12px !important;
    display: block;
    font-weight: 600;
}

/* 동적 옵션 입력창들 사이의 간격 */
.edit-option-row {
    margin-bottom: 10px !important;
    display: flex;
    align-items: center;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(26, 54, 93, 0.15);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(26, 54, 93, 0.25);
}

.btn-primary:disabled {
    background: var(--secondary);
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
    box-shadow: none;
}

.btn-outline {
    border: 1px solid var(--primary) !important;
    color: var(--primary) !important;
    background: transparent !important;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background-color: #eef2ff !important;
    border-color: var(--primary-hover) !important;
    color: var(--primary-hover) !important;
    box-shadow: 0 2px 4px rgba(26, 54, 93, 0.1);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn-sm {
    padding: 0.8rem 0.8rem;
    font-size: 0.9rem;
    width: auto;
}

/* Vote Item */
.vote-item {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.vote-item:hover {
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.vote-status {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    text-transform: uppercase;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-ended {
    background: #f1f5f9;
    color: #475569;
}

/* Progress Bars */
.result-row {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.result-row.selected {
    border: 2px solid #10b981;
}

.result-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 1rem;
}

.progress-track {
    width: 100%;
    height: 12px;
    background-color: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Radio Options */
.option-label {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.option-label:hover {
    background: #f8fafc;
}

.option-label.selected {
    border-color: #1a365d;
    background: #eef2ff;
    font-weight: bold;
    box-shadow: 0 0 0 1px #1a365d;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
}

.option-label.selected .radio-custom {
    border-color: #1a365d;
    background: #fff;
}

.option-label.selected .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #1a365d;
    border-radius: 50%;
}

/* Buttons Style */
.vote-btn-lg {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: #cbd5e1;
    color: #fff;
    margin-top: 20px;
}

.vote-btn-lg.active {
    background: #1a365d;
    box-shadow: 0 4px 6px rgba(26, 54, 93, 0.3);
}

.vote-btn-lg.active:hover {
    background: #2a4365;
}

.vote-btn-lg.completed {
    background: #475569 !important;
    color: #e2e8f0 !important;
    cursor: not-allowed;
    opacity: 1 !important;
    border: 1px solid #334155;
}

.vote-btn-lg:disabled {
    transform: none !important;
}

/* [추가] 헤더 및 아이콘 버튼 스타일 */
.btn-icon {
    background: transparent !important;
    border: none !important;
    color: var(--text-main) !important;
    /* 또는 #333 */
    font-size: 1.25rem !important;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    box-shadow: none !important;
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

/* 헤더 제목이 너무 길 때 말줄임표 처리 보강 */
.chat-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}


/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: max-content;
    max-width: 90%;
    pointer-events: auto !important;
    z-index: 2147483647 !important;
}

.toast {
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 2147483647;
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.warning {
    border-left-color: var(--warning);
}

/*settings*/

/* 설정 모달 스타일 */
.setting-tab-item {
    padding: 12px 15px;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}
.setting-tab-item:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}
.setting-tab-item.active {
    background-color: white;
    color: #3b82f6;
    font-weight: bold;
    border-left: 3px solid #3b82f6;
}
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
}
.setting-title {
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}
.setting-desc {
    font-size: 0.8rem;
    color: #94a3b8;
}

.font-large .chat-bubble, 
.font-large .chat-content-area {
    font-size: 1.1rem !important; /* 더 크게 */
}


/* Utils */
.hidden {
    display: none !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000 !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* [수정] 상세 리스트 모달을 프로필 모달(20010)보다 확실히 위로 올림 */
.detail-list-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20050 !important;
    /* 프로필(20010)보다 높게 설정 */
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: var(--surface);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    position: relative;
    border: 1px solid var(--border);
}

/* Flag & Icons */
.flag-icon {
    height: 20px;
    width: auto;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    margin-right: 4px;
    display: block;
}

.user-pill .flag-icon {
    height: 14px !important;
    margin-right: 0;
}

.user-pill span {
    line-height: 1;
    padding-top: 1px;
}

.participant-count-btn {
    position: relative;
    z-index: 5;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.participant-count-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Switch Toggle */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Vote Extra */
.vote-choice-badge {
    background-color: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: auto;
    font-weight: 500;
}

.border-danger {
    border: 3px solid #ef4444 !important;
}

.border-orange {
    border: 3px solid #f97316 !important;
}

.border-warning {
    border: 3px solid #facc15 !important;
}

.border-safe {
    border: 3px solid #10b981 !important;
}

.past-votes-divider {
    margin: 30px 0 15px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    position: relative;
}

.past-votes-btn {
    background: #f1f5f9;
    color: var(--text-sub);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    position: relative;
    top: -14px;
    transition: all 0.2s;
}

.past-votes-btn:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

/* Vote Types */
.vote-type-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.vote-type-card {
    display: flex;
    align-items: flex-start;
    /* 아이콘과 텍스트 상단 정렬 */
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 12px;
    /* 둥글기 조금 더 부드럽게 */
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
}

.vote-type-card:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.vote-type-card.active {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 0 0 1px #3b82f6;
}

.type-icon {
    font-size: 1.4rem;
    margin-right: 15px;
    width: 24px;
    text-align: center;
    padding-top: 2px;
    /* 텍스트와 높이 맞춤 */
}

.type-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.type-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 4px;
    /* 제목과 설명 사이 간격 */
}

.type-desc {
    font-size: 0.85rem;
    /* 글씨 작게 */
    color: #64748b;
    line-height: 1.4;
    word-break: keep-all;
    /* 한글 단어 끊김 방지 */
}

/* Comment Extra */
.comment-section {
    margin-top: 30px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.btn-excel {
    background: #217346;
    color: white;
    border: none;
}

.btn-excel:hover {
    background: #1e6b41;
}

/* Notifications */
.notification-dropdown {
    position: absolute;
    top: 120%;
    right: -10px;
    width: 320px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
}

.notification-dropdown::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 14px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.noti-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    /* 상단 정렬 */
    gap: 12px;
    transition: background 0.2s;
    background: #fff;
    position: relative;
}

.noti-item:hover {
    background: #f8fafc !important;
}

.noti-item.unread {
    background: #f0f9ff;
}

/* [신규] 읽지 않은 알림 인디케이터 (빨간 점) */
.noti-indicator {
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    margin-top: 6px;
    /* 텍스트 첫 줄과 높이 맞춤 */
    flex-shrink: 0;
    /* 찌그러짐 방지 */
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* 읽은 알림의 인디케이터 (투명하거나 회색) */
.noti-indicator.read {
    background-color: transparent;
    box-shadow: none;
}

/* 읽은 알림의 인디케이터 (투명하거나 회색) */
.noti-indicator.read {
    background-color: transparent;
    box-shadow: none;
}

/* 알림 텍스트 영역 */
.noti-content-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.noti-msg {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-main);
    word-break: break-all;
}

.noti-date {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* [신규] 투명 백드롭 (외부 클릭 시 닫기용) */
.transparent-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9990;
    /* 드롭다운(9999)보다 한 단계 낮음 */
    cursor: default;
}

.notification-badge {
    border: 2px solid #fff !important;
}

/* Header Icons */
.header-icon {
    padding: 5px;
    font-size: 1.1rem;
    color: var(--text-sub);
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon:hover {
    color: var(--primary);
}

/* [수정] 헤더 아이콘들을 감싸는 균일한 박스 (정렬 문제 해결) */
.header-action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: var(--text-main);
    position: relative;
    /* 뱃지 위치 기준점 */
}

.header-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}


/* Mention Highlight */
.mentioned-user {
    color: #3b82f6 !important;
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    padding: 0 2px;
}

.mentioned-user:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
    border-radius: 4px;
}

.other .mentioned-user {
    background: #e0e7ff !important;
    color: var(--primary) !important;
}

/* [추가] 멘션된 메시지나 검색된 메시지로 이동 시 테두리 강조 */
.highlight-flash::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 3px solid #facc15;
    border-radius: 16px;
    animation: fadeOutBorder 2.5s ease-out forwards;
    pointer-events: none;
}

@keyframes fadeOutBorder {
    0% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}


@keyframes highlightFlash {
    0% {
        background-color: rgba(250, 204, 21, 0.5);
    }

    /* 노란색 강조 */
    100% {
        background-color: transparent;
    }
}

.highlight-flash {
    animation: highlightFlash 2s ease-out forwards;
}

@keyframes chatFlash {
    0% {
        transform: scale(1.05);
        /* 살짝 커짐 */
        box-shadow: 0 0 0 4px #facc15, 0 0 20px rgba(250, 204, 21, 0.8);
        /* 진한 노란 테두리 + 광원 */
        z-index: 10;
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 2px #facc15, 0 0 10px rgba(250, 204, 21, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 transparent, 0 0 0 transparent;
        z-index: 0;
    }
}

.chat-flash {
    animation: chatFlash 1.5s ease-out forwards;
    position: relative;
    /* z-index 적용을 위해 */
}

/* [확인] 내 메시지 정렬 수정 (보내주신 코드 반영됨) */
.chat-bubble-row.mine {
    justify-content: flex-end;
    /* 우측 정렬 */
    margin-left: auto;
    /* 왼쪽 여백 채움 */
}

.chat-bubble-row.mine .chat-content-area {
    align-items: flex-end;
    /* 내부 요소(말풍선, 리액션) 우측 정렬 */
}

/* -----------------------------------------
   [Chat UI]
   ----------------------------------------- */
.chat-room-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 500px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.chat-header-bar {
    background: var(--surface);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.chat-messages-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f1f5f9;
}

.chat-date-divider {
    text-align: center;
    margin: 15px 0;
    position: relative;
}

.chat-date-divider span {
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-sub);
}

.chat-bubble-row {
    display: flex;
    margin-bottom: 10px;
    max-width: 90%;
    position: relative;
}

.chat-bubble-row.mine {
    align-self: flex-end;
    justify-content: flex-end;
    margin-left: auto;
    /* 왼쪽 여백을 자동으로 채워서 오른쪽 끝으로 밈 */
}

.chat-bubble-row.mine .chat-content-area {
    align-items: flex-end;
    /* 이게 없어서 리액션이 왼쪽에 떴던 것임 */
}

.chat-bubble-row.other {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-profile-area {
    margin-right: 10px;
    flex-shrink: 0;
}

.chat-avatar,
.chat-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-avatar-placeholder {
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.chat-content-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chat-sender-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 600;
}

.chat-sender-info .flag-icon {
    width: auto;
    height: 14px;
    border-radius: 2px;
}

.chat-bubble-wrapper {
    position: relative !important;
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.chat-bubble-row.mine .chat-bubble-wrapper {
    flex-direction: row;
}

.chat-bubble-row.other .chat-bubble-wrapper {
    flex-direction: row;
}

.msg-info-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: fit-content;
    height: 100%;
    margin-bottom: 0;
}

.mine .msg-info-col {
    align-items: flex-end;
    text-align: right;
}

.other .msg-info-col {
    align-items: flex-start;
    text-align: left;
}

.unread-count {
    color: var(--primary) !important;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2px;
}

.chat-time {
    font-size: 0.65rem;
    color: #94a3b8;
    white-space: nowrap;
    line-height: 1;
}

.chat-bubble {
    padding: 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    will-change: transform;
    contain: content;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

.chat-bubble.mine {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-top-right-radius: 2px;
    box-shadow: 0 2px 4px rgba(26, 54, 93, 0.2);
}

.chat-bubble.other {
    background: #ffffff !important;
    color: var(--text-main) !important;
    border-top-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-bubble.hidden-msg {
    background: #f1f5f9 !important;
    color: #94a3b8 !important;
    font-style: italic;
    font-size: 0.85rem;
}

.chat-reaction-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.mine .chat-reaction-container {
    justify-content: flex-end;
}

.reaction-pill {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-input-bar {
    background: var(--surface);
    padding: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
}

#chat-msg-input {
    resize: none;
    outline: none;
    font-family: inherit;
    display: block;
    line-height: 1.5;
    overflow-y: auto;
}

.btn-send {
    background: var(--primary) !important;
    box-shadow: 0 2px 5px rgba(26, 54, 93, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50%;
    font-size: 1.1rem;
}

/* Reply Quote & Preview */
.reply-preview-bar {
    position: absolute !important;
    bottom: 100% !important; /* 입력창의 바로 위로 띄움 */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95) !important; /* 반투명 흰색 */
    backdrop-filter: blur(5px);
    padding: 12px 20px !important;
    border-top: 1px solid #e2e8f0 !important;
    border-left: 4px solid var(--primary) !important;
    z-index: 50;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05) !important;
}

.reply-preview-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    flex: 1;
    overflow: hidden;
    margin-right: 16px;
    min-width: 0;
}

.reply-preview-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.reply-preview-text {
    font-size: 0.85rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-close-reply {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-close-reply:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.reply-quote-box {
    margin: 0 0 10px 0;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid;
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    text-align: left !important;
    gap: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    max-width: 100%;
}

.other .reply-quote-box {
    background-color: #f8fafc;
    border-left-color: #cbd5e1;
    border: 1px solid #f1f5f9;
}

.mine .reply-quote-box {
    /* [핵심] 노란 배경 위에서도 잘 보이게 흰색 반투명 처리 */
    background-color: rgba(255, 255, 255, 0.6) !important;
    border-left-color: rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important; /* 아주 진한 남색/검정 */
}

.mine .reply-quote-box .reply-quote-name {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
}

.mine .reply-quote-box .reply-quote-text {
    color: rgba(255, 255, 255, 0.85);
}


/* [New] 리액션 사용자 보기 버튼 (작은 원형 아이콘) */
.reaction-user-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
    margin-left: 2px;
}

.reaction-user-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: scale(1.1);
}

/* [수정] 기존 리액션 알약 버튼 (호버 효과 강화) */
.reaction-pill:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

/* [New] 내가 누른 리액션 강조 */
.reaction-pill.my-reaction {
    border: 1px solid var(--primary) !important;
    background-color: #e0f2fe !important;
    /* 연한 파란색 배경 */
    color: var(--primary) !important;
    font-weight: 700;
}

/* [New] 탈퇴 문구 스타일 (연하게) */
.withdrawn-label {
    font-size: 0.75rem;
    color: #cbd5e1;
    /* 아주 연한 회색 */
    margin-left: 4px;
    font-weight: 400;
}

/* [New] 멘션 태그 스타일 (밑줄 제거, 뱃지화) */
.mentioned-badge {
    color: #3b82f6;
    /* 파란색 텍스트 */
    background-color: #eff6ff;
    /* 아주 연한 파란 배경 */
    font-weight: 700;
    /* 굵게 */
    font-size: 0.85rem;
    /* 글자 크기 약간 작게 */
    padding: 2px 6px;
    /* 안쪽 여백 */
    border-radius: 4px;
    /* 둥근 모서리 */
    margin-right: 6px;
    /* 본문과의 간격 */
    text-decoration: none !important;
    /* [핵심] 밑줄 강제 제거 */
    display: inline-block;
    /* 박스 형태 유지 */
    cursor: default;
    /* 커서 기본 (링크 느낌 제거) */
    vertical-align: middle;
    /* 텍스트 줄맞춤 */
}

/* 멘션 뒤에 오는 본문 텍스트 */
.comment-body {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.5;
    vertical-align: middle;
}

/* 프로필 통계 박스 스타일 */
.stat-box {
    flex: 1;
    min-width: 100px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1e293b;
}

/* =========================================================
   [New] 댓글 입력창 & 리스트 디자인 개선
   ========================================================= */

/* 입력창 영역 전체 컨테이너 */
.comment-write-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 내 프로필 뱃지 스타일 */
.my-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin-left: 2px;
}

/* 입력 필드와 버튼을 감싸는 행 */
.input-action-row {
    display: flex;
    align-items: flex-end;
    /* 버튼과 입력창 밑변 맞춤 */
    gap: 8px;
    width: 100%;
}

/* 자동 조절 텍스트박스 */
.auto-expand-textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    /* 약 5줄 높이 */
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    font-size: 0.95rem;
    line-height: 1.4;
    resize: none;
    /* 사용자 임의 조절 방지 */
    outline: none;
    overflow-y: hidden;
    /* 스크롤바 숨김 (JS로 높이 조절) */
    font-family: inherit;
}

.auto-expand-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 54, 93, 0.1);
}

/* 등록 버튼 스타일 */
.btn-comment-submit {
    width: 70px;
    height: 44px;
    /* 입력창 최소 높이와 동일 */
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.btn-comment-submit:hover {
    background: var(--primary-hover);
}

/* --- 댓글 목록 아이템 디자인 --- */

.comment-item-new {
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
}

.comment-header-new {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.comment-profile-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-meta-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.comment-author-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
    line-height: 1.2;
}

.comment-date-info {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
    display: flex;
    flex-wrap: wrap;
    /* 좁으면 줄바꿈 */
    gap: 6px;
}

/* 수정/삭제 버튼 그룹 (가로 배치) */
.comment-actions-row {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    /* 찌그러짐 방지 */
}

.action-text-btn {
    font-size: 0.8rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.action-text-btn:hover {
    color: #333;
    font-weight: 600;
}

.action-text-btn.delete:hover {
    color: #ef4444;
}

.comment-body-text {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: 8px;
    padding-left: 2px;
    /* 살짝 들여쓰기 */
}

/* 대댓글 들여쓰기 선 */
.reply-wrapper {
    margin-top: 10px;
    padding-left: 15px;
    border-left: 2px solid #e2e8f0;
}

/* Mentions & Menu */
.mention-suggestions {
    position: absolute;
    bottom: 100%;
    left: 10px;
    width: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 10px 0;
    z-index: 9999;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    margin-bottom: 10px;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.mention-item:hover {
    background-color: #f1f5f9;
}

.msg-context-menu {
    position: absolute;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 5px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    min-width: 120px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    animation: menuPop 0.2s;
}

.msg-context-btn {
    text-align: left;
    background: white;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 16px 20px;
    font-size: 1.05rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.msg-context-btn:active {
    background-color: #f1f5f9;
}

@keyframes menuPop {
    from {
        opacity: 0;
        transform: translate(-50%, -40%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/*pop-up*/
/* [New] Rust 제어형 상단 팝업 배너 */
.popup-notification-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 2147483647;
    /* 최상위 */
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    animation: slideDownFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 5px solid var(--primary);
}

.popup-notification-banner:active {
    transform: translateX(-50%) scale(0.98);
}

.popup-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.popup-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
}

.popup-body {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-close {
    padding: 5px;
    color: #94a3b8;
    cursor: pointer;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Chat List Header */
.chat-list-header {
    background: white;
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
}

.chat-list-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-list-header h2::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 400;
    color: var(--primary);
    font-size: 1.1rem;
}

.chat-list-header .btn {
    width: auto;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
    background-color: var(--primary) !important;
    color: white !important;
}

/* Chat List Items */
.chat-list-container {
    display: flex;
    flex-direction: column;
    gap: 0px;
    margin-top: 0;
    border-top: 1px solid #f1f5f9;
}

.chat-room-item {
    padding: 10px 20px;
    margin-bottom: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background: white;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: none !important;
    transition: background-color 0.2s;
    cursor: pointer;
}

.chat-room-item:hover {
    background-color: #f8fafc;
}

.chat-room-icon,
.chat-room-icon-img {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    flex-shrink: 0;
}

.chat-room-icon {
    background: #f1f5f9;
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.chat-room-icon-img {
    object-fit: cover;
    border: 1px solid #eee;
}

.chat-room-info {
    flex: 1;
    min-width: 0;
}

.chat-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-room-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-room-time {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 8px;
    flex-shrink: 0;
}

/* [수정됨] 대화 목록 마지막 메시지 (2줄 제한) */
.chat-room-last-msg {
    color: #64748b;
    font-size: 0.85rem;

    /* 2줄 이상 넘어가면 ... 처리 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* 보여줄 줄 수 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    /* 줄 간격 */
    max-height: 2.8em;
    /* line-height * 2줄 */
    white-space: normal;
    /* 줄바꿈 허용 */
    word-break: break-all;
    /* 긴 단어 자르기 */
}

.unread-badge {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    margin-left: auto;
}

.chat-list-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-right: 10px;
    gap: 8px;
    /* [수정] 우측 정렬 추가 */
    justify-content: flex-end;
    margin-bottom: 10px;
    /* 아래 목록과 간격 */
}

/* [New] 파일 드래그 앤 드롭 오버레이 */
.drag-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 3px dashed var(--primary);
    border-radius: var(--radius);
    pointer-events: none;
    /* 드롭 이벤트가 부모에게 전달되도록 */
    animation: fadeIn 0.2s;
}

.drag-drop-overlay i {
    font-size: 3rem;
    margin-bottom: 10px;
}

.drag-drop-overlay span {
    font-size: 1.2rem;
    font-weight: 700;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* [New] 드래그 중일 때 내부 요소 무시 (끊김 방지 핵심) */
.dragging-mode * {
    pointer-events: none !important;
}

/* [New] 이미지 그리드 (카톡 스타일 모아보기) */
.img-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2열 배치 */
    gap: 4px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 280px;
}

/* 이미지가 1개일 때는 꽉 차게 */
.img-grid-container.single {
    grid-template-columns: 1fr;
}

/* 이미지가 3개 이상일 때 첫 번째 이미지는 크게? (선택사항, 일단은 균등분할) */

.img-grid-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    /* 1:1 정사각형 비율 유지 */
    background: #f1f5f9;
    overflow: hidden;
    cursor: pointer;
}

.img-grid-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 꽉 차게 */
    transition: transform 0.2s;
}

.img-grid-item:hover img {
    transform: scale(1.05);
}

/* 4장 넘어가면 '더보기' 오버레이 표현용 (옵션) */
.more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* [New] 채팅방 파일 첨부 카드 스타일 */
.file-msg-card {
    background-color: white;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    /* 아이콘과 텍스트 상단 정렬 */
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;

    /* [핵심] 너비 고정 (카톡 스타일) */
    width: 240px;
    min-width: 240px;

    transition: background-color 0.1s;
    user-select: none;
}

/* 카드 자체 호버 효과는 유지하되 클릭은 안 됨 */
.file-msg-card:hover {
    background-color: #f8fafc;
}

.file-msg-card:active {
    transform: scale(0.98);
}

.file-icon-box {
    width: 42px;
    height: 42px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.file-info-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.file-name-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;

    /* [핵심] 줄바꿈 처리 */
    white-space: normal;
    /* 줄바꿈 허용 */
    word-break: break-all;
    /* 긴 영문/숫자 강제 줄바꿈 */
    line-height: 1.3;
    /* 줄 간격 조정 */
    max-height: 3.9em;
    /* 최대 3줄까지만 표시 (선택사항) */
    overflow: hidden;
}

/* [New] 파일 액션 버튼 그룹 */
.file-actions {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
}

.file-action-link {
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.file-action-link:hover {
    color: #1e293b;
    text-decoration: underline;
}

.file-meta-text {
    font-size: 0.75rem;
    color: #3b82f6;
    /* 파란색으로 링크 느낌 줌 */
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 열기는 파란색, 다운로드는 녹색 계열로 포인트 */
.action-open:hover {
    color: #3b82f6;
}

.action-save:hover {
    color: #166534;
}

/* [New] 이모지 피커 스타일 */
.emoji-picker-container {
    position: absolute;
    bottom: 60px;
    /* 입력창 바로 위 */
    left: 10px;
    width: 300px;
    height: 250px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
}

.emoji-grid {
    flex: 1;
    overflow-y: auto;
    /* 세로 스크롤 허용 */
    overflow-x: hidden;
    /* 가로 스크롤 강제 금지 (하단 바 제거) */
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    /* 한 줄에 6개 */
    padding: 10px;
    gap: 5px;

    /* [핵심] 파이어폭스, IE/Edge용 스크롤바 숨김 */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

/* [핵심] 크롬, 사파리, 오페라용 스크롤바 숨김 */
.emoji-grid::-webkit-scrollbar {
    display: none;
}

.emoji-btn {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    border-radius: 8px;
    transition: background 0.1s;
    user-select: none;
}

.emoji-btn:hover {
    background-color: #f1f5f9;
    transform: scale(1.1);
}

.emoji-header {
    padding: 10px 15px;
    border-bottom: 1px solid #f1f5f9;
    font-weight: bold;
    color: #64748b;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}


/* Drawer */
.chat-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2001;
}

.chat-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 2002;
    display: flex;
    flex-direction: column;
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.drawer-footer {
    padding: 15px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.drawer-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.role-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    font-weight: bold;
}

.role-owner {
    background: #FEE500;
    color: #000;
}

.role-staff {
    background: #dbeafe;
    color: #1e40af;
}

.profile-overlay-icon {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    border: 2px solid #fff;
    z-index: 1;
}

/* Notice Bar */
.chat-notice-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid #f1f2f6;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.chat-notice-bar.expanded {
    flex-direction: column;
    align-items: stretch;
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.notice-top-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    cursor: pointer;
}

.notice-icon-circle {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #fef08a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #854d0e;
    font-size: 0.9rem;
}

.notice-content {
    flex: 1;
    overflow: hidden;
    cursor: pointer;
}

.notice-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-all;
    width: 100%;
    line-height: 1.5;
    font-size: 0.95rem;
    color: #1e293b;
    max-height: 3.1em;
    font-weight: 600;
}

.notice-text.one-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.chat-notice-bar.expanded .notice-text {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
}

.notice-arrow-area {
    flex-shrink: 0;
    width: 24px;
    text-align: right;
    padding-top: 4px;
    color: #cbd5e1;
    cursor: pointer;
}

.notice-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 10px;
}

/* [Mode 1] Marquee (흐르는 공지) */
.marquee-container {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.marquee-content {
    display: inline-block;
    padding-left: 100%; /* 오른쪽 끝에서 시작 */
    animation: marquee 15s linear infinite;
    font-weight: 600;
    color: #1e293b;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* [Mode 2] Ticker (플립/롤링 공지) */
.ticker-container {
    flex: 1;
    height: 24px; /* 한 줄 높이 */
    overflow: hidden;
    position: relative;
}

.ticker-wrapper {
    display: flex;
    flex-direction: column;
    animation: ticker-slide 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ticker-item {
    height: 24px;
    line-height: 24px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 롤링 애니메이션 (라인 수에 따라 조정 필요 - 여기선 3줄 기준 예시) */
@keyframes ticker-slide {
    0%, 25% { transform: translateY(0); }
    33%, 58% { transform: translateY(-24px); }
    66%, 91% { transform: translateY(-48px); }
    100% { transform: translateY(0); }
}

.btn-notice-opt {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.1s;
    white-space: nowrap;
}

.btn-notice-opt:hover {
    background: #f8fafc;
    color: var(--text-main);
}

.btn-list-left {
    margin-right: auto;
}

.notice-floating-icon {
    position: absolute;
    top: 65px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: #fef08a;
    color: #854d0e;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    border: 2px solid white;
    transition: transform 0.2s;
}

.notice-floating-icon:hover {
    transform: scale(1.1);
}

/* =========================================================
   [New] 계층형(Tree) 댓글 디자인 (가독성 & 공간 최적화)
   ========================================================= */
.comment-group {
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
}

.comment-item.parent {
    padding: 0;
    margin-bottom: 10px;
    background: #fff;
    border: none;
    box-shadow: none;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.meta-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: 38px;
    margin-top: 2px;
}

.user-info .date {
    font-size: 0.75rem;
    color: #94a3b8;
}

.edited-text {
    font-size: 0.7rem;
    color: #cbd5e1;
}

.actions {
    display: flex;
    gap: 8px;
}

.actions span {
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
}

.actions span.delete {
    color: #ef4444;
}

.comment-text.small {
    font-size: 0.9rem;
}

.comment-footer {
    margin-left: 38px;
}

.reply-btn {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    padding: 4px 0;
}

.reply-toggle-area {
    margin-left: 38px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.toggle-btn {
    color: #3b82f6;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.1s;
}

.toggle-btn:hover {
    background: #eff6ff;
}

/* Tree Structure (L-line) */
.replies-container {
    margin-top: 5px;
}

.reply-item {
    position: relative;
    padding-left: 16px;
    margin-top: 12px;
    display: flex;
}

.reply-connector {
    position: absolute;
    left: 0;
    top: -12px;
    bottom: 50%;
    width: 12px;
    border-left: 2px solid #e2e8f0;
    border-bottom: 2px solid #e2e8f0;
    border-bottom-left-radius: 8px;
    margin-bottom: auto;
    height: 30px;
}

.reply-content {
    flex: 1;
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
}

.reply-content .meta-row,
.reply-content .comment-text,
.reply-content .comment-footer {
    margin-left: 34px;
}

.reply-content .user-pill img,
.reply-content .user-pill div {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.6rem !important;
}

.reply-content .user-pill span {
    font-size: 0.85rem !important;
}

/* Edit & Delete */
.edit-area {
    margin-left: 38px;
}

.edit-btns {
    text-align: right;
    margin-top: 5px;
}

.edit-mode-textarea {
    width: 100%;
    min-height: 40px;
    padding: 5px 8px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    font-size: 0.95rem;
    resize: none;
}

.deleted-msg {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 4px;
}

.deleted-msg-row {
    display: flex;
    align-items: center; /* 아이콘과 텍스트 수직 중앙 정렬 */
    gap: 8px;
    color: #94a3b8;
    font-size: 0.9rem;
}

.deleted-msg-row i {
    font-size: 0.9rem; /* 아이콘 크기 조정 */
}

.deleted-time {
    font-size: 0.7rem;
    color: #cbd5e1;
    margin-top: 4px;
    padding-left: 22px; /* 아이콘 너비만큼 들여쓰기 */
}

.deleted-msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #64748b;
}

.deleted-msg-body {
    padding-left: 22px; /* 아이콘 크기만큼 들여쓰기 */
    color: #475569;
    font-style: normal;
}

.deleted-msg-date {
    text-align: right;
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-top: 4px; /* 날짜와 본문 사이 간격 확보 */
}

.deleted-msg .date {
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-top: 2px;
}

/* Input */
.reply-input-wrapper {
    margin-top: 10px;
    margin-left: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.reply-connector-input {
    position: absolute;
    left: -16px;
    top: -10px;
    width: 16px;
    height: 30px;
    border-left: 2px solid #e2e8f0;
    border-bottom: 2px solid #e2e8f0;
    border-bottom-left-radius: 8px;
}

.reply-input-wrapper .input-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.reply-input-wrapper .placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    flex-shrink: 0;
}

.reply-input-wrapper input {
    flex: 1;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
}

.reply-input-wrapper input:focus {
    border-color: var(--primary);
}

/* [문제 1 해결] 채팅방 레이아웃: 화면 꽉 채우기 & 빈 공간 제거 */
body.chat-on .app-container {
    padding: 0 !important;
    /* 채팅방일 때 패딩 제거 */
    height: 100vh;
    /* 전체 높이 사용 */
    overflow: hidden;
    /* 스크롤 방지 */
}

.chat-room-layout {
    display: flex;
    flex-direction: column;
    /* 고정 높이 계산(calc) 대신 flex-grow 사용으로 빈 공간 제거 */
    height: 100%;
    background: #f1f5f9;
    border: none;
    border-radius: 0;
    position: relative;
}

.chat-messages-area {
    flex: 1;
    /* 남은 공간 모두 차지 */
    padding: 20px;
    padding-bottom: 80px;
    /* 입력창 가림 방지 */
    overflow-y: auto;
    background-color: #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* [문제 1 해결] 서랍 아이콘 정렬 */
.drawer-user-item {
    display: flex;
    align-items: center;
    /* justify-content: space-between; 제거 -> 좌측 정렬 */
    gap: 10px;
    /* 아이콘과 이름 사이 간격 */
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.drawer-username {
    margin-left: 0 !important;
    /* 기존 마진 제거 */
    flex: 1;
    font-weight: 500;
}

/* [문제 3 해결] 답장(인용) 디자인 - 카카오톡 스타일 */
.reply-quote-box {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    
    /* [수정] 배경을 연한 회색으로, 글씨를 진한 색으로 변경 */
    background-color: #f1f5f9 !important; 
    border-left: 4px solid #cbd5e1 !important;
    color: #334155 !important; /* 글씨가 보이도록 진한 색 지정 */
    
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: none !important;
    transition: opacity 0.2s;
}

/* [문제 4 해결] 입력창 높이 가변 처리 */
#chat-msg-input {
    min-height: 44px;
    max-height: 120px;
    /* 5줄 정도 */
    overflow-y: auto !important;
    /* 내용 넘치면 스크롤 */
    line-height: 1.4;
    resize: none;
}

/* [문제 6 해결] 알림 센터 디자인 & 위치 수정 */
.header-action-btn {
    position: relative;
    /* 뱃지 위치 기준 */
}

.notification-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    /* 오른쪽 끝 정렬 (화면 밖으로 안 나가게) */
    width: 320px;
    max-width: 90vw;
    /* 모바일 대응 */
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    /* 왼쪽으로 빠지는 문제 해결: right: 0 유지 */
}

/* 뱃지 디자인 개선 (밋밋함 해결) */
.header-action-btn .badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    /* 흰색 테두리로 구분감 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 채팅방일 때는 하단 네비게이션 공간(60px)을 제거하고 전체 높이 사용 */
#main-content.no-padding.full-height {
    height: 100vh !important;
    height: 100dvh !important;
    /* 모바일 브라우저 주소창 대응 */
    padding-bottom: 0 !important;
}
.clickable-list-item:hover { background-color: #f8fafc !important; }

/* [Restore] Reply Quote Box */
.reply-quote-box {
    margin-bottom: 6px;
    padding: 10px 12px;
    background: #334155; 
    border-radius: 8px; 
    border-left: 4px solid #94a3b8; 
    font-size: 0.85rem; 
    color: #f1f5f9; 
    display: flex; 
    flex-direction: column; 
    cursor: pointer; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.reply-quote-box:hover {
    background: #475569;
    opacity: 0.8;
}

.reply-quote-name {
    font-weight: 800;
    font-size: 0.75rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: inherit !important; /* 부모 박스 색상 따름 */
    opacity: 1 !important;
}

/* 내용 부분 스타일 */
.reply-quote-text {
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 200px;
    font-size: 0.85rem;
    color: inherit !important; /* 부모 박스 색상 따름 */
    opacity: 0.8;
}


/* =========================================================
   [New] Enhanced Notice Bar Styles (Vivid News Style)
   ========================================================= */

.chat-notice-bar {
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 0; /* Removing padding for full-bleed look similar to ticker */
    min-height: 48px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.notice-top-row {
    display: flex;
    align-items: center; /* Center vertically for ticker look */
    width: 100%;
    cursor: pointer;
    padding: 8px 12px; /* Inner padding */
    min-height: 48px;
}

.notice-icon-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3); /* Translucent white */
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.notice-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.notice-text {
    font-size: 0.95rem;
    font-weight: 600; /* Bold text for news feel */
    line-height: 1.4;
    width: 100%;
}

/* 2-Line Limit for Normal Mode */
.notice-text.two-lines {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-wrap;
}


.notice-arrow-area {
    width: 24px;
    display: flex;
    justify-content: center;
    color: inherit;
    opacity: 0.7;
    margin-left: 8px;
}

/* --- Vivid Colors (News Ticker Style) --- */

/* 1. Info: Vivid Yellow + Blue Text (Reference Image 2) */
.notice-bg-info {
    background-color: #FFEA00 !important; /* Vivid Yellow */
    color: #000000 !important; /* Contrast Black/Blue */
    border-left: 5px solid #FFAB00; /* Darker Yellow/Orange accent */
}
.notice-bg-info .notice-text {
    color: #013682; /* Deep Blue Text */
}
.notice-bg-info .notice-icon-circle {
    background: #FFAB00; /* Orange circle */
    color: white;
}

/* 2. Important: Vivid Orange + White Text */
.notice-bg-important {
    background-color: #FF6D00 !important;
    color: #FFFFFF !important;
    border-left: 5px solid #E65100;
}
.notice-bg-important .notice-text {
    color: white;
}

/* 3. Urgent: Vivid Red + White Text */
.notice-bg-urgent {
    background-color: #D50000 !important;
    color: #FFFFFF !important;
    border-left: 5px solid #8E0000;
}
.notice-bg-urgent .notice-text {
    color: white;
}


/* --- Expanded --- */
.chat-notice-bar.expanded {
    padding-bottom: 0;
}
.chat-notice-bar.expanded .notice-top-row {
    align-items: flex-start; /* Revert to top alignment when expanded */
    white-space: normal;
}

.notice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.05); /* Slightly darker bottom area */
    border-top: 1px solid rgba(0,0,0,0.1);
}

.btn-notice-opt {
    padding: 6px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 4px;
    border: none;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    color: #333;
    cursor: pointer;
}
.btn-notice-opt:hover {
    background: #f1f5f9;
}


/* --- Minimized --- */
.notice-floating-icon {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #FFEA00; /* Match Info default */
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    cursor: pointer;
    color: #013682;
    border: 2px solid white;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}


/* --- Chip Selectors (Premium UI) --- */
.notice-option-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    opacity: 0.7;
    background: #f1f5f9;
    color: #475569;
}
.notice-option-chip input {
    display: none; /* Hide default radio */
}
.notice-option-chip:hover {
    opacity: 1;
    background: #e2e8f0;
}
/* Selected State */
.notice-option-chip.selected {
    opacity: 1;
    border-color: #3b82f6; /* Blue border default */
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* Color Previews */
.notice-option-chip.chip-info.selected {
    border-color: #FFAB00;
    color: #d97706;
    background: #fff9db;
}
.notice-option-chip.chip-important.selected {
    border-color: #E65100;
    color: #c2410c;
    background: #fff4e6;
}
.notice-option-chip.chip-urgent.selected {
    border-color: #D50000;
    color: #b91c1c;
    background: #ffe3e3;
}
/* Mode Icons */
.notice-option-chip i {
    margin-right: 6px;
}


/* --- Auto Animation: Marquee (Robust Transform) --- */
.marquee-mode {
    display: flex;
    flex-direction: row; /* Force row layout */
    align-items: center;
    height: 48px;
    padding: 0 !important;
    overflow: hidden;
    position: relative;
    background: inherit; /* Ensure BG applies */
}

.marquee-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.marquee-content {
    white-space: nowrap;
    position: absolute;
    will-change: transform;
    /* Start from right (100% of container) to left (-100% of self) */
    /* We use a long duration for readability */
    animation: marquee-scroll 30s linear infinite;
    animation-delay: -10s; /* Start immediately visible */
    left: 100%; /* Start position: just outside right edge */
}

@keyframes marquee-scroll {
    0% {
        transform: translate3d(0, 0, 0); 
    }
    100% {
        /* Move left by (Container Width + Self Width) roughly */
        /* Since we start at Left:100% (container right edge) */
        /* We need to move until the Right Edge of CONTENT hits Left Edge of CONTAINER */
        /* That is, translateX(- (Container + Self) ) */
        /* To be safe and simple: translate until fully off screen left */
        left: 0; 
        transform: translate3d(-100%, 0, 0); 
    }
}
/* 
   Correction: The previous logic `left: 100% -> 0` + `translate 0 -> -100%` 
   moves the element from [Right Edge] to [Left Edge - ContentWidth].
   Start: Pos = ContainerWidth
   End: Pos = 0 - ContentWidth = -ContentWidth
   Total Distance = ContainerWidth + ContentWidth. 
   This perfectly spans the visible area. 
*/


/* --- Auto Animation: Ticker (Robust Cycle) --- */
.ticker-mode {
    display: flex;
    flex-direction: row; /* Force row layout */
    align-items: center;
    height: 48px;
    padding: 0 !important;
    overflow: hidden;
    position: relative;
}

.ticker-container {
    flex: 1;
    height: 48px;
    overflow: hidden;
    position: relative;
}

.ticker-wrapper {
    position: absolute;
    width: 100%;
    /* Cycle 5 steps */
    animation: ticker-scroll 15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ticker-item {
    height: 48px;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 4px;
    justify-content: center; /* Center align text */
}

@keyframes ticker-scroll {
    0%, 15% { transform: translate3d(0, 0, 0); }
    
    20%, 35% { transform: translate3d(0, -48px, 0); }
    
    40%, 55% { transform: translate3d(0, -96px, 0); }
    
    60%, 75% { transform: translate3d(0, -144px, 0); }
    
    80%, 95% { transform: translate3d(0, -192px, 0); }
    
    100% { transform: translate3d(0, -240px, 0); } 
}

/* --- Notice Controls Drawer --- */
.notice-controls-drawer {
    background: #f8fafc;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 8px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    animation: slideDown 0.2s ease-out;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   [New] Participant Modal (Slim & Compact)
   ========================================= */
.participant-modal .modal-header h3 {
    font-size: 1rem; /* 제목 크기 축소 */
    letter-spacing: -0.5px;
}

/* =========================================
   [New] Comment Section (Commercial Native Style)
   ========================================= */
.comment-section-wrapper {
    margin-top: 20px;
    background: transparent;
    padding-bottom: 10px; /* 기본 여백 */
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 15px 0 10px 5px;
    letter-spacing: -0.3px;
}

/* 개별 댓글 */
.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

/* 프로필 사진 */
.comment-avatar {
    flex-shrink: 0;
    padding-top: 2px; /* 텍스트 높이와 시각적 정렬 보정 */
}

/* 뱃지 (왕관) - 프로필 사진 우측 하단에 겹치게 배치 */
.avatar-badge-icon {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background: white; /* 뱃지 배경 흰색 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 2;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 12px; /* 약간 둥근 사각형 (iOS 스타일) */
    object-fit: cover;
    border: 1px solid #f1f5f9;
}

.default-avatar {
    width: 100%;
    height: 100%;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 0.8rem;
}

/* 말풍선 본문 */
.comment-content {
    flex: 1;
    min-width: 0; /* flex 자식 말줄임표 작동 필수 설정 */
    display: flex;
    flex-direction: column;
}

/* 헤더 (이름 + 시간) */
.comment-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    line-height: 1.3;
}

.writer-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.creator-badge {
    font-size: 0.7rem;
    color: #f59e0b; /* 작성자 강조색 (주황) */
    background: #fffbeb;
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid #fcd34d;
}

.comment-time {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 2px;
}

/* 본문 텍스트 */
.comment-text {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 4px;
}

/* 수정됨 표시 */
.edited-mark {
    font-size: 0.7rem;
    color: #cbd5e1;
    margin-left: 4px;
}

/* 액션 버튼 (답글달기 등) */
.comment-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s;
}

.action-btn:hover {
    color: #334155;
    text-decoration: underline;
}

.action-btn.delete {
    color: #ef4444; /* 삭제 버튼은 빨간색 */
}

.edit-box textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    font-size: 0.9rem;
    resize: none;
    min-height: 60px;
    margin-bottom: 5px;
    font-family: inherit;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

/* 대댓글 들여쓰기 */
.comment-item.is-reply {
    margin-left: 42px; /* 들여쓰기 조정 */
    margin-top: 10px;  /* [핵심] 음수(-8px) 제거하고 양수(10px)로 변경하여 간격 확보 */
    margin-bottom: 12px;
    padding-left: 10px; /* 시각적 구분감 추가 */
    border-left: 2px solid #f1f5f9; /* 왼쪽에 얇은 선을 넣어 계층 구분 */
}

.comment-item.is-reply .comment-avatar {
    width: 24px; /* 대댓글 프사 더 작게 */
    height: 24px;
}

/* 입력창 (답글) */
.reply-input-box {
    margin-top: 8px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
    background: #fff;
}

.reply-input-box textarea {
    width: 100%;
    border: none;
    resize: none;
    outline: none;
    font-size: 0.9rem;
    height: 50px;
    font-family: inherit;
}

.reply-input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
}

.btn-cancel, .btn-submit {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    font-weight: 600;
}

.btn-cancel { background: #f1f5f9; color: #64748b; }
.btn-submit { background: #1e293b; color: white; }

/* 2. 메인 입력창 영역 (공통) */
.main-comment-input {
    background-color: #ffffff;
    border-top: 1px solid #f1f5f9;
    padding: 12px 16px;
    z-index: 50;
    transition: all 0.3s ease;
}

/* 3. 입력창 내부 컨테이너 (텍스트박스 + 버튼) */
.input-container {
    display: flex;
    align-items: flex-end; /* 텍스트 많아지면 버튼은 아래에 고정 */
    gap: 10px;
    background: #f8fafc; /* 연한 회색 배경 */
    padding: 8px 12px;
    border-radius: 20px; /* 둥근 모서리 */
    border: 1px solid #e2e8f0;
    box-shadow: none; /* 그림자 제거 (플랫 디자인) */
}

.input-container:focus-within {
    background: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.input-container textarea {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    padding: 2px 0;
    margin: 0;
    min-height: 24px;
    max-height: 100px; /* 최대 5줄 정도까지만 늘어남 */
}

.input-container button {
    background: transparent;
    color: var(--primary); /* 기본 색상 */
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.input-container button:hover {
    background: #e0f2fe; /* 호버 시 연한 파랑 */
}

.input-container button:active {
    transform: scale(0.95);
}

.input-container button i {
    margin-left: -2px; /* 아이콘 시각적 중앙 정렬 보정 */
}

.empty-comments {
    text-align: center;
    padding: 30px 0;
    color: #cbd5e1;
}

.comment-lock-screen {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

/* [New] 하단 스크롤 버튼 영역 */
.scroll-down-area {
    position: absolute;
    bottom: 80px; /* 입력창(약 60px) 위 */
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    cursor: pointer;
    animation: slideUp 0.2s ease-out;
}

/* 둥근 화살표 버튼 */
.btn-scroll-down {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1rem;
    transition: all 0.2s;
}

.scroll-down-area:hover .btn-scroll-down {
    background: white;
    color: var(--primary);
    transform: translateY(2px);
}

/* 새 메시지 토스트 (말풍선 모양) */
.new-msg-toast {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    max-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    margin-bottom: 5px; /* 버튼과의 간격 */
    position: relative;
}

/* 말풍선 꼬리 (선택사항) */
.new-msg-toast::after {
    content: "";
    position: absolute;
    bottom: -6px;
    right: 14px;
    width: 10px;
    height: 10px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    transform: rotate(45deg);
}

.toast-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.toast-text {
    font-size: 0.85rem;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================
   [Skeleton UI Animation]
   ========================================= */
.skeleton {
    background-color: #e2e8f0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* 채팅방 로딩 스켈레톤 구조 */
.chat-skeleton-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    align-items: flex-start;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
}

.skeleton-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-name {
    width: 60px;
    height: 12px;
}

.skeleton-bubble {
    width: 150px;
    height: 36px;
    border-radius: 4px 14px 14px 14px;
}

/* [New] 파일 전송 모달 (KakaoTalk Style) */
.file-upload-modal-content {
    width: 360px;
    max-width: 90%;
    background: #fff;
    border-radius: 4px; /* 카톡은 모서리가 덜 둥금 */
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: zoomIn 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.fu-header {
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #1e1e1e;
    border-bottom: 1px solid #f1f1f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fu-body {
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    background: #f9f9fa;
}

.fu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #f1f1f1;
    gap: 12px;
}

.fu-thumb {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #eee;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* 파일 아이콘 래퍼 */
.fu-icon-wrap {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 1.5rem;
    color: #64748b;
}

.fu-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fu-name {
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fu-size {
    font-size: 0.75rem;
    color: #888;
}

.fu-delete-btn {
    color: #ccc;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}
.fu-delete-btn:hover { color: #ef4444; }

.fu-footer {
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #f1f1f1;
    display: flex;
    justify-content: flex-end; /* 카톡은 우측 정렬 */
    gap: 8px;
}

.btn-fu-send {
    background: #ffe500; /* 카톡 노란색 */
    color: #191919;
    border: none;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
}
.btn-fu-send:hover { background: #fadd00; }

.btn-fu-cancel {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* [New] 로딩 스피어 & 썸네일 (Optimistic UI) */
.media-loading-container {
    position: relative;
    width: 240px; /* 고정 너비 */
    height: 240px;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 흐릿한 배경 (로딩 중) */
.media-blur-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    filter: blur(4px);
    opacity: 0.6;
}

/* 로딩 스피어 (카톡 스타일 원형 로더) */
.loading-sphere {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.upload-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

/* [Style Update] 이미지 그리드 (카카오톡 스타일: 말풍선 없이, 좁은 간격) */
/* [Style Update] 이미지 그리드 (카카오톡 스타일: 30개 대응) */
.media-grid-wrapper {
    display: grid;
    gap: 2px;
    border-radius: 12px;
    overflow: hidden;
    width: 300px;
    background: transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.media-grid-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 정사각형 비율 */
    overflow: hidden;
    cursor: pointer;
    background: #e2e8f0;
}

.media-grid-item img, .media-grid-item video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.2s, filter 0.2s;
}

.media-grid-item:hover img {
    filter: brightness(0.9);
}

/* --- 그리드 레이아웃 패턴 --- */

/* 1장: 꽉 차게 */
.grid-1 { grid-template-columns: 1fr; }

/* 2장: 2열 */
.grid-2 { grid-template-columns: 1fr 1fr; }

/* 4장: 2x2 (카톡 특유의 깔끔한 사각형) */
.grid-4 { grid-template-columns: 1fr 1fr; }

/* 그 외(3장, 5~30장): 무조건 3열로 계속 나열 */
.grid-multi { 
    grid-template-columns: repeat(3, 1fr); 
}

/* +N 더보기 오버레이 (마지막 이미지 위에 표시) */
.more-count-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 500;
    z-index: 2;
    backdrop-filter: blur(2px);
}

/* 업로드 중인 미디어 컨테이너 */
.uploading-media-container {
    position: relative;
    display: inline-block;
    overflow: hidden;
    border-radius: 12px;
}

/* 이미지를 살짝 흐리게 & 어둡게 */
.uploading-media-container img,
.uploading-media-container video {
    display: block;
    opacity: 0.6;
    filter: blur(2px);
    transition: all 0.3s;
}

/* 로딩 스피너 오버레이 */
.upload-spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    z-index: 10;
}

/* 회전하는 스피너 */
.upload-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* =========================================
   [New] Media Viewer (Premium Dark UI)
   ========================================= */
.media-viewer-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92); /* 짙은 배경 */
    backdrop-filter: blur(5px);
    z-index: 25000; /* 최상위 */
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease-out;
}

/* 헤더 */
.mv-header {
    position: absolute;
    top: 0; left: 0; width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

.mv-counter {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.mv-actions {
    display: flex;
    gap: 15px;
}

.mv-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}
.mv-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* 메인 콘텐츠 영역 */
.mv-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
}

.mv-media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.mv-iframe {
    width: 80%;
    height: 80%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.mv-error {
    color: #94a3b8;
    font-size: 1.2rem;
    border: 1px solid #333;
    padding: 20px;
    border-radius: 8px;
}

/* 네비게이션 버튼 (화살표) */
.mv-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 5;
}
.mv-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}
.mv-nav-btn.prev { left: 20px; }
.mv-nav-btn.next { right: 20px; }
/* [New] 파일 미리보기 대체 UI (Dark Theme) */
.mv-file-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.mv-file-box i.fa-file-lines {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.mv-file-text {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.8);
}

.mv-file-download {
    background: #3b82f6;
    color: white;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.mv-file-download:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

/* 상단 헤더 아이콘 전용 스타일 */
.btn-icon-header {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b; /* 기본 회색 */
    font-size: 1.1rem;
    padding: 5px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 8px; /* 살짝 둥근 사각형 */
}

.btn-icon-header:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

/* 검색창 컨테이너 (슬라이드 다운 효과용) */
.search-bar-container {
    padding: 10px 15px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    animation: slideDown 0.2s ease-out;
}

.search-bar-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.9rem;
    outline: none;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .mv-iframe { width: 100%; height: auto; aspect-ratio: 16/9; }
    .mv-nav-btn { width: 40px; height: 40px; font-size: 1.2rem; }
    .mv-nav-btn.prev { left: 10px; }
    .mv-nav-btn.next { right: 10px; }
}


/* --- User Profile View Component --- */
.upv-container {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s;
}
.upv-container:active {
    opacity: 0.8;
}

.upv-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.upv-img {
    width: 100%;
    height: 100%;
    border-radius: 40%; /* 애플 스타일 라운드 */
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.05);
}

.upv-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 40%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* 원형 뱃지 (아이콘) */
.upv-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 2px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 5;
}
.upv-badge.admin { background: #3b82f6; }
.upv-badge.owner { background: #f59e0b; }
.upv-badge.staff { background: #ec4899; }

/* 텍스트 정보 */
.upv-info {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0; /* 말줄임표 작동용 */
}

.upv-flag {
    width: auto;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.upv-nickname {
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 텍스트 뱃지 (이름 옆) */
.upv-text-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    white-space: nowrap;
}
.upv-text-badge.admin { background: #3b82f6; }
.upv-text-badge.owner { background: #f59e0b; }
.upv-text-badge.staff { background: #ec4899; }

/* =========================================
   [New] 투표 상세 페이지 스타일
   ========================================= */
/* [문제 3 해결] PC 화면에서 투표 상세 화면 여백 및 정렬 수정 */
.vote-detail-view {
    max-width: 800px; /* 다른 탭과 동일한 너비 제한 */
    margin: 0 auto;   /* 중앙 정렬 */
    width: 100%;
    padding-bottom: 40px;
}

/* [문제 1 & 2 해결] 입력창 디자인 통일 (채팅방 & 댓글창 공통) */

/* 1. 공통 입력 바 컨테이너 (채팅방, 댓글창 모두 사용) */
.common-input-bar {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column; /* 툴바가 위에 오도록 */
    gap: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.input-text-area {
    display: flex;
    align-items: flex-end; /* 텍스트와 버튼 하단 정렬 */
    padding: 8px 10px 10px 10px;
    gap: 8px;
    background: white;
}
/* 4. 텍스트 에어리어 (뚱뚱하지 않게 슬림하게) */
.input-text-area textarea {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    min-height: 24px; /* 슬림한 높이 */
    max-height: 100px;
    padding: 4px 0;
    margin: 0;
}

.btn-send-unified {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary) !important; /* 노란색(#fee500) 제거 -> 파란색 */
    color: white !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 2px 5px rgba(26, 54, 93, 0.2);
}

.btn-send-unified:hover {
    background-color: var(--primary-hover) !important;
    transform: translateY(-1px);
}

.btn-send-unified:active {
    transform: scale(0.95);
}

.btn-send-unified i {
    margin-left: -2px; /* 아이콘 시각적 보정 */
    margin-top: 1px;
}

/* ── 승인 환영 오버레이 ────────────────────────── */
.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 30000;
    background: rgba(10, 10, 20, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease;
}

.welcome-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 56px 48px 48px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
    position: relative;
    overflow: hidden;
}

.welcome-shimmer {
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #818cf8, #a5b4fc, #818cf8, #6366f1);
    background-size: 200% auto;
    animation: shimmer 2.5s linear infinite;
    border-radius: 0 0 4px 4px;
}

.welcome-icon-wrap {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: #eef2ff;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 28px;
    animation: popIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.welcome-icon-wrap i {
    font-size: 2.4rem;
    color: #6366f1;
}

.welcome-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #6366f1;
    text-transform: uppercase;
    margin: 0 0 12px;
}

.welcome-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px;
    line-height: 1.25;
}

.welcome-divider {
    width: 40px; height: 2px;
    background: #6366f1;
    margin: 0 auto 20px;
}

.welcome-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 32px;
}

.welcome-hints {
    display: flex;
    gap: 10px;
    margin-bottom: 36px;
}

.welcome-hint-card {
    flex: 1;
    background: var(--bg);
    border-radius: 12px;
    padding: 16px 12px;
    border: 1px solid var(--border);
}

.welcome-hint-icon {
    font-size: 1.3rem;
    margin-bottom: 6px;
}

.welcome-hint-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.welcome-btn {
    width: 100%; height: 52px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.2s, transform 0.15s;
}

.welcome-btn:hover { background: #4f46e5; }
.welcome-btn:active { transform: scale(0.98); }

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

/* =========================================
   [New] PC 버전 입력창 스타일 (카톡 PC 스타일)
   ========================================= */
/* 모바일이 아닐 때만 적용 (768px 이상) */
@media (min-width: 769px) {

    .main-comment-input {
        /* 부모(.card)의 패딩을 무시하고 꽉 채우기 위한 Negative Margin */
        margin-left: -1.5rem; 
        margin-right: -1.5rem;
        margin-bottom: -1.5rem; /* 카드 하단 패딩 상쇄 */
        
        /* 카드 하단 둥글기 상속 */
        border-bottom-left-radius: var(--radius);
        border-bottom-right-radius: var(--radius);
        
        position: sticky; /* 내용이 길면 하단에 붙음 */
        bottom: 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.02); /* 위쪽으로 살짝 그림자 */
    }
    .chat-input-bar {
        background: white !important;
        border-top: 1px solid #e2e8f0;
        padding: 0 !important;
        height: 160px; /* 넉넉한 높이 */
        position: relative;
        
        /* [핵심] Grid Layout으로 상단 텍스트, 하단 툴바 배치 */
        display: grid !important;
        grid-template-rows: 1fr auto; /* 상단 가변, 하단 고정 */
        grid-template-columns: 1fr auto;
        grid-template-areas: 
            "text text"
            "tools send";
    }

    /* 툴바 (이모지, 파일첨부 등) */
    .input-toolbar {
        grid-area: tools;
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 10px 20px;
    }
    
    .input-toolbar button {
        color: #94a3b8;
        font-size: 1.2rem;
        cursor: pointer;
        background: none;
        border: none;
        transition: color 0.2s;
        padding: 0;
    }
    .input-toolbar button:hover { color: #334155; }

    /* PC에서는 테두리 없애고 꽉 채우기 */
    #chat-msg-input {
        grid-area: text;
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        background: transparent !important;
        padding: 15px 20px !important;
        font-size: 0.95rem;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    /* 전송 버튼 영역 */
    .input-footer {
        grid-area: send;
        display: flex;
        align-items: center;
        padding: 10px 20px;
    }

    .btn-send {
        border-radius: 4px !important;
        width: 60px !important;
        height: 30px !important;
        font-size: 0.85rem !important;
        font-weight: 600;
        background: #fee500 !important; /* 카톡 노란색 */
        color: #191919 !important;
        box-shadow: none !important;
        border: 1px solid #e2e2e2 !important;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .btn-send i { display: none; } /* 아이콘 숨김 */
    .btn-send::after { content: "전송"; } /* 텍스트 표시 */
    .btn-send:hover { background-color: #fadd00 !important; }
}



/* Mobile Only */
@media (max-width: 768px) {

    /* 헤더 패딩 축소 */
    header {
        padding: 0.6rem 10px !important;
    }

    /* 로고 폰트 및 간격 축소 */
    .logo-area {
        font-size: 1.15rem !important;
        gap: 0.3rem !important;
    }

    /* 우측 아이콘 그룹 간격 축소 */
    .header-right {
        gap: 2px !important;
    }

    /* 아이콘 버튼 크기 축소 */
    .header-action-btn {
        width: 30px !important;
        height: 30px !important;
    }
    .header-action-btn i {
        font-size: 1.0rem !important;
    }

    /* 유저 프로필 알약 축소 */
    .user-pill {
        padding: 0.25rem 0.5rem !important; /* 패딩을 줄여서 컴팩트하게 */
        margin-left: 2px !important;
        gap: 6px !important;         /* 아이콘 간 간격 조정 */
        border-radius: 20px !important;
    }

    .user-pill .user-name {
        display: none !important;
    }
    .nav-profile-img {
        width: 24px !important;
        height: 24px !important;
        margin-right: 0 !important; /* 닉네임이 없으니 여백 제거 */
    }

    .header-action-btn,
    .noti-btn-wrapper .btn-icon {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* 아이콘 크기도 일괄 조정 */
    .header-action-btn i,
    .noti-btn-wrapper .btn-icon i {
        font-size: 1.0rem !important; 
        color: var(--text-main) !important; /* 색상 강제 통일 */
    }

    .user-pill > div {
        margin-right: 0 !important;
    }

    .header-right .header-action-btn {
        color: var(--text-main) !important; /* 기본 텍스트 색상(진한 남색/검정) 따르기 */
    }

    /* 2. 종 아이콘만 크기 미세 조정 (너무 커 보이지 않게) */
    /* fa-bell 클래스를 가진 아이콘(i태그)을 특정해서 사이즈를 줄입니다. */
    .header-right .fa-bell {
        font-size: 0.95rem !important; /* 다른 아이콘(1.0rem)보다 아주 약간 작게 설정 */
    }

    /* 국기 크기 */
    .nav-flag {
        width: 18px !important;
        height: auto !important;
    }
    #main-content {
        padding: 0 15px;
        padding-bottom: 0;
        display: block;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        height: 100%;
        /* [추가] 스크롤바 보이지 않게 설정 (표준 및 IE) */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    /* [추가] Chrome, Safari에서 스크롤바 숨기기 */
    #main-content::-webkit-scrollbar {
        display: none;
    }

    .app-container {
        padding: 0;
        max-width: 100%;
        height: 100vh;
        overflow: hidden;
    }

    #main-content.no-padding {
        padding-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px);
        overflow: hidden;
    }

    /* [추가] 패딩이 제거된 상태에서 내부 카드를 화면에 꽉 채우기 */
    #main-content.no-padding .card {
        flex: 1;
        display: flex;
        flex-direction: column;
        margin-bottom: 0 !important;
        min-height: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        padding-bottom: 80px !important;
        border-radius: 0;
        width: 100%;
        border-left: none;
        border-right: none;
        overflow-y: auto;
        /* [추가] 카드 내부 스크롤바 숨김 */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    /* [추가] Chrome, Safari용 카드 내부 스크롤바 숨김 */
    #main-content.no-padding .card::-webkit-scrollbar {
        display: none;
    }

    #main-content.no-padding .card .btn-primary {
        margin-top: auto;
        /* 버튼을 레이아웃 최하단으로 밀어냄 */
        margin-bottom: 20px;
        /* 탭바와의 간격 유지 */
    }

    /* Comment Tree Optimization */
    .meta-row,
    .comment-text,
    .comment-footer,
    .reply-toggle-area,
    .edit-area {
        margin-left: 0 !important;
        margin-top: 6px;
    }

    .comment-header .user-info {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .comment-header .meta-row {
        margin-left: 0;
        margin-top: 0;
    }

    .reply-content .meta-row,
    .reply-content .comment-text,
    .reply-content .comment-footer {
        margin-left: 0 !important;
    }

    .reply-item {
        padding-left: 12px;
    }

    .reply-connector {
        width: 10px;
        left: 0;
    }

    .reply-input-wrapper .input-avatar {
        display: none;
    }

    .reply-connector-input {
        left: -12px;
        width: 12px;
    }

    .reply-input-wrapper {
        margin-left: 12px;
    }

    /* Chat & Nav */
    body.chat-on header {
        display: none !important;
    }

    body.chat-on .nav-tabs {
        display: none !important;
    }

    body.chat-on #main-content {
        padding: 0 !important;
        height: 100dvh !important;
        overflow: hidden !important;
    }

    body.chat-on .chat-room-layout {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100dvh !important;
        z-index: 9999 !important;
        border: none;
        border-radius: 0;
    }

    body.chat-on .chat-input-bar {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        padding-bottom: env(safe-area-inset-bottom);
        z-index: 10000;
    }

    body.chat-on .chat-messages-area {
        padding-bottom: calc(70px + env(safe-area-inset-bottom)) !important;
    }

    .nav-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        margin-bottom: 0;
        border-radius: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }

    .nav-tabs.hide-on-keyboard {
        display: none !important;
    }

    .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;        /* 전체 높이 사용 */
        max-height: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;    /* 둥근 모서리 제거 (꽉 차게) */
        position: fixed !important;     /* 고정 위치 */
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        display: flex;
        flex-direction: column;
        animation: slideUp 0.3s ease-out; /* 아래에서 위로 올라오는 효과 */
        overflow-y: auto;               /* 내부 스크롤 허용 */
        border: none !important;        /* 테두리 제거 */
        padding: 20px !important;       /* 내부 여백 */
    }

    .modal-card .close-btn { 
        /* 닫기 버튼 클래스가 있다면 */
        position: absolute;
        top: 15px;
        right: 15px;
        font-size: 1.5rem;
        z-index: 10;
    }

    .modal-card .setting-container {
        flex-direction: column !important;
    }

    /* 2. 사이드바(탭 메뉴)를 상단 가로 스크롤 탭으로 변경 */
    .modal-card .setting-sidebar {
        width: 100% !important;
        height: auto !important;
        border-right: none !important;
        border-bottom: 1px solid #eee;
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap;
        padding: 0 !important;
        background: white !important; /* 배경 흰색으로 */
        flex-shrink: 0; /* 크기 고정 */
    }

    /* 3. 탭 아이템 스타일 변경 (가로형) */
    .setting-tab-item {
        flex: 1; /* 균등 분할 */
        text-align: center;
        padding: 12px 5px !important;
        border-left: none !important; /* PC용 왼쪽 보더 제거 */
        border-bottom: 3px solid transparent; /* 아래쪽 보더 추가 */
        font-size: 0.9rem;
    }

    /* 활성 탭 스타일 (아래쪽 파란 줄) */
    .setting-tab-item.active {
        background-color: transparent !important;
        border-bottom-color: var(--primary) !important;
        color: var(--primary) !important;
    }

    /* 4. 내용 영역 패딩 조정 */
    .modal-card .setting-content {
        padding: 20px 15px !important; /* 좌우 패딩 줄임 */
        overflow-y: auto;
    }

    /* 5. 설정 항목들 간격 및 폰트 조정 */
    .setting-row {
        padding: 12px 0 !important; /* 상하 간격 축소 */
    }
    .setting-title {
        font-size: 0.95rem !important;
    }
    .setting-desc {
        font-size: 0.8rem !important;
        margin-top: 2px;
    }
    
    /* 모바일에서 토글 스위치 위치 확보 */
    .setting-row {
        gap: 10px; /* 텍스트와 스위치 사이 간격 */
    }

    /* [Mobile] 윈도우 강제 전체화면 (Rust 인라인 스타일 덮어쓰기) */
    .floating-window {
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        display: flex;
        flex-direction: column;
    }
    
    .window-header {
        display: none !important; 
    }

    .chat-room-layout {
        height: 100%;
        border-radius: 0;
        border: none;
    }
    .chat-messages-area {
        padding: 15px 20px !important; /* 좌우 여백 20px로 넉넉하게 */
        padding-bottom: 80px !important; /* 입력창 공간 확보 */
        width: 100%;
        overflow-x: hidden; /* 가로 스크롤 방지 */
    }

    .chat-bubble-row {
        max-width: 85%; /* 90% -> 85%로 줄여서 여백 확보 */
    }

    /* (5) 모바일용 채팅 헤더 (뒤로가기 버튼 있는 그곳) */
    .chat-header-bar {
        padding: 12px 15px;
        background: #fff;
        border-bottom: 1px solid #f1f5f9;
        display: flex !important; /* 강제 표시 */
        align-items: center;
        height: 56px; /* 네이티브 앱 표준 높이 */
    }

    /* 뒤로가기 버튼 터치 영역 확대 */
    .btn-back-mobile {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        margin-right: 5px;
        cursor: pointer;
    }
    /* 모바일에서는 창 헤더의 드래그/최소화 기능 숨김 (닫기만 남김) */
    .floating-window > div:first-child button:first-child {
        display: none !important; /* 최소화 버튼 숨김 */
    }
    .chat-input-bar {
        background: white;
        padding: 8px 10px;
        border-top: 1px solid #f1f5f9;
        display: flex;
        align-items: flex-end; 
        gap: 8px;
        /* min-height 제거 또는 줄임 */
        min-height: auto; 
    }

    /* 툴바 (파일, 이모지) */
    .input-toolbar {
        display: flex;
        gap: 12px;
        padding-bottom: 10px; /* 아이콘 위치 미세 조정 */
        padding-left: 5px;
    }

    .input-toolbar button {
        background: none;
        border: none;
		cursor: pointer;
        font-size: 1.4rem;
        color: #64748b;
        padding: 0;
    }
    .input-toolbar button:active { color: #64748b; }

    /* 입력창 (자동 높이 조절용) */
    #chat-msg-input {
        flex: 1;
        background: #f1f5f9 !important;
        border: 1px solid transparent !important;
        border-radius: 18px !important; /* 조금 더 둥글게 */
        
        /* [핵심] 높이 및 패딩 최적화 (1줄에 딱 맞게) */
        padding: 8px 12px !important; 
        min-height: 36px !important; /* 40px -> 36px로 축소 */
        max-height: 100px; 
        
        font-size: 0.95rem; /* 폰트 살짝 줄임 */
        line-height: 1.4;   /* 줄 간격 타이트하게 */
    }

    #chat-msg-input:focus {
        background: #fff !important;
        border-color: #cbd5e1 !important;
    }

    .input-footer {
        padding-bottom: 4px; /* 높이 보정 */
    }

    .btn-send {
        width: 36px !important; /* 40px -> 36px */
        height: 36px !important;
        border-radius: 50% !important;
        background: #fee500 !important;
        color: #191919 !important;
        font-size: 1.0rem !important;
        box-shadow: none !important;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .btn-send::after { content: ""; }
    .btn-send i { display: block; margin-left: -1px; margin-top: 1px; }

    /* 입력창에 가려지지 않도록 컨텐츠 하단 여백 추가 */
    .comment-section-wrapper {
        padding-bottom: 80px !important; 
    }

    .main-comment-input {
        position: fixed; /* 화면 고정 */
        bottom: 0;
        left: 0;
        width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        padding-bottom: calc(12px + env(safe-area-inset-bottom)); /* 아이폰 하단 바 대응 */
        z-index: 1000; /* 탭바보다 위에 오도록 */
    }

    /* 모바일에서는 입력창 좌우 여백을 조금 더 줌 */
    .input-container {
        border-radius: 24px;
        padding: 10px 15px;
    }
    
    /* 모바일 전송 버튼 강조 */
    .input-container button {
        background: var(--primary);
        color: white;
        width: 36px;
        height: 36px;
        font-size: 1rem;
        margin-right: -4px;
    }
    
    .input-container button:hover {
        background: var(--primary-hover);
    }

}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .nav-tabs {
        height: calc(60px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
    }

    #main-content {
        padding-bottom: calc(0px + env(safe-area-inset-bottom));
    }
}
