/* Theme and header controls. Loaded after page-specific styles. */
.header-actions{display:flex;align-items:center;gap:9px;margin-left:auto;white-space:nowrap}
.header-actions .my-links{margin-left:0}
.theme-toggle{display:grid;place-items:center;flex:none;width:54px;height:44px;padding:0;border:0;border-radius:24px;background:transparent;color:var(--text);cursor:pointer}
.theme-track{position:relative;display:block;width:47px;height:25px;border:1px solid #cbd4dd;border-radius:20px;background:#e8edf2;box-shadow:inset 0 1px 2px #142b4518}
.theme-thumb{position:absolute;left:2px;top:2px;display:grid;place-items:center;width:19px;height:19px;border-radius:50%;background:#fff;color:#c48618;font-size:14px;line-height:1;box-shadow:0 1px 3px #142b4538;transition:left .18s ease}
.theme-toggle:hover .theme-track{border-color:#8193a6;background:#dce6ee}
.theme-toggle:focus-visible{outline:3px solid #ef754d;outline-offset:3px}
@media(max-width:600px){
  .header-inner{column-gap:8px}
  .header-actions{gap:7px}
  .theme-toggle{width:49px;height:44px}
  .page-tools{position:fixed;top:auto;bottom:calc(12px + env(safe-area-inset-bottom));left:0;right:0;width:106px;min-height:52px;margin-inline:auto;padding:6px 9px;gap:6px;border:1px solid #dbe2e9;border-radius:999px;background:#fff;box-shadow:0 6px 22px #11162038;justify-content:center}
  .page-tools .page-tool:not(.page-tool-top){width:40px;height:38px;border:0;background:transparent;color:#576477;box-shadow:none;font-size:15px}
  .page-tools .page-tool:not(.page-tool-top):hover,.page-tools .page-tool[aria-expanded=true]{background:#e9eef3;color:#172e47}
  .page-tools .page-tool svg{width:18px;height:18px}
  .page-tool-top{position:fixed;right:14px;bottom:calc(14px + env(safe-area-inset-bottom));left:auto;width:42px;height:40px;border:1px solid #fff;background:#fff;color:#142b45;box-shadow:0 4px 14px #11162038}
  .font-size-options{top:auto;bottom:calc(100% + 10px);left:-46px;right:auto;display:flex;align-items:center;gap:2px;width:max-content;min-width:0;padding:4px 6px;border-radius:999px;box-shadow:0 6px 20px #14171d29}
  .font-size-options button{width:auto;padding:4px 7px;font-size:0;line-height:1;border-radius:50%;color:#617083}
  .font-size-options button::before{content:'가';display:block;font-size:13px;line-height:1.5}
  .font-size-options button:nth-child(2)::before{font-size:15px}
  .font-size-options button:nth-child(3)::before{font-size:17px}
  .font-size-options button:nth-child(4)::before{font-size:19px}
  .font-size-options button[aria-checked=true]{background:transparent;color:#c94d38}
  footer{padding-bottom:calc(100px + env(safe-area-inset-bottom))}
}
@media(max-width:360px){
  .header-inner{padding-inline:12px}
  .brand{font-size:calc(18px * var(--reader-scale,1))}
  .brand-icon{width:34px;height:34px}
  .header-actions{gap:5px}
  .header-actions .my-links{padding:8px 10px}
  .site-card h3 span{display:none}
}

html[data-theme="dark"]{color-scheme:dark;--text:#eef3f8;--muted:#d9e3ed;--line:#34495d;--paper:#182633;--pale:#1d2c3a;color:var(--text);background:#101923}
html[data-theme="dark"] .theme-track{background:#36516a;border-color:#607b94}
html[data-theme="dark"] .theme-thumb{left:24px;background:#172535;color:#e7edff}
html[data-theme="dark"] body,html[data-theme="dark"] main{background:#101923;color:var(--text)}
html[data-theme="dark"] :is(.header,footer,.page-tools){background:#14212d;color:var(--text);border-color:var(--line)}
html[data-theme="dark"] :is(.theme-toggle,.my-links,.hero-search,.hub-hero .hero-search,.compact-search,.filters button,.situation-tabs button,.launchpad>a,.task-grid,.task-grid>a,.category-grid>a,.site-card,.purpose-card,.service-map-card,.bookmark-card,.bookmark-filters input,.bookmark-filters select,.bookmark-filters button,.bookmark-download button,.font-size-options,.page-tool,.share-fallback,.share-fallback input,.article-related>div>a,.hub-read-card,.hub-flow-links>a){background:#1b2b39;color:var(--text);border-color:var(--line)}
html[data-theme="dark"] :is(.hero,.hub-hero,.hub-overview,.home-editorial,.home-category-nav a,.guide-grid>a,.guide-grid>a:nth-child(2),.article-toc,.article-related,.article-related>div>a,.health-flow>div,.health-case thead,.empty,.detail-body aside,.bookmark-filters,.bookmark-card:has(input:checked),.status-info,.situation-panel .task-grid,.situation-directory .task-grid,.hub-read-card,.hub-flow-links>a,.purpose-card a,.service-map,.hub-count){background:#1b2b39;color:var(--text);border-color:var(--line)}
html[data-theme="dark"] :is(.situation-panel .task-grid>a,.situation-directory .task-grid>a){background:#1b2b39;color:var(--text)}
html[data-theme="dark"] .hub-hero{background:radial-gradient(ellipse at 90% 0,#233c51 0,transparent 45%),#172738}
html[data-theme="dark"] :is(.hero-search input,.compact-search input,.bookmark-filters input,.bookmark-filters select,.share-fallback input){color:var(--text);background:#14212d}
html[data-theme="dark"] :is(.button.light,.utility-banner .button){background:#263c50;color:var(--text);border-color:#54708a}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#c8d5e1;opacity:1}
html[data-theme="dark"] .breadcrumbs [aria-current=page]{color:var(--text)}
html[data-theme="dark"] :is(.prose a,.detail-body article a,.bookmark-hero a){color:#ffad87}
html[data-theme="dark"] :is(.header nav a[aria-current=page],.prose h2,.hero-foot b,.shortcut-mark,.button.light,.utility-banner .button){color:var(--text)}
html[data-theme="dark"] :is(.site-card,.category-grid>a,.task-grid>a,.guide-grid>a,.bookmark-card,.hub-read-card,.purpose-card,.home-story,.home-questions details,.hub-questions details,.service-map-card,.health-flow>div,.article-related,.article-toc){border-color:var(--line)}
html[data-theme="dark"] :is(.category-grid>a:hover,.task-grid>a:hover,.site-card .save:hover,.purpose-card a:hover,.hub-flow-links>a:hover,.home-category-nav a:hover,.page-tool:hover,.theme-toggle:hover,.font-size-options button:hover,.font-size-options button:focus-visible){background:#294056;color:var(--text)}
html[data-theme="dark"] :is(.home-category-nav a[aria-current=true],.filters button[aria-pressed=true],.situation-tabs button[aria-pressed=true],.font-size-options button[aria-checked=true]){background:#315270;color:#fff;border-color:#54708a}
html[data-theme="dark"] :is(.page-tool-share,.page-tool-share:hover,.hero-search button,.hub-hero .hero-search button,.share-fallback button,.bookmark-download,.health-downloads a:first-child){background:#315270;color:#fff;border-color:#54708a}
html[data-theme="dark"] .page-tool-top{background:#1b2b39;color:var(--text)}
html[data-theme="dark"] .font-size-options{box-shadow:0 12px 28px #0008}
html[data-theme="dark"] .utility-banner{background:#1d354e;color:#eef3f8}
html[data-theme="dark"] .utility-banner :is(p,span){color:#e0eaf3}
html[data-theme="dark"] .feature{background:#19334f;color:#eef3f8}
html[data-theme="dark"] .bookmark-download :is(span,p){color:#eef3f8}
html[data-theme="dark"] .bookmark-download button:first-of-type{background:#e67750;color:#101923}
html[data-theme="dark"] .health-case pre{background:#13212f;color:#f6f8fa}
html[data-theme="dark"] .link-status[data-state=ok] summary{color:#81d6a8}
html[data-theme="dark"] :is(.green,.story-kicker,.hub-overview .eyebrow){color:#9ed6ad}
html[data-theme="dark"] .blue{color:#a9c5ff}
html[data-theme="dark"] .violet{color:#c4b7fa}
html[data-theme="dark"] .orange{color:#f4b27d}
html[data-theme="dark"] :is(.green,.blue,.violet,.orange){background:#26394b}
html[data-theme="dark"] .brand-icon{color:#fff;background:#142b45}
html[data-theme="dark"] .share-fallback::backdrop{background:#030a10b8}
html[data-theme="dark"] #toast{background:#315270;color:#fff}
html[data-theme="dark"] :is(.home-reading-steps p a,.bookmark-card>a,.breadcrumbs a:hover,.bookmark-hero a,.map-source a,.map-method a,.map-checklist a,.article-citations a,.article-related a,.site-usage a,.bookmark-help a,.hub-jumps>a:not(.hub-jump-primary)){color:#ffb38f}
html[data-theme="dark"] :is(.hub-step,.hub-check-list article>span,.service-map-card .map-task,.home-reading-steps article>span){color:#f2ba91}
html[data-theme="dark"] :is(.hub-intro h1 em,.home-story h3 a:hover,.home-reading a:hover,.hub-read-card:hover h3){color:#ffb38f}
html[data-theme="dark"] :is(.home-story h3 a,.home-reading a,.hub-read-card h3,.hub-flow-links>a,.home-category-nav a,.site-card a,.category-grid>a,.task-grid>a,footer a){color:var(--text)}
html[data-theme="dark"] :is(.home-story h3 a:hover,.home-story h3 a:focus-visible,.home-reading a:hover,.home-reading a:focus-visible,.hub-read-card:hover h3){color:#ffb38f}
@media(max-width:600px){
  html[data-theme="dark"] .page-tools{background:#161b24;border-color:#2a313e;box-shadow:0 6px 22px #11162038}
  html[data-theme="dark"] .page-tools .page-tool:not(.page-tool-top){background:transparent;color:#a9b1bf}
  html[data-theme="dark"] .page-tools .page-tool[aria-expanded=true]{background:#111620;color:#fff}
  html[data-theme="dark"] .page-tool-top{background:#161b24;color:#eef3f8;border-color:#7c8da0}
  html[data-theme="dark"] .page-tools .font-tools .font-size-options{background:#161b24;border-color:#2a313e;box-shadow:0 6px 20px #14171d29}
  html[data-theme="dark"] .font-size-options button{background:transparent;color:#a9b1bf}
  html[data-theme="dark"] .font-size-options button:is([aria-checked=true],:focus-visible){background:transparent;color:#ff846b}
}
@media print{.theme-toggle{display:none!important}}

/* Search uses a single neutral focus ring around the field, including keyboard focus. */
:is(.hero-search,.compact-search):focus-within{border-color:#52677c;box-shadow:0 0 0 2px #52677c66}
:is(.hero-search,.compact-search) input:focus-visible{outline:none}
html[data-theme="dark"] :is(.hero-search,.compact-search):focus-within{border-color:#91acc5;box-shadow:0 0 0 2px #91acc566}

/* A server response is distinct from verified page access. */
.link-status[data-state=responding] .status-dot{background:#326a9a}
.link-status[data-state=responding] summary{color:#285b82}
html[data-theme="dark"] .link-status[data-state=responding] .status-dot{background:#94cafa}
html[data-theme="dark"] .link-status[data-state=responding] summary{color:#b5dbfc}
