.theme-control {
  --theme-ink: var(--shared-ink, var(--ink));
  --theme-muted: var(--shared-muted, var(--body));
  --theme-paper: var(--shared-paper, var(--paper));
  --theme-selected: var(--shared-raised, var(--selected));
  --theme-line: var(--shared-control, var(--control));
  --theme-focus: var(--shared-focus, var(--focus));
  --theme-accent: var(--shared-link, var(--link));
  position: relative;
  flex: none;
  color: var(--theme-ink);
}
.theme-control[hidden] { display: none; }
.theme-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-inline-size: 44px;
  min-block-size: 44px;
  padding-inline: .62rem;
  border: 1px solid var(--theme-line);
  border-radius: 9px;
  background: var(--theme-paper);
  color: var(--theme-ink);
  list-style: none;
  cursor: pointer;
  font-size: .83rem;
  font-weight: 720;
}
.theme-trigger::-webkit-details-marker { display: none; }
.theme-trigger::marker { content: ''; }
.theme-trigger:hover, .theme-control[open] .theme-trigger { background: var(--theme-selected); }
.theme-trigger:focus-visible, .theme-option:has(input:focus-visible) {
  outline: 2px solid var(--theme-focus);
  outline-offset: 2px;
}
.theme-trigger .theme-symbol { color: var(--theme-accent); }
.theme-caret {
  flex: none;
  inline-size: .37rem;
  block-size: .37rem;
  margin-block-start: -.2rem;
  border-inline-end: 1.5px solid currentColor;
  border-block-end: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.theme-control[open] .theme-caret { margin-block-start: .2rem; transform: rotate(225deg); }
.theme-panel {
  position: absolute;
  z-index: 31;
  inset-block-start: calc(100% + .5rem);
  inset-inline-end: 0;
  inline-size: min(13.5rem, calc(100vw - 24px));
  padding: .5rem;
  border: 1px solid var(--theme-line);
  border-radius: 12px;
  background: var(--theme-paper);
  color: var(--theme-ink);
  box-shadow: 0 12px 30px #080f2540;
  transform: translateX(var(--theme-offset, 0px));
}
.theme-panel-title {
  margin: .2rem .55rem .4rem;
  color: var(--theme-muted);
  font-size: .79rem;
  font-weight: 700;
}
.theme-option {
  position: relative;
  display: grid;
  grid-template-columns: 1.2rem minmax(0, 1fr) 1rem;
  align-items: center;
  gap: .45rem;
  min-block-size: 44px;
  padding-inline: .55rem;
  border-radius: 7px;
  color: var(--theme-ink);
  font-size: .9rem;
  cursor: pointer;
}
.theme-option input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.theme-option:hover, .theme-option:has(input:checked) { background: var(--theme-selected); }
.theme-option:has(input:checked) { font-weight: 720; }
.theme-check {
  inline-size: .42rem;
  block-size: .7rem;
  margin: 0 auto .12rem;
  color: var(--theme-accent);
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(45deg);
  visibility: hidden;
}
.theme-option input:checked ~ .theme-check { visibility: visible; }
.theme-symbol {
  position: relative;
  display: inline-grid;
  place-items: center;
  inline-size: 18px;
  block-size: 18px;
  flex: none;
}
.theme-symbol::before, .theme-symbol::after { content: ''; position: absolute; box-sizing: border-box; }
.theme-symbol[data-mode="system"]::before { inline-size: 15px; block-size: 10px; top: 2px; border: 1.5px solid currentColor; border-radius: 2px; }
.theme-symbol[data-mode="system"]::after { inline-size: 7px; block-size: 1.5px; bottom: 3px; border-radius: 1px; background: currentColor; }
.theme-symbol[data-mode="light"]::before {
  inline-size: 7px;
  block-size: 7px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -7px 0 -2.5px currentColor, 0 7px 0 -2.5px currentColor, 7px 0 0 -2.5px currentColor, -7px 0 0 -2.5px currentColor, 5px 5px 0 -2.5px currentColor, -5px 5px 0 -2.5px currentColor, 5px -5px 0 -2.5px currentColor, -5px -5px 0 -2.5px currentColor;
}
.theme-symbol[data-mode="dark"]::before {
  inline-size: 11px;
  block-size: 13px;
  border-radius: 50%;
  transform: rotate(-35deg);
  box-shadow: -2px 2px 0 0 currentColor;
}
@media (max-width: 760px) {
  .theme-trigger { gap: .32rem; padding-inline: .42rem; }
  .theme-current { display: none; }
}
@media print { .theme-control { display: none; } }
