/* Калькулятор пропуска by devollve — дизайн-система сайта аренды (Pit Lane). */
:root {
  --bg: #0B0D11;
  --bg-card: #15171C;
  --bg-raised: #101318;
  --bg-pop: #101318;
  --border: #23262C;
  --text: #FFFFFF;
  --text-dim: #A8ADB7;
  --text-faint: #7A7F87;
  --accent: #FF7A00;
  --accent-dim: rgba(255, 122, 0, 0.14);
  --green: #37C978;
  --red: #FF5C5C;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body { background: transparent; color: var(--text); font-family: var(--font); min-height: 100vh; }
input { font-family: inherit; }
button { font-family: inherit; cursor: pointer; transition: background .25s, border-color .25s, color .25s; }
a { color: inherit; }
.hidden { display: none !important; }
.accent { color: var(--accent); }

/* Живой фон-сеть (background.js) — за контентом */
#bg-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }

/* Скроллбары в стиле сайта */
* { scrollbar-width: thin; scrollbar-color: #3A3A40 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3A3A40; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }

/* Клик мышью не должен оставлять «залипающую» обводку; клавиатурный фокус сохраняем */
button:focus:not(:focus-visible) { outline: none; }
.icon-btn:focus-visible, .tab:focus-visible, .help:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Шапка ---------- */
.topbar {
  border-bottom: 1px solid var(--border); background: var(--bg-raised);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px; height: 60px;
  display: flex; align-items: center; gap: 10px;
}
.logo {
  font-weight: 800; letter-spacing: 1.2px; font-size: 14px; white-space: nowrap;
  text-decoration: none; color: inherit; user-select: none;
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
}
.logo .logo-main span { color: var(--accent); }
.logo:hover .logo-main span { text-shadow: 0 0 14px rgba(255, 122, 41, .5); }
.logo-by {
  display: block; color: #B8B8C0; font-size: 11px; font-weight: 600;
  letter-spacing: 3px; margin-top: 2px; text-align: center;
}
.topbar-menu { display: flex; align-items: center; flex: 1; min-width: 0; }
.tabs { display: flex; gap: 2px; margin: 0 auto; justify-content: center; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  font-size: 13px; font-weight: 600; padding: 0 10px; height: 34px;
  display: inline-flex; align-items: center; border-radius: 10px;
  white-space: nowrap; text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--accent-dim); }
.icon-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; width: 36px; height: 36px; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.burger-btn { display: none; }

/* ---------- Каркас ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.page { max-width: 1200px; width: 100%; margin: 0 auto; padding: 24px 20px 40px; flex: 1; }
h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.lead { color: var(--text-dim); font-size: 14px; line-height: 1.7; margin-bottom: 22px; max-width: 70ch; }
.lead-link { color: var(--accent); text-decoration: none; white-space: nowrap; }
.lead-link:hover { text-decoration: underline; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
}
/* Заголовки панелей — как h2 на аренде и калькуляторе перекупа */
.card-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 14px; }

/* ---------- Поля ---------- */
/* Группа — строка: подпись слева, поля справа. Так блок ввода занимает три
   строки вместо девяти и целиком помещается на экран вместе с вердиктом. */
.group { display: grid; grid-template-columns: 118px 1fr; gap: 18px; align-items: start; }
.group + .group { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-faint); padding-top: 9px;
}
/* auto-fill, а не auto-fit: пустые треки остаются, и поле под число 0–8 не
   растягивается на пол-экрана, когда в ряду всего два поля. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.grid.off { opacity: .4; }
.field { display: block; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 9px 12px; font-size: 15px; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; outline: none;
  transition: border-color .2s;
}
.field input:focus { border-color: var(--accent); }
.hint { display: block; margin-top: 4px; font-size: 11px; color: var(--text-faint); }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.check:has(input:checked) { color: var(--text); }
/* Чекбокс стоит в сетке полей, поэтому выравниваем его по строке ввода, а не по
   подписи: иначе он висит в воздухе над пустым местом. */
.check-field { align-self: center; padding-top: 18px; line-height: 1.35; }

/* ---------- Вердикт ---------- */
.verdict.ok { border-color: rgba(55, 201, 120, .35); }
.verdict.fail { border-color: rgba(255, 92, 92, .35); }
.v-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.v-icon { font-size: 26px; line-height: 1; }
.v-title { font-size: 19px; font-weight: 800; }
.v-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.v-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  flex: 1 1 150px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 15px;
}
.stat-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); margin-bottom: 7px;
}
/* В плитке значок подсказки мельче, чем у полей ввода: подпись здесь 10px */
.stat-label .help { width: 14px; height: 14px; font-size: 9px; margin-left: 4px; }
.stat-value { font-size: 21px; font-weight: 700; font-family: var(--mono); }
.stat-value.accent { color: var(--accent); }
.stat-value.good { color: var(--green); }
.stat-value.bad { color: var(--red); }

/* ---------- Чем закрыть недостачу ---------- */
.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.way { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; }
.way-title { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.way-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.way.accent { border-color: rgba(255, 122, 0, .35); }

/* ---------- Дни ---------- */
/* overflow-y без overflow-x даёт горизонтальный скролл внутри списка: строка
   с уровнем не переносится и на узких экранах уезжала за край. */
.days { max-height: 340px; overflow-y: auto; overflow-x: hidden; }
.day-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .04); font-size: 13px;
}
.day-row:last-child { border-bottom: none; }
.day-date { color: var(--text-dim); width: 92px; flex-shrink: 0; }
.day-x2 { color: var(--accent); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.day-spacer { flex: 1; }
.day-level { font-weight: 700; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.day-level.up { color: var(--green); }

/* ---------- Акции ---------- */
.events { display: flex; flex-direction: column; gap: 9px; }
.event {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 11px; font-size: 13px;
}
.event-dates { font-weight: 700; font-family: var(--mono); font-size: 12px; }
.event-days { color: var(--text-dim); margin-left: auto; font-size: 12px; }
.event.past { opacity: .55; }
.note { margin-top: 12px; font-size: 12px; color: var(--text-faint); line-height: 1.6; }

/* ---------- Факты ---------- */
.facts { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.facts li { font-size: 13px; color: var(--text-dim); line-height: 1.6; padding-left: 20px; position: relative; }
.facts li::before { content: '·'; position: absolute; left: 7px; color: var(--accent); font-weight: 700; }
.facts b { color: var(--text); font-weight: 600; }

.foot { color: var(--text-faint); font-size: 12px; line-height: 1.7; text-align: center; margin-top: 24px; }

/* ---------- Подсказки «?» (кружок с пояснением) ---------- */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--text-faint); color: var(--text-faint);
  font-size: 10px; font-weight: 700; cursor: help; margin-left: 6px; line-height: 1;
  vertical-align: middle;
}
.help:hover { border-color: var(--accent); color: var(--accent); }
/* Облачко рисуется в <body> (bindTips в app.js): через ::after его обрезали бы
   блоки со своим скроллом. */
.tip-pop {
  position: fixed; z-index: 200; max-width: 280px;
  background: var(--bg-pop); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  font-family: var(--font); font-size: 12px; font-weight: 500; line-height: 1.45;
  text-align: left; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); pointer-events: none;
}

/* ---------- Футер (как на сайте аренды) ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 32px; background: rgba(11, 13, 17, .5); }
.footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 8px 20px;
  display: flex; align-items: center; gap: 24px;
  font-size: 11px; color: var(--text-dim);
}
.footer-brand { font-weight: 600; white-space: nowrap; line-height: 1.25; }
.footer-brand small { display: block; color: var(--text-faint); font-weight: 400; }
.footer-note {
  flex: 1; min-width: 320px; color: var(--text-faint); line-height: 1.35; font-size: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.footer-links { display: grid; grid-template-columns: auto auto; gap: 4px 18px; justify-content: end; }
.footer-links a { color: var(--text-dim); text-decoration: none; white-space: nowrap; }
.footer-links a:hover { color: var(--accent); }
.footer-links a:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fl-ico { display: inline-block; width: 1.5em; }

/* ---------- Мобильные ---------- */
/* Пока ссылки на соседние сервисы не помещаются в строку рядом с логотипом,
   сворачиваем их в панель под шапкой — как на аренде и калькуляторе перекупа. */
@media (max-width: 860px) {
  .burger-btn { display: inline-flex; margin-left: auto; width: 38px; height: 38px; font-size: 18px; }
  .topbar-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    flex-direction: column; align-items: stretch;
    background: rgba(16, 19, 24, .98); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border); padding: 14px 20px 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  }
  .topbar-menu.open { display: flex; }
  .topbar-menu .tabs { flex-direction: column; gap: 6px; width: 100%; }
  .topbar-menu .tab { text-align: left; padding: 12px 14px; border: 1px solid var(--border); }
  .topbar-menu .tab.active { border-color: var(--accent-dim); }
}
@media (max-width: 1000px) {
  .footer-inner { flex-wrap: wrap; gap: 8px 20px; }
  .footer-note { order: 3; min-width: 100%; }
}
/* Узкий экран: подпись группы встаёт над полями — в строку они уже не влезают. */
@media (max-width: 720px) {
  .group { grid-template-columns: 1fr; gap: 10px; }
  .group-title { padding-top: 0; }
}
@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .page { padding: 20px 12px 32px; }
  .card { padding: 16px 15px; }
  /* На телефоне числовые поля встают по двое: в один столбец карточка ввода
     вытягивается почти на экран, и вердикт уезжает далеко вниз. */
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .check-field { grid-column: 1 / -1; padding-top: 0; }
  .day-row { gap: 8px; padding: 8px 2px; }
  .day-date { width: 64px; font-size: 11px; }
  .day-level { font-size: 10px; }
}

/* ==================================================================
   СТЕКЛО — финальные переопределения (как на сайте аренды).
   Держать В КОНЦЕ файла: иначе фоны выше по каскаду их перекроют.
   ================================================================== */
.card, .stat, .way, .event { background: rgba(21, 23, 28, .6); }
.field input { background: rgba(16, 19, 24, .6); }
