/* 扩展阅读底色（6 套）、双色渐变主题（8 套）、柔和画布与字号三档 */
:root {
  --accent-2: #6366f1;
  --qs-logo-start: #2b5ce6;
  --qs-logo-end: #6366f1;
  --qs-logo-foreground: #ffffff;
}
.brand-icon .quizsprint-logo {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.14));
}

/* 6 套高质感阅读底色 */
:root[data-theme="mist"] {
  color-scheme: light;
  --bg: #eef3f9;
  --surface: #fafcff;
  --surface-soft: #e6eef7;
  --surface-hover: #dde7f4;
  --ink: #0f172a;
  --muted: #52657d;
  --line: rgba(15, 23, 42, 0.09);
  --line-strong: rgba(15, 23, 42, 0.16);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.14);
}

:root[data-theme="sage"] {
  color-scheme: light;
  --bg: #eaf1ec;
  --surface: #f7fbf8;
  --surface-soft: #e0ebe3;
  --surface-hover: #d5e4da;
  --ink: #1b2a22;
  --muted: #546c5e;
  --line: rgba(27, 42, 34, 0.09);
  --line-strong: rgba(27, 42, 34, 0.17);
  --ok: #1d6f42;
  --ok-soft: #dff2e6;
  --shadow-sm: 0 1px 2px rgba(27, 42, 34, 0.05);
  --shadow-md: 0 8px 22px rgba(27, 42, 34, 0.07);
  --shadow-lg: 0 18px 40px rgba(27, 42, 34, 0.15);
}

:root[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111b2e;
  --surface-soft: #17233b;
  --surface-hover: #1e2d4a;
  --ink: #e8effa;
  --muted: #8ea0bc;
  --line: rgba(148, 180, 235, 0.11);
  --line-strong: rgba(148, 180, 235, 0.21);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.65);
}

/* 彩蛋解锁隐藏底色：黑板粉笔 & 终端极客 */
:root[data-theme="chalkboard"] {
  color-scheme: dark;
  --bg: #12211a;
  --surface: #182b22;
  --surface-soft: #1f362b;
  --surface-hover: #264235;
  --ink: #f3f1e6;
  --muted: #a6b9ad;
  --line: rgba(243, 241, 230, 0.13);
  --line-strong: rgba(243, 241, 230, 0.24);
  --ok: #6ee7b7;
  --ok-soft: rgba(110, 231, 183, 0.14);
  --bad: #fda4af;
  --bad-soft: rgba(253, 164, 175, 0.14);
  --warn: #fde68a;
  --warn-soft: rgba(253, 230, 138, 0.14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.48);
  --shadow-lg: 0 20px 46px rgba(0, 0, 0, 0.62);
}

:root[data-theme="terminal"] {
  color-scheme: dark;
  --bg: #070d0a;
  --surface: #0c1611;
  --surface-soft: #112019;
  --surface-hover: #172b21;
  --ink: #d7fbe8;
  --muted: #76a98f;
  --line: rgba(52, 211, 153, 0.16);
  --line-strong: rgba(52, 211, 153, 0.32);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.16);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.16);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.52);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.72);
}

/* 8 套双色渐变强调色（浅色系） */
:root[data-accent="indigo"] { --accent: #2b5ce6; --accent-2: #4f46e5; --accent-hover: #1e4ad1; --accent-soft: #ebf1ff; --accent-fg: #2b5ce6; --accent-ink: #ffffff; --qs-logo-start: #2b5ce6; --qs-logo-end: #6366f1; }
:root[data-accent="cyan"] { --accent: #0369a1; --accent-2: #0284c7; --accent-hover: #075985; --accent-soft: #e0f2fe; --accent-fg: #0369a1; --accent-ink: #ffffff; --qs-logo-start: #0284c7; --qs-logo-end: #06b6d4; }
:root[data-accent="emerald"] { --accent: #0f766e; --accent-2: #059669; --accent-hover: #115e59; --accent-soft: #e6f6f3; --accent-fg: #0f766e; --accent-ink: #ffffff; --qs-logo-start: #0f766e; --qs-logo-end: #10b981; }
:root[data-accent="amber"] { --accent: #b45309; --accent-2: #c2410c; --accent-hover: #92400e; --accent-soft: #fef3c7; --accent-fg: #b45309; --accent-ink: #ffffff; --qs-logo-start: #d97706; --qs-logo-end: #f59e0b; }
:root[data-accent="rose"] { --accent: #be123c; --accent-2: #db2777; --accent-hover: #9f1239; --accent-soft: #ffe4e6; --accent-fg: #be123c; --accent-ink: #ffffff; --qs-logo-start: #e11d48; --qs-logo-end: #f472b6; }
:root[data-accent="violet"] { --accent: #6d28d9; --accent-2: #7e22ce; --accent-hover: #5b21b6; --accent-soft: #f3e8ff; --accent-fg: #6d28d9; --accent-ink: #ffffff; --qs-logo-start: #6d28d9; --qs-logo-end: #a855f7; }
:root[data-accent="crimson"] { --accent: #c2410c; --accent-2: #dc2626; --accent-hover: #9a3412; --accent-soft: #ffedd5; --accent-fg: #c2410c; --accent-ink: #ffffff; --qs-logo-start: #c2410c; --qs-logo-end: #ef4444; }
:root[data-accent="slate"] { --accent: #1e293b; --accent-2: #334155; --accent-hover: #0f172a; --accent-soft: #e2e8f0; --accent-fg: #1e293b; --accent-ink: #ffffff; --qs-logo-start: #1e293b; --qs-logo-end: #475569; }

/* 8 套双色渐变强调色（深色系 Midnight / Dark 统一适配） */
:root[data-color-scheme="dark"][data-accent="indigo"] { --accent: #2563eb; --accent-2: #4f46e5; --accent-hover: #1d4ed8; --accent-soft: rgba(59, 130, 246, 0.16); --accent-fg: #93c5fd; --accent-ink: #ffffff; --qs-logo-start: #2b5ce6; --qs-logo-end: #6366f1; }
:root[data-color-scheme="dark"][data-accent="cyan"] { --accent: #0369a1; --accent-2: #0284c7; --accent-hover: #075985; --accent-soft: rgba(14, 165, 233, 0.16); --accent-fg: #67e8f9; --accent-ink: #ffffff; --qs-logo-start: #0284c7; --qs-logo-end: #06b6d4; }
:root[data-color-scheme="dark"][data-accent="emerald"] { --accent: #0f766e; --accent-2: #047857; --accent-hover: #115e59; --accent-soft: rgba(16, 185, 129, 0.16); --accent-fg: #34d399; --accent-ink: #ffffff; --qs-logo-start: #0f766e; --qs-logo-end: #10b981; }
:root[data-color-scheme="dark"][data-accent="amber"] { --accent: #b45309; --accent-2: #c2410c; --accent-hover: #92400e; --accent-soft: rgba(245, 158, 11, 0.16); --accent-fg: #fcd34d; --accent-ink: #ffffff; --qs-logo-start: #d97706; --qs-logo-end: #f59e0b; }
:root[data-color-scheme="dark"][data-accent="rose"] { --accent: #be123c; --accent-2: #db2777; --accent-hover: #9f1239; --accent-soft: rgba(244, 63, 94, 0.16); --accent-fg: #fda4af; --accent-ink: #ffffff; --qs-logo-start: #e11d48; --qs-logo-end: #f472b6; }
:root[data-color-scheme="dark"][data-accent="violet"] { --accent: #6d28d9; --accent-2: #7e22ce; --accent-hover: #5b21b6; --accent-soft: rgba(168, 85, 247, 0.17); --accent-fg: #d8b4fe; --accent-ink: #ffffff; --qs-logo-start: #6d28d9; --qs-logo-end: #a855f7; }
:root[data-color-scheme="dark"][data-accent="crimson"] { --accent: #c2410c; --accent-2: #dc2626; --accent-hover: #9a3412; --accent-soft: rgba(239, 68, 68, 0.16); --accent-fg: #fca5a5; --accent-ink: #ffffff; --qs-logo-start: #c2410c; --qs-logo-end: #ef4444; }
:root[data-color-scheme="dark"][data-accent="slate"] { --accent: #334155; --accent-2: #475569; --accent-hover: #475569; --accent-soft: rgba(148, 163, 184, 0.14); --accent-fg: #e2e8f0; --accent-ink: #f8fafc; --qs-logo-start: #334155; --qs-logo-end: #64748b; }

/* 深色模式题型胶囊统一高对比适配 */
:root[data-color-scheme="dark"] .type-pill[data-qtype="0"] { background: rgba(59, 130, 246, .16); color: #93c5fd; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="1"] { background: rgba(139, 92, 246, .18); color: #c4b5fd; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="2"] { background: rgba(245, 158, 11, .16); color: #fcd34d; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="3"] { background: rgba(20, 184, 166, .16); color: #5eead4; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="4"] { background: rgba(236, 72, 153, .16); color: #f9a8d4; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="5"] { background: rgba(99, 102, 241, .18); color: #a5b4fc; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="6"] { background: rgba(6, 182, 212, .16); color: #67e8f9; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="7"] { background: rgba(249, 115, 22, .16); color: #fdba74; }
:root[data-color-scheme="dark"] .type-pill[data-qtype="8"] { background: rgba(34, 197, 94, .16); color: #86efac; }

/* 柔和氛围渐变画布开关 */
:root[data-ambient="soft"] body {
  background-image:
    radial-gradient(ellipse 68% 46% at 10% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 62%),
    radial-gradient(ellipse 56% 48% at 92% 96%, color-mix(in srgb, var(--accent-2) 7%, transparent), transparent 62%);
  background-attachment: fixed;
}
:root[data-color-scheme="dark"][data-ambient="soft"] body {
  background-image:
    radial-gradient(ellipse 68% 46% at 12% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 64%),
    radial-gradient(ellipse 56% 48% at 90% 96%, color-mix(in srgb, var(--accent-2) 13%, transparent), transparent 64%);
}
:root[data-ambient="flat"] body { background-image: none; }

/* 全局阅读字号三档（1rem 基准随 html font-size 全站等比例缩放） */
:root, :root[data-font-scale="normal"] { font-size: 16px; }
:root[data-font-scale="compact"] { font-size: 14px; }
:root[data-font-scale="large"]   { font-size: 18.5px; }

/* 升级版外观菜单布局 */
.accent-swatch { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.appearance-menu {
  width: min(312px, calc(100vw - 24px));
  max-height: calc(100dvh - 76px);
  overflow-y: auto;
  padding: 13px;
  gap: 11px;
}
.appearance-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.appearance-head .appearance-label { margin-bottom: 0; }
.appearance-head .theme-seg-btn { border: 1px solid var(--line); background: var(--surface-soft); }
.appearance-head .theme-seg-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-fg); box-shadow: none; }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.preset-chip {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft);
  color: var(--ink); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer;
}
.preset-chip:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.preset-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-fg); }
.preset-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }

.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.theme-card-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 7px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft);
  color: var(--ink); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer;
}
.theme-card-btn:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.theme-card-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-fg); }
.theme-card-swatch {
  width: 15px;
  height: 15px;
  border-radius: 5px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex: none;
}
:root[data-color-scheme="dark"] .theme-card-swatch {
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.seg-row {
  display: grid; gap: 4px; padding: 3px;
  background: var(--surface-soft); border-radius: 8px;
}
.seg-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.seg-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

.accent-dots-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; padding: 2px 0; }
.accent-dots-grid .accent-dot { width: 100%; aspect-ratio: 1; height: auto; }
.accent-wheel-trigger {
  position: relative;
  background: conic-gradient(from 0deg, #ff2e55, #ff8a00, #f5d000, #22c55e, #06b6d4, #2563eb, #8b5cf6, #ec4899, #ff2e55);
}
.accent-wheel-trigger::after {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
  transition: background-color 0.16s ease, transform 0.16s ease;
}
.accent-wheel-trigger.active::after {
  background: var(--wheel-core-color, var(--accent));
  box-shadow: 0 0 0 1.5px var(--surface);
}
.accent-wheel-panel {
  margin-top: 8px;
  padding: 12px 10px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.accent-wheel-stage {
  position: relative;
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
}
.accent-wheel-ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: grab;
  outline: none;
}
.accent-wheel-ring:active { cursor: grabbing; }
.accent-wheel-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    hsl(0 90% 56%),
    hsl(60 90% 52%),
    hsl(120 75% 46%),
    hsl(180 85% 44%),
    hsl(240 88% 58%),
    hsl(300 82% 54%),
    hsl(360 90% 56%)
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 22px), #000 calc(100% - 21px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 22px), #000 calc(100% - 21px));
}
.accent-wheel-ring:focus-visible::before {
  box-shadow: 0 0 0 2px var(--accent);
}
.accent-wheel-knob {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.36), 0 0 0 1px rgba(15, 23, 42, 0.16);
  pointer-events: none;
}
.accent-wheel-core {
  position: absolute;
  inset: 25px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}
.accent-wheel-preview {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.accent-wheel-hex {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.accent-wheel-sat-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr 30px;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}
.accent-wheel-sat-row input[type="range"] {
  width: 100%;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.accent-wheel-sat-row span:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
