:root {
  /* Global motion tokens shared across pages/components. */
  --motion-fast: 180ms;
  --motion-base: 260ms;
  --motion-slow: 420ms;
  --motion-ease-enter: cubic-bezier(0.22, 0.61, 0.36, 1);
  --motion-ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Accessibility guard: keep motion minimal when reduced-motion is requested. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 1ms;
    --motion-base: 1ms;
    --motion-slow: 1ms;
  }
}

.root-shell {
  display: flex;
  min-height: 100vh;
  justify-content: center;
}

.page {
  flex: 1;
  padding: 0 16px calc(100px + env(safe-area-inset-bottom));
  min-height: 100vh;
  width: 100%;
  max-width: 560px;
  position: relative;
  z-index: 1;
}

.section {
  display: none;
  padding-bottom: 60px;
}

.section.active {
  display: block;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 9;
  padding: 8px 0;
  background: transparent;
}

.top-bar .title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 22px;
}

.top-bar .burger {
  background: transparent;
  color: var(--text-primary);
  border: none;
  padding: 8px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.top-bar .burger-icon {
  width: 24px;
  height: 24px;
  stroke: #f5f5f5;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer.tap-bar.bottom-bar {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  background: transparent;
  z-index: 8;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
  border-top: none;
  box-shadow: none;
  padding: 0 14px calc(12px + env(safe-area-inset-bottom));
}

.footer.tap-bar.bottom-bar.hidden {
  transform: translateY(120%);
}

.footer.tap-bar.bottom-bar.menu-open {
  transform: translateY(140%);
  pointer-events: none;
}

body.tg-webapp .page {
  padding-top: calc(var(--tg-top-inset, 0px) + 8px);
}

body.tg-webapp .top-bar {
  padding-top: calc(8px + var(--tg-top-inset, 0px));
}

.footer.tap-bar.bottom-bar .footer-buttons {
  position: relative;
  width: fit-content;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 auto;
  background: #191b23;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.footer-active-pill {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--footer-pill-w, 0px);
  height: var(--footer-pill-h, 0px);
  transform: translate3d(var(--footer-pill-x, 0px), var(--footer-pill-y, 0px), 0)
    scale(var(--footer-pill-scale, 1));
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  opacity: 0;
  transform-origin: center;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    width 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    height 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 0.25s ease;
  pointer-events: none;
}

.footer-buttons:not(.pill-ready) .footer-active-pill {
  transition: none;
  opacity: 0;
  --footer-pill-scale: 0.92;
}

.footer-buttons.has-pill .footer-active-pill {
  opacity: 1;
  --footer-pill-scale: 1;
}

.footer.tap-bar.bottom-bar .footer-nav {
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
  min-height: 52px;
  color: #9aa1b2;
  text-decoration: none;
  border: none;
  background: transparent;
  border-radius: 16px;
  padding: 12px 16px;
  position: relative;
  z-index: 1;
  transition: color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    gap 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.2s ease;
}

.footer.tap-bar.bottom-bar .footer-nav:hover {
  color: #d6d7dc; /* only color change on hover */
}

.footer.tap-bar.bottom-bar .footer-nav.active {
  color: #ffffff;
  gap: 8px;
}

.footer.tap-bar.bottom-bar .footer-nav:active {
  transform: scale(0.97);
}

.footer-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.footer-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.footer-nav svg path {
  fill: currentColor;
}

#footer-shop .footer-icon--static svg path {
  fill: none;
  stroke: currentColor;
}

.footer-icon--active {
  display: none;
}

.footer-nav.active .footer-icon--static {
  display: none;
}

.footer-nav.active .footer-icon--active {
  display: inline-flex;
}

.footer.tap-bar.bottom-bar .footer-text {
  font-size: 12px;
  line-height: 14px;
  font-weight: 600;
  color: currentColor;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    max-width 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.footer.tap-bar.bottom-bar .footer-nav.active .footer-text {
  max-width: var(--footer-text-width, 0px);
  opacity: 1;
  transform: translateX(0);
}
