/* Shared semantic palette for practice and Connections. Figures retain their original white canvas. */
:root {
  color-scheme: light;
  --ground: #f5f6f8;
  --surface: #ffffff;
  --input-surface: #ffffff;
  --surface-hover: #f1f3f5;
  --ink: #13294b;
  --ink-2: #4c5666;
  --ink-3: #606b79;
  --hairline: #dce1e8;
  --field-line: #7a8594;
  --field-line-hover: #52647d;
  --accent: #13294b;
  --accent-deep: #0b1e38;
  --accent-on: #ffffff;
  --accent-soft: #edf1f7;
  --thinking-surface: #ffffff;
  --thinking-ink-2: #4c5666;
  --thinking-ink-3: #606b79;
  --thinking-line: #dce1e8;
  --signals-surface: #eef1f5;
  --signals-ink-2: #4c5666;
  --notice-surface: #fff3dd;
  --notice-ink: #7c5315;
  --ok: #24683f;
  --ok-soft: #e8f3eb;
  --ok-line: #9bbda6;
  --ok-action: #286b46;
  --ok-action-hover: #1c5736;
  --ok-on: #ffffff;
  --err: #a13936;
  --err-bg: #fff0ee;
  --err-line: #d4a7a2;
  --err-hover: #fce3df;
  --track: #e5eaf0;
  --bar-muted: #d1dae6;
  --bar-best: #ceddf3;
  --scroll-thumb: #8794a6;
  --selection: #d8e3f3;
  --selection-ink: #13294b;
  --backdrop: rgba(18, 27, 35, .58);
  --modal-shadow: 0 24px 60px rgba(18, 27, 35, .25);
  --key-surface: rgba(0, 0, 0, .14);
  --key-line: rgba(255, 255, 255, .45);
  --spinner-track: rgba(255, 255, 255, .4);
  --figure-surface: #ffffff;
  --illini-orange: #ff5f05;
  --choice-selected-surface: #fff1e8;
  --choice-selected-line: #c44900;
  --choice-badge-ink: #13294b;
  --question-surface: #edf2f8;
  --recording-surface: #fff1e8;
  --recording-ink: #a83e00;
  --recording-line: #c44900;
  --decision-ink: #315d9c;
  --decision-hover: #264b81;
  --decision-soft: #edf3fd;
  --decision-line: #bdceea;
  --decision-on: #ffffff;
  --speech-ink: #1d6b62;
  --speech-hover: #14574f;
  --speech-soft: #eaf6f1;
  --speech-line: #b3d7ca;
  --speech-on: #ffffff;
  --inference-ink: #75578f;
  --inference-hover: #5f4478;
  --inference-soft: #f5eef8;
  --inference-line: #d7c7e4;
  --inference-on: #ffffff;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --book-serif: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #151c28;
  --surface: #202a3a;
  --input-surface: #182231;
  --surface-hover: #2b3038;
  --ink: #eef2f8;
  --ink-2: #c0c9d6;
  --ink-3: #aeb9c9;
  --hairline: #414b5c;
  --field-line: #8796ac;
  --field-line-hover: #b5c3d7;
  --accent: #aec8ee;
  --accent-deep: #d1e0f6;
  --accent-on: #13294b;
  --accent-soft: #2d3c52;
  --thinking-surface: #202a3a;
  --thinking-ink-2: #c0c9d6;
  --thinking-ink-3: #aeb9c9;
  --thinking-line: #414b5c;
  --signals-surface: #253143;
  --signals-ink-2: #c0c9d6;
  --notice-surface: #3c3020;
  --notice-ink: #f1cf91;
  --ok: #9bd5ac;
  --ok-soft: #20392a;
  --ok-line: #588468;
  --ok-action: #a1d6b2;
  --ok-action-hover: #bce5c8;
  --ok-on: #183322;
  --err: #ffb5ad;
  --err-bg: #3e2829;
  --err-line: #a37270;
  --err-hover: #503135;
  --track: #29394b;
  --bar-muted: #3a5066;
  --bar-best: #344c6c;
  --scroll-thumb: #8092aa;
  --selection: #3e5575;
  --selection-ink: #ffffff;
  --backdrop: rgba(4, 9, 14, .76);
  --modal-shadow: 0 24px 60px rgba(0, 0, 0, .4);
  --key-surface: rgba(255, 255, 255, .2);
  --key-line: rgba(18, 35, 59, .45);
  --spinner-track: rgba(18, 35, 59, .4);
  --choice-selected-surface: #3b2a22;
  --choice-selected-line: #ff5f05;
  --question-surface: #263449;
  --recording-surface: #3b2a22;
  --recording-ink: #ffb58a;
  --recording-line: #ff5f05;
  --decision-ink: #abc7f4;
  --decision-hover: #c7dcff;
  --decision-soft: #202f42;
  --decision-line: #476183;
  --decision-on: #14263f;
  --speech-ink: #91d6c5;
  --speech-hover: #b4e7db;
  --speech-soft: #1c3532;
  --speech-line: #43766c;
  --speech-on: #112f29;
  --inference-ink: #d3b9e8;
  --inference-hover: #e4cff5;
  --inference-soft: #33283f;
  --inference-line: #715b86;
  --inference-on: #30203f;
}

html { scrollbar-color: var(--scroll-thumb) var(--ground); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 2px solid var(--ground); border-radius: 6px; }
::selection { color: var(--selection-ink); background: var(--selection); }
body { caret-color: var(--accent); }
a { color: var(--accent-deep); text-underline-offset: 4px; }
input, textarea, select { accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.theme-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--input-surface); border: 1px solid var(--field-line); border-radius: 10px; }
.theme-choice { appearance: none; display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); cursor: pointer; }
.theme-choice:hover { background: var(--surface-hover); color: var(--ink); }
.theme-choice[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-deep); }
.theme-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.theme-choice svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.settings-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.language-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); flex: none; }
.language-choice { min-width: 42px; min-height: 38px; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: 600 .8125rem/1.2 var(--font); cursor: pointer; }
.language-choice:hover { background: var(--surface-hover); color: var(--ink); }
.language-choice[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-deep); }
.language-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

[data-model-role="decision"] { --role-ink: var(--decision-ink); --role-hover: var(--decision-hover); --role-soft: var(--decision-soft); --role-line: var(--decision-line); --role-on: var(--decision-on); }
[data-model-role="speech"] { --role-ink: var(--speech-ink); --role-hover: var(--speech-hover); --role-soft: var(--speech-soft); --role-line: var(--speech-line); --role-on: var(--speech-on); }
[data-model-role="inference"] { --role-ink: var(--inference-ink); --role-hover: var(--inference-hover); --role-soft: var(--inference-soft); --role-line: var(--inference-line); --role-on: var(--inference-on); }
.chip[data-model-role] { color: var(--role-ink); background: var(--role-soft); border-color: var(--role-line); }
.chip[data-model-role]:hover { border-color: var(--role-ink); }
.chip-state { color: var(--ink-2); }
.chip[data-state="ok"] .chip-state { color: var(--ok); }
.chip[data-state="down"] .chip-state { color: var(--err); }

@media (max-width: 560px) {
  .header-actions { justify-content: space-between; gap: 12px; }
  .settings-header-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .settings-page header { flex-wrap: wrap; }
}
