
/* 纯 UI 主题：默认使用官网参考图的轻盈浅蓝色。
   同一套 RGB 分量供背景、强调色和玻璃折光使用，避免只换按钮而背景不变。 */
:root, [data-theme-preset="blue"] {
  --theme-origin: 0% 78%;
  --theme-preview-origin: 0% 75%;
  --theme-rgb-1: 161, 202, 241;
  --theme-rgb-2: 225, 239, 251;
  --theme-rgb-3: 188, 222, 247;
  --theme-accent: #316ea8;
  --theme-accent-hover: #255a8c;
  --theme-accent-dark: #b2dbff;
  --theme-swatch: #a1caf1;
}
[data-theme-preset="violet"] {
  --theme-origin: 50% 0%;
  --theme-preview-origin: 50% 0%;
  --theme-rgb-1: 148, 95, 250;
  --theme-rgb-2: 247, 223, 217;
  --theme-rgb-3: 246, 152, 184;
  --theme-accent: #7040aa;
  --theme-accent-hover: #59318d;
  --theme-accent-dark: #e0c8ff;
  --theme-swatch: #945ffa;
}
[data-theme-preset="sunset"] {
  --theme-origin: 40% 0%;
  --theme-preview-origin: 40% 0%;
  --theme-rgb-1: 187, 173, 230;
  --theme-rgb-2: 254, 201, 109;
  --theme-rgb-3: 226, 173, 180;
  --theme-accent: #84507d;
  --theme-accent-hover: #6c3c66;
  --theme-accent-dark: #f3d2ee;
  --theme-swatch: #bbade6;
}
[data-theme-preset="warm"] {
  --theme-origin: 0% 60%;
  --theme-preview-origin: 0% 60%;
  /* 参考图右下角标注重复，按实际视觉使用珊瑚、浅桃和乳白。 */
  --theme-rgb-1: 239, 137, 116;
  --theme-rgb-2: 255, 248, 218;
  --theme-rgb-3: 242, 184, 169;
  --theme-accent: #a34337;
  --theme-accent-hover: #85352c;
  --theme-accent-dark: #ffd2c2;
  --theme-swatch: #ef8974;
}
[data-theme-preset="mint"] {
  --theme-origin: 0% 30%;
  --theme-preview-origin: 0% 30%;
  --theme-rgb-1: 69, 167, 174;
  --theme-rgb-2: 216, 237, 181;
  --theme-rgb-3: 154, 213, 233;
  --theme-accent: #206b68;
  --theme-accent-hover: #175653;
  --theme-accent-dark: #b9efdc;
  --theme-swatch: #45a7ae;
}
[data-theme-preset="rose"] {
  --theme-origin: 0% 100%;
  --theme-preview-origin: 0% 100%;
  --theme-rgb-1: 211, 144, 182;
  --theme-rgb-2: 237, 217, 241;
  --theme-rgb-3: 166, 197, 240;
  --theme-accent: #904568;
  --theme-accent-hover: #753652;
  --theme-accent-dark: #f9cde3;
  --theme-swatch: #d390b6;
}
:root {
  --accent: var(--theme-accent);
  --accent-hover: var(--theme-accent-hover);
  --accent-light: rgba(var(--theme-rgb-1), .12);
  --accent-medium: rgba(var(--theme-rgb-1), .18);
  --accent-border: rgba(var(--theme-rgb-1), .28);
  --accent-shadow: rgba(var(--theme-rgb-1), .18);
  --accent-glow: rgba(var(--theme-rgb-3), .16);
  --accent-2: rgb(var(--theme-rgb-3));
  --accent-3: rgb(var(--theme-rgb-2));
  --accent-4: rgba(var(--theme-rgb-2), .65);
  --bg-gradient-1: rgba(var(--theme-rgb-1), .18);
  --bg-gradient-2: rgba(var(--theme-rgb-2), .20);
  --bg-gradient-3: rgba(var(--theme-rgb-3), .16);
}
:root[data-theme="dark"] {
  --accent: var(--theme-accent-dark);
  --accent-hover: var(--theme-accent-dark);
}

/* 只是一组外观按钮，不新增请求。预览使用相融的大色域，与页面背景同源。 */
.theme-preset-grid {
  --picker-accent: var(--accent);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.theme-preset-grid .theme-preset {
  position: relative;
  display: grid;
  grid-template-rows: 88px auto;
  gap: 10px;
  min-width: 0;
  min-height: 132px;
  padding: 9px 9px 12px;
  text-align: left;
  color: var(--text-primary);
  border: 1px solid var(--liquid-border);
  border-radius: 26px !important;
  corner-shape: squircle;
  background: rgba(255, 255, 255, .10);
  cursor: pointer;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: transform .36s var(--liquid-ease), box-shadow .3s ease;
}
.theme-preset-grid .theme-preset > span {
  display: block;
  width: 100%;
  height: 88px;
  margin: 0;
  border-radius: 20px;
  corner-shape: squircle;
  background:
    radial-gradient(ellipse 150% 150% at var(--theme-preview-origin), rgba(var(--theme-rgb-1), .92), transparent 65%),
    radial-gradient(ellipse 125% 180% at 100% 100%, rgb(var(--theme-rgb-2)), transparent 70%),
    linear-gradient(155deg, rgb(var(--theme-rgb-3)), rgb(var(--theme-rgb-2)));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}
.theme-preset-grid .theme-preset small {
  padding-inline: 5px 22px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.5;
}
.theme-preset-grid .theme-preset[aria-pressed="true"] {
  /* 选中描边取全站强调色，不继承预览按钮的局部色。 */
  outline: 2px solid var(--picker-accent);
  outline-offset: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8) !important;
}
.theme-preset-grid .theme-preset[aria-pressed="true"]::after {
  content: "";
  display: block !important;
  position: absolute;
  width: 7px;
  height: 12px;
  right: 17px;
  bottom: 17px;
  border: solid var(--picker-accent);
  border-width: 0 2px 2px 0;
  border-radius: 0 !important;
  transform: rotate(45deg);
  pointer-events: none;
}
.ui-theme-section { padding-block: 12px 20px; }
.ui-theme-section > h2 { margin: 0 0 18px; font-size: 16px; color: var(--text-primary); }
.settings-body .theme-preset-grid { gap: 12px; }
@media (hover: hover) {
  .theme-preset-grid .theme-preset:hover { transform: translateY(-3px); }
}
@media (max-width: 620px) {
  .theme-preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .theme-preset-grid .theme-preset { grid-template-rows: 76px auto; min-height: 120px; }
  .theme-preset-grid .theme-preset > span { height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-preset-grid .theme-preset { transition: none; transform: none !important; }
}
