/* ════════════════════════════════════════════════════════════════════
   하토담 다크모드 v2 (2026-11-14 다시 만듦) — 모든 HTML 화면 <head> 에 config.php 가 넣는다.
   켜는 법: localStorage 'hansaeng-theme' = dark | auto(시스템) → html.dark + body.dark (머리 스크립트가 맞춰 줌)
   원칙: ① 색은 변수 한 벌(따뜻한 갈색 + 주황) ② html.dark · body.dark 어디에 붙어도 같게
        ③ 페이지마다 박아 둔 밝은 색은 아래 '덮기' 규칙으로 ④ 그림 · 광고 · 동영상은 건드리지 않는다
   ════════════════════════════════════════════════════════════════════ */
html.dark, html.dark body, body.dark {
  color-scheme: dark;
  --bg: #14110f; --bg-0: #14110f; --bg-1: #1c1815; --bg-card: #1d1916; --card-bg: #1d1916;
  --bg-2: #241f1b; --bg-3: #2c2622; --bg-4: #37302a; --bg-hover: #231e1a; --hover-row: #231e1a;
  --header-bg: #18140f; --nav-bg: #1c1815; --nav-text: #c9bbaf;
  --border: #3b332c; --border-light: #2e2823;
  --text: #efe6dd; --text-0: #fbf5ef; --text-1: #efe6dd; --text-2: #c6b7aa; --text-3: #9c8d81; --text-muted: #9d8e82;
  --text-primary: #ff9b74; --text-secondary: #c6b7aa; --text-on-accent: #1d120b;
  --accent: #ff7a4d; --accent-text: #ff9b74; --accent-hover: #ff8d63; --accent-light: #33211a;
  --accent-bg-soft: rgba(255,122,77,.14); --accent-bg-hover: rgba(255,122,77,.22);
  --accent-shadow: rgba(255,122,77,.28); --accent-shadow2: rgba(255,122,77,.16);
  --pinned-bg: #2c2416; --pinned-hover: #352b19;
  --sidebar-bg: #1c1815; --sidebar-hover: #241f1b; --sidebar-active: #33211a; --sidebar-text: #c6b7aa; --sidebar-text-active: #ff9b74;
  --danger: #ff6f61; --danger-hover: #ff8a7e; --danger-bg: rgba(255,111,97,.14); --danger-border: rgba(255,111,97,.4); --danger-text: #ffb1a8;
  --success: #4cc38a; --success-bg: rgba(76,195,138,.14); --success-border: rgba(76,195,138,.4); --success-text: #9ee6c1;
  --warning: #f2b544; --warning-bg: rgba(242,181,68,.14); --warning-border: rgba(242,181,68,.4); --warning-text: #ffd68a;
  --info: #5ab4f0; --info-bg: rgba(90,180,240,.14); --info-border: rgba(90,180,240,.4); --info-text: #a9d8fa;
  --mark-bg: rgba(255,122,77,.28); --mark-text: #fff1e8;
  --shadow: 0 1px 0 rgba(0,0,0,.4); --shadow-xs: 0 1px 0 rgba(0,0,0,.35); --shadow-sm: 0 2px 6px rgba(0,0,0,.35);
  --shadow-md: 0 4px 14px rgba(0,0,0,.4); --shadow-lg: 0 10px 30px rgba(0,0,0,.45);
  --px-paper: #1d1916; --px-paper-2: #241f1b; --px-cream: #241f1b; --px-line: #3b332c; --px-ink: #efe6dd; --px-ink-soft: #c6b7aa;
  --px-hard: rgba(0,0,0,.45); --px-hard-strong: rgba(0,0,0,.6); --px-coral-soft: rgba(255,122,77,.16); --px-gold-soft: rgba(242,181,68,.16);
  --overlay-dim: rgba(0,0,0,.55); --overlay-strong: rgba(0,0,0,.75);
  --hs-dash-bg: #14110f; --hs-dash-card: #1d1916; --hs-dash-line: #3b332c;
  --m2-canvas: #14110f; --m2-surface: #1d1916; --m2-surface-soft: #241f1b; --m2-line: #3b332c; --m2-line-strong: #4b4139;
  --m2-ink: #efe6dd; --m2-ink-2: #c6b7aa; --m2-ink-3: #9c8d81; --m2-accent: #ff7a4d; --m2-accent-strong: #ff8d63;
  --m2-accent-soft: rgba(255,122,77,.15); --m2-accent-ink: #ff9b74; --m2-danger-soft: rgba(255,111,97,.14);
  --m2-shadow-card: 0 1px 0 rgba(0,0,0,.35); --m2-shadow-float: 0 8px 24px rgba(0,0,0,.45);
  /* 예전 'hs' 껍데기 변수(style.css 뒷부분 · 페이지별 인라인) */
  --hs-page: #14110f; --hs-bg: #14110f; --hs-surface: #1d1916; --hs-panel: #1d1916; --hs-panel-2: #241f1b;
  --hs-line: #3b332c; --hs-line-soft: #2e2823; --hs-border: #3b332c;
  --hs-text: #efe6dd; --hs-text-2: #c6b7aa; --hs-text-3: #9c8d81; --hs-text-4: #85776c; --hs-text-soft: #c6b7aa; --hs-text-faint: #85776c;
  --hs-accent: #ff7a4d; --hs-accent2: #ff8d63; --hs-accent-soft: rgba(255,122,77,.15);
}
html.dark { background: #14110f !important; }
/* style.css 의 body:not(.landing-page):not(.login-page):not(.register-page){background:흰 그라데이션 !important} 를 이기려면 더 구체적이어야 한다 */
html.dark body, body.dark, html.dark body:not(.landing-page):not(.login-page):not(.register-page):not(#_) { background: var(--bg) !important; color: var(--text); }

/* ── 흔한 껍데기(머리 · 메뉴 · 카드 · 입력) ─────────────────────────── */
html.dark :is(.hs-gnb, .dc-header, .dc-nav-bar, .m-topbar, #mTopbar, .app-mobile-topbar, .page-topbar, .topbar, .m-tabbar, #mTabbar, .m2-tabbar, .dc-footer, footer.dc-footer) {
  background: var(--header-bg) !important; border-color: var(--border) !important; color: var(--text) !important;
}
html.dark :is(.card, .unified-card, .board-card, .settings-section, .sidebar-panel, .hs-card, .bm-card, .bm-sidebar, .bm-empty, .wt-card, .qa-card, .mh-card, .dc-sidebar, .dc-main .dc-post-table-wrap, .board-v2-channel-header, .dc-join-cta, .dc-guest-purpose-hero, .dc-board-titlebar, .post-card, .m-feed-card, .m2-feed-card, .cb-panel, .cb-preview-card, .notif-card, .shop-wrap .box-tile, .faq-item, .help-item, .lp-faq-list details, .terms-body, .chat-hub-shell .chat-card) {
  background-color: var(--bg-card) !important; border-color: var(--border) !important; color: var(--text);
}
html.dark :is(input, textarea, select):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]) {
  background-color: var(--bg-2) !important; color: var(--text) !important; border-color: var(--border) !important;
}
html.dark ::placeholder { color: var(--text-3) !important; }
html.dark :is(.btn-ghost, .btn-secondary, .sort-tab, .explore-tab, .tab-item, .chip, .pill):not(.active):not(.is-active):not([aria-selected="true"]) {
  background-color: var(--bg-2) !important; color: var(--text-2) !important; border-color: var(--border) !important;
}
html.dark :is(.qa-card-title, .mh-card-title, .wt-title, .bm-post-title, .board-card-name, .dc-post-title-link:not(:visited)) { color: var(--text) !important; }
html.dark :is(.qa-card-link, .mh-card, .wt-card, .bm-card) { color: var(--text) !important; }
html.dark :is(table, th, td) { border-color: var(--border) !important; }
html.dark th { background: var(--bg-2) !important; color: var(--text-2) !important; }
html.dark hr { border-color: var(--border) !important; }
html.dark a:not([class]):not([style*="background"]) { color: var(--accent-text); }

/* ── 페이지마다 박아 둔 밝은 배경 · 진한 글자 덮기(인라인 style) ─────────── */
html.dark :is([style*="background:#fff"], [style*="background: #fff"], [style*="background:#FFF"], [style*="background:white"], [style*="background: white"],
  [style*="background-color:#fff"], [style*="background-color: #fff"], [style*="background:#fef"], [style*="background:#fdf"], [style*="background:#fcf"],
  [style*="background:#f9f"], [style*="background:#f8f"], [style*="background:#f7f"], [style*="background:#f6f"], [style*="background:#f5f"],
  [style*="background:#f3f"], [style*="background:#f0f"], [style*="background:#ecf"], [style*="background:#eef"], [style*="background:#fff8"],
  [style*="background:#fef3c7"], [style*="background:#fffbeb"], [style*="background:#fff7ed"], [style*="background:#fffaf6"], [style*="background:#fffdfa"],
  [style*="background:var(--bg-card,#fff)"], [style*="background:#fafafa"], [style*="background:#f4f4f5"])
  :not(img):not(video):not(iframe):not(ins):not(canvas):not(svg) {
  background-color: var(--bg-card) !important; background-image: none !important; border-color: var(--border) !important;
}
html.dark :is([style*="color:#111"], [style*="color: #111"], [style*="color:#1a1a1a"], [style*="color:#1f160e"], [style*="color:#222"], [style*="color: #222"],
  [style*="color:#2e2117"], [style*="color:#333"], [style*="color: #333"], [style*="color:#3a2a20"], [style*="color:#374151"], [style*="color:#1e2b4a"],
  [style*="color:#0f172a"], [style*="color:#1e293b"], [style*="color:#000"], [style*="color: #000"], [style*="color:black"]) {
  color: var(--text) !important;
}
html.dark :is([style*="color:#555"], [style*="color:#666"], [style*="color:#6b5648"], [style*="color:#6b7280"], [style*="color:#64748b"], [style*="color:#777"]) {
  color: var(--text-2) !important;
}
html.dark [style*="border:1px solid #"]:not(img) { border-color: var(--border) !important; }

/* ── 로고: 검은 글씨 로고는 뒤집어 보이게 ───────────────────────────── */
html.dark :is(img[src*="logo-black"], img[src*="logo-hansaeng"], img[src*="logo-full"], .hs-gnb-logo img, .dc-header-logo img) { filter: invert(1) hue-rotate(180deg) brightness(1.05); }

/* ── 폰 홈 묻고 답하기 · 첫 의견 · 안내 띠 ───────────────────────────── */
html.dark .qa-ask { background: var(--bg-card) !important; box-shadow: none !important; }
html.dark .qa-tabs { background: var(--bg) !important; }
html.dark .qa-tab[aria-selected="true"] { background: var(--bg-3) !important; color: var(--text) !important; }
html.dark .mh-waiting, html.dark .dc-guest-banner, html.dark .pwa-install-top { background: var(--bg-2) !important; border-color: var(--border) !important; color: var(--text) !important; }
html.dark .hs-today-bar { background: var(--bg-2) !important; color: var(--text-2) !important; }

/* ── 광고 · 그림은 그대로 ────────────────────────────────────────────── */
html.dark :is(ins.kakao_ad_area, .adfit-wrap iframe, iframe[src*="googlesyndication"]) { filter: none !important; }

/* ── 2차 점검(2026-11-14): 남은 밝은 칸 · 주황 위 주황 글자 ───────────── */
html.dark :is(.stab, .settings-tabs a, .m-compose-topbar, .m-compose-actionbar, form.kcmt-bar, .kcmt-bar, .hero-image, .hs-route-step, .hero, .m-guest-comment-sheet, .guest-toast) {
  background-color: var(--bg-2) !important; border-color: var(--border) !important; color: var(--text) !important;
}
html.dark :is(.stab.active, .stab[aria-current="page"]) { background-color: var(--accent-light) !important; color: var(--accent-text) !important; }
html.dark :is(.btn-primary, .guest-toast-btn, .shop-tab.active, .m-compose-submit, .qa-ask-go, .cb-submit, a[style*="background:var(--accent)"], a[style*="background: var(--accent)"], button[style*="background:var(--accent)"]) {
  color: #fff !important;
}
html.dark .m-compose-topbar-title, html.dark .m-compose-action-btn { color: var(--text) !important; }
html.dark span[style*="background:var(--accent)"], html.dark span[style*="background: var(--accent)"] { color: #1d120b !important; }
