/* ═══════════════════════════════════════════════════════════════════════
   nav-bar.css v1 — нижняя панель быстрого перехода TopQuiz.
   Единый компонент для всех платформ (MUST_BE_IDENTICAL).
   Токены — из aurora-tokens.css. Safe-area — env(safe-area-inset-bottom).
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --nb-h: 60px;                 /* высота панели (без safe-area) */
  --nb-bg: var(--card, rgba(255,255,255,.72));
  --nb-brd: var(--card-brd, rgba(26,21,48,.08));
  --nb-ink: var(--muted, #5B5480);
  --nb-ink-active: var(--accent, #7B2FFF);
  --nb-gold: #E0A21B;
}

/* Контент страницы не прячем под панель — добавляем нижний отступ body.
   На страницах без панели класса .tq-has-navbar нет — отступа тоже нет. */
body.tq-has-navbar {
  padding-bottom: calc(var(--nb-h) + env(safe-area-inset-bottom) + 8px) !important;
}

/* Плавающая панель (как в Telegram): по ширине контейнера (max 600px),
   с отступами от краёв и низа, скруглённая. Центрируем через left/right+margin. */
.tq-navbar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 1500;
  max-width: 576px;                 /* 600 (контейнер) - 2×12 (отступы) */
  margin: 0 auto;
  height: var(--nb-h);
  display: flex;
  align-items: stretch;
  background: var(--nb-bg);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
          backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--nb-brd);
  border-radius: 22px;
  box-shadow: 0 14px 40px -14px rgba(80,40,140,.45), inset 0 1px 0 rgba(255,255,255,.5);
  transform: translateY(0);
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .2s;
  opacity: 1;
  overflow: hidden;
}
html.dark-mode .tq-navbar {
  --nb-bg: var(--card, rgba(12,16,32,.72));
  box-shadow: 0 14px 40px -14px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.06);
}

/* Скрытие панели (игровые экраны) */
.tq-navbar.is-hidden { transform: translateY(105%); opacity: 0; pointer-events: none; }

.tq-nb-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--nb-ink);
  position: relative;
  padding: 6px 2px calc(6px);
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.tq-nb-btn:active { transform: scale(.94); }
.tq-nb-btn .nb-ico {
  font-size: 20px;
  line-height: 1;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
}
.tq-nb-btn .nb-ico img { width: 22px; height: 22px; display: block; }
.tq-nb-btn .nb-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1;
  white-space: nowrap;
}

/* Активный пункт */
.tq-nb-btn.is-active { color: var(--nb-ink-active); }
.tq-nb-btn.is-active .nb-ico { transform: translateY(-1px); }
.tq-nb-btn.is-active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--nb-ink-active);
}

/* Золотой замочек PRO на иконке */
.tq-nb-lock {
  position: absolute;
  top: -3px; right: -6px;
  width: 13px; height: 13px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 7px;
  color: #fff;
  background: linear-gradient(135deg, #FDB931, #FFD700);
  box-shadow: 0 2px 6px rgba(253,185,49,.55);
}
.tq-nb-btn.is-pro-unlocked .tq-nb-lock { display: none; }

/* LIVE-точка (дуэли) */
.tq-nb-live {
  position: absolute;
  top: -2px; right: -4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #E94A75;
  border: 1.5px solid var(--nb-bg);
  animation: tq-nb-blink 1.4s ease-in-out infinite;
}
@keyframes tq-nb-blink { 0%,100%{opacity:1} 50%{opacity:.25} }

/* ═══ Sheet «Ещё» ═══ */
.tq-nb-sheet-ov {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  z-index: 2500;   /* выше PRO-модалки (2000); loading (99999) не трогаем */
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.tq-nb-sheet-ov.is-open { opacity: 1; visibility: visible; }

/* Sheet «Ещё» — на широком экране по ширине панели (max 576px, по центру). */
.tq-nb-sheet {
  position: fixed;
  left: 12px; right: 12px; bottom: 0;
  max-width: 576px;
  margin: 0 auto;
  z-index: 2501;
  background: var(--card, #fff);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--nb-brd);
  border-bottom: none;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  max-height: 78vh;
  overflow-y: auto;
  box-shadow: 0 -18px 50px -20px rgba(0,0,0,.4);
}
html.dark-mode .tq-nb-sheet { background: var(--bg-card, #141A2B); }
.tq-nb-sheet-ov.is-open + .tq-nb-sheet,
.tq-nb-sheet.is-open { transform: translateY(0); }

.tq-nb-grab {
  width: 40px; height: 4px;
  border-radius: 999px;
  background: var(--nb-brd);
  margin: 0 auto 12px;
}
.tq-nb-sheet-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim, #8B84A8);
  margin: 2px 4px 12px;
}
.tq-nb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tq-nb-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border-radius: 14px;
  background: var(--panel, rgba(123,47,255,.06));
  border: 1px solid var(--line, rgba(26,21,48,.11));
  cursor: pointer;
  font-family: inherit;
  color: var(--text, #191430);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s, border-color .15s;
}
.tq-nb-cell:active { transform: scale(.96); }
.tq-nb-cell.is-active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}
.tq-nb-cell .nb-ico { font-size: 22px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.tq-nb-cell .nb-ico img { width: 24px; height: 24px; }
/* Иконка-маска (дуэли — как на главной): красится в текущий цвет кнопки. */
.tq-nb-cell .nb-ico .nb-mask,
.tq-nb-btn .nb-ico .nb-mask {
  display: inline-block;
  width: 22px; height: 22px;
  background-color: currentColor;
  /* Абсолютный путь: CSS лежит в /js/, относительный ./asset резолвился бы в /js/asset (404). */
  -webkit-mask: url('/asset/duel-svgrepo-com.svg') center/contain no-repeat;
          mask: url('/asset/duel-svgrepo-com.svg') center/contain no-repeat;
}
.tq-nb-cell .nb-ico .nb-mask { width: 24px; height: 24px; }
.tq-nb-cell .nb-lbl { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.15; }
.tq-nb-cell .tq-nb-lock { top: 6px; right: 6px; }
.tq-nb-cell.is-pro-unlocked .tq-nb-lock { display: none; }
/* LIVE-точка в sheet — в углу ЯЧЕЙКИ (не у иконки). */
.tq-nb-cell .tq-nb-live { top: 6px; right: 6px; border-color: transparent; }

/* perf-low / reduced-motion — глушим анимации */
html.perf-low .tq-nb-live,
html.perf-low .tq-navbar { animation: none !important; transition: none !important; }
html.perf-low .tq-nb-sheet,
html.perf-low .tq-nb-sheet-ov { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .tq-navbar, .tq-nb-sheet, .tq-nb-sheet-ov { transition: none !important; }
  .tq-nb-live { animation: none !important; }
}
