.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--app-max-width);
  margin-inline: auto;
  background: var(--bg);
  /*
   * Second line of defence behind base.css's html/body rule: iOS has a long
   * history of ignoring a root-level overflow-x for touch panning, so the
   * shell clips its own children too. `clip` makes no scroll container, so
   * the sticky nav still sticks to the viewport and the fixed pages are
   * untouched (a fixed box's containing block is the viewport, not this).
   */
  overflow-x: clip;
}

/* Only wider than the shell itself — i.e. a desktop tab. In Telegram the app
   is full-bleed and the frame never shows. */
@media (min-width: 500px) {
  .app {
    box-shadow: 0 0 0 1px var(--border), 0 calc(24px * var(--scale)) calc(64px * var(--scale)) calc(-32px * var(--scale)) rgb(var(--shadow-rgb) / 0.25);
  }
}

.app__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-5);
}

/*
 * One pane per bottom-nav tab (app.js, TabPanes.js). Each is a flex column so
 * the home pane's .app__main keeps its flex: 1 through the wrapper; `hidden`
 * has to be spelled out because the class's display beats the UA's [hidden].
 */
.tab-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition:
    opacity var(--duration) var(--easing),
    transform var(--duration) var(--easing);
}

.tab-pane[hidden] {
  display: none;
}

/*
 * The top inset, for the panes that do not clear it themselves. Inside the
 * Telegram header (or a browser tab) --safe-top is 0 and these are the
 * screens' own top paddings, unchanged; in Telegram's fullscreen mode and as
 * a home-screen app the status bar and Telegram's floating controls overlay
 * the top of the page, and the first card would sit under them. The fixed
 * pages (fixture, club, account…) already pad by it at their own roots, and
 * the Catch-Up room's bar clears it itself (catch-up.css), so only the home
 * header and the two `.slip` shells (Quick Slip, SureTOOLS) are named here.
 */
.tab-pane > .header {
  padding-top: calc(var(--space-4) + var(--safe-top));
}

.tab-pane > .slip {
  padding-top: calc(var(--space-3) + var(--safe-top));
}

/*
 * The switch between panes (TabPanes.js), a fade-through. The pane leaving
 * fades on the press timing — going down is quick and linear, INTERACTIONS.md's
 * own rule — and the one arriving rises 8px through its fade on the ordinary
 * `--duration`: a shorter climb than the fixture page's 12px entrance, since
 * this is a sibling taking the same ground rather than a page opening on
 * top. `--easing` for both, not `--spring`: the pane is appearing, not
 * being thrown, and nothing here has a reason to overshoot.
 *
 * No transform at rest, on purpose. A transformed ancestor becomes the
 * containing block for anything `position: fixed` inside it, and the slip
 * and tools panes both float their toasts that way — so the rest state has
 * to be `transform: none`, and the rise is only ever the enter state's.
 */
.tab-pane[data-state="leave"] {
  opacity: 0;
  transition-duration: var(--duration-press);
}

.tab-pane[data-state="enter"] {
  opacity: 0;
  transform: translateY(calc(8px * var(--scale)));
}

/*
 * Sticky rather than fixed: the bar reserves its own space at the end of the
 * column, so the last match row is never trapped underneath it at full scroll.
 * The gutters around the floating bar pass clicks through to the list.
 */
.app__nav {
  position: sticky;
  bottom: 0;
  z-index: 10;
  /*
   * Clear whichever bottom obstruction is larger: the device safe area, or
   * the slice of the window Telegram's own chrome is currently covering
   * (--tg-chrome-inset, kept in sync from viewportStableHeight).
   */
  padding: var(--space-2) var(--space-3)
    calc(var(--space-5) + max(var(--safe-bottom), var(--tg-chrome-inset, 0px)));
  pointer-events: none;
}

/*
 * A screen, not a message — INTERACTIONS.md's own words: an icon, one sentence
 * and one clear next action. The column layout holds for the bare one-line form
 * too (app.js's fixtures-failed state is a plain <p> wearing this class), since
 * a lone text node becomes an anonymous flex item and centres like the rest.
 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* White disc lifted off the page by its hairline and shadow — the same card
   treatment every other surface gets, at the size an empty screen can carry. */
.empty-state__icon {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-card);
  color: var(--text-muted);
}

/* Wrapped well before the shell's width: a single sentence set to the full
   column reads as a paragraph rather than as a caption. */
.empty-state__message {
  max-width: 30ch;
}

/*
 * A refusal's way out (`UnlockButton`, PanelStatus.js) under a one-line note
 * that is not an `.empty-state` — the fixture tabs' "Sign in to see…" lines.
 * Its own line, centred, one step below the words: the gap `.empty-state`
 * leaves above its own action. Two classes, because `.btn` (primitives.css,
 * loaded later) sets `inline-flex` and would otherwise sit the button at the
 * end of the sentence.
 */
.btn.unlock-button {
  display: flex;
  width: fit-content;
  margin: var(--space-3) auto 0;
}

/*
 * Boot skeleton — the home screen in grey, index.html's first paint, up until
 * app.js has built the real screen and `mount` replaces it. The markup wears
 * the real screen's own containers (the app bar, the story strip, the date
 * strip, league cards and match rows, the nav), so all that is set here is
 * what those leave to their contents: the size of each grey mark standing in
 * for a glyph, a crest or an avatar. The lines of words are `.skeleton--line`s
 * inside the real text elements (interactions.css) and take their height
 * from them. The pulse, and its stop under reduced motion, is `.skeleton`'s.
 */

/* Nothing in it answers a tap: a match row greying under a finger would
   promise a page that is not there yet. */
.boot-skeleton {
  pointer-events: none;
}

/* The story strip runs off the screen's edge as the real one does, but has
   nothing to scroll to. Its circles sit on the page ground rather than in a
   card, where the pulse's grey all but vanishes, so they are drawn as the
   real ones are (category-bar.css): white avatars on a hairline, after the
   "+" circle's dashed outline. */
.boot-skeleton__strip {
  overflow: hidden;
}

.boot-skeleton__strip .skeleton {
  background: var(--surface);
  border: 1px solid var(--border);
}

.boot-skeleton__strip .category--action .skeleton {
  background: transparent;
  border: 1px dashed var(--border-strong);
}

/* The nav's columns are floored in JS off its widest label (sizeIndicator in
   BottomNav.js: the label plus COLUMN_AIR). With no label to measure, the
   floor is written out — "SureTOOLS" in semibold is 5.68em at the label's
   size — so the bar is as wide as the real one that replaces it. */
.boot-skeleton__nav .bottom-nav__bar {
  --nav-column-min: calc(var(--text-3xs) * 5.68 + 14px * var(--scale));
}

/* An icon's glyph: the nav's four, and the app bar's two, centred in the
   34px chip the bar gives its controls (app-bar.css). */
.boot-skeleton__glyph {
  width: var(--icon-xl);
  height: var(--icon-xl);
}

.app-bar .boot-skeleton__glyph {
  --chip: calc(34px * var(--scale));
  margin: calc((var(--chip) - var(--icon-xl)) / 2);
}

/* A crest or a face at the real one's size (MARK in sizes.js): a league's
   crest and the account bubble's avatar by default, a team's crest in a
   match row, a story circle's avatar. */
.boot-skeleton__mark {
  flex: none;
  width: var(--mark-lg);
  height: var(--mark-lg);
}

.boot-skeleton__mark--sm {
  width: var(--mark-sm);
  height: var(--mark-sm);
}

.boot-skeleton__mark--xl {
  width: var(--mark-xl);
  height: var(--mark-xl);
}
