/* 도화서원 다크 테마 (2026-11-08) — html[data-theme="dark"] 일 때만 적용.
   공통 화면(머리말·하단 메뉴·홈·목록·검색·후기·컬렉션·환경설정·바닥글)을 덮는다.
   상품 몰입 화면(타로·사주 진행)은 자체 배경을 유지한다. */
html[data-theme="dark"]{
  color-scheme:dark;
  --ink:#e9e9f2;
  --muted:#a3a6b8;
  --line:#2c3045;
  --navy:#c9cdf0;
  --dk-bg:#0f111b;
  --dk-surface:#181b29;
  --dk-surface-2:#20243a;
  --dk-line:#2c3045;
  --dk-text:#e9e9f2;
  --dk-muted:#a3a6b8;
}
html[data-theme="dark"] body{background:var(--dk-bg);color:var(--dk-text)}
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] main.collection-page{background:var(--dk-bg);color:var(--dk-text)}

/* 머리말 · 카테고리 · 하단 메뉴 · 바닥글 */
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .category-nav{background:var(--dk-bg);color:var(--dk-text);border-color:var(--dk-line)}
html[data-theme="dark"] .site-header .brand img{filter:invert(1) hue-rotate(180deg) saturate(1.2);mix-blend-mode:screen}
html[data-theme="dark"] .category-nav a{color:var(--dk-muted)}
html[data-theme="dark"] .category-nav a[aria-current],html[data-theme="dark"] .category-nav .is-active{color:var(--dk-text)}
html[data-theme="dark"] .bottom-nav{background:rgba(17,19,31,.94);color:var(--dk-text);border-color:var(--dk-line)}
html[data-theme="dark"] .bottom-nav a{color:var(--dk-muted)}
html[data-theme="dark"] .bottom-nav a[aria-current]{color:var(--dk-text)}
html[data-theme="dark"] .site-footer{background:#0c0e17;color:var(--dk-muted);border-color:var(--dk-line)}
html[data-theme="dark"] .site-footer a{color:var(--dk-muted)}
html[data-theme="dark"] .pwa-install-banner{background:var(--dk-surface-2);color:var(--dk-text);border-color:var(--dk-line)}
html[data-theme="dark"] .pwa-install-primary,html[data-theme="dark"] .pwa-setting-button{background:#e9e9f2;color:#151729;border-color:#e9e9f2}

/* 공통 글자 */
html[data-theme="dark"] .app-shell :is(h1,h2,h3,h4,strong):not(.home-fortune-banner *){color:var(--dk-text)}
html[data-theme="dark"] .app-shell :is(p,small,.section-eyebrow):not(.home-fortune-banner *){color:var(--dk-muted)}
html[data-theme="dark"] .app-shell .more-link{color:var(--dk-muted)}

/* 홈 */
html[data-theme="dark"] .quick-menu{background:var(--dk-bg)!important}
html[data-theme="dark"] .quick-item>span:last-child{color:var(--dk-muted)!important}
html[data-theme="dark"] .quick-item{color:var(--dk-text)}
html[data-theme="dark"] .quick-item .quick-icon{background:var(--dk-surface-2)}
html[data-theme="dark"] .quick-item.rose,html[data-theme="dark"] .quick-item.cream,html[data-theme="dark"] .quick-item.blue,html[data-theme="dark"] .quick-item.lilac{background:var(--dk-surface)}
html[data-theme="dark"] .ranking-item a,html[data-theme="dark"] .ranking-item{color:var(--dk-text);border-color:var(--dk-line)}
html[data-theme="dark"] .ranking-item.is-placeholder{background:var(--dk-surface)}
html[data-theme="dark"] .dohwa-product-card{background:var(--dk-surface);color:var(--dk-text);border-color:var(--dk-line)}
html[data-theme="dark"] .home-pending-dialog{background:var(--dk-surface);color:var(--dk-text)}

/* 카드형 목록 · 후기 · 컬렉션 · 아카이브 */
html[data-theme="dark"] .review-card,
html[data-theme="dark"] .collection-card,
html[data-theme="dark"] .catalog-search,
html[data-theme="dark"] .archive-search,
html[data-theme="dark"] .reviews-tabs,
html[data-theme="dark"] .empty-reviews,
html[data-theme="dark"] .product-placeholder,
html[data-theme="dark"] .product-placeholder *{background:var(--dk-surface)!important;color:var(--dk-text);border-color:var(--dk-line)!important}
html[data-theme="dark"] .collection-card.is-preview{background:var(--dk-surface-2)!important}
html[data-theme="dark"] .collection-guidance,
html[data-theme="dark"] .collection-activity-help{background:#231f1a;color:#e6dccd}
html[data-theme="dark"] .ui-image-pending{background:var(--dk-surface-2)}

/* 폼 요소 */
html[data-theme="dark"] .app-shell :is(input:not([type=checkbox]):not([type=radio]),select,textarea){background:var(--dk-surface-2);color:var(--dk-text);border-color:#3a3f58}
html[data-theme="dark"] .app-shell :is(input,textarea)::placeholder{color:#7f8399}

/* 환경설정 */
html[data-theme="dark"] .setting-card{background:var(--dk-surface);color:var(--dk-text);border-color:var(--dk-line)}
html[data-theme="dark"] .setting-section-icon{background:var(--dk-surface-2);color:var(--dk-text)}
html[data-theme="dark"] .setting-font-preview{background:var(--dk-surface-2);border-color:var(--dk-line)}
html[data-theme="dark"] .setting-reset{background:var(--dk-surface);color:var(--dk-text);border-color:var(--dk-line)}
html[data-theme="dark"] .setting-switch{background:#3a3f58}

/* 메뉴(드로어) */
html[data-theme="dark"] :is(.drawer,.site-drawer,.drawer-panel){background:var(--dk-surface);color:var(--dk-text)}
html[data-theme="dark"] :is(.drawer,.site-drawer,.drawer-panel) a{color:var(--dk-text)}

/* 테마 선택 UI (밝은 테마에서도 사용) */
.setting-theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:4px 0 0;padding:0;border:0}
.setting-theme-options legend{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.setting-theme-option{position:relative;display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 6px 10px;border:1.5px solid #e2dde9;border-radius:14px;background:#fff;cursor:pointer;font-size:13px;font-weight:600;color:#191b30;text-align:center}
.setting-theme-option input{position:absolute;opacity:0;pointer-events:none}
.setting-theme-option:has(input:checked){border-color:#191b37;box-shadow:0 0 0 3px #191b3714}
.setting-theme-option:has(input:focus-visible){outline:3px solid #6f8ba6;outline-offset:2px}
.setting-theme-swatch{display:block;width:44px;height:30px;border-radius:8px;border:1px solid #d9d6e2;background:linear-gradient(#fff 0 40%,#eff0f4 40%)}
.setting-theme-swatch.is-dark{background:linear-gradient(#20243a 0 40%,#0f111b 40%);border-color:#2c3045}
.setting-theme-swatch.is-system{background:linear-gradient(90deg,#fff 0 50%,#0f111b 50%)}
html[data-theme="dark"] .setting-theme-option{background:var(--dk-surface-2);border-color:#3a3f58;color:var(--dk-text)}
html[data-theme="dark"] .setting-theme-option:has(input:checked){border-color:#c9cdf0;box-shadow:0 0 0 3px #c9cdf024}

/* 바닥글 로고: 머리말 로고와 같은 방식으로 반전 */
html[data-theme="dark"] .footer-brand img{filter:invert(1) hue-rotate(180deg) saturate(1.2);mix-blend-mode:screen}

/* 마우스를 올렸을 때(호버): 밝은 배경 대신 한 단계 밝은 어두운 면 */
html[data-theme="dark"] :is(.icon-button,.category-tab,.drawer-close,.catalog-search button,.promo-footer button,.setting-reset,.policy-toc a,.source-actions a,.inbox-menu-panel a,.inbox-menu-panel button,.ai-chat-answers button):hover,
html[data-theme="dark"] :is(.bottom-nav>a,.bottom-nav>button):hover,
html[data-theme="dark"] .ranking-item:hover,
html[data-theme="dark"] .inbox-thread:not(.is-unread):hover{background:var(--dk-surface-2)!important;color:var(--dk-text)}
html[data-theme="dark"] .drawer-nav-link:hover{background:var(--dk-surface-2)!important;color:#d9c4ec}
html[data-theme="dark"] .collection-card:hover{background:var(--dk-surface-2)!important;border-color:#4a4f6b!important}
html[data-theme="dark"] .category-tab[aria-current],html[data-theme="dark"] .category-tab.is-active{background:#c9cdf0;color:#151729}
html[data-theme="dark"] :is(a,button):focus-visible{outline-color:#c9cdf0}