/* Shared by every page (home, handbook, PC, Pokédex), loaded after each page's own styles.
   On phones the masthead shrinks to one row and a tab bar at the bottom moves between pages.
   Inside the bot's Mini App (.tg, set by tg.js) the site drops its website chrome. */

/* ---------- Bottom tab bar (shown on phones and in the Mini App) ---------- */
.tabbar {
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0 6px env(safe-area-inset-bottom);
  background: var(--paper);
  border-top: 3px solid var(--line);
}
.tabbar a {
  position: relative;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--pixel);
  font-size: 1.2rem;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  -webkit-tap-highlight-color: transparent;
}
.tabbar a:active { color: var(--red); }
.tabbar a[aria-current="page"] { color: var(--ink); }
/* A red notch above the current tab, like a menu cursor. */
.tabbar a[aria-current="page"]::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 22%;
  right: 22%;
  height: 3px;
  background: var(--red);
}

@media (max-width: 820px) {
  /* ---------- Compact masthead ---------- */
  .masthead {
    padding: 14px 0 12px;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    border-bottom-width: 3px;
  }
  .masthead > div:first-child { min-width: 0; }
  .masthead .kicker { font-size: 1.05rem; line-height: 1.1; }
  .masthead h1 {
    font-size: 2.1rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mast-actions { flex: none; flex-wrap: nowrap; gap: 8px; margin-left: auto; }
  .masthead .play {
    font-size: 1.15rem;
    line-height: 1.4;
    padding: 1px 9px 3px;
    box-shadow: 3px 3px 0 var(--shadow);
  }
  /* Links the tab bar already gives you. */
  .mast-actions .dup { display: none; }

  .tabbar { display: grid; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  /* Floating buttons sit above the tab bar. */
  .top { bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }

  footer { margin-top: 40px; }
  /* The tab bar covers the site's own pages; the footer keeps the outside links. */
  footer .links a[href^="/"] { display: none; }
}

@media (max-width: 380px) {
  .tabbar a { font-size: 1.05rem; }
  .masthead h1 { font-size: 1.85rem; }
}

/* ---------- Mini App ----------
   Telegram already shows the bot's name, a Back and a close button and sets the theme,
   so the page keeps just its title and content, with the tab bar to move around. */
.tg .tabbar { display: grid; }
.tg body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
.tg .top { bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
.tg .toast { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
.tg .peek { bottom: calc(70px + env(safe-area-inset-bottom)); }
.tg .masthead {
  padding: 12px 0 10px;
  align-items: center;
  flex-wrap: nowrap;
  border-bottom-width: 3px;
}
.tg .masthead .kicker, .tg .mast-actions, .tg footer { display: none; }
.tg .masthead h1 {
  font-size: 2.1rem;
  line-height: 1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
