/* MoGoDice shared 5-tab sticky header/nav + clean page styles (v=20261125-tabs2).
   Loaded LAST on every page so the nav is identical everywhere and on scroll. */

#dice,
#events,
#upcoming,
#tips,
#trade,
#board,
#matches,
#album-tracker {
  scroll-margin-top: var(--header-offset, 9rem);
}

/* Single canonical sticky header: opaque dark background (no backdrop-filter)
   prevents iOS Safari sticky compositing glitches on scroll. */
.site-header.hub-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 60;
  background: #0D071E;
  background-image: linear-gradient(180deg, #100826 0%, #0B0618 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(168, 85, 247, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transform: translateZ(0);
}

.site-header.hub-header .wrap {
  width: min(var(--max, 1080px), calc(100% - 1rem));
  margin-inline: auto;
}

.site-header.hub-header .header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0 0.55rem;
}

.site-header.hub-header .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex: 0 0 auto;
}

.site-header.hub-header .logo .logo-banner {
  width: auto;
  height: 54px;
  max-width: 82vw;
  filter: none;
  display: block;
}

/* Five equal, tap-friendly tabs on phones: Home, Dice, Events, Trade, Guide. */
.site-header.hub-header .nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  max-width: 100%;
  gap: 0.16rem;
  margin: 0;
  padding: 0.22rem;
  overflow: visible;
  background: rgba(16, 8, 36, 0.96);
  border: 1px solid rgba(168, 85, 247, 0.42);
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(140, 60, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.site-header.hub-header .nav a {
  flex: unset;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 46px;
  min-width: 0;
  width: 100%;
  padding: 0.28rem 0.1rem;
  border-radius: 999px;
  color: #E4D6FF;
  text-decoration: none;
  font-family: var(--font-body, "Fredoka", system-ui, sans-serif);
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1.1;
  white-space: nowrap;
  opacity: 0.92;
  background: transparent;
  box-shadow: none;
}

.site-header.hub-header .nav a:hover {
  color: #fff;
  opacity: 1;
}

.site-header.hub-header .nav a[aria-current="page"],
.site-header.hub-header .nav a.is-active {
  background: linear-gradient(180deg, #D946EF 0%, #A21CAF 40%, #7C3AED 100%);
  color: #fff;
  opacity: 1;
  box-shadow: 0 0 18px rgba(192, 38, 255, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.site-header.hub-header .nav-ico {
  display: inline !important;
  font-size: 0.98rem;
  line-height: 1;
}

.site-header.hub-header .nav-label {
  display: inline !important;
  font-weight: 600;
}

@media (min-width: 760px) {
  .site-header.hub-header .wrap {
    width: min(var(--max, 1080px), calc(100% - 2rem));
  }
  .site-header.hub-header .header-inner {
    gap: 0.6rem;
    padding: 0.55rem 0 0.7rem;
  }
  .site-header.hub-header .logo .logo-banner {
    height: 82px;
    max-width: min(480px, 68vw);
  }
  .site-header.hub-header .nav {
    display: flex;
    width: max-content;
    margin-inline: auto;
    gap: 0.25rem;
    padding: 0.28rem;
  }
  .site-header.hub-header .nav a {
    flex-direction: row;
    width: auto;
    min-width: 6.4rem;
    min-height: 44px;
    padding: 0.5rem 0.95rem;
    font-size: 0.94rem;
    gap: 0.35rem;
  }
  .site-header.hub-header .nav-ico {
    font-size: 1rem;
  }
}

/* ---------------- Home landing page ---------------- */
.home-hero {
  padding: 1.15rem 0 0.75rem;
  text-align: center;
}
.home-hero .kicker {
  margin: 0 0 0.45rem;
}
.home-hero h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.75rem, 6vw, 2.55rem);
  line-height: 1.08;
}
.home-hero .lede-mini {
  margin: 0 auto;
  max-width: 36rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.home-cards {
  padding: 0.5rem 0 2rem;
}
.home-grid {
  display: grid;
  gap: 0.9rem;
}
@media (min-width: 760px) {
  .home-hero {
    text-align: left;
    padding-top: 1.5rem;
  }
  .home-hero .lede-mini {
    margin: 0;
  }
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

.home-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}
.home-card-primary {
  border: 2px solid rgba(34, 211, 90, 0.55);
}
.home-card-trade {
  border: 2px solid rgba(255, 210, 74, 0.65);
}
.home-card-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.home-card h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.35rem;
  color: var(--ink);
  background: none;
  -webkit-text-fill-color: var(--ink);
  filter: none;
}
.home-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}
.home-card .home-status-strong {
  color: var(--ink);
  font-weight: 600;
}
.home-card .home-meta {
  margin-top: 0.25rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.home-card .btn {
  width: 100%;
}
@media (min-width: 760px) {
  .home-card .btn {
    width: auto;
    align-self: flex-start;
  }
}

.home-app-hint {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.home-app-hint img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex: none;
}
.home-app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ---------------- Dice & Events dedicated pages ---------------- */
.tab-head {
  padding: 1.05rem 0 0.45rem;
}
.tab-head .kicker {
  margin: 0 0 0.5rem;
}
.tab-head h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.7rem, 6vw, 2.45rem);
  line-height: 1.08;
}
.tab-head .lede-mini {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 0.96rem;
}

.dice-section {
  padding: 0.65rem 0 2rem;
}
.dice-section .last-checked {
  margin: 0.9rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}
.dice-section .subhead {
  margin: 1.35rem 0 0.7rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--gold);
}
#dice-links-list .dice-item {
  border: 2px solid rgba(34, 211, 90, 0.45);
}
#dice-links-list .claim {
  width: 100%;
  justify-self: stretch;
  min-height: 50px;
  padding: 0.85rem 1.15rem;
  font-size: 1.04rem;
}
@media (min-width: 700px) {
  #dice-links-list .claim {
    width: auto;
    min-width: 13rem;
    justify-self: end;
  }
}

.how-compact {
  margin: 1rem 0 0;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 0.15rem 1rem;
  box-shadow: var(--shadow);
}
.how-compact > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 650;
  padding: 0.75rem 0;
}
.how-compact > summary::-webkit-details-marker,
.how-compact > summary::marker { display: none; content: ""; }
.how-compact > summary::after { content: " ▾"; color: var(--gold); }
.how-compact[open] > summary::after { content: " ▴"; }
.how-compact ol { margin: 0 0 0.7rem; padding-left: 1.2rem; }
.how-compact li { margin: 0.25rem 0; }
.how-compact p { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.92rem; }

.events-section {
  padding: 0.65rem 0 1.2rem;
}
.events-section + .events-section {
  padding-top: 0.5rem;
  padding-bottom: 2rem;
}
.events-section .section-head {
  margin-bottom: 0.75rem;
}
.events-section .section-head h2 {
  font-size: clamp(1.45rem, 4.5vw, 1.95rem);
}
.event.is-ended {
  opacity: 0.72;
  border-color: rgba(255, 255, 255, 0.14);
}
.upcoming-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
#upcoming-grid:empty + .upcoming-empty { display: block; }
#upcoming-grid:not(:empty) + .upcoming-empty { display: none; }

/* ---------------- Offline card ---------------- */
.offline-wrap {
  padding: 2rem 0 3rem;
  display: flex;
  justify-content: center;
}
.offline-card {
  width: min(28rem, 100%);
  text-align: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.6rem 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}
.offline-card img {
  width: 84px;
  height: 84px;
  margin: 0 auto 0.9rem;
  border-radius: 20px;
}
.offline-card h1 {
  margin: 0 0 0.45rem;
  font-size: 1.7rem;
}
.offline-card p {
  margin: 0 0 0.9rem;
  color: var(--muted);
}

/* ---------------- Install banner (pwa-install.js) ---------------- */
.md-install {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  padding: 0.65rem 0.8rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.md-install-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: min(28rem, 100%);
  margin: 0 auto;
  padding: 0.7rem 0.75rem 0.7rem 0.7rem;
  background: #17102C;
  border: 1px solid rgba(168, 85, 247, 0.45);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 24px rgba(124, 58, 237, 0.16);
  color: #F4EFFE;
  font-family: var(--font-body, "Fredoka", system-ui, sans-serif);
}
.md-install-card img {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex: none;
}
.md-install-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.md-install-copy strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}
.md-install-copy span {
  display: block;
  margin-top: 0.12rem;
  color: #B9A8D6;
  font-size: 0.8rem;
  line-height: 1.35;
}
.md-install-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: none;
}
.md-install-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  min-height: 36px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #7CFF8A 0%, #22D35A 48%, #14B84A 100%);
  color: #063318;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  box-shadow: 0 3px 0 #0B7A32;
}
.md-install-dismiss {
  appearance: none;
  border: 0;
  background: transparent;
  color: #B9A8D6;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  font-size: 1.15rem;
  line-height: 1;
}
.md-install-dismiss:hover { color: #fff; }
.md-install-btn:focus-visible,
.md-install-dismiss:focus-visible {
  outline: 3px solid #FFD24A;
  outline-offset: 2px;
}
body.md-install-open { padding-bottom: 5.5rem; }
