:root {
  --appearance-surface: #fff;
  --appearance-text: #20313d;
  --appearance-muted: #526477;
  --appearance-line: #c0cbd9;
  --appearance-accent: #2765d4;
}
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --appearance-surface: #20252d;
    --appearance-text: #eef1f5;
    --appearance-muted: #b5bfcd;
    --appearance-line: #475260;
    --appearance-accent: #88b6ff;
  }
}
button[data-theme-trigger], .theme-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--appearance-line);
  border-radius: 12px;
  background: var(--appearance-surface);
  color: var(--appearance-text);
  font: inherit;
  cursor: pointer;
}
button[data-theme-trigger]:hover, .theme-close:hover { border-color: var(--appearance-accent); }
button[data-theme-trigger]:focus-visible, .theme-close:focus-visible {
  outline: 2px solid var(--appearance-accent);
  outline-offset: 3px;
}
.theme-glyph {
  display: block;
  width: 17px;
  height: 17px;
  flex: none;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
#site-theme-dialog {
  box-sizing: border-box;
  width: min(448px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 22px;
  border: 1px solid var(--appearance-line);
  border-radius: 20px;
  background: var(--appearance-surface);
  color: var(--appearance-text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  box-shadow: 0 16px 64px #11161f37;
}
#site-theme-dialog::backdrop { background: rgb(14 20 30 / .48); }
.theme-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.theme-heading h2 { margin: 0; color: inherit; font-size: 21px; font-weight: 600; }
.theme-close { width: 44px; padding: 0; font-size: 24px; line-height: 1; border-color: transparent; }
.theme-options { min-width: 0; margin: 12px 0 0; padding: 0; border: 0; }
.theme-options legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.theme-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-choice { display: block; position: relative; min-width: 0; text-align: center; cursor: pointer; }
.theme-choice input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.theme-preview {
  display: block;
  position: relative;
  height: 69px;
  overflow: hidden;
  border: 2px solid var(--appearance-line);
  border-radius: 11px;
}
.theme-mini {
  position: absolute;
  inset: 0;
  display: block;
  --mini-bg: #f0f2f5;
  --mini-card: #fff;
  --mini-rule: #c6ced9;
  --mini-accent: #6c9ffb;
  background: var(--mini-bg);
}
.theme-mini-dark { --mini-bg: #2c3037; --mini-card: #16191e; --mini-rule: #68707e; --mini-accent: #88b6ff; }
.theme-mini + .theme-mini { clip-path: inset(0 0 0 50%); }
.theme-mini::before {
  content: "";
  position: absolute;
  inset: 8px 6px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--mini-rule) 0 15%, var(--mini-card) 15% 100%);
}
.theme-mini i, .theme-mini i::before, .theme-mini i::after {
  display: block; height: 3px; border-radius: 4px; background: var(--mini-rule);
}
.theme-mini i { position: absolute; left: 27%; right: 16%; top: 29%; }
.theme-mini i::before, .theme-mini i::after { content: ""; position: absolute; left: 0; width: 78%; top: 9px; }
.theme-mini i::after { width: 58%; top: 18px; background: var(--mini-accent); }
.theme-choice-name { display: block; margin-top: 7px; color: var(--appearance-muted); font-size: 14px; }
.theme-choice input:checked + .theme-preview { border-color: var(--appearance-accent); }
.theme-choice input:checked + .theme-preview::after {
  content: "✓";
  position: absolute; right: 4px; bottom: 4px;
  width: 17px; height: 17px; line-height: 17px; border-radius: 50%;
  background: #2765d4; color: white; font-size: 12px; font-weight: 700;
}
.theme-choice input:checked ~ .theme-choice-name { color: var(--appearance-text); font-weight: 600; }
.theme-choice input:focus-visible + .theme-preview { outline: 2px solid var(--appearance-accent); outline-offset: 2px; }
#site-theme-note { margin: 16px 0 0; font-size: 13px; color: var(--appearance-muted); }
@media (max-width: 680px) {
  button[data-theme-trigger] { min-width: 44px; padding-inline: 8px; }
  .theme-trigger-caption { display: none; }
  .theme-choices { gap: 8px; }
}
@media print {
  button[data-theme-trigger], #site-theme-dialog { display: none !important; }
  #site-theme-dialog::backdrop { background: transparent; }
}
