/* Visual themes share layout, dimensions, controls and working data. */
:root[data-theme='paper'] {
  --bg: #f7f3eb; --panel: #faf7f1; --ink: #3d362e; --muted: #71675b;
  --line: #e4ddd0; --accent: #895631; --accent-hover: #704424; --wash: #eee4d6;
  --danger: #954617; --warning-bg: #f7e5d3; --quiet: #71675b;
  --control-line: #d3c9b8; --input-line: #b8ab97; --hover-line: #b8ab97;
  --hover: #f1ebdf; --soft: #eee8dc; --shadow: #49381d26; --backdrop: #3d362e50;
  --heading-font: 'Songti TC', 'Noto Serif TC', 'PMingLiU', serif; --control-radius: 4px;
}
:root[data-theme='celadon'] {
  --bg: #f4f8f6; --panel: #f9fcfa; --ink: #253c36; --muted: #536e65;
  --line: #dce7e0; --accent: #166a55; --accent-hover: #105340; --wash: #e2efe7;
  --danger: #995028; --warning-bg: #f6e7db; --quiet: #536e65;
  --control-line: #c8d9ce; --input-line: #9fb8a9; --hover-line: #9fb8a9;
  --hover: #eaf2ed; --soft: #e4eee8; --shadow: #183a2826; --backdrop: #203c3250;
  --control-radius: 10px;
}
:root[data-theme='mauve'] {
  --bg: #f7f6fa; --panel: #fcfbff; --ink: #343042; --muted: #6d637d;
  --line: #e5e0ed; --accent: #7055a0; --accent-hover: #5b4189; --wash: #ede5f6;
  --danger: #9c482d; --warning-bg: #f8e8e1; --quiet: #6d637d;
  --control-line: #d7cce3; --input-line: #b8a9cb; --hover-line: #b8a9cb;
  --hover: #f0ebf6; --soft: #ebe7f2; --shadow: #37244826; --backdrop: #34304250;
  --control-radius: 8px;
}
:root[data-theme='night'] {
  --bg: #171b22; --panel: #1d232d; --ink: #e7ecf4; --muted: #a7b3c5;
  --line: #323c4b; --accent: #9fb9ff; --accent-hover: #b9ccff; --wash: #293a56;
  --danger: #ffc092; --warning-bg: #3b2c23; --quiet: #a7b3c5;
  --control-line: #49576b; --input-line: #69798f; --hover-line: #8396b0;
  --hover: #26303e; --soft: #2b3544; --on-accent: #14203a;
  --shadow: #00000066; --backdrop: #090d1580; color-scheme: dark;
}

.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-options button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13px; text-align: left; }
.theme-options button[aria-pressed=true] { background: var(--wash); border-color: var(--accent); color: var(--accent); }
.theme-preview { display: block; width: 18px; height: 20px; flex: none; border: 1px solid var(--preview-line); border-bottom: 3px solid var(--preview-accent); border-radius: 3px; background: var(--preview-bg); }
.theme-preview[data-preview='clear'] { --preview-bg: #fff; --preview-line: #dadce0; --preview-accent: #1967d2; }
.theme-preview[data-preview='paper'] { --preview-bg: #f7f3eb; --preview-line: #d3c9b8; --preview-accent: #895631; }
.theme-preview[data-preview='celadon'] { --preview-bg: #f4f8f6; --preview-line: #c8d9ce; --preview-accent: #166a55; }
.theme-preview[data-preview='mauve'] { --preview-bg: #f7f6fa; --preview-line: #d7cce3; --preview-accent: #7055a0; }
.theme-preview[data-preview='night'] { --preview-bg: #171b22; --preview-line: #49576b; --preview-accent: #9fb9ff; }
