:root {
  --mobile-tab-h: 56px;
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-content-pad: calc(var(--mobile-tab-h) + var(--mobile-safe-bottom) + 8px);
}

.mobile-bottom-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9990;
  height: calc(var(--mobile-tab-h) + var(--mobile-safe-bottom));
  padding-bottom: var(--mobile-safe-bottom);
  background: rgba(10, 10, 18, 0.96);
  border-top: 1px solid rgba(155, 140, 248, 0.28);
  justify-content: space-around;
  align-items: stretch;
  box-shadow: 0 -4px 28px rgba(155, 140, 248, 0.08), 0 -8px 32px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.mobile-tab-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.38);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 6px 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease;
}
.mobile-tab-btn svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  flex-shrink: 0;
}
.mobile-tab-btn.active {
  color: var(--accent-bright);
}
.mobile-tab-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 0 0 2px 2px;
}
.mobile-tab-btn.active svg {
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.mobile-nav-sheet {
  position: fixed;
  inset: 0;
  z-index: 9995;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.mobile-nav-sheet.open {
  pointer-events: auto;
  opacity: 1;
}
.mobile-nav-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}
.mobile-nav-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(72vh, 520px);
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  padding: 12px 16px calc(var(--mobile-tab-h) + var(--mobile-safe-bottom) + 16px);
  transform: translateY(105%);
  transition: transform 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.mobile-nav-sheet.open .mobile-nav-sheet-panel {
  transform: translateY(0);
}
.mobile-nav-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.mobile-nav-sheet-head h3 {
  font-size: 1rem;
  font-weight: 600;
}
.mobile-nav-sheet-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.mobile-nav-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.mobile-nav-tile svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent-bright);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}
.mobile-nav-tile:hover,
.mobile-nav-tile:active {
  background: var(--accent-soft);
  border-color: rgba(155, 140, 248, 0.35);
}
.mobile-nav-tile--accent {
  background: var(--accent-soft);
  border-color: rgba(155, 140, 248, 0.35);
}

@media (max-width: 768px) {
  body {
    padding-bottom: var(--mobile-content-pad);
  }
  .mobile-bottom-bar {
    display: flex;
  }
  .header .search {
    display: none;
  }
  .footer {
    padding-bottom: calc(1.5rem + var(--mobile-content-pad));
  }
}

@media (min-width: 769px) {
  .mobile-bottom-bar {
    display: none !important;
  }
}
