/* Цвета тем: общие для окна программы, оверлея и уведомлений. */
/* hidden всегда прячет, даже если у элемента свой display (flex, grid, inline-block) */
[hidden] { display: none !important; }
:root {
  --bg: #0b0d10; --side: #111418; --panel: #14181d; --panel2: #1b2026; --hover: #20262d; --line: #232930; --line-hi: #3a434a;
  --text: #e8eaed; --muted: #9aa3ae; --dim: #6f7881; --dash: #4a535a; --accent: #f2a93b; --accent-soft: rgba(242,169,59,.13); --on-accent: #1a1205;
  --good: #3fc27a; --good-soft: rgba(63,194,122,.12); --on-good: #062014; --bad: #e5604d;
  --q0: #aeb5be; --q1: #5fd38a; --q2: #5aa9ff; --q3: #b58cff; --q4: #ff7a6b; --q5: #f2c14b;
  --scroll: #2c343a; --icon-bg: #0b0d0f; --row-hover: rgba(255,255,255,.02); --shadow: rgba(0,0,0,.5);
  --c1: #f2a93b; --c2: #9b7bff; --c3: #ef5f7a; --c4: #3fc1c9;
  color-scheme: dark;
}
/* Цветовые темы: переключатель в «Профиле» и кнопка 🎨 внизу меню. */
:root[data-theme="light"] {
  --bg: #f3f4f6; --side: #ffffff; --panel: #ffffff; --panel2: #f0f2f5; --hover: #e7eaee; --line: #dde1e6; --line-hi: #c5ccd4;
  --text: #1b2027; --muted: #5b6571; --dim: #8a939d; --dash: #a9b1ba; --accent: #d9870f; --accent-soft: rgba(217,135,15,.12); --on-accent: #ffffff;
  --good: #1c9a58; --good-soft: rgba(28,154,88,.1); --on-good: #ffffff; --bad: #d2452f;
  --q0: #6b7480; --q1: #1c9a58; --q2: #2a74d4; --q3: #8656ec; --q4: #dd4f3b; --q5: #b98a06;
  --scroll: #c8cdd3; --icon-bg: #eef0f3; --row-hover: rgba(0,0,0,.025); --shadow: rgba(20,30,40,.14);
  --c1: #e08600; --c2: #7656ea; --c3: #dd3d5d; --c4: #0f9aa4;
  color-scheme: light;
}
:root[data-theme="midnight"] {
  --bg: #090e18; --side: #0d1320; --panel: #111a2a; --panel2: #162136; --hover: #1b2842; --line: #1e2a40; --line-hi: #2f3f5e;
  --text: #e6ecf5; --muted: #93a1b8; --dim: #66748c; --accent: #4c9dff; --accent-soft: rgba(76,157,255,.14); --on-accent: #03101f;
  --scroll: #24314a; --icon-bg: #0a101c; --c1: #4c9dff; --c2: #ffb547; --c3: #ff6b8a; --c4: #4fd1a5;
}
:root[data-theme="swamp"] {
  --bg: #0a0e0a; --side: #0f150f; --panel: #131a13; --panel2: #192219; --hover: #1f2a1f; --line: #223022; --line-hi: #34472f;
  --text: #e4ebe1; --muted: #98a693; --dim: #6c7a67; --accent: #94c94a; --accent-soft: rgba(148,201,74,.13); --on-accent: #0d1405;
  --scroll: #273425; --icon-bg: #0b100b; --c1: #94c94a; --c2: #f2a93b; --c3: #5ab0ff; --c4: #e86d6d;
}
:root[data-theme="rust"] {
  --bg: #100c0b; --side: #161110; --panel: #1b1513; --panel2: #231b18; --hover: #2b211d; --line: #2e2420; --line-hi: #4a3a33;
  --text: #efe7e3; --muted: #ab9d96; --dim: #7e706a; --accent: #ec6a3f; --accent-soft: rgba(236,106,63,.14); --on-accent: #1a0904;
  --scroll: #3a2d28; --icon-bg: #120d0c; --c1: #ec6a3f; --c2: #f2c14b; --c3: #6fb6ff; --c4: #b58cff;
}
:root[data-theme="amethyst"] {
  --bg: #0d0a13; --side: #13101b; --panel: #181421; --panel2: #201a2c; --hover: #272036; --line: #2a2338; --line-hi: #41375a;
  --text: #ece8f4; --muted: #a39cb3; --dim: #766f87; --accent: #b07cff; --accent-soft: rgba(176,124,255,.15); --on-accent: #12051f;
  --scroll: #332a46; --icon-bg: #0e0b14; --c1: #b07cff; --c2: #f2a93b; --c3: #4fd1c5; --c4: #ff6b8a;
}

:root[data-theme="newyear"] {
  --bg: #08121c; --side: #0c1825; --panel: #0f1e2e; --panel2: #14273a; --hover: #1a3048; --line: #1b3045; --line-hi: #2d4a66;
  --text: #eef4fb; --muted: #9fb3c8; --dim: #6f859b; --accent: #f5c84c; --accent-soft: rgba(245,200,76,.14); --on-accent: #1d1503;
  --good: #3fc27a; --q5: #f5c84c;
  --scroll: #23405a; --icon-bg: #0a1622; --c1: #f5c84c; --c2: #e8394d; --c3: #4fc3f7; --c4: #3fc27a;
}

/* Новогоднее украшение окна программы (галочка в «Оформлении»): гирлянда по верху, снег, шапка на значке. */
#nyDeco { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
#nyDeco .garland { position: absolute; top: -6px; left: 0; right: 0; height: 26px; display: flex; justify-content: space-around;
  background: radial-gradient(ellipse 52% 14px at 50% 0, transparent 70%, rgba(40,60,50,.85) 72%, transparent 76%) 0 0 / 64px 26px repeat-x; }
#nyDeco .garland i { width: 8px; height: 13px; margin-top: 9px; border-radius: 50% 50% 45% 45%; background: var(--b); box-shadow: 0 0 9px 2px var(--b);
  transition: opacity .25s; }
#nyDeco .garland i:nth-child(4n+1) { --b: #ff4d5e; } #nyDeco .garland i:nth-child(4n+2) { --b: #ffd34d; }
#nyDeco .garland i:nth-child(4n+3) { --b: #4fd1ff; } #nyDeco .garland i:nth-child(4n) { --b: #6dff8f; }
/* Гирлянда бегущими огнями: раз в 0,8 с гаснет каждая третья лампочка (переключает снег в ui.js, в тех же
   кадрах), а не мигает плавно каждая сама по себе — так экран не перерисовывается 60 раз в секунду. */
#nyDeco .garland[data-ph="0"] i:nth-child(3n+1), #nyDeco .garland[data-ph="1"] i:nth-child(3n+2),
#nyDeco .garland[data-ph="2"] i:nth-child(3n) { opacity: .3; }
#nyDeco canvas.snow { position: absolute; inset: 0; width: 100%; height: 100%; }
/* сугроб — холст внутри самого блока, над его верхним краем: едет вместе с блоком при прокрутке */
.nypile { position: absolute; left: 6px; bottom: calc(100% - 2px); z-index: 2; pointer-events: none; display: block; }
:root.noanim #nyDeco * { animation: none; }
@media (prefers-reduced-motion: reduce) { #nyDeco * { animation: none !important; } }
/* Зимой края блоков чуть в инее (снег на них рисует ui.js), под верхней полосой сосульки. */
:root.ny .card, :root.ny .panel { position: relative; box-shadow: inset 0 1px 0 rgba(225,240,255,.14), inset 0 0 26px rgba(170,210,255,.05); }
:root.ny .main > .top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 18px; pointer-events: none; z-index: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 18'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23eaf6ff' stop-opacity='.95'/%3E%3Cstop offset='1' stop-color='%23a9d8ff' stop-opacity='.15'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 0 H96 V1.5 H92 L90 8 L88 1.5 H79 L76 15 L73 1.5 H66 L64.5 6 L63 1.5 H52 L49 17 L46 1.5 H38 L36 9 L34 1.5 H25 L23 12 L21 1.5 H12 L10.5 5 L9 1.5 H0 Z' fill='url(%23g)'/%3E%3C/svg%3E") 0 0 / 96px 18px repeat-x; opacity: .7; }
/* Снеговик с лопатой идёт по верхнему краю блока, за ним снега нет; снег из лопаты летит вперёд. */
.nyman { position: absolute; left: 0; bottom: calc(100% - 4px); width: 56px; height: 58px; z-index: 3; pointer-events: none;
  transition: opacity .5s; will-change: transform; }
.nyman svg { display: block; }
.nyman .sm-shovel { transform-origin: 24px 30px; }
.nyman.bye { opacity: 0; }
/* «Подсыпать снега»: круглая кнопка в правом нижнем углу, подпись — при наведении. Уведомления поднимаются над ней. */
#nyDeco .nymore { position: absolute; right: 16px; bottom: 16px; pointer-events: auto; height: 38px; min-width: 38px; padding: 0 12px;
  display: flex; align-items: center; gap: 6px; border-radius: 19px; border: 1px solid var(--line-hi); cursor: pointer;
  background: color-mix(in srgb, var(--panel2) 88%, transparent); color: var(--text); font: inherit; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
#nyDeco .nymore b { font-size: 18px; line-height: 1; font-weight: 400; }
#nyDeco .nymore span { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .25s ease; }
#nyDeco .nymore:hover span, #nyDeco .nymore:focus-visible span { max-width: 160px; }
#nyDeco .nymore:hover { border-color: var(--accent); }
:root.ny .toasts { bottom: 68px; }
:root.ny.phone #nyDeco .nymore { display: none; }
:root.ny .logo { position: relative; }
:root.ny .logo::before { content: ""; position: absolute; left: 13px; top: -7px; width: 24px; height: 20px; z-index: 1; pointer-events: none;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20'%3E%3Cpath d='M2 16 C5 6 12 1 19 4 L22 12 C17 9 11 11 8 16 Z' fill='%23e8394d'/%3E%3Crect x='1' y='14' width='14' height='5' rx='2.5' fill='%23f4f7fa'/%3E%3Ccircle cx='22' cy='13' r='2.4' fill='%23f4f7fa'/%3E%3C/svg%3E");
  transform: rotate(-14deg); }
/* Фон-пейзаж под панелями: затемнение, размытие и плотность панелей — в «Оформлении». */
:root.hasbg.scrolling * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
#zoneBg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#zoneBg .img { position: absolute; inset: 0; background: center / cover no-repeat; text-decoration: none; }
#zoneBg .img video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* слайд-шоу: картинки только проявляются друг над другом. Движение под стеклянными панелями заставляло
   браузер заново размывать фон каждый кадр, и прокрутка тормозила. */
#zoneBg .img .sl { position: absolute; inset: 0; background: center / cover no-repeat; opacity: 0; transition: opacity 2.5s ease; }
#zoneBg .img .sl.on { opacity: 1; }
#zoneBg i { position: absolute; inset: 0; background: var(--bg); opacity: var(--bg-dim, .55);
  /* края темнее середины: сверху и снизу текст и панели, в середине видно сам пейзаж */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.72) 45%, #000 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.72) 45%, #000 100%); }
#zoneBg b { position: absolute; display: none; will-change: transform; }

/* Живой фон: камера медленно плывёт, поверх туман, дождь, пепел или вспышки выброса.
   Двигаются только transform и opacity, это дёшево для видеокарты. */
#zoneBg[class^="fx-"] .img { animation: zkb 38s ease-in-out infinite; will-change: transform; }
@keyframes zkb {
  0%, 100% { transform: translate3d(-1.5%, -1%, 0) scale(1.04); }
  50% { transform: translate3d(1.5%, 1.2%, 0) scale(1.08); }
}

#zoneBg.fx-fog b { display: block; inset: -10% -60%;
  background: radial-gradient(ellipse 22% 16% at 15% 72%, rgba(205, 212, 222, .22), transparent 70%),
              radial-gradient(ellipse 26% 14% at 42% 84%, rgba(205, 212, 222, .18), transparent 70%),
              radial-gradient(ellipse 20% 12% at 68% 66%, rgba(205, 212, 222, .16), transparent 70%),
              radial-gradient(ellipse 28% 18% at 90% 80%, rgba(205, 212, 222, .2), transparent 70%); }
#zoneBg.fx-fog .f1 { animation: zfog 70s ease-in-out infinite alternate; }
#zoneBg.fx-fog .f2 { animation: zfog 110s ease-in-out infinite alternate-reverse; top: -22%; opacity: .7; }
@keyframes zfog { from { transform: translateX(-18%); } to { transform: translateX(18%); } }

#zoneBg.fx-rain b { display: block; left: -10%; right: -10%; top: -480px; bottom: 0; transform-origin: 50% 0;
  background: radial-gradient(1px 13px at 50% 50%, rgba(205, 220, 240, .5), transparent),
              radial-gradient(1px 10px at 50% 50%, rgba(205, 220, 240, .35), transparent),
              radial-gradient(1px 16px at 50% 50%, rgba(205, 220, 240, .4), transparent);
  background-size: 41px 80px, 67px 120px, 97px 160px; background-position: 0 0, 17px 33px, 51px 70px; }
#zoneBg.fx-rain .f1 { animation: zrain .55s linear infinite; }
#zoneBg.fx-rain .f2 { animation: zrain .8s linear infinite; opacity: .55; background-position: 23px 11px, 40px 90px, 7px 20px; }
@keyframes zrain { from { transform: skewX(-8deg) translateY(0); } to { transform: skewX(-8deg) translateY(480px); } }

#zoneBg.fx-ash b { display: block; left: -6%; right: -6%; top: -840px; bottom: 0;
  background: radial-gradient(circle 1.6px, rgba(230, 225, 215, .55), transparent),
              radial-gradient(circle 1.1px, rgba(230, 225, 215, .45), transparent),
              radial-gradient(circle 2px, rgba(255, 190, 130, .35), transparent);
  background-size: 140px 140px, 105px 210px, 280px 280px; background-position: 0 0, 50px 90px, 130px 40px; }
#zoneBg.fx-ash .f1 { animation: zash 38s linear infinite; }
#zoneBg.fx-ash .f2 { animation: zash 60s linear infinite; opacity: .6; background-position: 70px 30px, 10px 150px, 200px 220px; }
@keyframes zash { from { transform: translate(0, 0); } 50% { transform: translate(24px, 420px); } to { transform: translate(0, 840px); } }

#zoneBg.fx-emission b { display: block; inset: 0; }
#zoneBg.fx-emission .f1 { background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(200, 30, 40, .55), rgba(120, 10, 40, .25) 55%, transparent 80%);
  animation: zemi 14s ease-in-out infinite; }
#zoneBg.fx-emission .f2 { background: rgba(255, 220, 210, .9); opacity: 0; animation: zflash 14s linear infinite; }
@keyframes zemi { 0%, 100% { opacity: .35; } 40% { opacity: .55; } 47% { opacity: 1; } 55% { opacity: .5; } 80% { opacity: .8; } }
@keyframes zflash { 0%, 46% { opacity: 0; } 46.5% { opacity: .22; } 47.2% { opacity: 0; } 47.8% { opacity: .12; } 48.6%, 100% { opacity: 0; } }
:root.hasbg { background: var(--bg); }
:root.hasbg body { background: transparent; }
:root.anim #zoneBg { animation: bgin .6s ease-out; }
@keyframes bgin { from { opacity: 0; } }

/* Анимации можно выключить: тогда всё появляется сразу. */
:root.noanim *, :root.noanim *::before, :root.noanim *::after { animation: none !important; transition: none !important; }

/* Свой акцентный цвет поверх темы: «Профиль» → «Оформление» → «Акцент». */
:root[data-accent="amber"]  { --accent: #f2a93b; --accent-soft: rgba(242,169,59,.14); --on-accent: #1a1205; }
:root[data-accent="blue"]   { --accent: #4c9dff; --accent-soft: rgba(76,157,255,.15); --on-accent: #03101f; }
:root[data-accent="green"]  { --accent: #3fc27a; --accent-soft: rgba(63,194,122,.14); --on-accent: #04190d; }
:root[data-accent="red"]    { --accent: #ef5a4c; --accent-soft: rgba(239,90,76,.15); --on-accent: #1f0603; }
:root[data-accent="violet"] { --accent: #a77bff; --accent-soft: rgba(167,123,255,.16); --on-accent: #12051f; }
:root[data-accent="teal"]   { --accent: #2fc4c4; --accent-soft: rgba(47,196,196,.15); --on-accent: #031818; }
:root[data-accent="pink"]   { --accent: #f0609e; --accent-soft: rgba(240,96,158,.15); --on-accent: #1f0412; }
/* Прибыль синим, убыток оранжевым: красный и зелёный путает каждый двенадцатый мужчина. */
:root.cb { --good: #4ea1ff; --good-soft: rgba(78,161,255,.13); --on-good: #03101f; --bad: #ff8a1f; }
:root.cb[data-theme="light"] { --good: #1f6fd1; --good-soft: rgba(31,111,209,.1); --on-good: #ffffff; --bad: #d96a00; }
