:root {
  color-scheme: light;
}

.site-logo-picture {
  display: contents;
}

/* 系统偏好与手动选择统一由 data-theme 控制。 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-page-bg: #101923;
  --theme-surface: #192634;
  --theme-surface-subtle: #15212d;
  --theme-surface-muted: #1d2c3b;
  --theme-surface-info: #20394c;
  --theme-footer-bg: #131f2b;
  --theme-border: #304252;
  --theme-border-strong: #486175;
  --theme-text-strong: #edf4fa;
  --theme-text: #ccdae6;
  --theme-text-muted: #a6b8c9;
  --theme-text-dim: #95a9bb;
  --theme-link: #85c8f0;
  --theme-success-text: #8edbb5;
  --theme-success-bg: #18382e;
  --theme-success-border: #34634f;
  --theme-success-accent: #69bd94;
  --theme-danger-text: #ffb2ba;
  --theme-danger-bg: #3a252e;
  --theme-danger-border: #70404c;
  --theme-danger-accent: #df8792;
  --theme-warning-text: #edcb96;
  --theme-warning-bg: #362f23;
  --theme-warning-badge: #50412b;
  --theme-warning-border: #6d5939;
  --theme-warning-accent: #cda663;
  --theme-overlay: rgba(0, 0, 0, 0.68);
}

:root[data-theme="dark"] input::placeholder {
  color: var(--theme-text-dim);
  opacity: 1;
}

.header-actions {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 12px;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--theme-border-strong, #c6d5e0);
  border-radius: 50%;
  background: var(--theme-surface, #ffffff);
  color: var(--theme-text-muted, #68849b);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 320ms ease, border-color 320ms ease, box-shadow 180ms ease;
}

.theme-icon {
  display: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

:root[data-theme="light"] .theme-icon-sun,
:root[data-theme="dark"] .theme-icon-moon {
  display: block;
}

.theme-toggle:hover {
  box-shadow: 0 0 0 3px rgba(105, 157, 193, 0.15);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--theme-link, #2276a7);
  outline-offset: 3px;
}

@media (pointer: coarse) {
  .theme-toggle {
    width: 44px;
    height: 44px;
  }
}

/* 仅过渡颜色，页面原有的布局和弹窗动画继续使用各自的规则。 */
:where(html, body, .page-shell, .pickup-panel, .empty-state-guide,
  .status-strip > div, .rental-summary, .credentials-rows, .verification-card,
  .verification-code-panel, .verification-stats, .tutorial-modal-card,
  .renewal-modal-card, .friend-guide-modal-card, .verification-failure-modal-card,
  .toc-panel, .message, input, h1, h2, h3, p, span, strong, label) {
  transition: background-color 320ms ease, border-color 320ms ease, color 320ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  :where(html, body, .page-shell, .pickup-panel, .empty-state-guide,
    .status-strip > div, .rental-summary, .credentials-rows, .verification-card,
    .verification-code-panel, .verification-stats, .tutorial-modal-card,
    .renewal-modal-card, .friend-guide-modal-card, .verification-failure-modal-card,
    .toc-panel, .message, input, h1, h2, h3, p, span, strong, label) {
    transition: none;
  }
}
