/* AiVi console colors (07-CONSOLE-CONTRACT.md, "Цвета", decision of 18.10 evening).
   - data-source="telegram" (default): everything comes from the user's Telegram theme (--tg-theme-*).
     Each variable keeps the fallback palette value, so a key missing in themeParams never breaks the page.
   - data-source="fallback": neutral blue palette. Used outside Telegram, on clients without themeParams,
     and when the user picked "Светлая"/"Тёмная" in Profile (stored only as ui_theme).
   No purple, no Telegram logo. Inter is a local OFL font (console/fonts/). */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-head: Inter, -apple-system, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: Inter, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- fallback palette: light ---- */
:root, :root[data-theme="light"] {
  --f-bg: #F4F8FF;
  --f-surface: #FFFFFF;
  --f-line: #DCE6F5;
  --f-text: #101B30;
  --f-muted: #536784;
  --f-accent: #0754EB;
  --f-on-accent: #FFFFFF;
  --f-tint: #EDF4FF;
  --f-danger: #C0263B;
  --f-done-bg: #E3F4E8;
  --f-done-fg: #1E7A3C;
  --f-warn-bg: #FFF1D6;
  --f-warn-fg: #7A4B00;
}
/* ---- fallback palette: dark ---- */
:root[data-theme="dark"] {
  --f-bg: #06152D;
  --f-surface: #0E2142;
  --f-line: #1F3560;
  --f-text: #F2F6FF;
  --f-muted: #A3B3CF;
  --f-accent: #4D86FF;
  --f-on-accent: #06152D;
  --f-tint: #15294F;
  --f-danger: #FF8A9F;
  --f-done-bg: #1C3A2B;
  --f-done-fg: #9BE3AE;
  --f-warn-bg: #3F3320;
  --f-warn-fg: #FFD58A;
}

/* ---- fallback mode ---- */
:root[data-source="fallback"] {
  --c-bg: var(--f-bg);
  --c-surface: var(--f-surface);
  --c-bar: var(--f-surface);
  --c-line: var(--f-line);
  --c-text: var(--f-text);
  --c-muted: var(--f-muted);
  --c-accent: var(--f-accent);
  --c-on-accent: var(--f-on-accent);
  --c-link: var(--f-accent);
  --c-tint: var(--f-tint);
  --c-danger: var(--f-danger);
}

/* ---- Telegram mode: user's theme, fallback value per variable ---- */
:root[data-source="telegram"] {
  --c-bg: var(--tg-theme-secondary-bg-color, var(--f-bg));
  --c-surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--f-surface)));
  --c-bar: var(--tg-theme-bottom-bar-bg-color, var(--c-surface));
  --c-line: var(--tg-theme-section-separator-color, var(--f-line));
  --c-text: var(--tg-theme-text-color, var(--f-text));
  --c-muted: var(--tg-theme-subtitle-text-color, var(--tg-theme-hint-color, var(--f-muted)));
  --c-accent: var(--tg-theme-button-color, var(--f-accent));
  --c-on-accent: var(--tg-theme-button-text-color, var(--f-on-accent));
  --c-link: var(--tg-theme-link-color, var(--f-accent));
  --c-tint: var(--f-tint);
  --c-danger: var(--tg-theme-destructive-text-color, var(--f-danger));
}
/* tint under chips and the tip card: a soft mix of the theme's own accent and surface */
@supports (background: color-mix(in srgb, red 10%, blue)) {
  :root[data-source="telegram"] { --c-tint: color-mix(in srgb, var(--c-accent) 13%, var(--c-surface)); }
}

:root {
  --c-done-bg: var(--f-done-bg);
  --c-done-fg: var(--f-done-fg);
  --c-warn-bg: var(--f-warn-bg);
  --c-warn-fg: var(--f-warn-fg);
  --c-chip: var(--c-tint);
  --c-tip: var(--c-tint);
  --c-accent-hover: var(--c-accent);
}
