@font-face {
    font-family: 'Twemoji';
    src: url('https://cdn.jsdelivr.net/gh/jdecked/twemoji-amazed@latest/fonts/Twemoji-Mozilla.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 2. 채팅 영역 전체에 폰트 스택 적용 */
.content, .msg-body, #message-input, #pinned-content, .nick-row, #my-nick, .user-item {
    /* Twemoji를 가장 앞에 두어도 됩니다. 
       어차피 이 폰트에는 숫자/한글이 없어서 브라우저가 자동으로 다음 폰트(Pretendard)로 넘어갑니다. */
    font-family: 'Twemoji', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif !important;
    
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* --- [1. 다크모드 대응을 위한 변수 정의] --- */
:root {
    --bg-main: #f8f9fa;
    --bg-chat: #ffffff;
    --text-main: #333333;
    --text-muted: #888888;
    --text-ip: #aaaaaa;
    --border-color: #dddddd;
    --border-light: #eeeeee;
    --bg-msg-me: rgba(0, 123, 255, 0.05);
    --bg-sys: #f8f9fa;
    --bg-popup: #ffffff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

body.dark-mode {
    --bg-main: #000000;
    --bg-chat: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #bbbbbb;
    --text-ip: #777777;
    --border-color: #333333;
    --border-light: #2d2d2d;
    --bg-msg-me: rgba(0, 123, 255, 0.15);
    --bg-sys: #2d2d2d;
    --bg-popup: #252525;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* --- [2. 사용자 초정밀 베이스 코드 시작 (원본 유지)] --- */
* { box-sizing: border-box; }

/* 💡 [수정] 앱 전용 헤더와 채팅창 배치를 위해 body 레이아웃을 유연하게 설정 */
html, body {
    height: 100% !important;
    width: 100% !important;
    margin: 0;
    padding: 0;
    overflow: hidden; 
    background-color: var(--bg-main);
}

body { 
    font-family: 'Pretendard', sans-serif; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

/* 💡 [수정] 헤더는 기본적으로 숨김 처리 (웹 접속 시 안 보임) */
#app-header {
    display: none; 
    width: 100%;
    height: 60px;
    flex-shrink: 0;
    background: var(--bg-chat);
    border-bottom: 1px solid var(--border-color);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* 💡 [핵심 추가] body에 .is-app 클래스가 붙었을 때만 헤더를 노출함 */
body.is-app #app-header {
    display: flex;
}

#ad-area {
    flex: 1;
    height: 50px;
    background: var(--bg-sys);
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}


.header-content {
    width: 100%;
    max-width: 700px;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-logo {
    font-weight: 800;
    font-size: 16px;
    color: var(--text-main);
}

#blog-move-btn {
    background-color: #007bff;
    color: white !important;
    border: none;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}

#blog-move-btn:hover { background-color: #0056b3; }

#chat-container { 
    width: 100%; 
    max-width: 700px; 
    
    /* 💡 [수정] 헤더가 있을 때와 없을 때를 모두 고려해 유연하게 남는 공간 차지 */
    flex: 1; 
    max-height: 700px !important; 
    
    background: var(--bg-chat); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    display: flex !important; 
    flex-direction: column !important; 
    overflow: hidden; 
    position: relative; 
    box-shadow: var(--shadow); 
}

#message-box { 
    flex: 1; 
    padding: 5px; 
    padding-bottom: 10px;
    overflow-y: auto; 
    display: block; 
    background: var(--bg-chat); 
    overflow-x: hidden; 
}

#image-preview-container {
    position: fixed;
    display: none;
    z-index: 10000;
    width: 150px;
    height: 230px;
    background-color: #000;
    border: 1px solid #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
    overflow: hidden;
}
#image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.image-link {
    color: #28a745 !important;
}

#status-bar { 
    height: 50px; 
    max-height: 50px;
    padding: 0 10px; 
    background: var(--bg-chat); 
    border-bottom: 1px solid var(--border-light); 
    font-size: 13px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    z-index: 10; 
    overflow: visible !important; 
    flex-wrap: nowrap; 
}

#my-info-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.2s;
    flex: 0 1 auto; 
    min-width: 0; 
    margin-right: auto;
}
#my-info-wrapper:hover { background: rgba(0,0,0,0.05); }
body.dark-mode #my-info-wrapper:hover { background: rgba(255,255,255,0.05); }

.nick-edit-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

#my-nick { 
    font-weight: bold; 
    font-size: 14px; 
    color: var(--text-main); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 80px; 
    display: inline-block;
}

#edit-pencil {
    font-size: 11px;
    opacity: 0.6;
}

#my-ip {
    font-size: 9px;
    color: var(--text-ip);
    margin-top: -2px;
    white-space: nowrap;
}

.top-btn { 
    font-size: 11px; 
    padding: 4px 8px; 
    cursor: pointer; 
    border: 1px solid var(--border-color); 
    border-radius: 4px; 
    background: var(--bg-chat); 
    color: var(--text-muted); 
    white-space: nowrap; 
    transition: 0.2s; 
}

.top-btn, #user-count-badge {
    flex-shrink: 0; 
    padding: 4px 6px;
    font-size: 11px;
}
.top-btn:hover { background: var(--bg-sys); }

#admin-menu-btn { background-color: #6610f2; color: white; border: none; display: none; }
#admin-menu-btn:hover { background-color: #520dc2; }

#admin-btn { border-color: #ff7875; color: #ff4d4f; margin-left: auto; }
body.is-admin #admin-btn { background-color: #ff4d4f; color: white; border-color: #ff4d4f; }

#user-count-badge { 
    background: #52c41a; 
    color: white; 
    padding: 3px 8px; 
    border-radius: 12px; 
    font-size: 11px; 
    font-weight: bold;
    cursor: pointer; 
    margin-left: 5px; 
    flex-shrink: 0; 
    white-space: nowrap; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-popup {
    position: absolute;
    top: 45px;
    right: 85px; 
    left: auto;
    background: var(--bg-popup);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 2500;
    padding: 8px;
    min-width: 160px;
    flex-direction: column;
}

#emoji-picker { 
    position: absolute; /* 💡 레이아웃 흐름에서 제외 */
    bottom: 70px; 
    right: 10px; 
    /*width: 300px; */
    height: 200px; 
    background: var(--bg-popup); 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    overflow-y: auto; 
    display: none; 
    grid-template-columns: repeat(5, 1fr); 
    gap: 5px; 
    padding: 5px; 
    z-index: 2000; 
    box-shadow: var(--shadow); 
    overflow-x: hidden;  /* 👈 가로 스크롤바를 강제로 숨김 */
}
.onion-icon { 
    width: 50px !important; 
    height: 50px !important; 
    max-width: 50px !important; 
    min-width: 50px !important;
    object-fit: contain !important;
    cursor: pointer; 
    transition: transform 0.1s;  
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
}


#pinned-area { 
    background: #f0f7ff; 
    border-bottom: 1px solid #bae7ff; 
    font-size: 13px; 
    display: none; 
    align-items: flex-start; 
    min-height: 35px; 
    height: auto; 
    max-height: none; 
    overflow: visible; 
    padding: 5px;
}
body.dark-mode #pinned-area { background: #1a2733; border-color: #1a3c5e; }

#pinned-meta { 
    display: flex; 
    flex-direction: column; 
    min-width: 60px; 
    font-size: 11px; 
    color: var(--text-muted); 
    align-items: center;
} 
#pinned-sender { font-weight: bold; color: #0050b3; }
body.dark-mode #pinned-sender { color: #69b1ff; }

#pinned-content { 
    flex: 1; 
    color: var(--text-main); 
    font-size: 13px; 
    margin-left: 5px; 
    white-space: normal; 
    word-break: break-all; 
    line-height: 1.1; 
    display: block;
}

#pinned-content div, 
#pinned-content p {
    display: inline !important; 
    margin: 0;
    padding: 0;
}

#pinned-content a {
    display: inline;
    color: #007bff;
    text-decoration: underline;
    word-wrap: break-word;
}

#pinned-content img {  vertical-align: middle; border-radius: 4px; }

#message-box::-webkit-scrollbar, #user-items-container::-webkit-scrollbar { width: 6px; }
#message-box::-webkit-scrollbar-thumb, #user-items-container::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px; }
#message-box::-webkit-scrollbar-track, #user-items-container::-webkit-scrollbar-track { background-color: var(--bg-sys); }

.msg-line { 
    display: block; 
    width: 100%; 
    padding: 2px; 
    line-height: 1.4;
    word-break: break-all;
    position: relative;
    padding-left: 10px; 
    text-indent: -5px; 
}
.msg-body { line-height: 1.3; display: inline; }
.msg-line.me { background-color: var(--bg-msg-me); }
.msg-line.whisper { 
    background-color: #fff0f6; 
    border: 1px dashed #ffadd2; 
    border-radius: 8px; 
} 
body.dark-mode .msg-line.whisper { background-color: #3d1024; border-color: #782046; }

.time-box { 
    display: inline-flex; 
    flex-direction: column; 
    align-items: center;
    justify-content: center; 
    font-size: 9px; 
    color: var(--text-ip); 
    line-height: 1.1; 
    text-align: center;
    vertical-align: middle;
}

.selection-breaker {
    display: inline;
    -webkit-user-select: none; 
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    width: 0;
    overflow: hidden;
}

.nick-row { 
    display: inline; 
    isolation: isolate; 
    font-weight: bold; 
    font-size: 16px; 
    cursor: pointer; 
    vertical-align: middle;
    padding-right: 5px;
    -webkit-touch-callout: none;
}
.nick-row::after {
    content: "";
    display: inline-block;
    width: 0;
    -webkit-user-select: none;
    user-select: none;
}

.content { 
    display: inline; 
    font-size: 16px; 
    color: var(--text-main); 
    word-break: break-all; 
    vertical-align: middle;
    -webkit-user-select: text; 
    user-select: text;
}

.content img { 
    max-width: 80px; 
    border-radius: 4px; 
    display: inline-block; 
    vertical-align: middle; 
    margin-left: 5px;        
    margin-top: 0;           
}

#message-input img {
    width: 50px;
    height: auto;
    vertical-align: middle;
    margin: 2px;
}

#message-input.frozen { 
    background-color: #ececec !important; 
    color: #888; 
    cursor: not-allowed; 
    font-style: italic; 
}
body.dark-mode #message-input.frozen { background-color: #333 !important; }

.sys-msg { 
    text-align: center; color: var(--text-muted); font-size: 12px; margin: 8px 0; 
    background: var(--bg-sys); padding: 6px 15px; border-radius: 20px; 
    display: block; width: fit-content; margin-left: auto; margin-right: auto; 
}

#nick-popup, #user-list-popup, #main-admin-popup { 
    position: absolute; 
    background: var(--bg-popup); 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    box-shadow: var(--shadow); 
    display: none; 
    z-index: 2500; 
    padding: 0; 
    flex-direction: column; 
    min-width: 160px; 
    overflow: hidden; 
    max-width: 200px;
}
#main-admin-popup {
    min-width: 200px; 
    max-height: 450px; 
    overflow-y: auto; 
}

#user-items-container { max-height: 250px; overflow-y: auto; background: var(--bg-popup); }

.popup-btn { 
    font-size: 13px; 
    padding: 10px; 
    border: none; 
    background: var(--bg-popup); 
    cursor: pointer; 
    text-align: left; 
    border-bottom: 1px solid var(--border-light); 
    transition: 0.1s; 
    color: var(--text-main);
}
.popup-btn:last-child { border-bottom: none; }
.popup-btn:hover { background: var(--bg-sys); }

.user-item { padding: 10px 15px; border-bottom: 1px solid var(--border-light); cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; }
.user-item:hover { background-color: var(--bg-msg-me); }

#input-wrapper { 
    background: var(--bg-chat); 
    border-top: 1px solid var(--border-light); 
    z-index: 10; 
    position: relative; 
    padding-bottom: 5px; 
}

#whisper-indicator { 
    background: #fff0f6; 
    color: #c41d7f; 
    font-size: 12px; 
    padding: 6px 12px; 
    display: none; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #ffd6e7; 
    font-weight: bold;
}
body.dark-mode #whisper-indicator { background: #3d1024; color: #ff85c0; border-color: #782046; }

#input-area {
    position: relative; 
    display: flex;
    align-items: center; 
    background: var(--bg-sys);
    border-top: 1px solid var(--border-light);
    gap: 2px; 
}

#message-input {
    flex: 1;
    min-height: 20px; 
    max-height: 80px; 
    padding: 5px; 
    line-height: 1.4; 
    font-size: 14px; 
    background: var(--bg-chat);
    border: 1px solid var(--border-color);
    color: var(--text-main); 
    overflow-y: auto; 
    outline: none;
    word-break: break-all;
	
}
#message-input:focus { border-color: #007bff; }

#send-btn { 
    background: #007bff; 
    color: white; 
    border: none; 
    padding: 0 15px; 
    border-radius: 20px; 
    cursor: pointer; 
    font-weight: bold; 
    height: 40px; 
    font-size: 13px; 
    transition: 0.2s; 
}
#send-btn:hover { background: #0056b3; }

.settings-wrapper {
    position: relative; 
    display: inline-block;
}

#user-settings-popup {
    position: absolute;
    top: 38px; 
    right: 0; 
    left: auto; 
    display: none;
    z-index: 2500;
    background: var(--bg-popup);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 5px;
    min-width: 170px;
    flex-direction: column;
}

.icon-btn { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 22px; 
    cursor: pointer; 
    padding: 0 5px; 
    height: 43px; 
    color: var(--text-muted); 
    background: none; 
    border: none; 
    transition: transform 0.1s;
    flex-shrink: 0;
}
.icon-btn:hover { transform: scale(1.1); }

.settings-header { font-weight: bold; margin-bottom: 8px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border-light); }
.settings-item { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--text-main); padding: 3px 0; }
.font-ctrl button { width: 25px; height: 25px; border: 1px solid var(--border-color); background: var(--bg-sys); border-radius: 4px; color: var(--text-main); cursor: pointer; }
.popup-close-btn { width: 100%; padding: 8px; border: none; background: var(--bg-sys); border-radius: 5px; cursor: pointer; font-size: 12px; color: var(--text-muted); font-weight: bold; margin-top: 10px; }
#current-font-size { font-weight: bold; min-width: 20px; text-align: center; }

#loading-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.8); z-index: 3000; display: none; flex-direction: column; justify-content: center; align-items: center; }
body.dark-mode #loading-overlay { background: rgba(0,0,0,0.7); }
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid #007bff; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.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: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #007bff; }
input:checked + .slider:before { transform: translateX(14px); }

#char-counter {
    position: absolute;
    right: 55px; 
    bottom: 8px;
    font-size: 10px;
    color: #999;
    pointer-events: none; 
    z-index: 5;
}

#direct-access-gate {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    background: var(--bg-main);
    display: none; 
    justify-content: center; 
    align-items: center;
    z-index: 10000;
}

.gate-content {
    background: var(--bg-popup); 
    padding: 30px; 
    border-radius: 12px;
    box-shadow: var(--shadow); 
    text-align: center;
    max-width: 320px; 
    width: 90%; 
    color: var(--text-main);
}

#gate-password {
    width: 100%; padding: 12px; margin-bottom: 15px;
    border: 1px solid var(--border-color); border-radius: 6px; 
    background: var(--bg-chat); color: var(--text-main);
}

.gate-content button {
    width: 100%; padding: 12px; background: #007bff; color: white;
    border: none; border-radius: 6px; cursor: pointer; font-weight: bold;
}

#settings-block-view {
    display: none;
    flex-direction: column;
    background: var(--bg-popup);
    color: var(--text-main);
}

#block-list-container {
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-chat); 
    border: 1px solid var(--border-light);
    border-radius: 6px;
    margin-bottom: 8px;
}

.block-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-popup); 
}
.block-item:last-child { border-bottom: none; }

.block-nick {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-main) !important; 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

body.dark-mode .popup-btn {
    color: var(--text-main);
}

.block-x-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-back {
    width: 100%;
    padding: 10px;
    border: none;
    background: var(--bg-sys);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
}

body.dark-mode .nick-row {
    filter: brightness(1.3) ;
}

.dice-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--bg-sys);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
    margin: 5px 0;
}

.dice-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.dice-text {
    font-size: 14px;
    color: var(--text-main);
}

@keyframes dice-roll {
    0% { transform: rotate(-45deg) scale(0.5); opacity: 0; }
    100% { transform: rotate(0deg) scale(1); opacity: 1; }
}

.toast {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 11000;
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    pointer-events: none; 
}

.toast.show {
    opacity: 1;
    bottom: 70px;
}

.reaction-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.reaction-badge {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    -webkit-user-select: none; 
    -moz-user-select: none; 
    -ms-user-select: none; 
    user-select: none; 
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.reaction-badge:hover { background: rgba(0, 0, 0, 0.1); }

.reaction-badge.my-reaction {
    background: #fff9c4; 
    border-color: #fdd835;
}

.reaction-badge small { font-weight: bold; color: #555; padding-left: 2px; }

body.dark-mode .reaction-badge {
    background-color: #3a3b3c; 
    color: #e4e6eb; 
    border: 1px solid #555; 
    -webkit-user-select: none; 
    -moz-user-select: none; 
    -ms-user-select: none; 
    user-select: none; 
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
body.dark-mode .reaction-badge small { font-weight: bold; color: #fff;padding-left: 2px; }
body.dark-mode .reaction-badge.my-reaction {
    background-color: #2b5278; 
    border-color: #4da3ff; 
    color: #ffffff;
}

body.dark-mode .reaction-badge:hover {
    background-color: #4e4f50; 
}

.reaction-row-popup {
    display: flex;
    justify-content: space-around;
    padding: 8px 5px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    border-radius: 8px 8px 0 0;
}

.reaction-row-popup span {
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.reaction-row-popup span:hover {
    transform: scale(1.3);
}

.popup-btn {
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}

.popup-btn:hover {
    background-color: #f5f5f5;
}

.date-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #888;
    font-size: 0.85rem;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #eee;
}

.date-separator span {
    padding: 0 15px;
}
#message-box a, 
#message-box a:link, 
#message-box .content a:link {
    color: #007bff !important; 
    text-decoration: none !important;
    border-bottom: 1px solid currentColor !important;
    font-weight: normal !important; 
}

#message-box .image-link:link {
    color: #28a745 !important; 
}

#message-box a:visited,
#message-box .content a:visited,
#message-box .image-link:visited,
#message-box .msg-line a:visited {
    color: #800080 !important; 
    border-bottom: 1px solid currentColor !important;
}

#message-box a:hover,
#message-box a:active {
    color: #0056b3 !important;
    border-bottom-width: 2px !important;
}

.visited-link {
    color: #800080 !important; 
    border-bottom: 1px solid #800080 !important;
}

#message-box a.visited-link {
    color: #800080 !important;
    border-bottom: 1px solid #800080 !important;
}

#message-box a {
    -webkit-tap-highlight-color: transparent;
}

#new-msg-toast {
position: absolute;
    bottom: 55px; /* 기본 입력창 바로 위 */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 170, 255, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    display: none; /* 기본은 숨김 */
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: bottom 0.3s ease, opacity 0.3s ease, transform 0.3s ease; /* 위치 변화 부드럽게 */
    animation: fadeInDown 0.3s ease;
	
}

#new-msg-toast.shifted {
    bottom: 105px; /* 귓속말 바 높이만큼 더 올라감 */
}

#new-msg-toast:hover {
    background-color: #0088cc;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}


/* --- [3. PC 호환성 및 이모지 출력 보정] --- */

/* 1. PC에서 기본 이모지가 깨지거나 안 보이는 현상 방지 (폰트 스택 강제) */
.content, .msg-body, #message-input, #pinned-content, .nick-row, #my-nick, .user-item {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 
                 "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", 
                 "Noto Color Emoji", sans-serif !important;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* 2. 이모지 피커 가로 스크롤바 제거 및 레이아웃 고정 */
#emoji-picker {
    /*width: 285px !important;*/ /* 고정폭 설정으로 넘침 방지 */
    overflow-x: hidden !important;
    scrollbar-width: none; /* 파이어폭스 */
    -ms-overflow-style: none; /* IE/Edge */
}
#emoji-picker::-webkit-scrollbar {
    display: none; /* 크롬/사파리 */
}

/* 3. 새 메시지 토스트 클릭 영역 최적화 */
#new-msg-toast {
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    font-family: 'Pretendard', sans-serif;
}

/* 4. 다크모드 시 링크 색상 가독성 보정 */
body.dark-mode #message-box a {
    color: #4da3ff !important;
}
body.dark-mode #message-box a:visited {
    color: #da70d6 !important;
}