:root {
  --interval: 6000ms;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Bricolage Grotesque",system-ui,-apple-system,"Segoe UI",sans-serif;
}

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

html, body { margin: 0; min-height: 100%; }

:root { --footer-h: calc(48px + env(safe-area-inset-bottom)); }

body {
  background: #0e1a26;
  color: #fff;
  font: 16px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  padding-bottom: var(--footer-h);
}

:where(a, button):focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */

.bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
}

.favs,
.bar.is-scrolled {
  background: rgba(14, 26, 38, .82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: .01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.share,
.install {
  min-height: 32px;
  padding: 0 1rem;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 999px;
  background: rgba(0, 0, 0, .25);
  color: #fff;
  font: 600 .9375rem/1 var(--sans);
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.6rem;
  width:auto;
}
.install[hidden] { display: none; }
.share[hidden] span { display: none; }
.share:hover,
.install:hover { background: rgba(255, 255, 255, .16); }

.share svg{width:1.2rem;height:1.2rem;stroke:currentColor;fill:none;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}

/* ---------- Carousel ---------- */

.carousel {
  position: relative;
  height: 62vh;
  height: max(62svh, 28rem);
  overflow: hidden;
  background: #0e1a26;
}

.viewport {
  position: absolute;
  inset: 0;
  touch-action: pan-y;
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .7s ease, visibility 0s linear .7s;
}

.slide.is-active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.slide__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 50%;
  opacity: .25;
}

/* Keeps text readable over the art: from the bottom on phones, from the left on wide screens. */
.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 38%, transparent 70%);
  pointer-events: none;
}

.slide__copy {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding: 5rem max(24px, env(safe-area-inset-right)) calc(88px + env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.slide__name {
  margin: 0 0 .75rem;
  font: 700 clamp(2.75rem, 11vw, 6.25rem)/.95 var(--sans);
  letter-spacing: -.02em;
  text-wrap: balance;
}

.slide__tagline {
  margin: 0 0 .5rem;
  max-width: 24ch;
  font-size: clamp(1.25rem, 3.6vw, 1.75rem);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

.slide__text {
  margin: 0 0 1.75rem;
  max-width: 38ch;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, .85);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  min-height: 52px;
  padding: 0 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #10202e;
  font-weight: 700;
  font-size: 1.0625rem;
  text-decoration: none;
}
.cta:hover { filter: brightness(1.08); }
.cta svg { flex: none; }

/* ---------- Arrows ---------- */

.arrow {
  position: absolute;
  z-index: 3;
  bottom: calc(26px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: rgba(0, 0, 0, .3);
  color: #fff;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.arrow:hover { background: rgba(255, 255, 255, .22); }
.arrow.prev { left: max(16px, env(safe-area-inset-left)); }
.arrow.next { right: max(16px, env(safe-area-inset-right)); }

/* ---------- Dots ---------- */

.dots {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  height: 48px;
}

.dot {
  position: relative;
  flex: none;
  width: 18px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: width .3s ease;
}

.dot::before,
.dot::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 10px;
  margin-top: -5px;
  border-radius: 5px;
}
.dot::before { background: rgba(255, 255, 255, .45); }
.dot::after  { background: #fff; opacity: 0; transform-origin: left center; }
.dot:hover::before { background: rgba(255, 255, 255, .75); }

.dot[aria-current="true"] { width: 44px; }
.dot[aria-current="true"]::after { opacity: 1; }

/* While autoplay is running, the active dot fills to show time until the next slide. */
.dots.auto .dot[aria-current="true"]::after {
  animation: fill var(--interval) linear forwards;
}

@keyframes fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---------- Wide screens ---------- */

@media (min-width: 900px) {
  .slide { align-items: center; }

  .slide::after {
    background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 85%, transparent) 38%, transparent 68%);
  }

  .slide__copy { padding-top: 6rem; padding-bottom: 6rem; }

  .arrow {
    top: 50%;
    bottom: auto;
    width: 56px;
    height: 56px;
    margin-top: -28px;
  }
  .arrow.prev { left: 24px; }
  .arrow.next { right: 24px; }

  /* Keep the copy clear of the arrows */
  .slide__copy { padding-left: 6rem; padding-right: 6rem; }
}

.arrow[hidden], .dot[hidden], .dots[hidden] { display: none !important; }

/* ---------- Favorites (links floating over the top of the hero, under the header) ---------- */

.favs {
  position: absolute;
  top: calc(max(14px, env(safe-area-inset-top)) + 38px);
  left: 0; right: 0;
  z-index: 4;
  pointer-events: none;
  padding: 8px 0;
}
.favs[hidden] { display: none; }

.favs__list {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}
.favs__list::-webkit-scrollbar { display: none; }

.fav {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #fff;
  font: 600 .9375rem/1 var(--sans);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .65);
  white-space: nowrap;
}
.fav svg { color: #ffcf4a; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.fav:hover { text-decoration-thickness: 2px; }

/* ---------- Page layout (side ads on wide screens) ---------- */

.page > .mosaic { min-width: 0; }
.rail { display: none; }

@media (min-width: 1100px) {
  .page {
    display: grid;
    grid-template-columns: 192px minmax(0, 1fr) 192px;
  }
  .rail {
    display: block;
    padding: 12px;
  }
  .rail__inner {
    position: sticky;
    top: 72px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
}

/* ---------- Ads (promos for other apps) ---------- */

.ad {
  position: relative;
  display: flex;
  align-items: flex-end;
  flex: none;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg);
  color: #fff;
  text-decoration: none;
  isolation: isolate;
}

.ad__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .5;
}

.ad::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 60%, transparent) 50%, transparent 90%);
}

.ad__label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px 7px;
  background: rgba(0, 0, 0, .6);
  font: 600 .6875rem/1.4 var(--sans);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ad__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
  width: 100%;
  padding: .875rem;
  border-left: 4px solid var(--accent);
  margin-bottom: .75rem;
}

.ad__text { display: block; min-width: 0; }
.ad__name { display: block; font: 700 1.125rem/1.15 var(--sans); }
.ad__tagline { display: block; margin-top: .15rem; font-size: .8125rem; line-height: 1.35; color: rgba(255, 255, 255, .85); }

.ad__cta {
  display: inline-block;
  padding: .45rem .9rem;
  border-radius: 999px;
  background: var(--accent);
  color: #10202e;
  font: 700 .875rem/1.2 var(--sans);
  white-space: nowrap;
}
.ad:hover .ad__cta { filter: brightness(1.08); }

/* Wide strip shown under an open app on narrow screens */
.ad--bar {
  align-items: center;
  aspect-ratio: auto;
  min-height: 72px;
  border-bottom: 3px solid var(--accent);
}
.ad--bar::after {
  background: linear-gradient(90deg, var(--bg) 35%, color-mix(in srgb, var(--bg) 60%, transparent) 100%);
}
.ad--bar .ad__label { left: auto; right: 0; }
.ad--bar .ad__copy {
  flex-direction: row;
  align-items: center;
  gap: .75rem;
  margin: 0;
  padding: .75rem 1rem;
  border-left: 0;
}
.ad--bar .ad__text { flex: 1; }
.ad--bar .ad__name { font-size: 1rem; }
.ad--bar .ad__tagline {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile:focus-visible,
.ad:focus-visible { outline-offset: -6px; }

/* ---------- Mosaic ---------- */

.mosaic { padding-bottom: env(safe-area-inset-bottom); }

/* The search box is a grid cell, like the old heading: half width, centered in the two rows above the first left tile, so the tiles stagger. */
.search {
  position: relative;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 0 .5rem 0 max(16px, env(safe-area-inset-left));
}

.search__icon {
  position: absolute;
  left: calc(max(16px, env(safe-area-inset-left)) + 14px);
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, .7);
  pointer-events: none;
}

.search__input {
  width: 100%;
  padding: .55rem .75rem .55rem 2.9rem;
  font: 600 1rem/1.2 var(--sans); /* 16px+ stops iOS zooming on focus */
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 2px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
}
.search__input::placeholder { color: rgba(255, 255, 255, .6); }
.search__input:focus { outline: none; border-color: #fff; background: rgba(255, 255, 255, .16); }
.search__input::-webkit-search-cancel-button { filter: invert(1); cursor: pointer; }

.mosaic__empty {
  margin: 0;
  padding: 1.5rem max(16px, env(safe-area-inset-right)) 2rem max(16px, env(safe-area-inset-left));
  color: rgba(255, 255, 255, .8);
  text-align: center;
}

/* Two columns, no gaps. Tile heights alternate tall and short, and the first tile on the right
   is short, so the columns are staggered all the way down the page. */
.mosaic__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: clamp(2.25rem, 6.5vw, 3.75rem);
  grid-auto-flow: row dense;
  gap: 0;
}

.tile {
  position: relative;
  display: flex;
  align-items: flex-end;
  grid-row: span 4;
  overflow: hidden;
  border-radius: 0;
  background: var(--bg);
  color: #fff;
  text-decoration: none;
  isolation: isolate;
}

.tile[hidden] { display: none; }

.tile__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .5;
  transition: transform .5s ease, opacity .3s ease;
}
.tile:hover .tile__img { transform: scale(1.05); opacity: .65; }

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 60%, transparent) 45%, transparent 80%);
}

.tile__copy {
  padding: 1rem;
  border-left: 4px solid var(--accent);
  margin: 0 0 .9rem;
}

.tile__name {
  margin: 0 0 .15rem;
  font: 700 clamp(1.125rem, 4.5vw, 1.75rem)/1.1 var(--sans);
  text-wrap: balance;
}

.tile__tagline {
  margin: 0;
  font-size: .875rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, .85);
}

@media (min-width: 900px) {
  .tile__copy { padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
  .tile__tagline { font-size: 1rem; }
}

/* ---------- Footer ---------- */

.footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--footer-h);
  padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
  background: rgba(14, 26, 38, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: .875rem;
}
.footer[hidden] { display: none; }
.footer__full { display: none; }
@media (min-width: 640px) { .footer__full { display: inline; } }
@media (max-width: 639px) { .footer { font-size: .8125rem; gap: .75rem; } }
.footer small { font-size: inherit; color: rgba(255, 255, 255, .75); }
.footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer a:hover { text-decoration-thickness: 2px; }

/* ---------- App viewer ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  color: #fff;
}
.viewer[hidden] { display: none; }

/* Large screens keep the footer visible under the open app. */
@media (min-width: 1100px) {
  .viewer { bottom: var(--footer-h); }
}

/* No page scrolling while an app is open: only the app itself may scroll. */
html.viewer-open,
html.viewer-open body { overflow: hidden; }
.viewer { overflow: hidden; overscroll-behavior: none; }
.viewer__bar,
.viewer__rail,
.viewer__adbar { touch-action: none; }

.viewer__bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 3px solid var(--accent);
}

.viewer__close {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex: none;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  background: rgba(0, 0, 0, .25);
  color: #fff;
  font: 600 .9375rem/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  padding: 0 .625rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.viewer__close span { padding-right: .25rem; }
.viewer__close:hover {
  background: rgba(255, 255, 255, .18);
}

.viewer__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 1.25rem/1.5 var(--sans);
}

.viewer__fav {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
.viewer__fav:hover { opacity: .8; }
.viewer__fav.is-on { color: #ffcf4a; }

.viewer__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.viewer__stage {
  position: relative;
  min-height: 0;
  min-width: 0;
}

/* Side ads (wide screens) and the ad under the app (narrow screens) */
.viewer__rail { display: none; }
.viewer__adbar { flex: none; }

@media (min-width: 1100px) {
  .viewer__body { grid-template-columns: 192px minmax(0, 1fr) 192px; }
  .viewer__rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    overflow: hidden;
  }
  .viewer__adbar { display: none; }
}

@media (max-height: 480px) {
  .viewer__adbar { display: none; }
}

/* Short desktop windows: one ad per side, so the side columns never need to scroll. */
@media (max-height: 640px) {
  .viewer__rail > .ad:nth-child(n + 2) { display: none; }
}

.viewer__loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: rgba(255, 255, 255, .85);
  font-size: 1.0625rem;
}
.viewer.is-loaded .viewer__loading { display: none; }

/* Transparent until the app has loaded, so the loading message shows. */
.viewer__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}
.viewer.is-loaded .viewer__frame { background: #fff; }

@media (max-width: 480px) {
  .viewer__close span { display: none; }
}

/* ---------- Misc ---------- */

.nojs {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 2rem;
  background: #0e1a26;
  text-align: center;
  z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .slide { transition: none; }
  .tile, .tile__img { transition: none; }
  .dot { transition: none; }
  .dots.auto .dot[aria-current="true"]::after { animation: none; }
}