/* tcgrate.com — единственный файл стилей.
   Части в фиксированном порядке: tokens → base → components → screens → utilities.
   Все цвета и расстояния — только из токенов. */

@layer tokens, base, components, screens, utilities;

/* ============================================================ tokens */
@layer tokens {
  :root {
    color-scheme: dark;

    /* нейтраль, холодный подмес */
    --bg:        oklch(0.155 0.012 255);
    --bg-deep:   oklch(0.125 0.012 255);
    --bg-raised: oklch(0.198 0.014 255);
    --bg-hover:  oklch(0.235 0.016 255);
    --line:      oklch(0.28  0.016 255);
    --line-2:    oklch(0.38  0.020 255);
    --ink:       oklch(0.95  0.005 255);
    --ink-2:     oklch(0.74  0.014 255);
    --ink-3:     oklch(0.57  0.016 255);

    /* один акцент — кислотный лайм HUD */
    --accent:      oklch(0.90 0.20 118);
    --accent-dim:  oklch(0.78 0.18 118);
    --accent-ink:  oklch(0.20 0.05 118);
    --accent-soft: oklch(0.90 0.20 118 / .13);
    --accent-line: oklch(0.90 0.20 118 / .45);

    /* семантика рынка */
    --up:        oklch(0.84 0.19 145);
    --up-soft:   oklch(0.84 0.19 145 / .14);
    --down:      oklch(0.70 0.19 20);
    --down-soft: oklch(0.70 0.19 20 / .14);
    --flat:      var(--ink-3);

    /* шкала отступов, только эти */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-6: 24px; --sp-8: 32px; --sp-12: 48px; --sp-16: 64px;

    /* типографика */
    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Chakra Petch", "Inter", system-ui, sans-serif;
    --step--2: clamp(.70rem, .68rem + .10vw, .76rem);
    --step--1: clamp(.81rem, .78rem + .15vw, .88rem);
    --step-0:  clamp(.94rem, .91rem + .15vw, 1.02rem);
    --step-1:  clamp(1.12rem, 1.05rem + .35vw, 1.35rem);
    --step-2:  clamp(1.4rem, 1.22rem + .8vw, 2rem);
    --step-3:  clamp(1.9rem, 1.5rem + 1.8vw, 3.1rem);
    --step-4:  clamp(2.6rem, 1.8rem + 3.6vw, 5.2rem);
    --step-5:  clamp(3.4rem, 2.1rem + 6vw, 8rem);

    /* HUD-геометрия: срез угла вместо скругления */
    --notch: 12px;
    --notch-sm: 7px;
    --radius-1: 2px;
    --row: 40px;
    --fast: 140ms;
    --normal: 240ms;
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --container: 1560px;
    --gutter: clamp(16px, 2.6vw, 40px);
    --rail: 76px;
  }

  [data-theme="light"] {
    color-scheme: light;
    --bg:        oklch(0.975 0.004 255);
    --bg-deep:   oklch(0.94 0.006 255);
    --bg-raised: oklch(1 0 0);
    --bg-hover:  oklch(0.945 0.008 255);
    --line:      oklch(0.90 0.008 255);
    --line-2:    oklch(0.80 0.012 255);
    --ink:       oklch(0.19 0.012 255);
    --ink-2:     oklch(0.44 0.016 255);
    --ink-3:     oklch(0.58 0.016 255);
    --accent:      oklch(0.72 0.18 118);
    --accent-dim:  oklch(0.62 0.17 118);
    --accent-ink:  oklch(0.99 0.02 118);
    --accent-soft: oklch(0.72 0.18 118 / .16);
    --accent-line: oklch(0.62 0.17 118 / .5);
    --up:        oklch(0.58 0.17 148);
    --up-soft:   oklch(0.58 0.17 148 / .13);
    --down:      oklch(0.57 0.21 25);
    --down-soft: oklch(0.57 0.21 25 / .13);
  }
}

/* ============================================================ base */
@layer base {
  @font-face { font-family: "Inter"; src: url("/assets/fonts/InterVariable.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; }
  @font-face { font-family: "Chakra Petch"; src: url("/assets/fonts/ChakraPetch-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
  @font-face { font-family: "Chakra Petch"; src: url("/assets/fonts/ChakraPetch-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
  @font-face { font-family: "Chakra Petch"; src: url("/assets/fonts/ChakraPetch-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg-deep); }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  body {
    margin: 0;
    background:
      radial-gradient(120% 80% at 50% -10%, oklch(0.90 0.20 118 / .07), transparent 60%),
      radial-gradient(90% 60% at 50% 110%, oklch(0.55 0.10 255 / .10), transparent 60%),
      var(--bg-deep);
    color: var(--ink);
    font: 400 var(--step-0) / 1.55 var(--font-ui);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -.01em; text-wrap: balance; text-transform: uppercase; }
  h1 { font-size: var(--step-3); }
  h2 { font-size: var(--step-2); }
  h3 { font-size: var(--step-1); }
  p  { margin: 0; }
  a  { color: inherit; text-decoration: none; }
  ul, ol { margin: 0; padding: 0; list-style: none; }
  img, svg { display: block; max-width: 100%; }
  table { border-collapse: collapse; width: 100%; }
  th { text-align: left; font-weight: 500; }
  button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
  input { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  ::selection { background: var(--accent-soft); }

  .num, td, .tile__value, .price, .ticker, .stat__value { font-variant-numeric: tabular-nums; }
}

/* ============================================================ components */
@layer components {

  /* --- каркас: левый рельс игр + колонка контента --- */
  .app { flex: 1; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); align-items: start; }
  .app__col { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }

  .rail {
    position: sticky; top: 0; height: 100dvh; z-index: 25;
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
    padding: var(--sp-3) 0; border-right: 1px solid var(--line); background: var(--bg-deep);
  }
  .rail__logo { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--sp-2); border: 1px solid var(--accent-line); flex: none;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
  .rail__mark { width: 14px; height: 14px; background: var(--accent); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
  .rail__list { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; scrollbar-width: none; min-height: 0; width: 100%; align-items: center; }
  .rail__list::-webkit-scrollbar { display: none; }
  .rail__item {
    display: grid; place-items: center; width: 44px; height: 38px; flex: none;
    font-family: var(--font-display); font-size: var(--step--2); font-weight: 700; letter-spacing: .04em;
    color: var(--ink-3); border: 1px solid transparent; transition: color var(--fast), background var(--fast), border-color var(--fast);
    clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  }
  .rail__item:hover { color: var(--ink); background: var(--bg-hover); }
  .rail__item.is-active { color: var(--accent-ink); background: var(--accent); }
  .rail__item--more { margin-top: var(--sp-2); border-color: var(--line); color: var(--ink-2); }

  .wrap { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
  .main { flex: 1; padding-block: var(--sp-6) var(--sp-16); position: relative; }

  /* --- hazard-штриховка: техническая деталь по краям --- */
  .hazard { height: 10px; background: repeating-linear-gradient(-45deg, var(--line-2) 0 8px, transparent 8px 18px); opacity: .5; }
  .hazard--accent { background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, transparent 8px 18px); opacity: .28; }

  /* --- соединительная линия между блоками (technical drawing) --- */
  .link-line { position: relative; height: 1px; background: var(--line-2); }
  .link-line::before, .link-line::after { content: ""; position: absolute; top: 50%; width: 5px; height: 5px; translate: 0 -50%; background: var(--accent); }
  .link-line::before { left: 0; }
  .link-line::after { right: 0; }

  /* --- HUD-панель: срезанный угол + рамка --- */
  .panel {
    position: relative;
    background: color-mix(in oklab, var(--bg-raised) 82%, transparent);
    border: 1px solid var(--line);
    clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch)));
  }
  .panel--flat { background: transparent; }
  .panel--active { border-color: var(--accent-line); background: color-mix(in oklab, var(--bg-raised) 88%, transparent); }

  /* маркеры по всем четырём углам — «прицел» вокруг ключевого блока */
  .marked { position: relative; }
  .marked::before, .marked::after {
    content: ""; position: absolute; inset: -3px; pointer-events: none; z-index: 2;
    background:
      radial-gradient(circle at 0 0, var(--accent) 2.5px, transparent 2.6px),
      radial-gradient(circle at 100% 0, var(--accent) 2.5px, transparent 2.6px),
      radial-gradient(circle at 0 100%, var(--accent) 2.5px, transparent 2.6px),
      radial-gradient(circle at 100% 100%, var(--accent) 2.5px, transparent 2.6px);
  }
  .marked::after { content: none; }

  /* --- служебная подпись HUD --- */
  .hud { font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
  .hud--accent { color: var(--accent); }

  /* --- верхняя панель --- */
  .topbar { border-bottom: 1px solid var(--line); background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
  .topbar__in { display: flex; align-items: center; gap: var(--sp-4); height: 60px; }
  .brand { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: .04em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; }
  .brand__dot { width: 7px; height: 7px; background: var(--accent); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
  .nav { display: flex; gap: 2px; margin-inline-start: var(--sp-4); }
  .nav__link { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: var(--sp-2) var(--sp-3); font-size: var(--step--1); transition: color var(--fast), background var(--fast); clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px)); }
  .nav__link:hover { color: var(--ink); background: var(--bg-hover); }
  .nav__link.is-active { color: var(--accent); background: var(--accent-soft); }
  .topbar__tools { margin-inline-start: auto; display: flex; align-items: center; gap: var(--sp-2); }

  .search { position: relative; }
  .search__input { width: clamp(150px, 20vw, 300px); height: 36px; padding: 0 var(--sp-3) 0 var(--sp-8); border: 1px solid var(--line); background: var(--bg-deep); color: var(--ink); font-size: var(--step--1); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); transition: border-color var(--fast); }
  .search__input::placeholder { color: var(--ink-3); }
  .search__input:focus { border-color: var(--accent-line); outline: 0; }
  .search__icon { position: absolute; left: var(--sp-3); top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
  .search__kbd { position: absolute; right: var(--sp-2); top: 50%; translate: 0 -50%; font-family: var(--font-display); font-size: var(--step--2); color: var(--ink-3); border: 1px solid var(--line); padding: 0 5px; line-height: 17px; }

  .theme, .burger { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink-2); border: 1px solid var(--line); transition: background var(--fast), color var(--fast), border-color var(--fast); clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px)); }
  .theme:hover, .burger:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent-line); }
  .theme svg, .burger svg { width: 16px; height: 16px; }
  .theme__moon { display: none; }
  [data-theme="light"] .theme__sun { display: none; }
  [data-theme="light"] .theme__moon { display: block; }
  .burger { display: none; }

  /* --- тикер --- */
  .ticker { border-bottom: 1px solid var(--line); background: var(--bg-deep); overflow-x: auto; scrollbar-width: none; }
  .ticker::-webkit-scrollbar { display: none; }
  .ticker__in { display: flex; min-width: max-content; }
  .ticker__item { display: flex; align-items: baseline; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); border-right: 1px solid var(--line); font-size: var(--step--1); color: var(--ink-2); white-space: nowrap; transition: background var(--fast), color var(--fast); }
  .ticker__item:hover { background: var(--accent-soft); color: var(--ink); }
  .ticker__name { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: var(--step--2); }

  /* --- чип изменения --- */
  .chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px var(--sp-2); font-family: var(--font-display); font-size: var(--step--1); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.5; white-space: nowrap; clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px)); }
  .chip.is-up   { color: var(--up);   background: var(--up-soft); }
  .chip.is-down { color: var(--down); background: var(--down-soft); }
  .chip.is-flat { color: var(--flat); background: transparent; }
  .chip--bare { padding: 0; background: transparent; clip-path: none; }
  .chip--lg { font-size: var(--step-1); padding: var(--sp-1) var(--sp-3); }

  /* --- фильтры-чипсы (раскладка референса) --- */
  .chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  .chips__item { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: var(--step--2); padding: 6px var(--sp-3); border: 1px solid var(--line); color: var(--ink-2); background: var(--bg-raised); white-space: nowrap; transition: color var(--fast), border-color var(--fast), background var(--fast); clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px)); }
  .chips__item:hover { color: var(--ink); border-color: var(--line-2); }
  .chips__item.is-active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

  /* --- монограмма игры --- */
  .mono { display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--bg-hover); border: 1px solid var(--line); color: var(--ink-2); font-family: var(--font-display); font-size: var(--step--2); font-weight: 700; letter-spacing: .04em; flex: none; clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px)); }
  .mono--lg { width: 46px; height: 46px; font-size: var(--step-0); }

  /* --- бейдж --- */
  .badge { display: inline-block; padding: 0 var(--sp-2); border: 1px solid var(--line-2); font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; line-height: 20px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
  .badge--accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }

  /* --- кнопки --- */
  .button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: 42px; padding: 0 var(--sp-6); border: 1px solid transparent; font-family: var(--font-display); font-size: var(--step--1); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
  .button:active { transform: translateY(1px); }
  .button--primary { background: var(--accent); color: var(--accent-ink); }
  .button--primary:hover { background: var(--accent-dim); }
  .button--plain { border-color: var(--line-2); color: var(--ink); background: var(--bg-raised); }
  .button--plain:hover { border-color: var(--accent-line); color: var(--accent); }
  .button--sm { height: 32px; padding: 0 var(--sp-4); }
  .button[aria-disabled="true"] { opacity: .45; pointer-events: none; }

  /* --- переключатель периода --- */
  .seg { display: inline-flex; border: 1px solid var(--line); background: var(--bg-deep); padding: 2px; }
  .seg__item { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 4px var(--sp-3); font-size: var(--step--2); color: var(--ink-3); transition: background var(--fast), color var(--fast); }
  .seg__item:hover { color: var(--ink); }
  .seg__item.is-active { background: var(--accent); color: var(--accent-ink); }

  /* --- крошки --- */
  .crumbs { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-family: var(--font-display); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: var(--sp-4); }
  .crumbs a:hover { color: var(--accent); }
  .crumbs li + li::before { content: "/"; margin-inline-end: var(--sp-2); color: var(--line-2); }

  /* --- шапка страницы --- */
  .hero { display: grid; gap: var(--sp-4); padding-block: var(--sp-2) var(--sp-8); margin-bottom: var(--sp-8); border-bottom: 1px solid var(--line); }
  .hero__eyebrow { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
  .hero__title { max-width: 20ch; }
  .hero__title em { font-style: normal; color: var(--accent); }
  .hero__lede { max-width: 62ch; color: var(--ink-2); font-size: var(--step-0); line-height: 1.55; text-wrap: pretty; }
  .hero__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }

  /* --- метрика со шкалой (как в HUD статов) --- */
  .stats { display: grid; gap: var(--sp-3); }
  .stat { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-4); align-items: baseline; }
  .stat__label { font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
  .stat__value { font-family: var(--font-display); font-size: var(--step-0); font-weight: 700; }
  .stat__bar { grid-column: 1 / -1; height: 4px; background: var(--bg-hover); overflow: hidden; }
  .stat__bar i { display: block; height: 100%; background: var(--accent); }
  .stat__bar.is-up i { background: var(--up); }
  .stat__bar.is-down i { background: var(--down); }

  /* --- плитки показателей --- */
  .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); border: 1px solid var(--line); background: var(--bg-raised); }
  .tile { padding: var(--sp-3) var(--sp-4); border-right: 1px solid var(--line); min-width: 0; }
  .tile:last-child { border-right: 0; }
  .tile__label { font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; margin-bottom: var(--sp-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tile__value { font-family: var(--font-display); font-size: var(--step-1); font-weight: 700; line-height: 1.1; white-space: nowrap; }
  .tile__delta { margin-top: var(--sp-1); }

  /* --- крупное число --- */
  .price { font-family: var(--font-display); font-weight: 700; font-size: var(--step-4); line-height: .92; letter-spacing: -.02em; }
  .price--md { font-size: var(--step-3); }
  .price__cur { color: var(--ink-3); font-size: .5em; vertical-align: .5em; margin-inline-end: .06em; }

  /* --- секция --- */
  .section { margin-block: var(--sp-12); }
  .section--tight { margin-block: var(--sp-8); }
  .section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
  .section__title { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
  .section__count { font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
  .section__more { font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); white-space: nowrap; }
  .section__more:hover { color: var(--accent); }
  .section__more::after { content: " →"; }

  /* --- КАРТОЧКА КАРТЫ (раскладка референса) --- */
  .grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-4); }
  .grid-cards--sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }

  .ccard {
    position: relative; display: grid; grid-template-rows: 1fr auto; min-width: 0;
    background: var(--bg-raised); border: 1px solid var(--line);
    clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch)));
    transition: border-color var(--fast), transform var(--normal) var(--ease-out);
  }
  .ccard:hover { border-color: var(--accent-line); transform: translateY(-3px); }
  /* высота арта фиксирована пропорцией — иначе карты разных издателей дают разную высоту плиток */
  .ccard__art { position: relative; aspect-ratio: 4 / 5; padding: var(--sp-6) var(--sp-4) var(--sp-3); display: grid; place-items: center; overflow: hidden; }
  .ccard__art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 55% at 50% 45%, var(--glow, transparent), transparent 72%); }
  .ccard.is-up   { --glow: oklch(0.84 0.19 145 / .30); }
  .ccard.is-down { --glow: oklch(0.70 0.19 20 / .28); }
  /* contain по обеим осям: карты разных издателей имеют разную пропорцию и иначе масштабируются по-разному */
  .ccard__img { position: relative; width: 100%; height: 100%; object-fit: contain; }
  .ccard__no { position: absolute; z-index: 1; top: var(--sp-2); left: var(--sp-4); font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; color: var(--ink-3); letter-spacing: .06em; max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ccard__rarity { position: absolute; z-index: 1; top: var(--sp-2); right: var(--sp-4); font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; color: var(--ink-3); letter-spacing: .06em; max-width: 8ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ccard__foot { padding: var(--sp-3) var(--sp-4) var(--sp-4); border-top: 1px solid var(--line); background: var(--bg-deep); }
  .ccard__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
  .ccard__price { font-family: var(--font-display); font-size: var(--step-1); font-weight: 700; font-variant-numeric: tabular-nums; }
  .ccard__name { font-size: var(--step--1); font-weight: 500; margin-top: var(--sp-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ccard__meta { font-size: var(--step--2); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ccard__rank { position: absolute; top: 0; left: 0; z-index: 1; background: var(--accent); color: var(--accent-ink); font-family: var(--font-display); font-weight: 700; font-size: var(--step--2); padding: 2px 8px; clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }

  /* --- таблица данных --- */
  .table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
  .table th, .table td { height: var(--row); padding: 0 var(--sp-3); border-bottom: 1px solid var(--line); font-size: var(--step--1); white-space: nowrap; vertical-align: middle; }
  .table th { font-family: var(--font-display); color: var(--ink-3); font-weight: 600; font-size: var(--step--2); text-transform: uppercase; letter-spacing: .08em; background: var(--bg); }
  .table th a:hover, .table th a.is-active { color: var(--accent); }
  .table th a.is-active::after { content: " ↓"; }
  .table td:first-child, .table th:first-child { padding-inline-start: 0; }
  .table td:last-child, .table th:last-child { padding-inline-end: 0; }
  .table .r, .table td.num { text-align: right; }
  .table tbody tr { transition: background var(--fast); }
  .table tbody tr:hover { background: var(--bg-hover); }
  .table .t-name { min-width: 0; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
  .table .t-name a:hover { color: var(--accent); }
  .table .t-sub { color: var(--ink-3); font-size: var(--step--2); display: block; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
  .table .t-dim { color: var(--ink-3); }
  .table .t-idx { color: var(--ink-3); width: 2.5em; text-align: right; font-family: var(--font-display); }
  .table .t-thumb { width: 44px; padding-inline-end: 0; }
  .table .t-spark { width: 110px; }
  .table .t-game { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
  .thumb { width: 32px; height: 44px; object-fit: cover; background: var(--bg-hover); }

  /* --- спарклайн --- */
  .spark { width: 96px; height: 24px; }
  .spark path { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
  .spark.is-up path { stroke: var(--up); }
  .spark.is-down path { stroke: var(--down); }
  .spark.is-flat path { stroke: var(--ink-3); }

  /* --- график --- */
  .chart { position: relative; border: 1px solid var(--line); background: var(--bg-raised); padding: var(--sp-4); clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch))); }
  .chart__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
  .chart__legend { display: flex; gap: var(--sp-4); font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
  .chart__legend i { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-inline-end: 6px; background: var(--accent); }
  .chart__legend i.is-muted { background: var(--ink-3); }
  .chart__svg { width: 100%; height: auto; overflow: visible; }
  .chart__svg .grid line { stroke: var(--line); stroke-dasharray: 2 5; }
  .chart__svg .axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--font-display); font-weight: 500; font-variant-numeric: tabular-nums; }
  .chart__svg .line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
  .chart__svg .line.is-muted { stroke: var(--ink-3); stroke-width: 1.25; }
  .chart__svg .line.is-up { stroke: var(--up); } .chart__svg .line.is-down { stroke: var(--down); }
  .chart__cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--accent-line); pointer-events: none; opacity: 0; transition: opacity var(--fast); }
  .chart__tip { position: absolute; top: var(--sp-2); padding: 2px var(--sp-2); background: var(--bg-deep); border: 1px solid var(--accent-line); font-family: var(--font-display); font-size: var(--step--2); font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--fast); translate: -50% 0; font-variant-numeric: tabular-nums; }
  .chart.is-hover .chart__cursor, .chart.is-hover .chart__tip { opacity: 1; }
  .chart__foot { display: flex; justify-content: space-between; margin-top: var(--sp-3); font-family: var(--font-display); font-size: var(--step--2); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
  .chart__empty { display: grid; place-items: center; height: 200px; color: var(--ink-3); font-family: var(--font-display); font-size: var(--step--1); text-transform: uppercase; letter-spacing: .08em; }

  /* --- тепловая карта --- */
  .treemap { width: 100%; height: auto; display: block; }
  .treemap rect { stroke: var(--bg); stroke-width: 2; transition: opacity var(--fast); }
  .treemap a:hover rect { opacity: .85; }
  .treemap .cell--up rect { fill: var(--up); }
  .treemap .cell--down rect { fill: var(--down); }
  .treemap .cell--flat rect { fill: var(--ink-3); }
  .treemap text { font-family: var(--font-display); fill: var(--ink); pointer-events: none; }
  .treemap .cell__name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  .treemap .cell__pct { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .9; }
  .treemap .cell__sum { font-size: 11px; opacity: .65; }
  .treemap .cell--sm .cell__sum { display: none; }
  .treemap .cell--xs text { display: none; }
  .treemap-mob { display: none; }
  .treemap-legend { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-display); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-top: var(--sp-3); }
  .treemap-legend__bar { width: 110px; height: 5px; background: linear-gradient(90deg, var(--down), var(--bg-hover), var(--up)); }

  /* --- лента --- */
  .feed { border-top: 1px solid var(--line); }
  .feed__row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); transition: background var(--fast); }
  .feed__row:hover { background: var(--bg-hover); }
  .feed__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feed__meta { color: var(--ink-3); font-size: var(--step--2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feed__price { font-variant-numeric: tabular-nums; text-align: right; font-family: var(--font-display); font-weight: 600; }
  .feed__gap { color: var(--ink-3); font-size: var(--step--2); display: block; font-weight: 500; }

  /* --- страница карты --- */
  .split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-8); }
  .card-image { position: sticky; top: calc(60px + var(--sp-4)); }
  .card-image__frame { position: relative; padding: var(--sp-4); border: 1px solid var(--line); background: var(--bg-raised); clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch))); }
  .card-image__frame::before { content: ""; position: absolute; inset: 0; background: radial-gradient(55% 45% at 50% 35%, var(--glow, var(--accent-soft)), transparent 70%); }
  .card-image img { position: relative; width: 100%; height: auto; aspect-ratio: 5 / 7; object-fit: contain; }
  .card-image__src { font-family: var(--font-display); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-top: var(--sp-2); }

  .variants { border-top: 1px solid var(--line); }
  .variants__row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, auto); gap: var(--sp-4); align-items: baseline; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); font-size: var(--step--1); }
  .variants__row:first-child { font-family: var(--font-display); color: var(--ink-3); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .08em; }
  .variants__row > :not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
  .variants__row.is-main { font-weight: 600; }

  .venues { display: grid; gap: var(--sp-3); }
  .venue { display: grid; grid-template-columns: 8em minmax(0, 1fr) 7em; align-items: center; gap: var(--sp-3); font-size: var(--step--1); }
  .venue__name { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: var(--step--2); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .venue__bar { height: 6px; background: var(--bg-hover); overflow: hidden; }
  .venue__bar i { display: block; height: 100%; background: var(--ink-3); }
  .venue.is-best .venue__bar i { background: var(--accent); }
  .venue.is-best .venue__name { color: var(--accent); }
  .venue__price { text-align: right; font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
  .venue__price small { color: var(--ink-3); font-weight: 500; }

  .attrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 var(--sp-6); border-top: 1px solid var(--line); }
  .attrs > div { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); font-size: var(--step--1); }
  .attrs dt { font-family: var(--font-display); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
  .attrs dd { margin: 0; overflow-wrap: anywhere; }

  /* --- проза --- */
  .prose { max-width: 68ch; color: var(--ink-2); line-height: 1.7; text-wrap: pretty; }
  .prose h2, .prose h3 { color: var(--ink); margin-top: var(--sp-8); margin-bottom: var(--sp-3); }
  .prose p + p { margin-top: var(--sp-4); }
  .prose a { color: var(--accent); }
  .prose a:hover { text-decoration: underline; }
  .prose ul { list-style: none; padding-inline-start: var(--sp-4); margin-top: var(--sp-3); }
  .prose li { position: relative; }
  .prose li::before { content: "▸"; position: absolute; left: calc(-1 * var(--sp-4)); color: var(--accent); }
  .prose li + li { margin-top: var(--sp-2); }
  .prose code { font-family: ui-monospace, monospace; font-size: .9em; background: var(--bg-deep); padding: 1px 5px; }
  .prose--sm { font-size: var(--step--1); }

  /* --- пагинация --- */
  .pager { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-6); }
  .pager__info { font-family: var(--font-display); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-inline: auto; }

  /* --- пустое состояние: HUD-штриховка --- */
  .empty { padding: var(--sp-12) var(--sp-4); text-align: center; color: var(--ink-3); border: 1px solid var(--line); background:
      repeating-linear-gradient(-45deg, transparent 0 9px, color-mix(in oklab, var(--line) 55%, transparent) 9px 10px); }
  .empty b { display: block; font-family: var(--font-display); font-size: var(--step-0); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin-bottom: var(--sp-1); }
  .empty span { display: inline-block; background: var(--bg); padding: 0 var(--sp-2); }

  /* --- подпись источника --- */
  .source { font-family: var(--font-display); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: var(--sp-4); }
  .source a:hover { color: var(--accent); }

  /* --- футер --- */
  .footer { border-top: 1px solid var(--line); background: var(--bg-deep); padding-block: var(--sp-8); color: var(--ink-3); font-size: var(--step--1); }
  .footer__in { display: grid; gap: var(--sp-6); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .footer__col b { display: block; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: var(--step--2); color: var(--ink-2); margin-bottom: var(--sp-2); }
  .footer__col a { display: block; padding: 2px 0; }
  .footer__col a:hover { color: var(--accent); }
  .footer__note { grid-column: 1 / -1; padding-top: var(--sp-6); border-top: 1px solid var(--line); max-width: 80ch; font-size: var(--step--2); }
}

/* ============================================================ screens */
@layer screens {

  /* главная — терминал: центр + правая колонка (раскладка референса) */
  .home-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); margin-bottom: var(--sp-8); align-items: stretch; }
  /* график тянется по высоте панели индекса — иначе под ним остаётся пустота */
  .home-top > div:last-child, .home-top .chart { display: flex; flex-direction: column; }
  .home-top .chart { flex: 1; }
  .home-top .chart__svg { flex: 1; min-height: 260px; }
  .home-index { padding: var(--sp-6); display: grid; gap: var(--sp-4); align-content: start; }
  .home-index__big { display: flex; align-items: baseline; gap: var(--sp-4); flex-wrap: wrap; }
  .home-index__deltas { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: var(--sp-3); }
  .home-index__deltas div { display: grid; gap: 2px; }
  .home-index__deltas b { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; font-size: var(--step-0); }

  .home-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-8); }
  .home-aside { display: grid; gap: var(--sp-6); align-content: start; }
  .aside-box { padding: var(--sp-4); }
  .aside-box__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }

  .movers-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); }
  .game-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
  .set-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }

  /* карта */
  .card-head { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); }
  .card-head__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); color: var(--ink-2); font-size: var(--step--1); align-items: center; }
  .card-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-4); margin-bottom: var(--sp-6); }
  .card-price__note { font-family: var(--font-display); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
  .card-deltas { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); border: 1px solid var(--line); margin-bottom: var(--sp-6); background: var(--bg-raised); }
  .card-deltas > div { padding: var(--sp-3); border-right: 1px solid var(--line); }
  .card-deltas > div:last-child { border-right: 0; }
  .card-deltas b { display: block; font-family: var(--font-display); font-size: var(--step--2); color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-bottom: var(--sp-1); }

  .notfound { padding-block: var(--sp-16); text-align: center; }
  .notfound h1 { font-size: var(--step-5); color: var(--accent); }

  @media (min-width: 900px) {
    .home-top { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
    .home-body { grid-template-columns: minmax(0, 1fr) 340px; }
    .movers-two { grid-template-columns: 1fr 1fr; }
    .split { grid-template-columns: 330px minmax(0, 1fr); }
    .game-head { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  }
  @media (min-width: 1280px) {
    .split { grid-template-columns: 400px minmax(0, 1fr); }
    .home-body { grid-template-columns: minmax(0, 1fr) 380px; }
  }

  @media (max-width: 1099px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .rail { display: none; }
  }
  @media (max-width: 899px) {
    .nav { display: none; position: absolute; left: 0; right: 0; top: 60px; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: var(--sp-2) var(--gutter); margin: 0; }
    .topbar.is-open .nav { display: flex; }
    .burger { display: grid; }
    .search__input { width: 130px; }
    .search__kbd { display: none; }
    .card-image { position: static; max-width: 300px; }
  }
  @media (max-width: 599px) {
    .search { display: none; }
    .treemap-desk { display: none; }
    .treemap-mob { display: block; }
    .table th, .table td { padding: 0 var(--sp-2); }
    .table .t-name { max-width: 20ch; }
    .table .t-spark, .table .t-hide-sm { display: none; }
    .feed__row { grid-template-columns: 44px minmax(0, 1fr) auto; }
    .feed__row > :nth-child(4) { grid-column: 3; }
    .grid-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  }
}

/* ============================================================ utilities */
@layer utilities {
  .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .muted { color: var(--ink-3); }
  .up { color: var(--up); } .down { color: var(--down); }
  .stack > * + * { margin-top: var(--sp-4); }
  .row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
  .grow { flex: 1; min-width: 0; }
  .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
  .mb-4 { margin-bottom: var(--sp-4); }
}
