/* Six-palace palette adapter for the nine-palace UI.
   All colour values come from /theme-palette.css. No legacy theme layers. */
:root[data-theme] {
  --paper:var(--theme-back); --card:var(--theme-paper);
  --ink:var(--theme-ink); --muted:var(--theme-muted); --line:var(--theme-line);
  --accent:var(--theme-semantic); --green:var(--theme-accent);
  --soft:var(--theme-soft); --red-soft:var(--theme-current-bg);
  --focus:var(--theme-accent); --board-border:var(--theme-grid);
  --palace:var(--theme-palace); --palace-head:var(--theme-palace-head);
  --scroll-thumb:var(--theme-line); --scroll-hover:var(--theme-edge); --scroll-active:var(--theme-accent);
  --serif:var(--preferred-kai), 'Kaiti SC','STKaiti','KaiTi','Songti SC',serif;
}
body { background-color:var(--paper); background-image:var(--theme-ground); }
.site-header { min-height:116px; background:var(--card); border-bottom:2px solid var(--theme-edge); }
.brand { font-size:28px; font-weight:400; letter-spacing:2px; gap:16px; color:var(--theme-heading); }
.brand-logo { width:46px; height:46px; }
.brand-title { white-space:nowrap; }
.brand-dot { color:var(--theme-accent); margin:0 10px; }
.brand small { letter-spacing:3px; margin-top:10px; color:var(--muted); }
.workspace { padding-top:42px; gap:42px; }
.controls { color:var(--ink); background:var(--card); border:1px solid var(--line); border-top:3px double var(--theme-edge); }
.controls h1 { font-family:var(--serif); font-size:35px; line-height:1.75; letter-spacing:5px; color:var(--theme-heading); }
input,select,.year-controls button,.segmented,.segmented span,.primary,.branch-slot,.reference-toggle,.lookup-entry,.periods,.year-card { border-radius:2px; }
input,select { color:var(--ink); background:var(--theme-field); border-color:var(--line); color-scheme:inherit; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color:var(--accent); }
.segmented { background:var(--palace-head); }
.segmented span { color:var(--muted); }
.segmented input:checked + span { background:var(--theme-button); color:var(--theme-button-ink); box-shadow:none; }
.primary { background:var(--theme-button); color:var(--theme-button-ink); border:1px solid var(--theme-edge); }
.primary:hover:not(:disabled) { background:var(--theme-hover); }
.result-heading h2 { font-size:32px; letter-spacing:4px; color:var(--theme-heading); }
.pillars { border-radius:2px; background:var(--palace-head); border:1px solid var(--line); box-shadow:none; }
.pillar strong { font-size:28px; color:var(--theme-palace-name); }
.year-panel { border-color:var(--line); }
.year-controls button { background:var(--card); border-color:var(--line); }
.board { border-radius:1px; background:var(--theme-board); border-color:var(--board-border); box-shadow:0 0 0 3px var(--paper),0 0 0 4px var(--theme-edge); }
.palace { background:var(--palace); color:var(--theme-board-ink); border-color:var(--theme-board-rule); }
.palace.active-period { background:var(--soft); }
.palace.current-palace { box-shadow:inset 0 0 0 2px var(--accent); }
.palace-title { color:var(--theme-palace-name); }
.god-row { font-family:var(--serif); }
:root:is([data-theme="crimson"],[data-theme="song"],[data-theme="pine"],[data-theme="indigo"]) .god-row { border-bottom:1px solid var(--line); padding-bottom:6px; }
.palace .period-age, .center-pillar-value { color:var(--theme-palace-name); }
.palace .mark.body { color:var(--theme-accent); border-color:var(--theme-accent); }
.branch-slot { background:var(--palace-head); border-color:var(--line); }
.branch-slot.selected { background:var(--red-soft); color:var(--ink); border-color:var(--accent); }
.branch-slot.selected .slot-age { color:var(--accent); }
.branch-slot.selected .slot-house { color:var(--theme-board-muted); }
.slot-age, .center-birth, .palace .mark { color:var(--theme-board-muted); }
.center-pillar-value { color:var(--theme-board-ink); }
.periods,.year-card,.reference-toggle,.lookup-entry,.synthesis-panel { background:var(--card); border-color:var(--line); }
.period-button.selected,.synthesis-topics button[aria-pressed="true"] { background:var(--theme-button); color:var(--theme-button-ink); }
.year-card.selected { background:var(--red-soft); border-color:var(--accent); }
.reference-toggle,.lookup-entry { font-family:var(--serif); }
.synthesis-panel,.synthesis-topics button,.palace-guide { border-radius:2px; }
.synthesis-basis,.synthesis-article .synthesis-keywords { color:var(--theme-accent); }
.life-nav a,.life-house-index a,#life-summary { background:var(--palace-head); }
.life-facts summary,.life-note,.life-period-position,.life-period-facts { color:var(--muted); }
.life-period.is-current { background:var(--soft); border-color:var(--theme-accent); }
.life-nav a:focus-visible,.life-house-index a:focus-visible { outline-color:var(--focus); }
.palace-reference[open] > .reference-toggle,.lookup-entry[aria-expanded="true"] { background:var(--soft); border-color:var(--theme-accent); color:var(--theme-accent); }
.help-page { color:var(--ink); }
/* Selector layout and responsive brand structure are retained from the tool. */
.style-picker { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.style-picker-label { color:var(--muted); font-size:11px; letter-spacing:2px; margin:0; }
.style-picker select { width:116px; min-height:34px; padding:5px 8px; font-size:13px; font-family:var(--serif); border-color:var(--line); }
@media(min-width:901px) {
 .controls { align-self:start; padding:26px 22px 22px; }
 .controls h1 { margin:15px 0; }
 .intro { margin-bottom:26px; }
 .controls .input-pair { grid-template-columns:minmax(0,1fr); gap:14px; }
}
@media(max-width:900px) {
 .site-header { min-height:100px; }
 .workspace { padding-top:20px; }
 .controls h1 { font-size:26px; }
 .result-heading h2 { font-size:27px; }
 .brand { font-size:23px; line-height:1.4; }
 .brand-product { display:block; font-size:20px; letter-spacing:2px; margin-top:3px; }
 .brand-dot,.brand small { display:none; }
}
@media(max-width:700px) {
 .site-header { flex-wrap:wrap; gap:14px; padding-bottom:16px; }
 .style-picker { width:100%; flex-direction:row; align-items:center; justify-content:space-between; gap:10px; }
 .style-picker-label { letter-spacing:0; white-space:nowrap; }
 .style-picker select { width:124px; min-height:44px; font-size:16px; }
}
@media(max-width:600px) {
 .site-header { min-height:92px; padding:22px 20px 18px; gap:22px; }
 .brand { font-size:23px; letter-spacing:3px; gap:14px; }
 .workspace { padding-top:12px; }
 .result-heading h2 { font-size:24px; }
 .pillar strong { font-size:25px; }
 .board { box-shadow:none; }
}
:root[data-theme="song"] { --serif:var(--preferred-kai), 'Songti SC','STSong',serif; }
:root[data-theme="song"] .board { box-shadow:none; }
