/* mobile-nav-v2 - brand new bottom bar + drawer for the hv2-/v1- themed page
   family. Built as an independent component: reuses auth.js's existing
   IDs/classes for data binding (drawer open/close, user card, coins, level,
   notif badge) so that wiring keeps working untouched, but every visual
   rule here is new and scoped under .mnv2-bar / .mnv2-drawer so it wins
   over the old global mobile-nav.css by specificity instead of editing it. */

.mobile-nav.mnv2-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  height: auto;
  margin: 0;
  border-radius: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom);
  background: #0b0b0c;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: none;
  border-top-width: medium;
  border-top-style: none;
  border-top-color: currentcolor;
  border-top: 1px solid var(--v1-line, rgba(255, 255, 255, 0.08));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.25);
  z-index: 950;
}
/* senku-overlay-guard.js sets this on <html> whenever any modal/drawer/sheet
   is open (scroll-lock or a known overlay selector) - the bottom bar was
   still rendering on top of those overlays, so hide it for the duration. */
html[data-senku-overlay] .mobile-nav.mnv2-bar {
  display: none !important;
}

html[data-theme="light"] .mobile-nav.mnv2-bar {
  background: #ffffff;
  border-top-color: #eef0f2;
  box-shadow: 0 -4px 20px rgba(20, 20, 30, 0.08);
}

.mobile-nav.mnv2-bar .mnv2-list {
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 8px 6px;
}

.mobile-nav.mnv2-bar .mnv2-item {
  flex: 1;
  display: flex;
  justify-content: center;
}

.mobile-nav.mnv2-bar .mnv2-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  max-width: 68px;
  padding: 2px 2px 0;
  border-radius: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: "Unbounded", sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: var(--v1-muted, rgba(255, 255, 255, 0.42));
  transition: transform 0.2s ease;
}
.mobile-nav.mnv2-bar .mnv2-link:active {
  transform: scale(0.94);
}

.mobile-nav.mnv2-bar .mnv2-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 12px;
  background: transparent;
  transition: background 0.25s ease;
}
.mobile-nav.mnv2-bar .mnv2-link svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  color: inherit;
  transition: color 0.2s ease;
}

.mobile-nav.mnv2-bar .mnv2-label {
  color: var(--v1-muted, rgba(255, 255, 255, 0.42));
  transition: color 0.2s ease;
}

.mobile-nav.mnv2-bar .mnv2-link.is-active .mnv2-icon-wrap {
  background: #f2543d;
}
.mobile-nav.mnv2-bar .mnv2-link.is-active svg {
  color: #ffffff;
}
.mobile-nav.mnv2-bar .mnv2-link.is-active .mnv2-label {
  color: #f2543d;
  font-weight: 800;
}

.mnv2-badge {
  position: absolute;
  top: -2px;
  right: calc(50% - 22px);
  min-width: 15px;
  height: 15px;
  background: #ff3b30;
  color: #fff;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 900;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--v1-card, #17171a);
  padding: 0 3px;
  z-index: 5;
}
html[data-theme="light"] .mnv2-badge { border-color: #ffffff; }

/* ---- Drawer ("Ещё") ---- */

.mnv2-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 11000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}
.mnv2-drawer-overlay.open { opacity: 1; visibility: visible; }

#mobileDrawer.mnv2-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 88%;
  height: 100%;
  background: var(--v1-page, #0b0b0c);
  z-index: 11001;
  transform: translateX(100%);
  /* visibility, not just the transform: parked off-screen the drawer still
     held 340px of live content to the right of the viewport. That only stays
     out of the page because the <aside> is position:fixed - and a fixed
     element stops being viewport-fixed the moment ANY ancestor gains a
     transform/filter/will-change, at which point those 340px land in the page
     flow and the whole page gains a horizontal scrollbar. Hiding it removes
     that failure mode outright, and also drops its ~20 links out of the
     keyboard/D-pad tab order while closed (they were reachable on TV).
     The 0.45s visibility delay lets the slide-out animation finish first;
     the overlay next to it already uses exactly this pattern. */
  visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1),
              visibility 0s linear 0.45s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
  border-radius: 22px 0 0 22px;
  border-left: 1px solid var(--v1-line, rgba(255, 255, 255, 0.08));
}
#mobileDrawer.mnv2-drawer.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1),
              visibility 0s linear 0s;
}
/* While a swipe-to-close drag is live, the JS sets an inline transform on
   every touchmove to follow the finger 1:1 - the normal 0.45s transition
   would fight that and make the drawer visibly lag behind the touch point. */
#mobileDrawer.mnv2-drawer.mnv2-dragging { transition: none; }
.mnv2-drawer-overlay.mnv2-dragging-overlay { transition: none; }

#mobileDrawer.mnv2-drawer .drawer-header {
  padding: 18px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#mobileDrawer.mnv2-drawer .drawer-title {
  font-family: "Unbounded", sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--v1-text, #fff);
  border-left: 4px solid var(--v1-text, #fff);
  padding-left: 14px;
  line-height: 1.2;
}
#mobileDrawer.mnv2-drawer .close-drawer-btn {
  background: none;
  border: none;
  color: var(--v1-muted, #888);
  cursor: pointer;
  padding: 5px;
}

#mobileDrawer.mnv2-drawer .drawer-content {
  flex: 1;
  min-height: 0;
  padding: 6px 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

#mobileDrawer.mnv2-drawer .section-label {
  margin-top: 14px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--v1-muted, #888);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#mobileDrawer.mnv2-drawer .drawer-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--v1-line, transparent);
  background: #ffffff03 !important;
  padding: 13px 15px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--v1-text, #fff);
  font-family: "Unbounded", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  transition: transform 0.2s ease, background 0.2s ease;
}
#mobileDrawer.mnv2-drawer .drawer-link:active {
  transform: scale(0.97);
}
#mobileDrawer.mnv2-drawer .drawer-link-left {
  display: flex;
  align-items: center;
  gap: 11px;
}
#mobileDrawer.mnv2-drawer .drawer-link-left svg {
  width: 19px;
  height: 19px;
  color: var(--v1-muted, #ccc);
}
#mobileDrawer.mnv2-drawer .chevron {
  color: var(--v1-muted, #555);
  width: 15px;
  height: 15px;
}
#mobileDrawer.mnv2-drawer .premium-icon-check { color: #ffd700; }
/* The globally-loaded old mobile-nav.css has `.premium-btn { color: #fff
   !important; }` - invisible white-on-white once the drawer went light-
   theme aware. #mobileDrawer.mnv2-drawer beats it on specificity despite
   both being !important. Also gives the button (now the first, primary
   item in the list) a distinct gold-tinted surface instead of the flat
   drawer-link chip look. */
#mobileDrawer.mnv2-drawer .premium-btn {
  color: var(--v1-text, #fff) !important;
  background: linear-gradient(135deg, rgba(255, 209, 92, 0.16), rgba(255, 209, 92, 0.05)) !important;
  border-color: rgba(255, 209, 92, 0.35);
  margin-bottom: 4px;
}

#mobileDrawer.mnv2-drawer .drawer-footer {
  margin-top: auto;
  flex: 0 0 auto;
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.19);
  border-radius: 21px;
}

#mobileDrawer.mnv2-drawer .user-profile {
  display: flex;
  align-items: center;
  gap: 13px;
}
#mobileDrawer.mnv2-drawer #mobile-user-avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}
#mobileDrawer.mnv2-drawer .user-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
#mobileDrawer.mnv2-drawer .mobile-user-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#mobileDrawer.mnv2-drawer .user-nickname {
  font-size: 15px;
  font-weight: 700;
  color: var(--v1-text, #fff);
  min-width: 0;
  max-width: 140px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* auth.js's updateUI() re-injects #mobile-level-compact via JS whenever it's
   missing from the DOM (legacy fallback aimed at the old nav) - removing it
   from this fragment's markup alone doesn't stick, so it's hidden here
   instead, which works regardless of whether auth.js re-adds it. */
#mobileDrawer.mnv2-drawer .mobile-level-compact { display: none !important; }
#mobileDrawer.mnv2-drawer .mobile-level-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--v1-line, rgba(255, 255, 255, 0.12));
}
#mobileDrawer.mnv2-drawer .mobile-level-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--v1-text, #fff);
  transition: width 0.35s ease;
}
#mobileDrawer.mnv2-drawer .user-status {
  font-size: 11px;
  color: #4cd964;
  display: flex;
  align-items: center;
  gap: 4px;
}
#mobileDrawer.mnv2-drawer .online-dot {
  width: 6px;
  height: 6px;
  background-color: #4cd964;
  border-radius: 50%;
}

#mobileDrawer.mnv2-drawer .balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--v1-chip, #1a1a1a);
  border: 1px solid var(--v1-line, transparent);
  border-radius: 16px;
  padding: 10px 13px;
}
#mobileDrawer.mnv2-drawer .balance-content {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
}
/* The globally-loaded old mobile-nav.css draws its own '::before' star on
   .balance-content (a classname kept here on purpose for auth.js's data
   binding) - without killing it, that old star renders alongside our own
   SVG one below, showing two stars stacked. */
#mobileDrawer.mnv2-drawer .balance-content::before { content: none; }
#mobileDrawer.mnv2-drawer .mnv2-coin-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: var(--v1-text, #fff);
}
#mobileDrawer.mnv2-drawer .balance-text { display: flex; flex-direction: column; }
#mobileDrawer.mnv2-drawer .balance-label {
  font-size: 9.5px;
  color: var(--v1-muted, #888);
  text-transform: uppercase;
  font-weight: 600;
}
#mobileDrawer.mnv2-drawer .balance-amount {
  font-size: 16px;
  color: var(--v1-text, #e7e7e7);
  font-weight: 800;
  font-family: "Unbounded", sans-serif;
  letter-spacing: 0.4px;
}
#mobileDrawer.mnv2-drawer .add-balance-btn {
  width: 30px;
  height: 30px;
  background: var(--v1-line, rgba(255, 255, 255, 0.06));
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--v1-text, #fff);
  border: none;
  cursor: pointer;
}

#mobileDrawer.mnv2-drawer .mobile-plus-card {
  min-height: 74px;
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 12px 13px;
  border: 0;
  border-radius: 16px;
  background: var(--v1-chip, #1a1a1a);
  color: #fff;
  text-decoration: none;
  isolation: isolate;
}
#mobileDrawer.mnv2-drawer .mobile-plus-card[hidden] { display: none !important; }
#mobileDrawer.mnv2-drawer .mobile-plus-card-bg,
#mobileDrawer.mnv2-drawer .mobile-plus-card-shade {
  position: absolute;
  inset: -1px;
  pointer-events: none;
}
#mobileDrawer.mnv2-drawer .mobile-plus-card-bg {
  z-index: 0;
  background: #1a1a1a url("/assets/plus/senku-plus-mobile.webp?v=1784653200") center 38% / cover no-repeat;
}
#mobileDrawer.mnv2-drawer .mobile-plus-card-shade {
  z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.88));
}
#mobileDrawer.mnv2-drawer .mobile-plus-card-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 5px;
  min-width: 0;
}
#mobileDrawer.mnv2-drawer .mobile-plus-card-copy strong { font-size: 13px; line-height: 1.2; }
#mobileDrawer.mnv2-drawer .mobile-plus-card-copy small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

#mobileDrawer.mnv2-drawer .logout-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 15px;
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: none;
  border-radius: 16px;
  font-family: "Unbounded", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
#mobileDrawer.mnv2-drawer .logout-btn:active {
  transform: scale(0.97);
  background: rgba(255, 59, 48, 0.15);
}

html[data-theme="light"] #mobileDrawer.mnv2-drawer .logout-btn {
  background: rgba(255, 59, 48, 0.08);
}

@media (min-width: 1025px) {
  .mobile-nav.mnv2-bar { display: none; }
}

@media (max-width: 360px) {
  #mobileDrawer.mnv2-drawer .drawer-title { font-size: 16px; }
  #mobileDrawer.mnv2-drawer .user-nickname { font-size: 14px; max-width: 105px; }
  #mobileDrawer.mnv2-drawer .mobile-level-compact { width: 58px; flex-basis: 58px; }
  #mobileDrawer.mnv2-drawer .mobile-plus-card { min-height: 70px; padding: 11px; }
}
