/* Motyw jasny/ciemny. Wybór: js/theme.js ustawia html[data-theme="light|dark"]. Jedna paleta dla komputera i telefonu. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419; --panel-bg: #171e26; --border: #2a3541; --text: #e8edf2; --text-muted: #9fb0c0;
  --accent: #e08a63; --accent-contrast: #1a0f0a;
  --green: #4cc38a; --yellow: #f2b84b; --red: #f0706a; --grey: #6b7785;
  --surface2: #1f2933; --text-soft: #b7c3cf; --line2: #3a4755; --hair: #202a34;
  --tint: #2a1d16; --tint-line: #5a3a28; --user-bubble: #3a2418;
  --warn-bg: #1d1a10; --warn-line: #8a6a1c; --danger-line: #5a2a28;
  --soft-bg: rgba(255, 255, 255, 0.08); --soft-bg2: rgba(255, 255, 255, 0.06);
  --tag-run-bg: #12301f; --tag-warn-bg: #3a2e10; --tag-err-bg: #3a1a18;
  --overlay: rgba(5, 8, 11, 0.7); --shadow: rgba(0, 0, 0, 0.45);
  --on-green: #06210f; --err-text: #f0706a;
  --code-bg: #0b0f14; --code-head: #141b23; --code-line: #2a3541; --code-text: #e8edf2; --code-muted: #9fb0c0;
  --code-gutter: #6f8093; --code-gutter-line: #1f2933; --code-link: #f0a27f; --code-fade: rgba(11, 15, 20, 0);
  --tk-k: #ff9e7a; --tk-s: #9ed48c; --tk-n: #e5c07b; --tk-c: #8696a8; --tk-f: #7db8f5; --tk-t: #c9a7f2; --tk-o: #b7c3cf; --tk-v: #e8edf2; --tk-dd: #f27a7a;
  --diff-add: rgba(76, 195, 138, 0.16); --diff-del: rgba(240, 98, 98, 0.18);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7; --panel-bg: #ffffff; --border: #dfe1e6; --text: #1c1f24; --text-muted: #6b7280;
  --accent: #c8643a; --accent-contrast: #ffffff;
  --green: #1f8a4a; --yellow: #a87400; --red: #c5321f; --grey: #9aa1ab;
  --surface2: #eceff3; --text-soft: #4b5563; --line2: #c5cad3; --hair: #e6e8ec;
  --tint: #fbe9e0; --tint-line: #e8b9a2; --user-bubble: #fbe9e0;
  --warn-bg: #fff6df; --warn-line: #d1a23a; --danger-line: #e3a59d;
  --soft-bg: rgba(0, 0, 0, 0.06); --soft-bg2: rgba(0, 0, 0, 0.04);
  --tag-run-bg: #dcf3e5; --tag-warn-bg: #fbecc4; --tag-err-bg: #fbdcd7;
  --overlay: rgba(20, 24, 30, 0.45); --shadow: rgba(0, 0, 0, 0.2);
  --on-green: #ffffff; --err-text: #c5321f;
  --code-bg: #f6f8fa; --code-head: #eaeef2; --code-line: #d0d7de; --code-text: #24292f; --code-muted: #57606a;
  --code-gutter: #8c959f; --code-gutter-line: #d8dee4; --code-link: #b3400f; --code-fade: rgba(246, 248, 250, 0);
  --tk-k: #b3400f; --tk-s: #1a7f37; --tk-n: #8a5a00; --tk-c: #6e7781; --tk-f: #0b5fc2; --tk-t: #7a3fc0; --tk-o: #57606a; --tk-v: #24292f; --tk-dd: #c5221f;
  --diff-add: rgba(31, 138, 74, 0.16); --diff-del: rgba(197, 50, 31, 0.14);
}

/* Kolor belki instancji (PWA -> Kolor belki): miesza wybrany kolor z tłem panelu, zachowując czytelność tekstu */
html {
  --bar-bg: var(--panel-bg);
  --bar-border: var(--border);
}
html[data-theme="dark"][data-bar-color] {
  --bar-bg: color-mix(in srgb, var(--pwa-bar-color) 38%, #171e26);
  --bar-border: color-mix(in srgb, var(--pwa-bar-color) 72%, #2a3541);
}
html[data-theme="light"][data-bar-color] {
  --bar-bg: color-mix(in srgb, var(--pwa-bar-color) 26%, #ffffff);
  --bar-border: color-mix(in srgb, var(--pwa-bar-color) 65%, #dfe1e6);
}

/* przełącznik motywu (Ustawienia) */
.theme-seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; max-width: 420px; }
.theme-seg button { flex: 1; min-height: 40px; padding: 0 10px; border: 0; background: transparent; color: var(--text); font: 500 14px/1 inherit; cursor: pointer; }
.theme-seg button + button { border-left: 1px solid var(--border); }
.theme-seg button[aria-pressed="true"] { background: var(--tint); color: var(--accent); font-weight: 700; }
.theme-setting { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 16px; }
.theme-setting-label { font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); }
.theme-hint { font-size: 12px; line-height: 17px; color: var(--text-muted); }
