.theme-picker:not([hidden]) {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 4px;
  min-height: 44px;
  padding-inline: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--purple-deep);
  background: var(--lilac);
}
.theme-picker .icon { width: 16px; height: 16px; }
.theme-picker select {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .83rem;
  font-weight: 750;
  cursor: pointer;
}
.theme-picker option { background: var(--paper); color: var(--ink); }
.theme-picker select:focus-visible { outline-offset: 1px; }
.login-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-head .admin-head-tools { justify-content: flex-end; margin-block-end: 0; }
.mobile-nav .theme-picker:not([hidden]) { display: none; }

@media (max-width: 800px) {
  .site-header { grid-template-columns: minmax(0, 1fr) auto; }
  .site-header .theme-picker .icon { display: none; }
}
@media (max-width: 405px) {
  .header-tools > .theme-picker:not([hidden]) { display: none; }
  .mobile-nav .theme-picker:not([hidden]) { display: flex; justify-content: space-between; margin: 5px 8px 0; padding-inline-start: 12px; }
  .mobile-nav .theme-picker span { font-size: .87rem; font-weight: 750; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #17131e;
  --paper: #25202e;
  --ink: #f6edf9;
  --muted: #c9bbd1;
  --purple: #d8b0f0;
  --purple-deep: #f0d8fa;
  --lilac: #392b49;
  --line: #4e3e5e;
  --orange: #ffad8a;
  --orange-dark: #862c16;
  --shadow: 0 12px 32px #09060d50;
  --theme-field: #1e1927;
  --theme-hover: #493657;
  --theme-raised: linear-gradient(145deg, #30243b, #28202f 68%, #32232c);
  --theme-action: #a83a1e;
  --theme-danger: #ffb3a3;
  --theme-success: #b7e8c5;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 65rem 40rem at 97% -15rem, #38294b 0%, transparent 94%),
    radial-gradient(ellipse 45rem 30rem at 12% 24rem, #2f2038 0%, transparent 90%),
    var(--canvas);
}
:root[data-theme="dark"] :focus-visible { outline-color: var(--purple); }
:root[data-theme="dark"] :is(.site-header, .secondary, .hero-feature, .hero-platforms, .hero-motion, .footer-search, .admin-sidebar) {
  background: var(--paper);
  border-color: var(--line);
}
:root[data-theme="dark"] .site-header { box-shadow: var(--shadow); }
:root[data-theme="dark"] :is(.search-trigger, .icon-button, .product-meta bdi, .moments-controls, .faq-help, .contact-note, .reading-time, .article-outline, .customer-nav, .admin-stats a:nth-child(2)) {
  background: var(--lilac);
  border-color: var(--line);
}
:root[data-theme="dark"] :is(.primary, .shop-cart-count) { background: var(--theme-action); }
:root[data-theme="dark"] .primary:hover { background: var(--orange-dark); }
:root[data-theme="dark"] .hero-stage { border-color: var(--line); box-shadow: 0 18px 38px #08050c73; }
:root[data-theme="dark"] :is(.product-bottom, .guide details, .guide details:first-child, .footer-bottom, .empty-state) { border-color: var(--line); }
:root[data-theme="dark"] :is(.site-footer, .guide, .moments-frame, .home-buying, .shop-page-hero, .content-hero, .story-aside, .editorial-contact .contact-note, .faq-resource, .featured-story, .cover-fallback) {
  background: var(--theme-raised);
  border-color: var(--line);
}
:root[data-theme="dark"] .editorial-hero:not(.editorial-hero-about, .editorial-hero-faq) {
  background: var(--theme-raised);
  border-color: var(--line);
}
:root[data-theme="dark"] .moments-media { background: var(--lilac); }
:root[data-theme="dark"] .category { --category-bg: #3a2c4a; --category-fg: #e5bdf7; }
:root[data-theme="dark"] .category-pc { --category-bg: #342e52; --category-fg: #d8cdfb; }
:root[data-theme="dark"] .category-store { --category-bg: #4a302e; --category-fg: #ffc6ab; }
:root[data-theme="dark"] .category-ingame { --category-bg: #4b3045; --category-fg: #ffc6e9; }
:root[data-theme="dark"] :is(.search-form input, .faq-search-input input, .field-stack input, .field-stack textarea)::placeholder { color: var(--muted); }
:root[data-theme="dark"] :is(.field-stack :is(input:not([type="checkbox"], [type="radio"]), textarea, select), .admin-tools select, .faq-search-input, .cart-update input, .code-set code) {
  background: var(--theme-field);
  border-color: var(--line);
}
:root[data-theme="dark"] :is(.field-stack .variant-choice, .content-icon, .editorial-mark, .editorial-chips button, .delivery-codes, .shop-demo, .faq-item summary:hover, .faq-item[open] summary, .admin-sidebar nav a:hover, .admin-signout button:hover) {
  background: var(--lilac);
  border-color: var(--line);
}
:root[data-theme="dark"] :is(.field-stack .variant-choice:has(:checked), .admin-sidebar nav a[aria-current]) {
  background: var(--theme-hover);
  border-color: var(--purple);
}
:root[data-theme="dark"] .field-stack .variant-choice:has(:disabled) { background: var(--theme-field); }
:root[data-theme="dark"] .login-card { background: var(--theme-raised); border-color: var(--line); box-shadow: var(--shadow); }
:root[data-theme="dark"] .login-card .content-icon { border-color: var(--line); }
:root[data-theme="dark"] .notice { background: var(--lilac); border-color: var(--line); color: var(--ink); }
:root[data-theme="dark"] :is(.status-badge, .shop-stock, .shop-sample) { background: var(--lilac); color: var(--muted); }
:root[data-theme="dark"] :is(.notice-success, .shop-stock.is-available, .status-paid, .pill.is-live) { background: #233c34; border-color: #476251; color: var(--theme-success); }
:root[data-theme="dark"] .status-pending { background: #493823; color: #ffdc9e; }
:root[data-theme="dark"] .notice-error { background: #4c2c31; border-color: #77434c; color: var(--theme-danger); }
:root[data-theme="dark"] :is(.status-expired, .status-canceled, .danger-link) { color: var(--theme-danger); }
:root[data-theme="dark"] .shop-unavailable { color: var(--theme-danger) !important; }
:root[data-theme="dark"] :is(.secondary, .search-trigger, .icon-button, .hero-feature, .hero-motion, .search-form button, .moments-controls button, .editorial-chips button, .shop-order-link):hover {
  background: var(--theme-hover);
}
:root[data-theme="dark"] :is(.moments-controls button, .editorial-chips button)[aria-pressed="true"] {
  background: var(--purple);
  color: var(--canvas);
}
