:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #191a1c;
  --surface: #222326;
  --raised: #292a2e;
  --hover: #33353a;
  --ink: #f1f0ee;
  --muted: #bcbcc2;
  --soft: var(--surface);
  --line: #41434a;
  --border: var(--line);
  --control-border: #747680;
  --focus: #b6cce0;
  --action: #e9e8e5;
  --action-hover: #ffffff;
  --action-ink: #1f2023;
  --action-disabled: #414349;
  --warning-ink: #f1ba8d;
  --error-ink: #ffb4ac;
  color: var(--ink);
  background-color: var(--canvas);
}

.theme-account {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

button.theme-toggle {
  display: none;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink, #252527);
  background: transparent;
  cursor: pointer;
}

.theme-available button.theme-toggle { display: inline-grid; }
button.theme-toggle:not(:disabled):hover { background: var(--hover, #f0f0f2); }
button.theme-toggle:focus-visible { outline: 2px solid var(--focus, #607d9c); outline-offset: 2px; }
button.theme-toggle::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.8 13.4A8.8 8.8 0 0 1 10.6 3.2a8.9 8.9 0 1 0 10.2 10.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.theme-toggle span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.theme-toggle .theme-to-light,
[data-theme="dark"] .theme-toggle .theme-to-dark { display: none; }
[data-theme="dark"] .theme-toggle .theme-to-light { display: inline; }
[data-theme="dark"] button.theme-toggle::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2m0 16v2M2 12h2m16 0h2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4m0-14.2-1.4 1.4M6.3 17.7l-1.4 1.4'/%3E%3C/svg%3E");
}

@media (hover: none) {
  button.theme-toggle:not(:disabled):hover { background: transparent; }
}
@media (prefers-reduced-motion: no-preference) {
  button.theme-toggle:active { transform: scale(.96); }
}

:root[data-theme="dark"] ::selection { color: var(--canvas); background: var(--focus); }

:root[data-theme="dark"] .privacy-control,
:root[data-theme="dark"] .privacy-panel a,
:root[data-theme="dark"] .privacy-actions button { color: var(--ink); }
:root[data-theme="dark"] .privacy-open,
:root[data-theme="dark"] .privacy-panel p,
:root[data-theme="dark"] .privacy-sync { color: var(--muted); }
:root[data-theme="dark"] .privacy-panel {
  background: var(--raised);
  border-color: var(--control-border);
  box-shadow: 0 12px 36px rgb(0 0 0 / .36);
}
:root[data-theme="dark"] .privacy-actions button { background: var(--surface); border-color: var(--control-border); }
:root[data-theme="dark"] .privacy-actions button:hover,
:root[data-theme="dark"] .privacy-actions button:active { background: var(--hover); }
:root[data-theme="dark"] .privacy-panel input { accent-color: var(--action); }
:root[data-theme="dark"] .privacy-control :is(button,input,a):focus-visible { outline-color: var(--focus); }

/* Change the foreground and its button surface in the same frame. */
.theme-switching :is(button,.button,.home-button,.pricing-copy .packages-link) { transition: none; }
