/* Base reset + foundational element styles. No component classes here —
   those live in components.css. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* The page itself never scrolls — only .app-main does (see #app below).
     This is the actual fix for the bottom bar/price dock "jumping" or
     sliding under content inside Telegram's in-app WebView: position:fixed
     combined with page-level document scroll is a well-known source of
     jitter in mobile WebViews (especially Telegram's Android client) —
     confining all scrolling to one internal container removes that
     class of bug entirely, rather than trying to patch around it. */
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font: var(--text-body-md);
  color: var(--c-on-surface);
  background: var(--c-background);
  -webkit-tap-highlight-color: transparent;
  height: 100vh;
  height: 100dvh;
}

/* Author styles like `.price-dock { display:flex }` would otherwise beat the
   browser's built-in [hidden] rule, so `el.hidden = true` silently did
   nothing. */
[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Root app shell: full-bleed, edge-to-edge (no centered/capped column —
   see --app-max-width in tokens.css). Fixed height, own scrollbar hidden
   here — .app-main (components.css) is the only element that actually
   scrolls, which is what keeps the fixed header/tab-bar/price-dock/action-dock
   rock-solid instead of jittering. */
#app {
  width: 100%;
  max-width: var(--app-max-width);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--c-bg-gradient);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  /* `hidden` still lets scrollIntoView()/focus shove #app sideways (the
     decorative glows below poke outside it, giving it ~100px of hidden
     horizontal scroll -> the whole UI shifts left after tapping a gift or
     focusing the username field). `clip` forbids any scrolling. */
  overflow: clip;
}

/* Soft ambient "liquid glass" glows behind the content — purely
   decorative, matches the reference design's blurred color blooms. */
/* Drawn as soft radial gradients rather than `filter: blur(48px)` circles:
   same look, but no full-screen blur pass for the WebView to redo on every
   frame (this was one of the heavier things on lower-end phones). */
#app::before,
#app::after {
  content: "";
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
}
#app::before {
  top: -144px;
  inset-inline-end: -144px;
  width: 384px;
  height: 384px;
  background: radial-gradient(circle closest-side, rgba(125, 211, 252, 0.38) 0%, rgba(125, 211, 252, 0.16) 55%, rgba(125, 211, 252, 0) 100%);
}
#app::after {
  bottom: 40px;
  inset-inline-start: -176px;
  width: 432px;
  height: 432px;
  background: radial-gradient(circle closest-side, rgba(165, 180, 252, 0.28) 0%, rgba(165, 180, 252, 0.12) 55%, rgba(165, 180, 252, 0) 100%);
}
#app > * {
  position: relative;
  z-index: 1;
}

/* Router mount point. Needs to be a flex column that actually fills the
   remaining height under #app, or .app-main's "flex:1; min-height:0;
   overflow-y:auto" (components.css) has no bounded parent to size against
   — it just grows to fit its content instead of scrolling, and anything
   past the bottom of the viewport gets silently clipped by #app's own
   overflow:hidden. This is the fix for "can't scroll to see the rest of
   the page" (e.g. the gifts grid). */
#screen-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Utility: visually-hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
