/* Industry — токены дизайн-системы, тёмная тема.
   Barlow заменён на Fira: у Barlow нет кириллицы (только latin, latin-ext,
   vietnamese), заголовки молча падали на системный шрифт. */
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500&family=Fira+Sans+Condensed:wght@600;700&display=swap');

:root {
  --color-bg: #101214;
  --color-surface: #1a1d1f;
  --color-text: #e9ebed;
  --color-accent: #5980a6;
  --color-divider: rgba(233, 235, 237, .18);

  --color-accent-300: #b5d9fd;
  --color-accent-400: #94bce3;
  --color-accent-500: #749dc4;
  --color-accent-600: #597ea3;
  --color-accent-700: #416180;
  --color-accent-900: #1d2d3d;

  --font-heading: "Fira Sans Condensed", system-ui, sans-serif;
  --font-body: "Fira Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;

  --space-2: 6.8px;  --space-3: 10.2px;  --space-4: 13.6px;
  --radius-md: 4px;
  --muted: color-mix(in srgb, var(--color-text) 55%, transparent);
  --muted-2: color-mix(in srgb, var(--color-text) 45%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
  font-family: var(--font-heading); font-weight: 600;
  line-height: 1.12; letter-spacing: -.015em; margin: 0 0 var(--space-2);
}
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent-400); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-300); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — блюпринт-рамка: объекты системы квадратные, с метками по углам — */
.blueprint { position: relative; border: 1px solid var(--color-divider); border-radius: 0; }
.blueprint > .corner {
  position: absolute; width: 11px; height: 11px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.blueprint > .corner::before, .blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
.blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
.blueprint > .corner::after  { top: 5px; left: 0; width: 100%; height: 1px; }
.corner.tl { top: -6px; left: -6px; }  .corner.tr { top: -6px; right: -6px; }
.corner.bl { bottom: -6px; left: -6px; } .corner.br { bottom: -6px; right: -6px; }

/* — кнопки — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none; font-family: var(--font-heading);
  font-weight: 600; font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid var(--color-divider);
  padding: var(--space-2) 12px; border-radius: 0;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: #101214; }
.btn-primary:hover { background: var(--color-accent-400); }
.btn-primary:active { background: var(--color-accent-300); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-ghost { border-color: transparent; color: var(--color-accent-400); }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — поля — */
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit; font-size: 14px;
  color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: 0;
}
.input::placeholder { color: var(--muted-2); }
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }

.seg { display: inline-flex; border: 1px solid var(--color-divider); }
.seg-opt { display: inline-flex; align-items: center; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-opt:has(input:checked) { background: var(--color-accent); color: #101214; }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }

/* — таблицы и теги — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 1px solid var(--color-divider);
}
.table td { padding: var(--space-2); border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent); }
/* .table th перебивает .num по специфичности, поэтому заголовки числовых
   колонок надо выравнивать явно - иначе подпись слева, значение справа. */
.table th.num { text-align: right; }
/* Первая колонка забирает остаток ширины, числовые прижимаются вправо
   и не расползаются по всему экрану. */
.table th.num, .table td.num { width: 1%; min-width: 150px; white-space: nowrap; }
.table th:first-child, .table td:first-child { width: auto; }
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; font-size: 11px; padding: 3px 10px; }
.tag-accent { background: color-mix(in srgb, var(--color-accent) 22%, transparent); color: var(--color-accent-300); }
.tag-neutral { background: color-mix(in srgb, var(--color-text) 10%, transparent); color: var(--muted); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent-300); }

/* — служебное — */
.kicker { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--color-accent-300); }
.label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.h-num { font-family: var(--font-heading); font-weight: 600; font-variant-numeric: tabular-nums; }
.shell {
  /* Во всю ширину окна: на 2К колонка по центру смотрелась потерянной.
     Длину строк держат max-width в ch у самих текстовых блоков. */
  width: 100%; min-height: 100vh;
}
/* Главная: первый экран занимает высоту окна целиком, иначе на большом
   мониторе под ним висит полтора экрана пустоты. */
.shell-home { display: flex; flex-direction: column; }
.shell-home #screen-form { flex: 1; display: flex; }
.shell-home .hero { flex: 1; }
.hidden { display: none !important; }

/* — шапка — */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 3.4vw, 72px); border-bottom: 1px solid var(--color-divider);
}
.brand { font-family: var(--font-heading); font-weight: 700; font-size: 18px; letter-spacing: .02em; }

/* — главная — */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; min-height: 540px; width: 100%; }
.hero-left { padding: clamp(36px, 5vh, 80px) clamp(28px, 5vw, 130px); display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--color-divider); }
.hero-left h1 { font-size: clamp(46px, 3.9vw, 92px); line-height: .98; margin: 0 0 18px; max-width: 15ch; }
.hero-right { background: var(--color-accent-900); color: #eef4fa; padding: clamp(30px, 4vh, 64px) clamp(26px, 3.6vw, 96px); display: flex; flex-direction: column; justify-content: center; gap: clamp(24px, 3.4vh, 44px); }
.lookup { padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.lookup-row { display: flex; gap: 10px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 18px; }
.stat-grid .h-num { font-size: clamp(24px, 1.9vw, 34px); line-height: 1; }

/* — результат — */
.result-hero { background: var(--color-accent-900); color: #eef4fa; padding: 40px clamp(24px, 3.4vw, 72px) 36px; }
.result-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.big { font-family: var(--font-heading); font-weight: 600; font-size: 120px; line-height: .82; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.avatar { width: 52px; height: 52px; background: rgba(242,242,243,.12); border-color: rgba(242,242,243,.3); object-fit: cover; }
.four { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--color-divider); }
.four > div { padding: 22px clamp(20px, 2.2vw, 44px); border-right: 1px solid var(--color-divider); }
.four > div:last-child { border-right: none; }
.four .h-num { font-size: 38px; line-height: 1.15; }
.split { display: grid; grid-template-columns: 1.25fr 1fr; border-bottom: 1px solid var(--color-divider); }
.split > div { padding: 30px clamp(24px, 2.6vw, 56px); }
.split > div:first-child { border-right: 1px solid var(--color-divider); }
.section { padding: 30px clamp(24px, 3.4vw, 72px); border-bottom: 1px solid var(--color-divider); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h3 { font-size: 22px; margin: 0; }

.rank { display: grid; grid-template-columns: 26px 1fr 92px 56px; align-items: center; gap: 14px; }
.rank + .rank { margin-top: 16px; }
.bar { height: 9px; background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.bar > span { display: block; height: 100%; background: var(--color-accent); }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 26px; }
.cards3 > div { padding: 18px; }
.cards3 .h-num { font-size: 40px; line-height: 1.1; }
.years { display: grid; gap: 5px; align-items: end; height: 180px; }
.years > div { background: var(--color-accent-500); min-height: 2px; }
.years > div.peak { background: var(--color-accent); }
.grave { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 7px; }
.grave a { aspect-ratio: 3/4; background: var(--color-accent-700); display: block; position: relative; overflow: hidden; }
.grave img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); opacity: .75; }
.grave a:hover img { filter: none; opacity: 1; }
.footer2 { display: grid; grid-template-columns: 1fr 1fr; }
.footer2 > div { padding: 30px clamp(24px, 3.4vw, 72px); }
.footer2 > div:first-child { border-right: 1px solid var(--color-divider); }

/* — загрузка и ошибка — */
.panel { max-width: 520px; margin: 0 auto; min-height: calc(100vh - 60px); justify-content: center; padding: 44px 36px; display: flex; flex-direction: column; gap: 22px; }
.progress { height: 6px; overflow: hidden; position: relative; background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.progress > span { position: absolute; inset: 0; width: 34%; background: var(--color-accent); animation: scan 1.6s ease-in-out infinite; }
@keyframes scan { 0% { transform: translateX(-100%) } 100% { transform: translateX(300%) } }
.steps { display: flex; flex-direction: column; gap: 11px; font-size: 13.5px; }
.steps > div { display: flex; justify-content: space-between; }
.steps > div[data-state="wait"] { opacity: .4; }
.steps > div[data-state="done"] span:last-child { color: var(--color-accent-300); }
.stepnum { font-family: var(--font-heading); color: var(--color-accent); min-width: 16px; }

@media (prefers-reduced-motion: reduce) {
  .progress > span { animation: none; width: 100% }
  * { transition: none !important }
}

.hide-sm { display: revert }
@media (max-width: 900px) {
  .hide-sm { display: none !important }
  .topbar { flex-wrap: wrap; row-gap: 8px }
  .table th, .table td { padding: 6px 4px }
  .result-hero-top > div:last-child { width: 100% }
  .shell { border: none }
  .hero, .split, .four, .footer2 { grid-template-columns: 1fr }
  .hero-left { padding: 32px 18px; border-right: none }
  .hero-left h1 { font-size: 40px }
  .hero-right { padding: 28px 18px }
  .result-hero { padding: 24px 18px 22px }
  .big { font-size: 76px }
  .four { grid-template-columns: 1fr 1fr }
  .four > div:nth-child(2n) { border-right: none }
  .four > div { border-bottom: 1px solid var(--color-divider) }
  .four .h-num { font-size: 30px }
  .split > div, .section, .footer2 > div { padding: 20px 18px; border-right: none }
  .cards3 { grid-template-columns: 1fr }
  .topbar { padding: 11px 16px }
  .rank { grid-template-columns: 20px 1fr 66px 40px; gap: 8px }
  .rank > span { white-space: nowrap }
  .section-head { flex-wrap: wrap; row-gap: 4px }
  .table { font-size: 13px }
}
