/* 外觀主題：每個主題只換變數，版面不變。沒有 data-theme 的是「深色」（第一次打開會跟著手機的深色／淺色模式）。
   所有文字色在 ground／surface／raised 三種底色上都至少 4.5:1（tests/unit/themes.test.mjs 會檢查）。 */

/* 深色（預設，id 沿用 ember）：v5.91 運動萊姆綠——近黑底、#1B1C18 卡片、萊姆綠重點（上面放黑字），文字對比都 ≥ 4.5:1。預覽卡用同一組值 */
.th-prev[data-tp="ember"]{
  --ground:#0e0f0c; --surface:#1b1c18; --raised:#272823; --line:#3a3b34; --line-soft:#272823;
  --text:#f6f7f0; --muted:#a9ab9f; --faint:#9fa295;
  --ember:#c8f04a; --ember-deep:#a6cf2b; --gold:#e9ff8a;
  --str:#ff6f61; --end:#ffb84d; --dis:#7fe07a; --rec:#6cb4ff; --kit:#ff6b8b; --good:#7fe07a;
  --on-accent:#0e0f0c; --on-danger:#000000; --switch:#a6cf2b; --glow:#0e0f0c;
  --pop:#c8f04a; --on-pop:#0e0f0c;
  --card-shadow:none; --btn-glow:none; --bw:0px;
  color-scheme:dark;
}
/* 淺色（id 沿用 dawn）：v5.91 運動萊姆綠——淡淡帶綠的灰白底、白色卡片、深綠字和線條，「＋」等大按鈕是萊姆底黑字 */
:root[data-theme="dawn"],.th-prev[data-tp="dawn"]{
  --ground:#f3f4ef; --surface:#ffffff; --raised:#ebede5; --line:#c8cbbe; --line-soft:#e2e5da;
  --text:#0e0f0c; --muted:#585b50; --faint:#5e6156;
  --ember:#3f6b00; --ember-deep:#325600; --gold:#6a5600;
  --str:#c1000f; --end:#a14600; --dis:#1b7a34; --rec:#0040dd; --kit:#b40d3e; --good:#1b7a34;
  --on-accent:#ffffff; --on-danger:#ffffff; --switch:#5d9a00; --glow:#f3f4ef;
  --card-shadow:none; --btn-glow:none; --bw:0px;
  --seg-thumb:#ffffff; --sheet-bg:#f3f4ef;
  --pop:#c8f04a; --on-pop:#0e0f0c;
  --fill:rgba(118,118,128,.12); --fill-2:rgba(118,118,128,.2); --sep:rgba(60,60,67,.29);
  color-scheme:light;
}
/* 晴空：淡淡的天空藍＋湖水藍重點，清爽、像晴天早上的戶外 */
:root[data-theme="sky"],.th-prev[data-tp="sky"]{
  --ground:#dcecf9; --surface:#f6fbff; --raised:#e6f1fb; --line:#b9d3ea; --line-soft:#cfe2f4;
  --text:#0f2a44; --muted:#3b566f; --faint:#4a6682;
  --ember:#1766a8; --ember-deep:#11528a; --gold:#7f5600;
  --str:#b3262d; --end:#9a4507; --dis:#11663a; --rec:#4a45b5; --kit:#a8255d; --good:#11663a;
  --on-accent:#ffffff; --on-danger:#ffffff; --switch:#1766a8; --glow:#cfe5f8;
  --card-shadow:0 1px 2px rgba(15,42,68,.06),0 8px 24px rgba(23,102,168,.08);
  color-scheme:light;
}
/* 蒂芙尼綠：經典的淡藍綠（#81D8D0）當底色與開關，文字和按鈕用同色系的深青綠，才讀得清楚 */
:root[data-theme="tiffany"],.th-prev[data-tp="tiffany"]{
  --ground:#cdeee9; --surface:#f4fcfa; --raised:#e0f5f1; --line:#9fd6cf; --line-soft:#bfe6e0;
  --text:#0c2e2b; --muted:#335956; --faint:#43675f;
  --ember:#0a7069; --ember-deep:#075a54; --gold:#7a5300;
  --str:#b0242c; --end:#964306; --dis:#10623a; --rec:#3d4cb0; --kit:#a3245b; --good:#10623a;
  --on-accent:#ffffff; --on-danger:#ffffff; --switch:#0abab5; --glow:#bfe9e3;
  --card-shadow:0 1px 2px rgba(12,46,43,.06),0 8px 24px rgba(10,112,105,.10);
  color-scheme:light;
}
/* 深海：泳池的深藍與水光青，冷靜、適合晚上看 */
:root[data-theme="abyss"],.th-prev[data-tp="abyss"]{
  --ground:#061821; --surface:#0b2230; --raised:#112d3e; --line:#1f4459; --line-soft:#163548;
  --text:#e3f2f7; --muted:#a3c2cf; --faint:#86a7b5;
  --ember:#2cc6d8; --ember-deep:#1597a8; --gold:#f2c14e;
  --str:#ff6b6b; --end:#ffab5c; --dis:#4fd6a0; --rec:#7cb8ff; --kit:#ff8fc1; --good:#4fd6a0;
  --on-accent:#03222b; --on-danger:#2a0707; --switch:#2cc6d8; --glow:#0d3a4c;
  color-scheme:dark;
}
/* 霓虹競技場：電玩機台的靛紫底＋霓虹洋紅，升級打怪的遊戲感 */
:root[data-theme="arcade"],.th-prev[data-tp="arcade"]{
  --ground:#110c22; --surface:#1a1433; --raised:#241c45; --line:#3b2f6b; --line-soft:#2c2352;
  --text:#f4efff; --muted:#bfb2e3; --faint:#a597cf;
  --ember:#ff4fb3; --ember-deep:#d8328f; --gold:#ffd166;
  --str:#ff6b81; --end:#ffa24c; --dis:#5ef2b6; --rec:#58d3ff; --kit:#c792ff; --good:#5ef2b6;
  --on-accent:#1a0717; --on-danger:#2a0710; --switch:#58d3ff; --glow:#2a1250;
  --btn-glow:0 0 20px color-mix(in srgb,var(--ember) 45%,transparent);
  color-scheme:dark;
}
/* 抹茶道場：淡抹茶綠與墨色，像恢復日一樣安靜 */
:root[data-theme="matcha"],.th-prev[data-tp="matcha"]{
  --ground:#e9eee4; --surface:#fbfcf8; --raised:#f0f3eb; --line:#c9d3c2; --line-soft:#dde4d6;
  --text:#1b2a20; --muted:#4a5d4f; --faint:#5c6f60;
  --ember:#37702a; --ember-deep:#2b5a21; --gold:#86620a;
  --str:#b3312f; --end:#a2560f; --dis:#1f7a4d; --rec:#2a5f9e; --kit:#a1356b; --good:#1f7a4d;
  --on-accent:#ffffff; --on-danger:#ffffff; --switch:#37702a; --glow:#dfe8d6;
  --card-shadow:0 1px 2px rgba(27,42,32,.05),0 6px 18px rgba(27,42,32,.05);
  --r:22px;
  color-scheme:light;
}
/* 高對比：純黑底、白字、亮黃重點、加粗框線；陽光下或視力需要時最清楚 */
:root[data-theme="contrast"],.th-prev[data-tp="contrast"]{
  --ground:#000000; --surface:#0b0b0b; --raised:#1c1c1c; --line:#8a8a8a; --line-soft:#5c5c5c;
  --text:#ffffff; --muted:#ebebeb; --faint:#d4d4d4;
  --ember:#ffd60a; --ember-deep:#e6bf00; --gold:#ffe066;
  --str:#ff6b6b; --end:#ffb347; --dis:#4cff9a; --rec:#6cc4ff; --kit:#ff8ad0; --good:#4cff9a;
  --on-accent:#000000; --on-danger:#000000; --switch:#ffd60a; --glow:#000000;
  --bw:2px;
  color-scheme:dark;
}
:root[data-theme="contrast"] :focus-visible{outline:3px solid var(--ember);outline-offset:3px}
:root[data-theme="contrast"] .btn{border-width:2px}

/* 淺色主題：半透明的黑色遮罩、照片上的白字維持原樣；分頁列改成白色毛玻璃 */
:root[data-theme="dawn"] .tabs,:root[data-theme="matcha"] .tabs,:root[data-theme="sky"] .tabs,:root[data-theme="tiffany"] .tabs{box-shadow:0 -1px 0 var(--line-soft)}
:root[data-theme="dawn"] .hud,:root[data-theme="matcha"] .hud,:root[data-theme="sky"] .hud,:root[data-theme="tiffany"] .hud{border-bottom-color:var(--line)}

/* 主題選擇卡片 */
.th-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.th-card{min-width:0;overflow:hidden;position:relative;display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:16px;border:2px solid var(--line-soft);background:var(--surface);text-align:left;color:var(--text)}
.th-card[aria-pressed="true"]{border-color:var(--ember)}
.th-card[aria-pressed="true"]::after{content:"✓";position:absolute;top:8px;right:10px;width:24px;height:24px;border-radius:50%;background:var(--ember);color:var(--on-accent);display:grid;place-items:center;font-size:14px;font-weight:800}
.th-prev{border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:6px;border:1px solid rgba(127,127,127,.25)}
.th-prev .ln{height:8px;border-radius:99px}
.th-prev .ln.s{width:60%}
.th-prev{min-width:0;overflow:hidden}
.th-prev .row{display:flex;gap:6px;align-items:center;min-width:0}
.th-prev .dot{flex:none}
.th-prev .pill{width:44px;height:18px;border-radius:99px;padding:0}
.th-prev .dot{width:12px;height:12px;border-radius:50%}
.th-card b{font-size:16px}
.th-card span.d{font-size:13px;color:var(--muted);line-height:1.45}
.th-auto{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:0;border:0}
.th-auto > .th-prev{padding:6px}
.th-auto .pill{width:22px;flex:none}
.th-auto .row{gap:4px}
.th-auto .dot:nth-of-type(n+3){display:none}
