/* Shared header and theme picker. Colors come from the active theme's tokens. */
.header-tools { display: flex; align-items: center; gap: 24px; margin-left: auto; flex: 0 0 auto; }
.header-tools .header-note { margin-left: 0; white-space: nowrap; }
.theme-picker { position: relative; z-index: 15; }
.theme-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; width: 142px; padding: 10px 13px; color: var(--ink); background: var(--background); border: 1px solid var(--line); border-radius: 5px; font-size: 12px; transition: border-color .16s, background .16s; }
.theme-trigger:hover, .theme-trigger[aria-expanded="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--background)); }
.theme-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-icon { width: 16px; height: 16px; color: var(--accent); }
.theme-chevron { width: 12px; height: 12px; color: var(--muted); transition: transform .16s; }
.theme-trigger[aria-expanded="true"] .theme-chevron { transform: rotate(180deg); }
.theme-panel { position: absolute; top: calc(100% + 12px); right: 0; width: min(348px, calc(100vw - 48px)); max-height: min(520px, calc(100dvh - 100px)); overflow-y: auto; overscroll-behavior: contain; padding: 17px 13px 12px; color: var(--ink); background: var(--background); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 18px 60px #0006, 0 3px 10px #0003; }
.theme-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 14px; font-size: 13px; font-weight: 600; }
.theme-panel-index { font: 8px/1.5 var(--mono-font); letter-spacing: .12em; color: var(--muted); }
.theme-options { display: grid; gap: 8px; }
.theme-choice { display: grid; grid-template-columns: 78px minmax(0, 1fr) 32px; align-items: center; gap: 12px; width: 100%; min-height: 84px; padding: 9px; border: 1px solid var(--line); border-radius: 5px; text-align: left; background: transparent; color: var(--ink); transition: border-color .16s, background .16s; }
.theme-choice:hover { background: color-mix(in srgb, var(--accent) 5%, var(--background)); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.theme-choice[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 9%, var(--background)); border-color: var(--accent); }
.theme-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.theme-preview { width: 78px; height: 62px; object-fit: cover; border-radius: 3px; background: var(--line); }
.theme-choice-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.theme-choice-copy strong { font-size: 13px; line-height: 1.4; font-weight: 600; }
.theme-choice-copy > span { font-size: 10px; line-height: 1.6; color: var(--muted); }
.theme-choice-state { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.theme-choice[aria-pressed="true"] .theme-choice-state { color: var(--accent); }
.theme-choice[aria-pressed="true"] .theme-choice-state::before { content: "✓"; font: 15px/1 var(--body-font); }
.theme-panel-note { margin: 12px 4px 0; padding-top: 11px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
@media (max-width: 1200px) {
  .header-inner { gap: 34px; }
  .header-tools { gap: 18px; }
  .header-tools .header-note { display: none; }
}
@media (max-width: 800px) {
  .header-inner { gap: 22px; }
  .main-nav { margin-left: 0; gap: 24px; }
}
@media (max-width: 600px) {
  .header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: auto; column-gap: 10px; row-gap: 7px; padding-top: 13px; }
  .brand { gap: 8px; min-width: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 16px; letter-spacing: 0; white-space: nowrap; }
  .header-tools { grid-column: 2; grid-row: 1; margin-left: 0; }
  .theme-trigger { width: 126px; padding-inline: 10px; gap: 8px; font-size: 11px; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; min-height: 44px; margin: 0; gap: 26px; }
  .main-nav a, .main-nav button { min-height: 44px; }
  .nav-library::after { bottom: 0; }
  .theme-choice { grid-template-columns: 64px minmax(0, 1fr) 30px; gap: 8px; }
  .theme-preview { width: 64px; height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-trigger, .theme-chevron, .theme-choice { transition: none; }
}
