html[data-theme="dark"] {
  color-scheme: dark;
}
html[data-theme="light"] {
  color-scheme: light;
}
[data-theme-control] {
  --theme-ink: #b9c9e2;
  --theme-soft: #91a4c0;
  --theme-line: #b9ceee26;
  --theme-hover: #abc6ff0c;
  --theme-selected: #a9c0ff18;
  --theme-surface: #141f30;
  --theme-shadow: #0004;
  position: relative;
  flex: 0 0 auto;
}
html[data-theme="light"] [data-theme-control] {
  --theme-ink: #34476a;
  --theme-soft: #5d708d;
  --theme-line: #d5deed;
  --theme-hover: #edf2fa;
  --theme-selected: #e9eefd;
  --theme-surface: #fff;
  --theme-shadow: #223e6220;
}
.theme-switch {
  position: relative;
}
.theme-direct {
  display:grid;place-items:center;min-width:44px;min-height:44px;padding:8px;
  border:1px solid transparent;border-radius:11px;background:transparent;
  color:var(--theme-ink);cursor:pointer;box-shadow:none;
}
.theme-direct:hover { background:var(--theme-hover);border-color:var(--theme-line); }
.theme-direct:focus-visible { outline:2px solid #6484e9;outline-offset:3px; }
.theme-switch summary {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  color: var(--theme-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
}
.theme-switch summary::-webkit-details-marker {
  display: none;
}
.theme-switch summary:hover,
.theme-switch[open] summary {
  border-color: var(--theme-line);
  background: var(--theme-hover);
}
[data-theme-control] svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}
.theme-switch summary svg {
  display: none;
}
html[data-theme-preference="light"]
  .theme-switch
  summary
  [data-theme-symbol="light"],
html[data-theme-preference="dark"]
  .theme-switch
  summary
  [data-theme-symbol="dark"],
html[data-theme-preference="system"]
  .theme-switch
  summary
  [data-theme-symbol="system"] {
  display: block;
}
.theme-options {
  position: absolute;
  z-index: 65;
  top: calc(100% + 12px);
  right: 0;
  width: 172px;
  padding: 6px;
  border: 1px solid var(--theme-line);
  border-radius: 12px;
  background: var(--theme-surface);
  box-shadow: 0 14px 36px var(--theme-shadow);
}
.theme-options button,
.theme-segment button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--theme-soft);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  box-shadow: none;
}
.theme-options button:hover,
.theme-segment button:hover {
  background: var(--theme-hover);
  color: var(--theme-ink);
}
.theme-options button[aria-pressed="true"],
.theme-segment button[aria-pressed="true"] {
  color: var(--theme-ink);
  background: var(--theme-selected);
  border-color: var(--theme-line);
}
.theme-switch summary:focus-visible,
.theme-options button:focus-visible,
.theme-segment button:focus-visible {
  outline: 2px solid #6484e9;
  outline-offset: 3px;
}
.theme-label {
  display: block;
  font-size: 11px;
  color: var(--theme-soft);
  margin-bottom: 9px;
}
.theme-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--theme-line);
  border-radius: 8px;
}
.theme-segment button {
  justify-content: center;
  gap: 6px;
  padding: 7px 4px;
  min-height: 38px;
  font-size: 11px;
}
.theme-segment svg {
  width: 15px;
  height: 15px;
}
.theme-segment button[data-theme-choice="system"] span {
  font-size: 10px;
}
@media (prefers-reduced-motion: reduce) {
  [data-theme-control] *,
  [data-theme-control] *::after {
    transition: none !important;
  }
}

/* One native snapshot reveal; no per-frame JavaScript or color interpolation. */
html[data-theme-reveal]::view-transition-group(root) { animation:none; }
html[data-theme-reveal]::view-transition-old(root),html[data-theme-reveal]::view-transition-new(root) { animation:none;mix-blend-mode:normal; }
html[data-theme-reveal]::view-transition-new(root) { z-index:1; }
html[data-theme-reveal]::view-transition-old(root) { z-index:0; }
@media(prefers-reduced-motion:reduce) { html::view-transition-group(root) { animation-duration:0s!important; } }
