/* Visual polish is intentionally isolated from the question/game surface. */
body:not(.is-game):not(.is-challenge) nav.bottom-nav {
  --nav-height: 72px;
  --nav-inset: 7px;
  --nav-item-height: 58px;
  --nav-glow-x: 50%;
  --nav-glow-y: 50%;
  --nav-glow-alpha: 0;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 12px;
  width: auto;
  height: var(--nav-height);
  min-height: var(--nav-height);
  padding: var(--nav-inset) 8px;
  gap: 0;
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  background: rgba(238, 243, 251, 0.54);
  box-shadow: 0 18px 42px rgba(32, 54, 104, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.94), inset 0 -1px 0 rgba(91, 0, 184, 0.08);
  backdrop-filter: blur(28px) saturate(1.58);
  -webkit-backdrop-filter: blur(28px) saturate(1.58);
  scale: 1;
  transform: translateZ(0);
  transition: box-shadow 240ms ease;
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav.nav-engaged {
  scale: 1;
  box-shadow: 0 20px 46px rgba(32, 54, 104, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.98), inset 0 -1px 0 rgba(91, 0, 184, 0.1);
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-glow {
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(190px 110px at var(--nav-glow-x) var(--nav-glow-y), rgba(0, 184, 255, var(--nav-glow-alpha)), rgba(255, 0, 106, calc(var(--nav-glow-alpha) * 0.46)) 42%, transparent 74%);
  opacity: 1;
  transition: opacity 180ms ease;
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-active-indicator {
  top: var(--nav-inset);
  left: 0;
  width: var(--nav-indicator-width, calc((100% - 16px) / 5));
  height: var(--nav-indicator-height, var(--nav-item-height));
  min-height: var(--nav-item-height);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), inset 0 -1px 0 rgba(91, 0, 184, 0.1), 0 9px 22px rgba(55, 44, 118, 0.14);
  transform: translate3d(var(--nav-indicator-x, 8px), 0, 0);
  scale: 1;
  will-change: transform;
  transition: transform 520ms cubic-bezier(0.2, 0.9, 0.24, 1.14), scale 220ms cubic-bezier(0.22, 1, 0.36, 1), background-color 200ms ease, box-shadow 200ms ease;
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-active-indicator.nav-no-transition {
  transition: none !important;
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-active-indicator.interacting {
  z-index: 1;
  scale: 1.035;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), inset 0 -1px 0 rgba(91, 0, 184, 0.11), 0 10px 24px rgba(55, 44, 118, 0.16);
}

body:not(.is-game):not(.is-challenge) .liquid-refraction-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  border-radius: inherit;
  pointer-events: none;
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-item,
body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-item.active {
  z-index: 2;
  height: var(--nav-item-height);
  min-height: var(--nav-item-height);
  min-width: 0;
  flex: 1 1 0;
  gap: 1px;
  padding: 3px 2px;
  transform: none;
  text-shadow: none;
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-item {
  color: #565d72;
  scale: 1;
  touch-action: manipulation;
  transition: color 220ms ease, scale 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-item.active {
  color: var(--premium-a);
  scale: 1.025;
}

body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-item:focus-visible {
  outline: 2px solid var(--blue-b);
  outline-offset: -3px;
}

body:not(.is-game):not(.is-challenge) .category-card {
  isolation: isolate;
  overflow: visible;
  border: 0;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 15px 34px rgba(32, 54, 104, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

body:not(.is-game):not(.is-challenge) .category-card::before {
  inset: -3px;
  z-index: 3;
  padding: 3px;
  border-radius: 31px;
  background: conic-gradient(from var(--category-rotate), var(--card-a, var(--red-a)), var(--card-b, var(--blue-b)) 45%, var(--card-a, var(--red-a)) 100%);
  opacity: 1;
  animation: categoryBorderSpin 4.8s linear infinite;
}

body:not(.is-game):not(.is-challenge) .category-card::after {
  content: none;
}

body:not(.is-game):not(.is-challenge) .category-emoji {
  width: 68px;
  height: 68px;
  color: color-mix(in srgb, var(--card-a, var(--red-a)) 52%, var(--card-b, var(--blue-b)));
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), 0 10px 22px rgba(32, 54, 104, 0.1);
}

body:not(.is-game):not(.is-challenge) .category-emoji svg {
  width: 38px;
  height: 38px;
  filter: none;
}

body:not(.is-game):not(.is-challenge) .category-emoji .custom-svg-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

body:not(.is-game):not(.is-challenge) .category-card strong {
  color: var(--ink);
  text-shadow: none;
}

body:not(.is-game):not(.is-challenge) .category-card > span:last-child {
  color: var(--muted);
}

body:not(.is-game):not(.is-challenge) .category-badge {
  z-index: 4;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 16px rgba(32, 54, 104, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

body:not(.is-game):not(.is-challenge) .categories-titlebar {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto 26px;
  padding: 4px 12px 14px;
  text-align: center;
}

body:not(.is-game):not(.is-challenge) .categories-titlebar h1,
body:not(.is-game):not(.is-challenge) .categories-titlebar h2 {
  position: relative;
  max-width: 15ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 8vw, 40px);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 7px 22px rgba(91, 0, 184, 0.12);
}

body:not(.is-game):not(.is-challenge) .categories-titlebar h1::after,
body:not(.is-game):not(.is-challenge) .categories-titlebar h2::after {
  content: "";
  position: absolute;
  right: 50%;
  bottom: -10px;
  width: 72px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue-a), var(--premium-b), var(--red-a));
  box-shadow: 0 4px 12px rgba(91, 0, 184, 0.18);
  transform: translateX(50%);
}

body:not(.is-game):not(.is-challenge) .categories-titlebar p {
  max-width: 42ch;
  margin: 6px auto 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.8;
  text-align: center;
  text-wrap: balance;
}

body:not(.is-game):not(.is-challenge) #homeScreen .guide-copy,
body:not(.is-game):not(.is-challenge) #homeScreen .daily-panel > h2,
body:not(.is-game):not(.is-challenge) #homeScreen .daily-panel > p {
  text-align: center;
}

body:not(.is-game):not(.is-challenge) #homeScreen .guide-copy p {
  max-width: 46ch;
  margin-inline: auto;
}

body:not(.is-game):not(.is-challenge) #homeScreen .daily-panel > h2 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 25px;
  font-weight: 900;
}

body:not(.is-game):not(.is-challenge) #homeScreen .section-heading h2,
body:not(.is-game):not(.is-challenge) #homeScreen .daily-panel > h2 {
  margin-top: 0;
  line-height: 1.35;
}

body:not(.is-game):not(.is-challenge) #homeScreen .section-heading h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

/* Mobile pages reserve the navbar, its floating offset, and the gesture safe area. */
body:not(.is-game):not(.is-challenge) {
  --nav-safe-space: calc(72px + max(10px, env(safe-area-inset-bottom)) + 32px);
  scroll-padding-bottom: var(--nav-safe-space);
}

body:not(.is-game):not(.is-challenge) .page-surface {
  min-height: 100dvh;
  padding-bottom: var(--nav-safe-space);
}

body:not(.is-game):not(.is-challenge) .screen.active > :last-child {
  scroll-margin-bottom: var(--nav-safe-space);
}

/* The primary action arrives before supporting copy on small screens. */
body:not(.is-game):not(.is-challenge) #homeScreen .categories-header {
  margin-bottom: 16px;
}

body:not(.is-game):not(.is-challenge) #homeScreen .categories-titlebar {
  gap: 9px;
  margin-bottom: 14px;
  padding-bottom: 12px;
}

body:not(.is-game):not(.is-challenge) #homeScreen .categories-titlebar h1 {
  max-width: 13ch;
  font-size: clamp(30px, 8vw, 38px);
  line-height: 1.3;
}

body:not(.is-game):not(.is-challenge) #homeScreen .game-mode-teaser {
  gap: 9px;
  margin-top: 0;
}

body:not(.is-game):not(.is-challenge) #homeScreen .game-mode-teaser button {
  min-height: 76px;
  gap: 3px;
  padding: 13px 16px;
  border-radius: 22px;
}

body:not(.is-game):not(.is-challenge) #homeScreen .game-mode-teaser button:first-child {
  min-height: 88px;
}

body:not(.is-game):not(.is-challenge) #homeScreen .game-mode-teaser span {
  font-size: 20px;
}

body:not(.is-game):not(.is-challenge) #homeScreen .game-mode-teaser strong {
  max-width: 100%;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.65;
}

body:not(.is-game):not(.is-challenge) #homeScreen .guide-copy {
  gap: 6px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body:not(.is-game):not(.is-challenge) #homeScreen .guide-copy p {
  color: #50536b;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.75;
}

/* Keep user names on one stable line and pan only when measurement proves overflow. */
body:not(.is-game):not(.is-challenge) .leaderboard-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  contain: inline-size;
}

body:not(.is-game):not(.is-challenge) .leaderboard-name > span {
  display: block;
  width: max-content;
  min-width: 100%;
  white-space: nowrap;
  transform: translate3d(0, 0, 0);
}

body:not(.is-game):not(.is-challenge) .leaderboard-name.is-overflowing > span {
  animation: leaderboardNamePan 6.4s 700ms ease-in-out infinite alternate;
}

body:not(.is-game):not(.is-challenge) .podium-card .leaderboard-name {
  width: 100%;
  font-size: 13px;
}

/* Readable secondary copy while retaining the product palette. */
body:not(.is-game):not(.is-challenge) .categories-titlebar p,
body:not(.is-game):not(.is-challenge) .profile-section-title + *,
body:not(.is-game):not(.is-challenge) .leaderboard-table-head {
  color: #62657a;
}

body:not(.is-game):not(.is-challenge) .profile-section-title {
  font-size: 20px;
  font-weight: 800;
}

.sponsor-gate[hidden] {
  display: none !important;
}

.sponsor-gate[aria-hidden="true"] {
  visibility: hidden;
  pointer-events: none;
}

.sponsor-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

@media (min-width: 760px) {
  body:not(.is-game):not(.is-challenge) nav.bottom-nav {
    right: auto;
    left: 50%;
    width: min(406px, calc(100% - 24px));
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.is-game):not(.is-challenge) nav.bottom-nav .nav-active-indicator {
    transition-duration: 1ms;
  }

  body:not(.is-game):not(.is-challenge) .category-card::before {
    animation: none;
  }

  body:not(.is-game):not(.is-challenge) .leaderboard-name.is-overflowing > span {
    animation: none;
    text-overflow: ellipsis;
  }
}
