/*
 * JyotiSoft Telegram Mini App (/tma/) — the ONLY place its colours live.
 *
 * Source: jyotisoft-miniapp-design/screens/tma.css (design package 2026-09-30),
 * carried over 1:1: every design variable keeps its name behind the --jy-tma-
 * prefix and its value, light block from `.app`, dark block from `.app.dark`.
 * Values the design wrote straight into components (the toggle knob, shadows,
 * the navy glow, scrims, translucent inks on navy) and the per-screen colours
 * (D1/D2 category tiles) are tokens here too, so no stylesheet under
 * app/web/src/tma/ and no TSX carries a raw colour (tmaNoRawColors.test.ts).
 *
 * Scoped to <html data-tma>: only tma.html sets it, so the Kala app and the
 * historical build are untouched. Contrast of every ink/ground pair is measured in
 * both themes by app/web/src/kala/checks/tokenContrast.test.ts.
 */
@import "./coin-font.css"; /* the Telegram Stars sign */

:root[data-tma] {
  /* The JyotiSoft logotype (web/wordmark.css), same values as brand-jyotisoft.css: the Mini App and the
     web version load only this file, so without them «JyotiSoft» fell back to one plain ink. */
  --jy-wordmark-j: #fd5a01;
  --jy-wordmark-s: #01224e;
  --jy-wordmark-s-on-dark: #b4c5e0;
  /* Gold coins (owner 2026-10-27): 3D glossy gold→orange coin (GOLD_COINS_ICONS D1) + a warm glow, stronger in dark. */
  --coin-gold-core: #fff4b8;
  --coin-gold-hi: #ffd34d;
  --coin-gold: #ffa81f;
  --coin-gold-lo: #e8780c;
  --coin-gold-rim: #9a4a05;
  --coin-edge-hi: #e28b12;
  --coin-bevel-hi: #ffe27a;
  --coin-bevel-lo: #d86a08;
  --coin-ring-hi: #fff1a8;
  --coin-ring-lo: #c9660a;
  --coin-shade: #b95a06;
  --coin-gold-shine: #ffffff;
  --coin-glow: rgba(245, 208, 107, 0.55);
  --coin-glow-far: rgba(212, 161, 42, 0.35);
  --jy-tma-bg: #f3f8fc;
  --jy-tma-surface: #ffffff;
  --jy-tma-surface-2: #eef2f7;
  --jy-tma-surface-3: #e3e9f1;
  --jy-tma-ink: #080b26;
  --jy-tma-ink-2: #53668b;
  --jy-tma-ink-3: #53668b;
  --jy-tma-line: #e1ebf5;
  --jy-tma-line-2: rgba(19, 35, 59, .24);
  --jy-tma-navy: #142a45;
  --jy-tma-navy-2: #1a3758;
  --jy-tma-on-navy: #eef4fa;
  --jy-tma-on-navy-2: #b3c4d4;
  --jy-tma-or: #fd5a01;
  --jy-tma-or-2: #ff8a5c;
  --jy-tma-or-ink: #c2410c;
  /* text on the orange-tinted chips (or-soft): 4.8:1 there; the plain ink above is 4.4 */
  --jy-tma-or-ink-tint: #b93c0a;
  --jy-tma-or-soft: #ffe9df;
  --jy-tma-cta-ink: #13233b;
  --jy-tma-good: #1d7349;
  --jy-tma-good-soft: #e2f2e9;
  --jy-tma-bad: #b3261e;
  --jy-tma-bad-soft: #fbe6e4;
  /* Unread count on the «Спросить» tab: one saturated red in both themes. */
  --jy-tma-badge: #d92d20;
  --jy-tma-badge-ink: #ffffff;
  --jy-tma-warn: #8a5a00;
  --jy-tma-warn-soft: #fff1d1;

  /* Planets */
  --jy-tma-su: #b83a08;
  --jy-tma-mo: #1a6a9c;
  /* The drawn Moon of a calendar day (MoonPhase.tsx): lit part and soft dark disc; the ring is --jy-tma-or. */
  --jy-tma-moon-lit: #fffaf0;
  --jy-tma-moon-shade: #3b4a6b;
  --jy-moon-lit: var(--jy-tma-moon-lit);
  --jy-moon-shade: var(--jy-tma-moon-shade);
  --jy-moon-mark: var(--jy-tma-or);
  --jy-tma-ma: #c0262d;
  --jy-tma-me: #146c35;
  --jy-tma-ju: #8a5a00;
  --jy-tma-ve: #a8327a;
  --jy-tma-sa: #3b44b0;
  --jy-tma-ra: #4b5563;
  --jy-tma-ke: #8a4b2a;

  /* Planet names on the navy panel (C5 «now» line): the design writes the
     dark-theme planet tones there in both themes. */
  --jy-tma-su-nv: #ff9a52; --jy-tma-mo-nv: #72cff2; --jy-tma-ma-nv: #ff7a7a;
  --jy-tma-me-nv: #8fe7b3; --jy-tma-ju-nv: #f4cd55; --jy-tma-ve-nv: #f58cc8;
  --jy-tma-sa-nv: #b3b8ff; --jy-tma-ra-nv: #d0d4dc; --jy-tma-ke-nv: #e8b089;
  /* Label ink on the planet-coloured mahadasha strip (C5 .md) */
  --jy-tma-md-ink: #ffffff;

  --jy-tma-serif: "JyCoin", "Piazzolla", Georgia, "Times New Roman", serif;
  --jy-tma-sans: "JyCoin", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;

  /* Literals the design put inside components */
  --jy-tma-knob: #ffffff;
  --jy-tma-on-good: #ffffff;
  /* Icon ink on a solid category ground (B6 digest rows) */
  --jy-tma-on-cat: #ffffff;
  --jy-tma-logo-ground: #ffffff;
  --jy-tma-shadow-card: 0 6px 20px rgba(24, 61, 92, .05);
  --jy-tma-shadow-seg: 0 1px 3px rgba(19, 35, 59, .14);
  --jy-tma-shadow-knob: 0 1px 3px rgba(0, 0, 0, .2);
  --jy-tma-sky-glow: rgba(253, 90, 1, .30);
  --jy-tma-sky-badge: rgba(253, 90, 1, .2);
  --jy-tma-sky-badge-ink: #ffb899;
  --jy-tma-scrim: rgba(10, 21, 36, .5);
  --jy-tma-scrim-light: rgba(245, 247, 251, .55);
  /* Translucent on-navy ink (skeleton bars, lines and outlines on .sky) */
  --jy-tma-on-navy-a10: rgba(238, 244, 250, .1);
  --jy-tma-on-navy-a12: rgba(238, 244, 250, .12);
  --jy-tma-on-navy-a14: rgba(238, 244, 250, .14);
  --jy-tma-on-navy-a16: rgba(238, 244, 250, .16);
  --jy-tma-on-navy-a20: rgba(238, 244, 250, .2);
  --jy-tma-on-navy-a32: rgba(238, 244, 250, .32);
  --jy-tma-on-navy-a35: rgba(238, 244, 250, .35);
  --jy-tma-on-navy-a50: rgba(238, 244, 250, .5);

  /* Section E: the child avatar (E1 `.pa`, the Moon's blue at tile tone) and
     the «good» verdict badge on navy (E3 .sky). */
  --jy-tma-mo-soft: #e3eefb;
  --jy-tma-sky-good: rgba(127, 217, 168, .18);
  --jy-tma-sky-good-ink: #9be8bf;

  /* Topic categories (D1/D2): icon ground, tile ground, count ink */
  --jy-tma-cat-money: #15803d;    --jy-tma-cat-money-soft: #e3f4e8;    --jy-tma-cat-money-ink: #146c35;
  --jy-tma-cat-love: #be185d;     --jy-tma-cat-love-soft: #fde7ef;     --jy-tma-cat-love-ink: #a3154f;
  --jy-tma-cat-career: #1d5fbf;   --jy-tma-cat-career-soft: #e4edfb;   --jy-tma-cat-career-ink: #1a55ab;
  --jy-tma-cat-forecast: #6d3fc0; --jy-tma-cat-forecast-soft: #efe8fb; --jy-tma-cat-forecast-ink: #5f36a8;
  --jy-tma-cat-kids: #b45309;     --jy-tma-cat-kids-soft: #fdf0dc;     --jy-tma-cat-kids-ink: #97460a;
  --jy-tma-cat-family: #0f766e;   --jy-tma-cat-family-soft: #dff3f0;   --jy-tma-cat-family-ink: #0d6660;
  --jy-tma-cat-health: #c0262d;   --jy-tma-cat-health-soft: #fde6e6;   --jy-tma-cat-health-ink: #a92127;
  --jy-tma-cat-place: #0369a1;    --jy-tma-cat-place-soft: #e0f0fa;    --jy-tma-cat-place-ink: #035d8f;
  --jy-tma-cat-date: #c2410c;     --jy-tma-cat-date-soft: #ffe9df;     --jy-tma-cat-date-ink: #a8380a;
  --jy-tma-cat-spirit: #4338ca;   --jy-tma-cat-spirit-soft: #e8e8fb;   --jy-tma-cat-spirit-ink: #3d33b8;
  /* «Общий разбор» and «Обучение» (2026-10-11): own tones, no longer forecast/career's. */
  --jy-tma-cat-general: #a16207;  --jy-tma-cat-general-soft: #fbf1d6;  --jy-tma-cat-general-ink: #7f4d06;
  --jy-tma-cat-edu: #475569;      --jy-tma-cat-edu-soft: #e9edf2;      --jy-tma-cat-edu-ink: #3b4757;
  /* «Бизнес и дело» (2026-10-16): its own plum, apart from love's pink and forecast's violet. */
  --jy-tma-cat-biz: #86198f;      --jy-tma-cat-biz-soft: #f7e6f9;      --jy-tma-cat-biz-ink: #761680;

  /* Day-score bands (owner 2026-10-16, #3635, RBUG-4004): one hue per band, never red — the
     verdict card's gauge. The fill is the «Пульс дня» image's own colour
     (modules/daily_render/image_render.py), the same in both themes; -hi is the gradient's
     light end, -edge a ≥3:1 rim on the surface, -ink the ≥4.5:1 number. */
  --jy-tma-band-good: #10b981;    --jy-tma-band-good-hi: #6ee7b7;    --jy-tma-band-good-edge: #047857;    --jy-tma-band-good-ink: #1d7349;
  --jy-tma-band-neutral: #facc15; --jy-tma-band-neutral-hi: #fef08a; --jy-tma-band-neutral-edge: #a16207; --jy-tma-band-neutral-ink: #8a5a00;
  --jy-tma-band-hard: #f97316;    --jy-tma-band-hard-hi: #fdba74;    --jy-tma-band-hard-edge: #c2410c;    --jy-tma-band-hard-ink: #b8400b;
  /* «Your chakra scale» (flag chakra_scale_v2): the traditional colours of the centres, muted and
     warm (no neon, no violet); -ink = text on the surface (≥4.5:1), -on = text on the centre's badge. */
  --jy-tma-chakra-ajna: #4f5b93;  --jy-tma-chakra-ajna-ink: #4f5b93;  --jy-tma-chakra-ajna-on: #ffffff;
  --jy-tma-chakra-vishuddha: #4a8baa;  --jy-tma-chakra-vishuddha-ink: #417a96;  --jy-tma-chakra-vishuddha-on: #080b26;
  --jy-tma-chakra-anahata: #5f9469;  --jy-tma-chakra-anahata-ink: #527f5a;  --jy-tma-chakra-anahata-on: #080b26;
  --jy-tma-chakra-manipura: #d2a43a;  --jy-tma-chakra-manipura-ink: #8f7027;  --jy-tma-chakra-manipura-on: #080b26;
  --jy-tma-chakra-svadhisthana: #d8803a;  --jy-tma-chakra-svadhisthana-ink: #a8642d;  --jy-tma-chakra-svadhisthana-on: #080b26;
  --jy-tma-chakra-muladhara: #b04a3e;  --jy-tma-chakra-muladhara-ink: #b04a3e;  --jy-tma-chakra-muladhara-on: #ffffff;
  --jy-tma-chakra-sahasrara: #a08f78;  --jy-tma-chakra-sahasrara-ink: #807260;  --jy-tma-chakra-sahasrara-on: #080b26;
}

/* `.tma-dark`: a screen the design draws dark in both themes (G4 Plus). */
:root[data-tma][data-theme="dark"],
:root[data-tma] .tma-dark {
  --coin-gold-core: #fff4b8;
  --coin-gold-hi: #ffd34d;
  --coin-gold: #ffa81f;
  --coin-gold-lo: #e8780c;
  --coin-gold-rim: #9a4a05;
  --coin-edge-hi: #e28b12;
  --coin-bevel-hi: #ffe27a;
  --coin-bevel-lo: #d86a08;
  --coin-ring-hi: #fff1a8;
  --coin-ring-lo: #c9660a;
  --coin-shade: #b95a06;
  --coin-gold-shine: #ffffff;
  --coin-glow: rgba(245, 208, 107, 0.75);
  --coin-glow-far: rgba(245, 208, 107, 0.45);
  --jy-tma-bg: #0a1524;
  --jy-tma-surface: #0f1e33;
  --jy-tma-surface-2: #142a45;
  --jy-tma-surface-3: #1a3758;
  --jy-tma-ink: #e8eef5;
  --jy-tma-ink-2: #a3b6c7;
  --jy-tma-ink-3: #8fa3b6;
  --jy-tma-line: rgba(232, 238, 245, .12);
  --jy-tma-line-2: rgba(232, 238, 245, .26);
  --jy-tma-navy: #162b47;
  --jy-tma-navy-2: #1f3a5e;
  --jy-tma-or-ink: #fd5a01;
  --jy-tma-or-ink-tint: #ff6e24;
  --jy-tma-or-soft: rgba(253, 90, 1, .16);
  --jy-tma-good: #7fd9a8;
  --jy-tma-good-soft: rgba(127, 217, 168, .14);
  --jy-tma-bad: #ff9a90;
  --jy-tma-bad-soft: rgba(255, 154, 144, .14);
  --jy-tma-warn: #f4cd55;
  --jy-tma-warn-soft: rgba(244, 205, 85, .14);
  --jy-tma-su: #ff9a52;
  --jy-tma-mo: #72cff2;
  --jy-tma-moon-lit: #f4ecd6;
  --jy-tma-moon-shade: #24405f;
  --jy-moon-lit: var(--jy-tma-moon-lit);
  --jy-moon-shade: var(--jy-tma-moon-shade);
  --jy-moon-mark: var(--jy-tma-or);
  --jy-tma-ma: #ff7a7a;
  --jy-tma-me: #8fe7b3;
  --jy-tma-ju: #f4cd55;
  --jy-tma-ve: #f58cc8;
  --jy-tma-sa: #b3b8ff;
  --jy-tma-ra: #d0d4dc;
  --jy-tma-ke: #e8b089;
  --jy-tma-shadow-card: none;
  /* DERIVED (no dark design for C5): the dark planets are light tones, so the
     strip labels take the page ground instead of white. */
  --jy-tma-md-ink: #0a1524;
  /* DERIVED (no dark design for H2): the page ground at the light scrim's 55 %. */
  --jy-tma-scrim-light: rgba(10, 21, 36, .55);

  /* DERIVED, no designer value: the dark Moon ink at 16 %, like --jy-tma-or-soft. */
  --jy-tma-mo-soft: rgba(114, 207, 242, .16);

  /* DERIVED, no designer value (owner decision Q3, 2026-09-30): the planet
     rule of tma.css — same hue, lifted to ~74 % lightness on the dark ground;
     tile = the icon colour at 16 % like --jy-tma-or-soft. Contrast of each ink
     on its tile is 5.8–10.9:1. Replace with the designer's values when given. */
  --jy-tma-cat-money-soft: rgba(21, 128, 61, .16);    --jy-tma-cat-money-ink: #8decb1;
  --jy-tma-cat-love-soft: rgba(190, 24, 93, .16);     --jy-tma-cat-love-ink: #f089b4;
  --jy-tma-cat-career-soft: rgba(29, 95, 191, .16);   --jy-tma-cat-career-ink: #8cb4ee;
  --jy-tma-cat-forecast-soft: rgba(109, 63, 192, .16); --jy-tma-cat-forecast-ink: #b39bde;
  --jy-tma-cat-kids-soft: rgba(180, 83, 9, .16);      --jy-tma-cat-kids-ink: #f9b581;
  --jy-tma-cat-family-soft: rgba(15, 118, 110, .16);  --jy-tma-cat-family-ink: #89f0e8;
  --jy-tma-cat-health-soft: rgba(192, 38, 45, .16);   --jy-tma-cat-health-ink: #e99094;
  --jy-tma-cat-place-soft: rgba(3, 105, 161, .16);    --jy-tma-cat-place-ink: #7dcffd;
  --jy-tma-cat-date-soft: rgba(194, 65, 12, .16);     --jy-tma-cat-date-ink: #f7a482;
  --jy-tma-cat-spirit-soft: rgba(67, 56, 202, .16);   --jy-tma-cat-spirit-ink: #9c96e3;
  --jy-tma-cat-general-soft: rgba(161, 98, 7, .18);   --jy-tma-cat-general-ink: #f2c46b;
  --jy-tma-cat-edu-soft: rgba(148, 163, 184, .16);    --jy-tma-cat-edu-ink: #b8c4d4;
  --jy-tma-cat-biz-soft: rgba(134, 25, 143, .18);     --jy-tma-cat-biz-ink: #e9a6ef;

  /* Day-score bands: the fill itself is the rim on navy (≥ 5.9:1); lighter numbers. */
  --jy-tma-band-good-edge: #10b981;    --jy-tma-band-good-ink: #7fd9a8;
  --jy-tma-band-neutral-edge: #facc15; --jy-tma-band-neutral-ink: #f4cd55;
  --jy-tma-band-hard-edge: #f97316;    --jy-tma-band-hard-ink: #fdba74;
  /* «Your chakra scale»: the centres' text on the dark surface (≥4.5:1). */
  --jy-tma-chakra-ajna-ink: #7d86af;
  --jy-tma-chakra-vishuddha-ink: #5190ad;
  --jy-tma-chakra-anahata-ink: #5f9469;
  --jy-tma-chakra-manipura-ink: #d2a43a;
  --jy-tma-chakra-svadhisthana-ink: #d8803a;
  --jy-tma-chakra-muladhara-ink: #c17268;
  --jy-tma-chakra-sahasrara-ink: #a08f78;
}

/* Day levels of the calendar (owner choice «Calendar No. 2»): a neutral day is
 * a plain number — no ring, no glow — and there is no legend. */
:root[data-tma] {
  --jy-tma-day-ink: #10221d;
  --jy-tma-day-best: #62e7a0;     --jy-tma-day-best-border: #008a43;
  --jy-tma-day-best-glow: 0 0 8px rgba(0, 218, 99, .65), 0 0 23px rgba(0, 218, 99, .48);
  --jy-tma-day-good: #e3ffc1;     --jy-tma-day-good-border: #65c800;
  --jy-tma-day-good-glow: 0 0 8px rgba(141, 235, 28, .36), 0 0 20px rgba(141, 235, 28, .28);
  --jy-tma-day-warn: #ffead0;     --jy-tma-day-warn-border: #ff8b00;
  --jy-tma-day-warn-glow: 0 0 8px rgba(255, 150, 26, .35), 0 0 20px rgba(255, 150, 26, .26);
  --jy-tma-day-bad: #ff9ab0;      --jy-tma-day-bad-border: #e50b3b;
  --jy-tma-day-bad-glow: 0 0 8px rgba(255, 29, 75, .55), 0 0 23px rgba(255, 29, 75, .4);
  /* Time-of-day bands, shared by the strip and the axis. */
  --jy-tma-time-good: #44d98b;
  --jy-tma-time-best: #00a95c;
  --jy-tma-time-bad: #ff6266;
  /* «Осторожно» of the day's summary (Gulika, Varjyam, Vishti, a weak hour): the day
     calendar's warn border, between the good greens and the red veto. */
  --jy-tma-time-caution: #ff9a1f;
}
:root[data-tma][data-theme="dark"] {
  --jy-tma-time-best: #14c77c;
  --jy-tma-time-bad: #ff7376;
  --jy-tma-time-caution: #ffad4d;
}

/* Shell of the JyotiSoft review (S001–S107): avatar ground and the light hero
 * card's art and veil. */
:root[data-tma] {
  --jy-tma-avatar-bg: linear-gradient(120deg, #a18aff, #64d8ef);
  --jy-tma-on-avatar: #0b2038; /* fixed ink for the fixed gradient: 5.3:1 on its darkest stop, both themes */
  --jy-tma-hero-veil: linear-gradient(90deg, #ffffff 64%, rgba(255, 255, 255, .93) 82%, rgba(255, 255, 255, .84));
}

/* Telegram safe areas: device inset + Telegram's own controls (fullscreen). */
:root[data-tma] {
  /* The device part falls back to env() as the bottom does: an iOS client whose
   * safe_area_changed has not arrived yet still clears the status bar. */
  --jy-tma-safe-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --jy-tma-safe-bottom: max(env(safe-area-inset-bottom, 0px), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
}

/* The report reader's page (owner 2026-11-13, packages/ui/src/reader): its own light/dark pair, whatever
   the Mini App's theme — the reader's stylesheet only reads --jy-reader-*. */
:root[data-tma] .jy-reader {
  --jy-reader-bg: #ffffff;
  --jy-reader-surface: #f5f8fc;
  --jy-reader-ink: #16233a;
  --jy-reader-head: #142a45;
  --jy-reader-muted: #56678a;
  --jy-reader-line: #e3eaf3;
  --jy-reader-ac: #fd5a01;
  --jy-reader-ac-ink: #c2410c;
  --jy-reader-ac-soft: #fff4ec;
  --jy-reader-btn: #c2410c;
  --jy-reader-on-btn: #ffffff;
  --jy-reader-mark: #ffe1c7;
  --jy-reader-ok: #2c6f06;
  --jy-reader-ok-soft: #f3faf4;
  --jy-reader-warn: #9e2b1a;
  --jy-reader-warn-soft: #fdf5f4;
  --jy-reader-scrim: rgba(8, 12, 20, 0.42);
  --jy-reader-toast: #111827;
  --jy-reader-toast-ink: #ffffff;
  --jy-reader-serif: var(--jy-tma-serif);
  --jy-reader-display: var(--jy-tma-serif);
  --jy-reader-sans: var(--jy-tma-sans);
}
:root[data-tma] .jy-reader[data-theme="dark"] {
  --jy-reader-bg: #0e1626;
  --jy-reader-surface: #162135;
  --jy-reader-ink: #dce3ee;
  --jy-reader-head: #f4f7fb;
  --jy-reader-muted: #8fa0ba;
  --jy-reader-line: #26324a;
  --jy-reader-ac: #ff7a33;
  --jy-reader-ac-ink: #ff9d66;
  --jy-reader-ac-soft: #2a1c14;
  --jy-reader-btn: #ff7a33;
  --jy-reader-on-btn: #0e1626;
  --jy-reader-mark: #7a3a12;
  --jy-reader-ok: #7bc98d;
  --jy-reader-ok-soft: #13241a;
  --jy-reader-warn: #f08a7a;
  --jy-reader-warn-soft: #2a1716;
}
