:root {
    --color-main: #c62917;
    --color-border: #e3e3e3;
    --color-bg: #f8f8f8;
    --text-main: #292929;
    --text-sub: #777;
    --text-light: #a6a6a6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Malgun Gothic", dotum, sans-serif; background: var(--color-bg); color: var(--text-main); font-size: 13px; }
a { text-decoration: none; color: inherit; cursor: pointer; }
ul { list-style: none; }

header { background: #fff; border-bottom: 1px solid var(--color-border); position: relative; z-index: 1000; }
.header-top { display: flex; justify-content: center; height: auto; min-height: 80px; }
.header-inner { width: 100%; max-width: 1300px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.logo-area { display: flex; align-items: center; cursor: pointer; padding: 15px 0; }
.logo-img { width: 40px; height: 40px; margin-right: 10px; border-radius: 8px; object-fit: cover; }
.logo-text { font-size: 22px; font-weight: bold; color: var(--color-main); display: flex; flex-direction: column; line-height: 1.1; }
.logo-text span { font-size: 11px; color: var(--text-sub); font-weight: normal; }

.main-nav { display: flex; gap: 30px; height: 100%; align-items: center; }
.main-nav li { font-size: 16px; font-weight: bold; cursor: pointer; position: relative; height: 100%; display: flex; align-items: center; padding: 30px 0; transition: 0.2s; }
.main-nav li:hover, .main-nav li.active { color: var(--color-main); }
.main-nav li.active::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: var(--color-main); }

.header-icons { display: flex; gap: 15px; padding: 15px 0; }
.icon-btn { border: 1px solid var(--color-border); padding: 8px 12px; border-radius: 20px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; font-weight: bold; transition: 0.2s;}
.icon-btn:hover { background: #f9f9f9; }

.sub-nav-wrapper { display: flex; justify-content: center; background: #f4f5f7; border-bottom: 1px solid var(--color-border); padding: 15px 0; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); position: absolute; top: 100%; left: 0; width: 100%; z-index: 999; }
.sub-nav { width: 100%; max-width: 1300px; padding: 0 15px; display: flex; gap: 40px; font-size: 12px; }
.sub-nav-col { display: flex; flex-direction: column; gap: 10px; border-right: 1px solid #ddd; padding-right: 40px; }
.sub-nav-col:last-child { border: none; }
.sub-nav-col a { color: #555; transition: 0.2s; cursor: pointer; }
.sub-nav-col a:hover { color: var(--color-main); text-decoration: underline; font-weight: bold; }

.container { width: 100%; max-width: 1300px; padding: 0 15px; margin: 20px auto; display: flex; gap: 20px; }
aside { width: 180px; flex-shrink: 0; }
.main-content { flex: 1; min-width: 0; }

.profile-card { background: #fff; border: 1px solid var(--color-border); padding: 20px; border-radius: 4px; margin-bottom: 10px; text-align: center; }
.profile-img { width: 60px; height: 60px; background: #eee; border-radius: 15px; margin: 0 auto 10px; overflow: hidden; }
.profile-img img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-weight: bold; font-size: 15px; margin-bottom: 2px; }
.profile-id { font-size: 12px; color: var(--text-sub); margin-bottom: 15px; }
.profile-btns { display: flex; gap: 5px; }
.p-btn { flex: 1; padding: 8px 0; border: 1px solid var(--color-border); background: #f9f9f9; border-radius: 4px; font-size: 11px; cursor: pointer; font-weight: bold; }

.side-menu { background: #fff; border: 1px solid var(--color-border); border-radius: 4px; padding: 10px 0; margin-bottom: 10px; }
.side-menu li { padding: 12px 20px; cursor: pointer; font-weight: bold; font-size: 13px; }
.side-menu li:hover { background: #f9f9f9; color: var(--color-main); }
.notification-badge { min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--color-main); color: #fff; align-items: center; justify-content: center; font-size: 10px; line-height: 18px; font-weight: bold; vertical-align: middle; }
.notification-row { padding: 15px; border-bottom: 1px solid #eee; cursor: pointer; background: #fff; }
.notification-row:hover { background: #fafafa; }
.notification-title { font-size: 14px; font-weight: bold; color: #292929; margin-bottom: 6px; }
.notification-meta { display: flex; gap: 8px; font-size: 11px; color: #a6a6a6; }

.search-widget { border: 2px solid var(--color-main); background: #fff; padding: 10px; display: flex; align-items: center; border-radius: 4px; margin-bottom: 10px; }
.search-widget input { border: none; outline: none; flex: 1; font-size: 12px; }

.widget-box { background: #fff; border: 1px solid var(--color-border); border-radius: 4px; padding: 15px; }
.widget-title { font-weight: bold; font-size: 14px; margin-bottom: 10px; color: var(--color-main); }

/* PC 전용 4개씩 모인 게시판 디자인 */
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.board-box { background: #fff; border: 1px solid var(--color-border); border-radius: 4px; }
.board-title { padding: 15px; border-bottom: 1px solid #eee; font-weight: bold; font-size: 15px; color: var(--color-main); display: flex; justify-content: space-between; cursor: pointer; }
.board-title span { font-size: 12px; font-weight: normal; color: var(--text-light); }
.board-list { padding: 10px; }
.board-list li { padding: 8px 5px; display: flex; justify-content: space-between; cursor: pointer; }
.board-list li:hover { background: #f9f9f9; }
.post-t { width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.post-d { font-size: 11px; color: var(--text-light); }

#boardArea { display: none; background: #fff; border: 1px solid var(--color-border); border-radius: 4px; min-height: 600px; position: relative; }
.view-header { padding: 15px; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.view-title { font-size: 18px; font-weight: bold; }
.btn-write { background: var(--color-main); color: #fff; border: none; padding: 8px 15px; font-size: 12px; border-radius: 4px; cursor: pointer; font-weight: bold; }

.p-row { padding: 15px; border-bottom: 1px solid #eee; cursor: pointer; }
.p-row:hover { background: #fafafa; }
.p-row h3 { font-size: 14px; margin-bottom: 5px; font-weight: normal; }
.p-row p { font-size: 11px; color: var(--text-sub); }

.detail-wrapper { padding: 30px; background: #fff; border: 1px solid var(--color-border); border-radius: 4px; min-height: 600px; position: relative; }
.btn-back { display: inline-block; margin-bottom: 20px; color: var(--color-main); font-weight: bold; cursor: pointer; font-size: 13px; }

.post-profile { display: flex; align-items: center; margin-bottom: 15px; }
.p-img { width: 36px; height: 36px; background: #f2f2f2; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-right: 10px; overflow: hidden; }
.p-img img { width: 100%; height: 100%; object-fit: cover; }
.p-name { font-weight: bold; font-size: 14px; color: #292929; }
.p-time { font-size: 11px; color: #a6a6a6; margin-top: 2px; }

.d-title { font-size: 22px; font-weight: bold; margin-bottom: 15px; color: #292929; }
.d-body { font-size: 14px; line-height: 1.6; min-height: 150px; word-break: break-word; color: #444; }

.d-stats { display: flex; gap: 8px; margin: 20px 0; border-bottom: 1px solid #f2f2f2; padding-bottom: 20px; }
.btn-stat { background: #f4f5f7; border: none; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.btn-stat.like { color: var(--color-main); }
.btn-stat.scrap { color: #ffba00; }

.poll-box { margin: 20px 0 0; padding: 16px; border: 1px solid #eee; border-radius: 8px; background: #fafafa; }
.poll-title { font-size: 14px; font-weight: bold; margin-bottom: 12px; color: #292929; }
.poll-option { width: 100%; position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 42px; margin-top: 8px; padding: 10px 12px; border: 1px solid #e5e5e5; border-radius: 6px; background: #fff; cursor: pointer; overflow: hidden; font-size: 13px; text-align: left; }
.poll-option:hover { border-color: var(--color-main); }
.poll-option.selected { border-color: var(--color-main); color: var(--color-main); font-weight: bold; }
.poll-bar { position: absolute; top: 0; left: 0; height: 100%; background: rgba(198,41,23,0.08); pointer-events: none; }
.poll-label, .poll-count { position: relative; z-index: 1; }
.poll-count { flex-shrink: 0; color: #888; font-size: 12px; }
.poll-total { margin-top: 10px; color: #888; font-size: 12px; text-align: right; }
.write-poll-box { margin-bottom: 10px; padding: 12px; border: 1px solid #eee; border-radius: 6px; background: #fafafa; }
.poll-toggle { display: flex; align-items: center; gap: 6px; color: var(--color-main); font-size: 13px; font-weight: bold; cursor: pointer; }
.poll-write-input { width: 100%; margin-top: 8px; padding: 9px 10px; border: 1px solid #ddd; border-radius: 4px; outline: none; font-size: 13px; }
.btn-add-poll-option { margin-top: 8px; padding: 7px 10px; border: 1px solid #ddd; border-radius: 4px; background: #fff; color: #555; cursor: pointer; font-size: 12px; }
.c-time { margin-left: 6px; color: #aaa; font-size: 11px; font-weight: normal; }

.comment-item { padding: 15px 0; border-bottom: 1px solid #f2f2f2; }
.c-header { display: flex; justify-content: space-between; margin-bottom: 8px; align-items: flex-start; }
.c-profile { display: flex; align-items: center; gap: 8px; }
.c-img { width: 24px; height: 24px; background: #f2f2f2; border-radius: 6px; overflow: hidden; }
.c-img img { width: 100%; height: 100%; object-fit: cover; }
.c-name { font-weight: bold; font-size: 13px; color: #292929; }
.c-actions { display: flex; gap: 10px; font-size: 12px; color: #a6a6a6; }
.btn-c-action { cursor: pointer; }
.c-text { font-size: 14px; color: #292929; line-height: 1.4; word-break: break-word; padding-left: 32px; }

.reply-list { margin-top: 10px; padding-left: 32px; }
.reply-item { background: #f9f9f9; padding: 12px; border-radius: 6px; margin-top: 5px; }

.auth-wrapper { height: 100vh; display: flex; justify-content: center; align-items: center; background: var(--color-bg); }
.auth-box { background: #fff; padding: 40px; border-radius: 10px; border: 1px solid var(--color-border); width: 350px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.auth-box h2 { color: var(--color-main); margin-bottom: 25px; font-size: 24px; font-weight: bold;}
.auth-box input { width: 100%; padding: 12px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 5px; outline: none; font-size: 14px; }
.auth-box button { width: 100%; padding: 12px; background: var(--color-main); color: #fff; border: none; border-radius: 5px; font-weight: bold; cursor: pointer; font-size: 14px; margin-top: 5px; }
.auth-toggle-text { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-sub); cursor: pointer; }

.fixed-comment-input { margin-top: 20px; background: #f4f5f7; padding: 15px; border-radius: 8px; display: flex; align-items: center; }
.fixed-comment-input .anon-check { font-size: 13px; color: var(--color-main); font-weight: bold; margin-right: 15px; cursor: pointer; }
.fixed-comment-input .input-wrap { flex: 1; display: flex; background: #fff; border-radius: 20px; overflow: hidden; border: 1px solid #e5e5e5; }
.fixed-comment-input input[type="text"] { flex: 1; border: none; padding: 12px 15px; outline: none; font-size: 14px; }
.fixed-comment-input .submit-btn { background: var(--color-main); color: #fff; border: none; padding: 0 20px; font-weight: bold; cursor: pointer; }

.reply-input-box { margin-top: 10px; margin-left: 32px; background: #f4f5f7; padding: 10px; border-radius: 8px; display: flex; align-items: center; }
.reply-input-box input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 15px; outline: none; font-size: 13px; margin-right: 5px; }
.reply-input-box button { padding: 8px 15px; background: #666; color: #fff; border: none; border-radius: 15px; cursor: pointer; font-weight: bold; font-size: 12px; }
.modal-box { max-height: 90vh; overflow-y: auto; }
.profile-edit-preview { width: 76px; height: 76px; margin: 0 auto 15px; border-radius: 18px; overflow: hidden; background: #f2f2f2; }
.profile-edit-preview img { width: 100%; height: 100%; object-fit: cover; }

/* PC 전용 숨김/모바일 전용 숨김 */
.mobile-only { display: none !important; }

/* =========================================
   📱 스마트폰 앱 모드 최적화
   ========================================= */
@media (max-width: 768px) {
    /* PC 요소 철저히 숨김 */
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    .mobile-only.mobile-search-box { display: block !important; }
    .mobile-only.d-back { display: block !important; cursor: pointer; font-size: 20px; font-weight: bold; }
    
    body { background: #f2f3f5; padding-bottom: 70px; }

    /* 📱 모바일 헤더 */
    .header-top { min-height: 60px; padding: 0; border-bottom: none; }
    .mobile-header { width: 100%; padding: 15px 20px; justify-content: space-between; align-items: center; background: #fff; }
    .m-left { display: flex; flex-direction: column; cursor: pointer; }
    .m-title { color: var(--color-main); font-size: 11px; font-weight: bold; margin-bottom: 2px; }
    .m-univ { font-size: 20px; font-weight: bold; color: #222; }
    .m-right { display: flex; gap: 15px; font-size: 20px; cursor: pointer; }
    
    .container { margin: 0; padding: 0; }
    .main-content { width: 100%; }

    .mobile-search-box { padding: 15px 20px; background: #fff; margin-bottom: 10px; }
    .mobile-search-box input { width: 100%; padding: 12px; border-radius: 8px; border: none; background: #f4f5f7; outline: none; font-size: 14px; }

    /* 📱 퀵 메뉴 (가로스크롤) */
    .mobile-quick-menu { padding: 20px; background: #fff; margin-bottom: 10px; justify-content: flex-start; gap: 25px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .mobile-quick-menu::-webkit-scrollbar { display: none; }
    .m-icon { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: #333; cursor: pointer; }
    .m-icon .circle { width: 45px; height: 45px; border-radius: 50%; background: #f4f5f7; display: flex; justify-content: center; align-items: center; font-size: 20px; margin-bottom: 8px; }

    /* 📱 홈 전용 카드 뷰 (즐겨찾는 게시판) */
    .m-card { background: #fff; margin-bottom: 10px; padding: 0; display: block !important; }
    .m-card-title { font-size: 16px; font-weight: bold; padding: 15px 20px; border-bottom: 1px solid #f4f5f7; color: #222; }
    .m-fav-list { list-style: none; padding: 0; margin: 0; }
    .m-fav-list li { display: flex; align-items: center; padding: 15px 20px; border-bottom: 1px solid #f4f5f7; cursor: pointer; }
    .m-fav-list li .b-name { font-weight: bold; font-size: 14px; width: 100px; flex-shrink: 0; color: #222; }
    .m-fav-list li .b-title { font-size: 13px; color: #666; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* 📱 게시판 메뉴 리스트 (내가 쓴 글, 스크랩, 📌게시판 목록) */
    .m-menu-group { background: #fff; padding: 0 20px; flex-direction: column; }
    .m-menu-item { padding: 15px 0; border-bottom: 1px solid #f4f5f7; font-size: 15px; font-weight: bold; color: #222; cursor: pointer; }
    .m-menu-item:last-child { border-bottom: none; }
    .m-menu-divider { height: 10px; background: #f2f3f5; width: 100%; }
    .m-menu-header { font-size: 12px; color: #888; font-weight: bold; padding: 20px 0 5px 0; }

    /* 📱 게시판 리스트 뷰 (첫 번째 사진) */
    #boardArea { border: none; border-radius: 0; min-height: 100vh; background: #fff; margin-bottom: 0; padding-bottom: 80px; display:none; }
    #mobileBoardHeader { position: sticky; top: 0; z-index: 100; padding: 15px 20px; justify-content: space-between; }
    .m-board-title { font-size: 15px; font-weight: bold; color: #333; text-align: center; flex: 1; }
    
    .p-row { padding: 15px 20px; border-bottom: 1px solid #f4f5f7; }
    .p-row h3 { font-size: 15px; font-weight: bold; color: #222; margin-bottom: 5px; }
    .p-row .p-preview { font-size: 13px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
    .p-row .p-info { display: flex; font-size: 11px; color: #a6a6a6; gap: 10px; align-items: center; }
    .p-row .p-stats { margin-left: auto; display: flex; gap: 8px; font-weight: bold; }
    .p-row .p-stats .like-count { color: var(--color-main); }
    .p-row .p-stats .comment-count { color: #00a68a; }

    /* 📱 글쓰기 플로팅 버튼 (FAB) */
    .mobile-fab { position: fixed; bottom: 80px; right: 20px; width: 50px; height: 50px; border-radius: 50%; background: var(--color-main); color: #fff; display: flex !important; justify-content: center; align-items: center; font-size: 20px; box-shadow: 0 4px 10px rgba(198,41,23,0.3); cursor: pointer; z-index: 1000; }

    /* 📱 상세 뷰 (이전과 동일) */
    #postDetailArea { background: #fff; min-height: 100vh; padding-bottom: 80px; }
    .detail-wrapper { border: none; border-radius: 0; padding: 20px; min-height: auto; }
    .detail-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid #f2f2f2; background: #fff; position: sticky; top: 0; z-index: 100; }
    .d-board-name { font-size: 15px; font-weight: bold; color: #333; flex: 1; text-align: center; }
    
    .fixed-comment-input { margin-top: 0; border-radius: 0; position: fixed; bottom: 0; left: 0; width: 100%; border-top: 1px solid #e5e5e5; z-index: 2000; padding: 10px 15px; background: #f4f5f7; }
    .fixed-comment-input .anon-check { font-size: 12px; color: var(--color-main); font-weight: bold; margin-right: 12px; cursor: pointer; }
    .fixed-comment-input .input-wrap { border-radius: 20px; }
    .fixed-comment-input input[type="text"] { font-size: 14px; padding: 10px 15px; }
    .fixed-comment-input .submit-btn { width: 40px; border-radius: 0; padding: 0; }
    .write-poll-box { display: block; }
    #pollInputs { width: 100%; }
    .poll-option { align-items: flex-start; flex-direction: column; }
    .poll-count { align-self: flex-end; }

    /* 하단 네비게이션 바 */
    .bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: #fff; border-top: 1px solid #e5e5e5; justify-content: space-around; padding: 10px 0; z-index: 1500; height: 60px; align-items: center; }
    .b-nav-item { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: #aaa; cursor: pointer; flex: 1; }
    .b-icon { font-size: 20px; margin-bottom: 4px; position: relative; }
    .b-icon .notification-badge { position: absolute; top: -8px; right: -13px; margin-left: 0; }
    .b-nav-item.active { color: var(--color-main); font-weight: bold; }
    .modal-box { width: 95% !important; padding: 20px !important; }
}

/* =========================================
   📱 전체 화면 이미지 뷰어
   ========================================= */
#imageViewer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 3000; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.viewer-header { position: absolute; top: 0; left: 0; width: 100%; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.3); z-index: 3001; }
.v-back { color: #fff; font-size: 26px; cursor: pointer; font-weight: bold; }
.v-actions a { color: #fff; font-size: 24px; text-decoration: none; }
#vImage { max-width: 100%; max-height: 100%; object-fit: contain; }
