/* 커뮤니티 화면 전용 테마. 이미지, 지도, 처리 결과 색상과 표시 상태는 기존 규칙을 유지한다. */
body.ttonang-theme :is(.post-feed, .bugreport-list-container, .bugreport-detail-container,
    .bugreport-form-container, .userNoticeList-container, .userNoticeDetail-container,
    .board-post-deleted, #reportModal, #attExpireModal, #cancelModal, .note-modal) {
    --primary-color: var(--tt-accent);
    --primary-color-dark: #e8700f;
    --secondary-color: #ffac68;
    --text-color: var(--tt-text);
    --text-light-color: var(--tt-muted);
    --bg-color: var(--tt-surface);
    --bg-alt-color: var(--tt-raised);
    --bg-input-color: var(--tt-bg);
    --border-color: var(--tt-border);
    --border-color-light: var(--tt-border);
    --shadow-light: none;
    --shadow-medium: none;
    color: var(--tt-text);
    color-scheme: dark;
}

/* 페이지 외곽은 가는 주황색 선으로, 내부 정보는 차콜 면으로 구분한다. */
body.ttonang-theme :is(.bugreport-list-container, .bugreport-detail-container,
    .bugreport-form-container, .userNoticeList-container, .userNoticeDetail-container,
    .board-post-deleted) {
    background: var(--tt-surface);
    border: 1px solid var(--tt-accent);
    border-radius: 12px;
    box-shadow: none;
    min-width: 0;
}

body.ttonang-theme :is(.bugreport-list-page-title, .detail-title, .form-title,
    .userNoticeList-title, .userNoticeDetail-title, .board-post-deleted__title) {
    color: var(--tt-accent);
    text-shadow: none;
    overflow-wrap: anywhere;
}

body.ttonang-theme :is(.bugreport-list-page-title, .form-title,
    .userNoticeList-title, .userNoticeDetail-title)::after {
    background: var(--tt-accent);
    height: 1px;
    box-shadow: none;
}
body.ttonang-theme :is(.bugreport-list-container, .bugreport-form-container,
    .userNoticeList-container, .userNoticeDetail-container).is-visible
    :is(.bugreport-list-page-title, .form-title, .userNoticeList-title, .userNoticeDetail-title)::after {
    background: var(--tt-accent);
    height: 1px;
    box-shadow: none;
}

body.ttonang-theme :is(.bugreport-list-divider, .detail-divider, .form-divider) {
    background: var(--tt-border);
    border-color: var(--tt-border);
}

/* 전체보기 카드 피드: 기존 한 줄 메타, 세 줄 요약, 조회 게이지 동작은 그대로 둔다. */
body.ttonang-theme .feed-card {
    background: var(--tt-surface);
    border-color: var(--tt-accent);
    border-radius: 12px;
    box-shadow: none;
}

body.ttonang-theme :is(.feed-heading h1, .feed-story h2, .feed-author) { color: var(--tt-text); }
body.ttonang-theme :is(.feed-heading p, .feed-meta, .feed-story p, .feed-stats,
    .feed-empty, #feedStatus) { color: var(--tt-muted); }
body.ttonang-theme :is(.feed-eyebrow, .feed-read-more, .feed-like-total) { color: var(--tt-accent); }
body.ttonang-theme .feed-avatar { background: var(--tt-raised); color: var(--tt-accent); }
body.ttonang-theme .feed-photos { background: var(--tt-bg); }
body.ttonang-theme :is(.feed-stats, .feed-gallery-controls) { border-color: var(--tt-border); }
body.ttonang-theme .feed-stats > a { color: var(--tt-text); }
body.ttonang-theme .feed-gauge { background: var(--tt-border); }
body.ttonang-theme .feed-gauge > span { background: var(--tt-accent); }

body.ttonang-theme :is(.feed-categories a, .feed-category-arrow, .feed-search input,
    .feed-gallery-controls button, #feedMore) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme .feed-categories a.active {
    background: var(--tt-accent);
    color: var(--tt-accent-text);
    border-color: var(--tt-accent);
}
body.ttonang-theme :is(.feed-write, .feed-search button) {
    background: var(--tt-accent);
    color: var(--tt-accent-text);
    border-color: var(--tt-accent);
}
body.ttonang-theme :is(.feed-image-dialog, .post-sources-dialog) {
    background: var(--tt-surface);
    color: var(--tt-text);
    border: 1px solid var(--tt-accent);
    box-shadow: none;
}
body.ttonang-theme :is(.feed-image-dialog, .post-sources-dialog)::backdrop { background: rgb(0 0 0 / 80%); }
body.ttonang-theme :is(.feed-image-close, .post-sources-close) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
}
body.ttonang-theme .feed-image-source { color: var(--tt-accent); }

/* 게시판/문의 목록과 공지 목록 */
body.ttonang-theme :is(.bugreport-list-controls, .userNoticeList-main) {
    background: var(--tt-raised);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme :is(.bugreport-list-header, .board-list-header.board-list-row,
    .post-related-board .board-list-header, .userNoticeList-listHeader) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    border-bottom: 1px solid var(--tt-accent);
    box-shadow: none;
}
body.ttonang-theme :is(.bugreport-list-item, .bugreport-list-item:nth-child(odd),
    .post-related-board .board-list-item, .post-related-board .board-list-item:nth-child(odd),
    .userNoticeList-listItem, .userNoticeList-listItem:nth-child(odd)) {
    background: var(--tt-surface);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme :is(.bugreport-list-item, .post-related-board .board-list-item,
    .userNoticeList-listItem):hover {
    background: var(--tt-raised);
    box-shadow: none;
}
body.ttonang-theme :is(.post-title-link, .userNoticeList-title-title a,
    .bugreport-col-title a, .post-related-board .board-list-col) { color: var(--tt-text); }
body.ttonang-theme :is(.post-title-link, .userNoticeList-title-title a,
    .bugreport-col-title a):hover { color: var(--tt-accent); }
body.ttonang-theme :is(.board-list-meta, .board-list-text-muted, .author-posts-summary,
    .bugreport-list-no-data, .post-related-empty, .userNoticeList-noData,
    .userNoticeList-meta-info, .userNoticeList-author, .userNoticeList-reg_date) { color: var(--tt-muted); }
body.ttonang-theme :is(.post-category-chip, .post-comment-chip, .post-tag,
    .post-tag-trigger, .tag-chip) {
    background: var(--tt-raised);
    color: #ffac68;
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme .post-tag-popover {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-accent);
    box-shadow: none;
}
body.ttonang-theme .bugreport-list-container .answered-no {
    background: var(--tt-raised);
    color: var(--tt-muted);
    border: 1px solid var(--tt-border);
}
body.ttonang-theme .userNoticeList-container {
    --important-bg-color: #292018;
    --important-text-color: #ffac68;
}
body.ttonang-theme .userNoticeList-listItem:has(.important-link),
body.ttonang-theme .userNoticeList-listItem:has(.important-link):nth-child(odd),
body.ttonang-theme .userNoticeList-listItem:has(.important-link):hover {
    background: var(--important-bg-color);
}
body.ttonang-theme :is(.bugreport-page-link, .userNoticeList-pagination a,
    .userNoticeList-pagination button) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme :is(.bugreport-page-link.is-active, .userNoticeList-pagination button.shp) {
    background: var(--tt-accent);
    color: var(--tt-accent-text);
    border-color: var(--tt-accent);
}
body.ttonang-theme .bugreport-page-link.is-disabled {
    background: var(--tt-surface);
    color: var(--tt-muted);
}

/* 폼과 검색 입력: 오류 문구/성공 상태는 별도 색상을 유지한다. */
body.ttonang-theme :is(.bugreport-list-select, .bugreport-list-input,
    .userNoticeList-searchType, .userNoticeList-searchInput,
    .bugreport-form-container .form-control, .bugreport-form-container .textarea-content,
    .bugreport-form-container .select-status, .bugreport-form-container #image-expires,
    .tag-input-wrap, .tag-input, .comment-attachment-expires-select,
    .bugreport-detail-container textarea, #reportModal .report-reason-text) {
    background: var(--tt-bg);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
    min-width: 0;
    max-width: 100%;
    color-scheme: dark;
}
body.ttonang-theme :is(.feed-search input, .bugreport-list-input,
    .userNoticeList-searchInput, .bugreport-form-container .form-control,
    .tag-input, .bugreport-detail-container textarea, #reportModal .report-reason-text)::placeholder {
    color: var(--tt-muted);
    opacity: 1;
}
body.ttonang-theme :is(.bugreport-form-container .form-label,
    .bugreport-form-container .form-group-options, .bugreport-detail-container .meta-value) { color: var(--tt-text); }
body.ttonang-theme :is(.bugreport-form-container .form-text.text-muted,
    .report-meta, .meta-label, .comment-date, .pc-meta-line, .pc-meta-time,
    .comment-attachment-hint, .comment-attachment-expires-label) { color: var(--tt-muted); }

body.ttonang-theme :is(.bugreport-list-button-search, .bugreport-list-button-write,
    .bugreport-form-container .btn-submit, .report-manage-buttons .btn-edit,
    .bugreport-detail-container .btn-primary2, #attExpireModal .btn-primary2,
    #reportModal footer .btn-primary2, #cancelModal .btn-primary2,
    .userNoticeList-searchButton, .userNoticeList-button,
    .userNoticeDetail-list-button, .board-post-deleted__button,
    #submitCommentBtn, #submitNewAdminAnswerButton, #submitEditAdminAnswerButton,
    .bugreport-detail-container .reply-submit-btn, .bugreport-detail-container .save-edit-btn) {
    background: var(--tt-accent);
    border-color: var(--tt-accent);
    color: var(--tt-accent-text);
    box-shadow: none;
    text-shadow: none;
}
body.ttonang-theme .userNoticeList-button a { color: var(--tt-accent-text); }
body.ttonang-theme :is(.bugreport-form-container .btn-cancel,
    .bugreport-form-container .btn-secondary, .bugreport-detail-container .attach-button,
    .post-sources-button, #reportModal footer .attach-button,
    #cancelModal .btn-outline, #cancelEditAdminAnswerButton,
    .bugreport-detail-container .comment-actions button,
    .bugreport-detail-container .admin-answer-actions button,
    .bugreport-detail-container .cancel-edit-btn, #commentPagination button) {
    background: var(--tt-raised);
    border-color: var(--tt-border);
    color: var(--tt-text);
    box-shadow: none;
}
body.ttonang-theme :is(.bugreport-form-container .btn, .report-manage-buttons .btn-edit,
    .report-manage-buttons .btn-delete, .admin-answer-form button,
    #editAdminAnswerFormContainer button, #submitCommentBtn)::before { background: none; }

/* 본문과 관련 글: 본문 서체/블록 간격과 미디어 배치는 기존 전용 CSS를 따른다. */
body.ttonang-theme :is(.report-content.report-content, .userNoticeDetail-detail,
    .post-section, .post-section--reactions, .post-related-board,
    .admin-answers-section, .userNoticeDetail-attachment) {
    background: var(--tt-bg);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme :is(.report-content pre, .userNoticeDetail-content pre,
    .admin-answer-item pre, .post-image-unavailable) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme :is(.report-content blockquote, .userNoticeDetail-content blockquote) {
    background: var(--tt-raised);
    color: var(--tt-muted);
    border-left-color: var(--tt-accent);
}
body.ttonang-theme :is(.report-content td, .report-content th,
    .userNoticeDetail-content td, .userNoticeDetail-content th) { border-color: var(--tt-border); }
body.ttonang-theme :is(.userNoticeDetail-content strong, .userNoticeDetail-content b,
    .post-related-board-title, .post-sources-dialog h2, .pc-meta-author,
    .pc-text, .comment-text-content) { color: var(--tt-text); }
body.ttonang-theme :is(.report-content a[href]:not(.post-map-link), .post-map-link,
    .post-sources-dialog a, .userNoticeDetail-content a, .userNoticeDetail-attachment a,
    .pc-text a) {
    color: #ffac68;
    text-decoration-color: currentColor;
}
body.ttonang-theme .post-map-card { border-color: var(--tt-border); }
body.ttonang-theme :is(.post-map-address, .post-sources-dialog li,
    .userNoticeDetail-meta-info, .board-post-deleted__desc) { color: var(--tt-muted); }
body.ttonang-theme .post-sources-dialog header { border-color: var(--tt-border); }
body.ttonang-theme .board-post-deleted-page::after { background-image: none; }

/* 댓글/대댓글: 깊이는 기존 들여쓰기로, 선택 상태는 주황색 선으로 표시한다. */
body.ttonang-theme :is(.pc-item, .pc-item.depth-1, .pc-item.depth-2, .pc-item.depth-max,
    .bugreport-detail-container .reply-comment-item, .bugreport-detail-container .reply-form-container) {
    background: var(--tt-surface);
    border-color: var(--tt-border);
    color: var(--tt-text);
    box-shadow: none;
}
body.ttonang-theme :is(.pc-item.depth-1, .pc-item.depth-2, .pc-item.depth-max) { border-left-color: var(--tt-accent); }
body.ttonang-theme .pc-item:hover { border-color: #666; box-shadow: none; transform: none; }
body.ttonang-theme .pc-item.is-highlight { border-color: var(--tt-accent); box-shadow: none; }
body.ttonang-theme .pc-item:hover::after { border-color: transparent; }
body.ttonang-theme :is(.pc-item.depth-1, .pc-item.depth-2, .pc-item.depth-max)::before { background: var(--tt-border); }
body.ttonang-theme :is(.pc-item.depth-1, .pc-item.depth-2, .pc-item.depth-max)::after {
    background: var(--tt-accent);
    box-shadow: none;
}
body.ttonang-theme .pc-author-badge { background: #292018; color: #ffac68; border-color: #76502f; }
body.ttonang-theme :is(.report-like-actions button, .comment-likes button) { background: var(--tt-raised); box-shadow: none; }
body.ttonang-theme :is(.report-like-actions button.active, .report-like-actions button.active i,
    .report-like-actions button.active span, .comment-likes button.active) {
    background: var(--tt-accent);
    color: var(--tt-accent-text);
    border-color: var(--tt-accent);
    box-shadow: none;
}
body.ttonang-theme .bugreport-detail-container :is(.pc-actions .attach-button.pc-like.is-on,
    .reaction-buttons .attach-button.pr-like.is-on,
    .reaction-buttons .attach-button.pr-like[data-state="ON"]) {
    background: #292018;
    color: #ffac68;
    border-color: var(--tt-accent);
    box-shadow: none;
}
body.ttonang-theme .bugreport-detail-container .pc-actions .attach-button.pc-reply {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
}
body.ttonang-theme .bugreport-detail-container .attach-button.report-button {
    background: #322021;
    color: #ff9c9e;
    border-color: #855054;
}

/* 신고/첨부/취소 모달. 열림/닫힘과 포커스 이동은 기존 스크립트가 관리한다. */
body.ttonang-theme :is(#reportModal, #attExpireModal, #cancelModal) .modal-card {
    background: var(--tt-surface);
    color: var(--tt-text);
    border-color: var(--tt-accent);
    box-shadow: none;
    max-width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 32px);
}
body.ttonang-theme :is(#reportModal, #attExpireModal, #cancelModal) .modal-card :is(header, footer, .body) {
    background: var(--tt-surface);
    border-color: var(--tt-border);
    color: var(--tt-text);
}
body.ttonang-theme #reportModal :is(.report-info-grid, .report-info-chip,
    .report-info-box, .report-reason-option span) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme #reportModal :is(.report-info-label, .report-section-title) { color: var(--tt-muted); }
body.ttonang-theme #reportModal .report-info-value { color: var(--tt-text); }
body.ttonang-theme #reportModal .report-reason-option input:checked + span {
    background: var(--tt-accent);
    color: var(--tt-accent-text);
    border-color: var(--tt-accent);
    box-shadow: none;
}
body.ttonang-theme #reportModal .report-reason-option:focus-within span {
    outline: 2px solid var(--tt-accent);
    outline-offset: 3px;
}

/* Summernote의 도구 UI만 조정하며 작성자가 지정한 본문 색/색상표는 덮어쓰지 않는다. */
body.ttonang-theme .bugreport-form-container .note-editor.note-frame {
    border-color: var(--tt-border);
    background: var(--tt-bg);
    box-shadow: none;
}
body.ttonang-theme .bugreport-form-container :is(.note-toolbar, .note-statusbar,
    .note-popover .popover-content, .note-dropdown-menu, .note-dropdown-menu a,
    .note-btn) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme .bugreport-form-container .note-editor .note-editing-area .note-editable {
    background: var(--tt-bg);
    color: var(--tt-text) !important;
    caret-color: var(--tt-accent);
}
body.ttonang-theme .bugreport-form-container :is(.note-btn:hover, .note-btn.active,
    .note-dropdown-item:hover, .note-dropdown-menu a:hover) {
    background: #333;
    color: var(--tt-text);
    border-color: var(--tt-accent);
}
body.ttonang-theme .bugreport-form-container .note-placeholder { color: var(--tt-muted); }
body.ttonang-theme .note-popover :is(.popover-content, .note-btn, .note-dropdown-menu) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme :is(.sn-image-toolbar, .sn-dropzone, .sn-dropzone.dragover) {
    background: var(--tt-raised);
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}
body.ttonang-theme .sn-dropzone.dragover { border-color: var(--tt-accent); }
body.ttonang-theme .sn-image-toolbar button {
    background: var(--tt-surface);
    color: var(--tt-text);
    border-color: var(--tt-border);
}
body.ttonang-theme .sn-selected-image { outline-color: var(--tt-accent); }

/* 기존 편집기 모달에 있는 !important/업로드 인라인 색상만 정확히 재정의한다. */
body.ttonang-theme .note-modal :is(.modal-content, .note-modal-content) {
    background: var(--tt-surface) !important;
    border-color: var(--tt-accent) !important;
    box-shadow: none !important;
}
body.ttonang-theme .note-modal :is(.modal-header, .modal-footer, .note-modal-header,
    .note-modal-footer, .modal-body, .note-modal-body) {
    background: var(--tt-surface) !important;
    color: var(--tt-text) !important;
    border-color: var(--tt-border) !important;
}
body.ttonang-theme .note-modal :is(.modal-title, .note-modal-title, .note-form-label,
    .note-help-block, label) { color: var(--tt-text) !important; }
body.ttonang-theme .note-modal :is(input[type="text"], input[type="url"], input[type="email"],
    input[type="file"], select, textarea, .note-input) {
    background: var(--tt-bg) !important;
    color: var(--tt-text) !important;
    border-color: var(--tt-border) !important;
}
body.ttonang-theme .note-modal .note-btn-primary {
    background: var(--tt-accent);
    color: var(--tt-accent-text);
    border-color: var(--tt-accent);
}
body.ttonang-theme .note-modal .close { color: var(--tt-text); opacity: 1; text-shadow: none; }
body.ttonang-theme .bugreport-form-container #upload-status {
    background: var(--tt-raised) !important;
    border-color: var(--tt-border) !important;
    color: var(--tt-text);
}
body.ttonang-theme .bugreport-form-container #upload-current-name { color: var(--tt-muted) !important; }
body.ttonang-theme .bugreport-form-container #upload-cancel {
    background: var(--tt-surface) !important;
    border-color: var(--tt-border) !important;
    color: var(--tt-text) !important;
}
body.ttonang-theme .bugreport-form-container #upload-status > div:nth-child(2) { background: var(--tt-border) !important; }
body.ttonang-theme .bugreport-form-container #upload-file-list li { color: var(--tt-text) !important; }

/* 키보드 포커스와 텍스트 선택. 삭제/오류/성공의 의미색에는 개입하지 않는다. */
body.ttonang-theme :is(.post-feed, .bugreport-list-container, .bugreport-detail-container,
    .bugreport-form-container, .userNoticeList-container, .userNoticeDetail-container,
    .post-sources-dialog, .feed-image-dialog, #reportModal, #attExpireModal, #cancelModal,
    .note-modal) :is(a, button, input, select, textarea, [contenteditable="true"]):focus-visible {
    outline: 2px solid var(--tt-accent);
    outline-offset: 3px;
    box-shadow: none;
}
body.ttonang-theme :is(.post-feed, .bugreport-list-container, .bugreport-detail-container,
    .bugreport-form-container, .userNoticeList-container, .userNoticeDetail-container,
    .post-sources-dialog, #reportModal, .note-modal)::selection {
    background: var(--tt-accent);
    color: var(--tt-accent-text);
}

body.ttonang-theme .post-related-pagination .bugreport-page-link:is(:hover, :focus) {
    color: var(--tt-accent-text);
}

@media (max-width: 768px) {
    body.ttonang-theme :is(.bugreport-list-container, .bugreport-detail-container,
        .bugreport-form-container, .userNoticeList-container, .userNoticeDetail-container) {
        border-radius: 9px;
        padding-left: 14px;
        padding-right: 14px;
    }
    body.ttonang-theme :is(.report-content.report-content, .userNoticeDetail-detail,
        .admin-answers-section, .post-related-board) {
        min-width: 0;
        padding-left: 12px;
        padding-right: 12px;
    }
    body.ttonang-theme :is(.bugreport-list-select, .bugreport-list-input,
        .userNoticeList-searchType, .userNoticeList-searchInput) { min-width: 0; }
    body.ttonang-theme :is(.bugreport-list-filter-form .filter-item,
        .bugreport-list-filter-form .search-group, .userNoticeList-search) { min-width: 0; }
    body.ttonang-theme :is(.feed-write, .feed-search button, #feedMore,
        .bugreport-list-button-search, .bugreport-list-button-write,
        .bugreport-list-input, .bugreport-list-select, .bugreport-page-link,
        .bugreport-form-container .form-control, .bugreport-form-container .form-actions .btn,
        .userNoticeList-searchType, .userNoticeList-searchInput, .userNoticeList-searchButton,
        .userNoticeList-pagination a, .userNoticeList-pagination button,
        .post-sources-button, .post-sources-close, .feed-image-close,
        .bugreport-detail-container .attach-button, .bugreport-detail-container .btn-primary2,
        .report-manage-buttons .btn, #submitCommentBtn,
        #reportModal .attach-button, #reportModal .btn-primary2,
        #attExpireClose, #cancelModal button) { min-height: 44px; }
    body.ttonang-theme :is(.feed-image-close, .post-sources-close) { min-width: 44px; }
    body.ttonang-theme .bugreport-form-container .note-toolbar { overflow-wrap: anywhere; }
    body.ttonang-theme .bugreport-form-container #upload-status > div:first-child { flex-wrap: wrap; gap: 8px; }
    body.ttonang-theme .bugreport-form-container #upload-current-name { max-width: 145px !important; }
    body.ttonang-theme :is(#reportModal, #attExpireModal, #cancelModal) .modal-card footer { flex-wrap: wrap; }
    body.ttonang-theme .board-post-deleted { padding: 32px 18px; }
}
