/* Объём и движение платформы: переходы между страницами, ночное меню,
   стеклянная верхняя полоса, плитки и карточки в объёме, живые кнопки.
   Подключается после стилей раздела и переопределяет только оформление.
   Без движения (выключатель «Анимации» или «уменьшить движение» в системе)
   остаются цвета, тени и стекло, а все анимации и переходы отключаются. */

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --glow: rgb(var(--accent-rgb, 242 193 78) / 0.45);
  --night-1: #12203a;
  --night-2: #0b1424;
  --depth-1: 0 1px 2px rgba(13, 22, 38, 0.06), 0 10px 24px -18px rgba(13, 22, 38, 0.35);
  --depth-2: 0 2px 4px rgba(13, 22, 38, 0.06), 0 24px 44px -22px rgba(13, 22, 38, 0.5);
}

@property --spin {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* ================= Переходы между страницами ================= */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

/* Меню и верхняя полоса остаются на месте, в глубину уходит рабочая область (root). */
.shell .sidebar { view-transition-name: sidebar; }
.shell .topbar { view-transition-name: topbar; }
.shell .country-tab--current { view-transition-name: country-here; }
.shell .page a.tab--current { view-transition-name: tab-here; }
.shell .nav a[aria-current="page"]:not(:has(+ ul [aria-current="page"])) { view-transition-name: nav-here; }

::view-transition-group(*) {
  animation-duration: 0.5s;
  animation-timing-function: var(--ease-out);
}

/* Новая страница ложится поверх старой обычным наложением, без высветления. */
::view-transition-image-pair(root) { isolation: auto; }
::view-transition-old(root),
::view-transition-new(root) { mix-blend-mode: normal; }

/* Вглубь: старая страница проходит мимо нас, новая выплывает из глубины. */
::view-transition-old(root) {
  animation: vt-pass .38s var(--ease-in) both;
  transform-origin: 58% 45%;
}

::view-transition-new(root) {
  animation: vt-arrive .62s var(--ease-out) .04s both;
  transform-origin: 58% 45%;
}

/* Назад: старая уходит в глубину, новая возвращается из-за спины. */
html:active-view-transition-type(back)::view-transition-old(root) { animation-name: vt-recede; }
html:active-view-transition-type(back)::view-transition-new(root) { animation-name: vt-return; }

/* Вбок (другая страна, вкладка, фильтр): лёгкая смена без поворота. */
html:active-view-transition-type(side)::view-transition-old(root) { animation: vt-side-out .26s var(--ease-soft) both; }
html:active-view-transition-type(side)::view-transition-new(root) { animation: vt-side-in .42s var(--ease-out) .04s both; }

/* Та же страница (сохранение формы): почти незаметно. */
html:active-view-transition-type(same)::view-transition-old(root) { animation: vt-fade-out .16s linear both; }
html:active-view-transition-type(same)::view-transition-new(root) { animation: vt-fade-in .2s linear both; }

/* Вход после формы входа: ночная сцена пролетает сквозь нас, платформа собирается из глубины. */
html:active-view-transition-type(enter)::view-transition-old(root) { animation: vt-fly-through .8s var(--ease-in) both; transform-origin: 50% 50%; }
html:active-view-transition-type(enter)::view-transition-new(root) { animation: vt-assemble .9s var(--ease-out) .18s both; }
html:active-view-transition-type(enter)::view-transition-new(sidebar):only-child,
html:active-view-transition-type(enter)::view-transition-new(.menu):only-child,
html:active-view-transition-type(enter)::view-transition-new(nav-here):only-child { animation: vt-from-left .8s var(--ease-out) .12s both; }
html:active-view-transition-type(enter)::view-transition-new(topbar):only-child { animation: vt-from-top .7s var(--ease-out) .35s both; }

/* Выход: платформа уходит в глубину, ночная сцена возвращается. */
html:active-view-transition-type(leave)::view-transition-old(root) { animation: vt-recede .6s var(--ease-in) both; }
html:active-view-transition-type(leave)::view-transition-new(root) { animation: vt-dawn 1s var(--ease-out) .1s both; }
html:active-view-transition-type(leave)::view-transition-old(sidebar):only-child,
html:active-view-transition-type(leave)::view-transition-old(.menu):only-child,
html:active-view-transition-type(leave)::view-transition-old(nav-here):only-child { animation: vt-to-left .5s var(--ease-in) both; }
html:active-view-transition-type(leave)::view-transition-old(topbar):only-child { animation: vt-to-top .4s var(--ease-in) both; }

/* Меню сменилось (Главная ↔ раздел): старое уезжает, новое приезжает. */
::view-transition-old(.menu):only-child { animation: vt-menu-out .32s var(--ease-in) both; }
::view-transition-new(.menu):only-child { animation: vt-menu-in .55s var(--ease-out) .1s both; }
html:active-view-transition-type(back)::view-transition-old(.menu):only-child { animation-name: vt-menu-out-back; }
html:active-view-transition-type(back)::view-transition-new(.menu):only-child { animation-name: vt-menu-in-back; }

/* Плитка Главной превращается в заголовок раздела в меню и обратно.
   Обычное наложение (без своих анимаций): между подразделами заголовок не мигает. */
::view-transition-group(.sec) { animation-duration: .62s; }
::view-transition-old(.sec),
::view-transition-new(.sec) { height: 100%; object-fit: cover; }
::view-transition-old(.sec):only-child { animation: vt-pass .38s var(--ease-in) both; }
html:active-view-transition-type(back)::view-transition-old(.sec):only-child { animation-name: vt-recede; }
::view-transition-new(.sec):only-child { animation: none; }

@keyframes vt-pass {
  to { opacity: 0; filter: blur(6px); transform: perspective(1400px) translate3d(-2%, 0, 160px) rotateY(6deg); }
}

@keyframes vt-arrive {
  from { opacity: 0; filter: blur(4px); transform: perspective(1400px) translate3d(3%, 0, -260px) rotateY(-9deg); }
  45% { opacity: 1; }
}

@keyframes vt-recede {
  to { opacity: 0; filter: blur(4px) brightness(0.8); transform: perspective(1400px) translate3d(2%, 0, -260px) rotateY(-7deg); }
}

@keyframes vt-return {
  from { opacity: 0; filter: blur(6px); transform: perspective(1400px) translate3d(-3%, 0, 150px) rotateY(8deg); }
  45% { opacity: 1; }
}

@keyframes vt-side-out {
  to { opacity: 0; filter: blur(2px); transform: scale(0.985); }
}

@keyframes vt-side-in {
  from { opacity: 0; transform: scale(1.012); }
}

@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

@keyframes vt-fly-through {
  to { opacity: 0; filter: blur(10px); transform: scale(1.35); }
}

@keyframes vt-assemble {
  from { opacity: 0; filter: blur(6px); transform: perspective(1400px) translate3d(0, 4%, -420px) rotateX(10deg); }
  50% { opacity: 1; }
}

@keyframes vt-dawn {
  from { opacity: 0; transform: scale(1.12); }
}

@keyframes vt-from-left {
  from { opacity: 0; transform: perspective(1200px) translate3d(-60px, 0, 0) rotateY(28deg); }
}

@keyframes vt-to-left {
  to { opacity: 0; transform: perspective(1200px) translate3d(-60px, 0, 0) rotateY(28deg); }
}

@keyframes vt-from-top { from { opacity: 0; transform: translateY(-100%); } }
@keyframes vt-to-top { to { opacity: 0; transform: translateY(-100%); } }

@keyframes vt-menu-out { to { opacity: 0; transform: translate3d(-24px, 0, 0); filter: blur(2px); } }
@keyframes vt-menu-in { from { opacity: 0; transform: translate3d(28px, 0, 0); filter: blur(2px); } }
@keyframes vt-menu-out-back { to { opacity: 0; transform: translate3d(24px, 0, 0); filter: blur(2px); } }
@keyframes vt-menu-in-back { from { opacity: 0; transform: translate3d(-28px, 0, 0); filter: blur(2px); } }

/* ================= Меню слева: ночное небо ================= */

.shell .sidebar {
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  border-right: 1px solid rgb(var(--accent-rgb, 242 193 78) / 0.08);
  background:
    radial-gradient(120% 55% at 50% 118%, rgb(var(--accent-rgb, 242 193 78) / 0.17), transparent 62%),
    radial-gradient(90% 45% at 0% 0%, rgba(86, 124, 204, 0.2), transparent 62%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 58%, #0d1729 100%);
}

/* Два слоя звёзд: дальний медленно плывёт, ближний мерцает. */
.shell .sidebar::before,
.shell .sidebar::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
}

.shell .sidebar::before {
  top: -220px;
  background-image:
    radial-gradient(circle at 24px 36px, rgba(255, 255, 255, 0.85) 0 1px, transparent 1.6px),
    radial-gradient(circle at 132px 18px, rgba(255, 255, 255, 0.6) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 88px 120px, rgba(255, 244, 214, 0.75) 0 1px, transparent 1.6px),
    radial-gradient(circle at 168px 170px, rgba(255, 255, 255, 0.5) 0 0.7px, transparent 1.3px),
    radial-gradient(circle at 46px 196px, rgba(255, 255, 255, 0.55) 0 0.8px, transparent 1.4px);
  background-size: 190px 220px;
  opacity: 0.55;
  animation: stars-drift 70s linear infinite;
  animation-delay: calc(-1 * var(--clock, 0s));
}

.shell .sidebar::after {
  top: -300px;
  background-image:
    radial-gradient(circle at 60px 80px, rgba(255, 236, 180, 0.95) 0 1.2px, transparent 2px),
    radial-gradient(circle at 210px 40px, rgba(255, 255, 255, 0.85) 0 1px, transparent 1.8px),
    radial-gradient(circle at 150px 250px, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.8px);
  background-size: 260px 300px;
  opacity: 0.7;
  animation: stars-drift-near 110s linear infinite, twinkle-soft 5s ease-in-out infinite alternate;
  animation-delay: calc(-1 * var(--clock, 0s)), 0s;
}

@keyframes stars-drift { to { transform: translate3d(0, 220px, 0); } }
@keyframes stars-drift-near { to { transform: translate3d(0, 300px, 0); } }
@keyframes twinkle-soft { to { opacity: 0.3; } }

.shell .sidebar > * { position: relative; }

.shell .menu {
  min-height: 0;
  margin-right: -6px;
  margin-left: -6px;
  padding: 0 6px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

/* Логотип: золотая «T» дышит светом. */
.shell .sidebar .logo { text-shadow: 0 0 24px rgba(120, 160, 230, 0.25); }
.shell .sidebar .logo__accent { animation: glow-breathe 4.5s ease-in-out infinite alternate; }

@keyframes glow-breathe {
  from { text-shadow: 0 0 6px rgb(var(--accent-rgb, 242 193 78) / 0.25); }
  to { text-shadow: 0 0 18px rgb(var(--accent-rgb, 242 193 78) / 0.85), 0 0 42px rgb(var(--accent-rgb, 242 193 78) / 0.35); }
}

/* Пункты меню: подсветка вытекает слева, пункт чуть сдвигается. */
.shell .nav__link {
  position: relative;
  isolation: isolate;
  transition: color .25s, transform .35s var(--ease-out);
}

.shell .nav__link::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgb(var(--accent-rgb, 242 193 78) / 0.16), rgb(var(--accent-rgb, 242 193 78) / 0));
  opacity: 0;
  transform: scaleX(0.2);
  transform-origin: left center;
  transition: transform .4s var(--ease-out), opacity .3s;
}

.shell .nav__link:hover { background: none; transform: translateX(3px); }
.shell .nav__link:hover::before { opacity: 1; transform: scaleX(1); }

/* Текущая страница — светящаяся полоса. При переходе она перетекает к новому пункту. */
.shell .nav a[aria-current="page"]:not(:has(+ ul [aria-current="page"])) {
  background: linear-gradient(90deg, rgb(var(--accent-rgb, 242 193 78) / 0.22), rgb(var(--accent-rgb, 242 193 78) / 0.03));
  box-shadow: inset 2px 0 0 var(--gold), -8px 0 22px -8px var(--glow);
  color: var(--gold);
}

.shell .menu__back {
  transition: color .25s, transform .35s var(--ease-out);
}
.shell .menu__back:hover { transform: translateX(-3px); }

/* Счётчик в меню пульсирует кольцом. */
.shell .nav .count,
.shell .bell .count { position: relative; }

.shell .nav .count::after,
.shell .bell .count::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--glow);
  animation: ring-pulse 2.4s var(--ease-out) infinite;
  pointer-events: none;
}

@keyframes ring-pulse {
  0% { box-shadow: 0 0 0 0 rgb(var(--accent-rgb, 242 193 78) / 0.6); }
  70%, 100% { box-shadow: 0 0 0 8px rgb(var(--accent-rgb, 242 193 78) / 0); }
}

/* Низ меню: пользователь, выключатель «Анимации», выход. */
.shell .account { gap: 8px; }
.shell .account__who { flex: 1; }

.shell .account__exit,
.motion-toggle {
  position: relative;
  overflow: hidden;
  transition: color .2s, border-color .2s, box-shadow .3s, transform .2s var(--ease-out);
}

.shell .account__exit:active,
.motion-toggle:active { transform: scale(0.95); }

.motion-toggle {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  color: var(--muted-on-ink);
  cursor: pointer;
}

.motion-toggle[aria-pressed="true"] {
  border-color: rgb(var(--accent-rgb, 242 193 78) / 0.5);
  box-shadow: 0 0 16px -4px var(--glow);
  color: var(--gold);
}

.motion-toggle[aria-pressed="true"] svg { animation: spark-turn 6s var(--ease-soft) infinite; }
.motion-toggle:hover { border-color: var(--gold); color: var(--gold); }
.motion-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@keyframes spark-turn {
  0%, 70% { transform: rotate(0) scale(1); }
  85% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ================= Верхняя полоса: матовое стекло ================= */

.shell .topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom-color: rgba(13, 22, 38, 0.08);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 12px 30px -26px rgba(13, 22, 38, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
}

.shell .country-tab {
  background: rgba(255, 255, 255, 0.55);
  transition: transform .35s var(--ease-out), box-shadow .3s, border-color .3s, color .3s;
}

.shell .country-tab:hover {
  border-color: var(--gold-deep);
  box-shadow: 0 10px 18px -12px rgba(201, 154, 46, 0.8);
  transform: translateY(-2px);
}

.shell .country-tab--current,
.shell .country-tab--current:hover {
  border-color: var(--ink);
  background: radial-gradient(130% 170% at 30% 0%, #27406a, var(--ink) 62%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 18px -10px rgba(13, 22, 38, 0.7);
  color: var(--gold);
}

.shell .bell { transition: color .25s, transform .3s var(--ease-out); }
.shell .bell:hover { transform: translateY(-1px); }
.shell .bell:has(.count) svg {
  animation: bell-swing 7s var(--ease-soft) infinite;
  transform-origin: 50% 12%;
}

@keyframes bell-swing {
  0%, 82%, 100% { transform: rotate(0); }
  85% { transform: rotate(16deg); }
  88% { transform: rotate(-13deg); }
  91% { transform: rotate(8deg); }
  94% { transform: rotate(-4deg); }
}

/* ================= Рабочая область: бумага, сияние и свет за курсором ================= */

.shell .workspace {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(rgba(13, 22, 38, 0.05) 1px, transparent 1.3px) 0 0 / 22px 22px,
    var(--paper);
}

.shell .workspace::before {
  content: "";
  position: fixed;
  z-index: -2;
  top: -10%;
  right: -10%;
  bottom: -10%;
  left: 260px;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at 12% 8%, rgb(var(--accent-rgb, 242 193 78) / 0.17), transparent 70%),
    radial-gradient(42% 50% at 92% 18%, rgba(93, 134, 214, 0.14), transparent 70%),
    radial-gradient(50% 55% at 62% 104%, rgba(201, 154, 46, 0.12), transparent 70%);
  animation: aurora 46s ease-in-out infinite alternate;
  animation-delay: calc(-1 * var(--clock, 0s));
}

@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-4%, 3%, 0) scale(1.08); }
  100% { transform: translate3d(3%, -2%, 0) scale(1.03); }
}

.spotlight {
  position: fixed;
  z-index: -1;
  top: 0;
  left: 0;
  width: 680px;
  height: 680px;
  margin: -340px 0 0 -340px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(var(--accent-rgb, 242 193 78) / 0.2), rgb(var(--accent-rgb, 242 193 78) / 0.07) 45%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s;
  will-change: transform;
}

.spotlight.is-on { opacity: 1; }

/* Заголовок страницы шрифтом логотипа и золотая черта под ним. */
.shell .page h1 {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1.1rem + 0.7vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.shell .page h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), rgb(var(--accent-rgb, 242 193 78) / 0));
  box-shadow: 0 0 12px rgb(var(--accent-rgb, 242 193 78) / 0.55);
  transform-origin: left center;
  animation: bar-grow .9s var(--ease-out) .25s backwards;
}

@keyframes bar-grow { from { opacity: 0; transform: scaleX(0); } }

/* Содержимое страницы поднимается слоями, каждый чуть позже предыдущего. */
.shell .page > * { animation: rise .62s var(--ease-out) backwards; }
.shell .page > :nth-child(2) { animation-delay: .05s; }
.shell .page > :nth-child(3) { animation-delay: .1s; }
.shell .page > :nth-child(4) { animation-delay: .15s; }
.shell .page > :nth-child(5) { animation-delay: .2s; }
.shell .page > :nth-child(n+6) { animation-delay: .25s; }

@keyframes rise { from { opacity: 0; transform: translate3d(0, 16px, 0); } }

/* ================= Главная: плитки в объёме ================= */

.shell .tiles { gap: 18px; }

.shell .tiles > li {
  perspective: 900px;
  animation: tile-in .85s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 70ms + 90ms);
}

@keyframes tile-in {
  from { opacity: 0; transform: perspective(1100px) translate3d(0, 34px, -140px) rotateX(22deg); }
}

.shell .tile,
.shell .page a.tile {
  position: relative;
  min-height: 108px;
  padding: 22px 22px 20px;
  border: 1px solid rgb(var(--accent-rgb, 242 193 78) / 0.16);
  border-radius: 16px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(93, 134, 214, 0.3), transparent 55%),
    radial-gradient(90% 90% at 100% 100%, rgb(var(--accent-rgb, 242 193 78) / 0.16), transparent 60%),
    linear-gradient(160deg, #1a2b48 0%, var(--ink) 55%, #08101d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 4px rgba(13, 22, 38, 0.12), 0 26px 42px -26px rgba(13, 22, 38, 0.75);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .7s var(--ease-out), box-shadow .4s, border-color .4s;
}

.shell .tile.is-tilting { transition: transform .14s linear, box-shadow .4s, border-color .4s; }

.shell .tile:hover {
  border-color: rgb(var(--accent-rgb, 242 193 78) / 0.45);
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 34px 60px -30px rgba(13, 22, 38, 0.85),
    0 0 46px -12px rgb(var(--accent-rgb, 242 193 78) / 0.45);
}

.shell .tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Золотая кромка бежит по краю плитки под курсором. */
.shell .tile::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from var(--spin), transparent 0deg 210deg, rgb(var(--accent-rgb, 242 193 78) / 0.9) 300deg, #fff4cc 330deg, transparent 360deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s;
  animation: spin 3.2s linear infinite paused;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.shell .tile:hover::before { opacity: 1; animation-play-state: running; }

@keyframes spin { to { --spin: 360deg; } }

.shell .tile__shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

/* Блик там, где курсор, и полоса света по диагонали при наведении. */
.shell .tile__shine::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, 0.2), transparent 52%);
  opacity: 0;
  transition: opacity .4s;
}

.shell .tile__shine::after {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  left: -70%;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: skewX(-18deg);
  transition: left 1s var(--ease-out);
}

.shell .tile:hover .tile__shine::before { opacity: 1; }
.shell .tile:hover .tile__shine::after { left: 130%; }

/* Слои плитки на разной глубине: номер и заголовок. */
.shell .tile__index {
  position: absolute;
  right: 16px;
  bottom: 10px;
  color: transparent;
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  transform: translateZ(8px);
  -webkit-text-stroke: 1px rgb(var(--accent-rgb, 242 193 78) / 0.3);
  transition: -webkit-text-stroke-color .4s, text-shadow .4s;
}

.shell .tile:hover .tile__index {
  -webkit-text-stroke-color: rgb(var(--accent-rgb, 242 193 78) / 0.75);
  text-shadow: 0 0 22px rgb(var(--accent-rgb, 242 193 78) / 0.35);
}

.shell .tile__title {
  position: relative;
  padding-right: 64px;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  transform: translateZ(36px);
}

/* Возврат на Главную: плитка уже прилетела из меню, повторное появление не нужно. */
:root[data-arrived="back"] .shell .tiles > li { animation: none; }

/* ================= Рабочие экраны ================= */

/* Карточки регионов, проектов и стран. */
.shell .cards { gap: 14px; }
.shell .cards > li { perspective: 800px; animation: rise .6s var(--ease-out) backwards; }
.shell .cards > li:nth-child(2) { animation-delay: .04s; }
.shell .cards > li:nth-child(3) { animation-delay: .08s; }
.shell .cards > li:nth-child(4) { animation-delay: .12s; }
.shell .cards > li:nth-child(5) { animation-delay: .16s; }
.shell .cards > li:nth-child(6) { animation-delay: .2s; }
.shell .cards > li:nth-child(7) { animation-delay: .24s; }
.shell .cards > li:nth-child(8) { animation-delay: .28s; }
.shell .cards > li:nth-child(n+9) { animation-delay: .32s; }

.shell .page a.card {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--depth-1);
  transform: translateY(var(--lift, 0)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s var(--ease-out), box-shadow .3s, border-color .3s;
}

.shell .page a.card.is-tilting { transition: transform .14s linear, box-shadow .3s, border-color .3s; }

.shell .page a.card:hover {
  --lift: -3px;
  border-color: var(--gold-deep);
  box-shadow: var(--depth-2), 0 0 0 1px rgba(201, 154, 46, 0.22);
}

.shell .page a.card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  transform: scaleY(0);
  transform-origin: 50% 0;
  transition: transform .45s var(--ease-out);
}

.shell .page a.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, -20%), rgb(var(--accent-rgb, 242 193 78) / 0.2), transparent 58%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.shell .page a.card:hover::before { transform: scaleY(1); }
.shell .page a.card:hover::after { opacity: 1; }

.shell .page a.card:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

/* Панели, таблицы, карточка договора: бумага, лежащая над столом. */
.shell .table-wrap,
.shell .facts,
.shell .hr-group {
  border-radius: 12px;
  box-shadow: var(--depth-1);
}

.shell .hr-group { transition: transform .4s var(--ease-out), box-shadow .3s; }
.shell .hr-group:hover { box-shadow: var(--depth-2); transform: translateY(-2px); }

.shell .table tbody tr > td { transition: background-color .2s; }
.shell .table tbody tr:not(.row--backdated):hover > td {
  background-color: color-mix(in srgb, var(--page-surface) 88%, var(--gold) 12%);
}
.shell .table tbody tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--gold-deep); }

.shell .facts__row { transition: background-color .2s; }
.shell .facts__row:hover { background: color-mix(in srgb, var(--page-surface) 90%, var(--gold) 10%); }

/* Строки таблиц проявляются волной: только первые 16, длинные листы не тормозят. */
.shell .table tbody tr:nth-child(-n+16) { animation: row-in .5s var(--ease-out) backwards; }
.shell .table.calc tbody tr:nth-child(-n+16) { animation-name: row-fade; }
.shell .table.calc--edit tbody tr { animation: none; }
.shell .table tbody tr:nth-child(1) { animation-delay: .12s; }
.shell .table tbody tr:nth-child(2) { animation-delay: .15s; }
.shell .table tbody tr:nth-child(3) { animation-delay: .18s; }
.shell .table tbody tr:nth-child(4) { animation-delay: .21s; }
.shell .table tbody tr:nth-child(5) { animation-delay: .24s; }
.shell .table tbody tr:nth-child(6) { animation-delay: .27s; }
.shell .table tbody tr:nth-child(7) { animation-delay: .3s; }
.shell .table tbody tr:nth-child(8) { animation-delay: .33s; }
.shell .table tbody tr:nth-child(9) { animation-delay: .36s; }
.shell .table tbody tr:nth-child(10) { animation-delay: .39s; }
.shell .table tbody tr:nth-child(11) { animation-delay: .42s; }
.shell .table tbody tr:nth-child(12) { animation-delay: .45s; }
.shell .table tbody tr:nth-child(13) { animation-delay: .48s; }
.shell .table tbody tr:nth-child(14) { animation-delay: .51s; }
.shell .table tbody tr:nth-child(15) { animation-delay: .54s; }
.shell .table tbody tr:nth-child(16) { animation-delay: .57s; }

@keyframes row-in { from { opacity: 0; transform: translate3d(0, 8px, 0); } }
@keyframes row-fade { from { opacity: 0; } }

/* Та же страница после сохранения: содержимое не «прыгает» заново. */
:root[data-arrived="same"] .shell .page > *,
:root[data-arrived="same"] .shell .page h1::after,
:root[data-arrived="same"] .shell .table tbody tr,
:root[data-arrived="same"] .shell .cards > li { animation: none; }

/* Вкладки: золотая черта растёт от центра. */
.shell .page a.tab {
  position: relative;
  transition: color .2s;
}

.shell .page a.tab::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -2px;
  left: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform .4s var(--ease-out);
}

.shell .page a.tab:hover { color: var(--page-text); }
.shell .page a.tab:hover::after { transform: scaleX(0.55); }
.shell .page a.tab--current::after { box-shadow: 0 0 10px rgb(var(--accent-rgb, 242 193 78) / 0.75); transform: scaleX(1); }

/* Кнопки: объём, блик при наведении и нажатие вглубь. */
.shell .page .button {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8d27a, var(--gold) 55%, #e9b23c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(13, 22, 38, 0.14), 0 8px 16px -10px rgba(201, 154, 46, 0.9);
  transition: transform .25s var(--ease-out), box-shadow .25s, filter .25s;
}

.shell .page .button::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: -80%;
  width: 55%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-20deg);
  transition: left .75s var(--ease-out);
}

.shell .page .button:hover {
  background: linear-gradient(180deg, #f8d27a, var(--gold) 55%, #e9b23c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 2px 4px rgba(13, 22, 38, 0.14), 0 14px 22px -12px rgba(201, 154, 46, 0.95);
  transform: translateY(-1px);
}

.shell .page .button:hover::before { left: 130%; }

.shell .page .button:active {
  box-shadow: inset 0 2px 5px rgba(13, 22, 38, 0.22);
  transform: translateY(1px) scale(0.98);
  transition-duration: .06s;
}

.shell .page .button--quiet,
.shell .page .button--quiet:hover {
  background: linear-gradient(180deg, #fffefb, var(--page-surface));
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(13, 22, 38, 0.08), 0 8px 16px -12px rgba(13, 22, 38, 0.35);
}

.shell .page .button--quiet:hover { border-color: var(--gold-deep); }
.shell .page .button--quiet::before { background: linear-gradient(90deg, transparent, rgb(var(--accent-rgb, 242 193 78) / 0.25), transparent); }

.shell .page .button--danger,
.shell .page .button--danger:hover {
  background: linear-gradient(180deg, #a83420, var(--bad-text) 60%, #6e180c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 16px -10px rgba(138, 31, 16, 0.9);
}

/* Волна от нажатия (её добавляет motion.js). */
.ripple {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
  pointer-events: none;
  transform: scale(0);
  animation: ripple .65s var(--ease-out) forwards;
}

@keyframes ripple { to { opacity: 0; transform: scale(1); } }

/* Поля ввода светятся при фокусе. */
.shell .form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.shell .form select,
.shell .form textarea,
.shell .reject textarea,
.shell .list-search__input {
  transition: border-color .2s, box-shadow .3s var(--ease-out), background-color .2s;
}

.shell .form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):focus,
.shell .form select:focus,
.shell .form textarea:focus,
.shell .reject textarea:focus,
.shell .list-search__input:focus {
  border-color: var(--gold-deep);
  outline: none;
  box-shadow: 0 0 0 4px rgb(var(--accent-rgb, 242 193 78) / 0.28), 0 10px 20px -14px rgba(201, 154, 46, 0.8);
}

/* Сообщения выезжают сверху. */
.shell .notice {
  box-shadow: var(--depth-1);
  animation: notice-in .6s var(--ease-out) .15s backwards;
}

@keyframes notice-in { from { opacity: 0; transform: translate3d(0, -10px, 0) scale(0.98); } }

/* ================= Узкий экран ================= */

@media (max-width: 760px) {
  .shell .sidebar {
    position: relative;
    align-self: stretch;
    height: auto;
  }

  .shell .menu { overflow: visible; }
  /* Главная на телефоне: пустое место меню не нужно, плитки с одним названием ниже. */
  .shell .menu--empty { display: none; }
  .shell .tile,
  .shell .page a.tile { min-height: 76px; padding: 18px 20px; }
  .shell .tile__index { font-size: 1.75rem; }
  .shell .workspace::before { left: -10%; }
  .spotlight { display: none; }
}

/* ================= Без движения ================= */

:root[data-motion="off"] .shell-page *,
:root[data-motion="off"] .shell-page *::before,
:root[data-motion="off"] .shell-page *::after {
  animation: none !important;
  transition: none !important;
}

:root[data-motion="off"] .spotlight { display: none; }

@media (prefers-reduced-motion: reduce) {
  .shell-page *,
  .shell-page *::before,
  .shell-page *::after {
    animation: none !important;
    transition: none !important;
  }

  .spotlight { display: none; }
}
