:root {
  --yellow-100: #fffceb;
  --yellow-150: #e4e1cb;
  --grey-150: #898989;
  --grey-200: #505050;
  --grey-300: #262626;
  --footer-text: #c0bdab;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --strip-gradient: linear-gradient(179.28deg, #c8c0ff 0%, #fcc7d9 12.893%, #ffec82 23.411%, #fffceb 60.267%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  /* no rubber-band bounce at the end: extra scrolling drives the mockup reel */
  overscroll-behavior-y: none;
}

body {
  background: var(--yellow-100);
  color: var(--grey-300);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Page: pinned to the screen; scrolling drives the mockup shrink ---------- */

/* Gives the page its scroll length; the script sets --scroll-distance */
.scroller {
  height: calc(100vh + var(--scroll-distance, 0px));
  height: calc(100dvh + var(--scroll-distance, 0px));
}

/* Shrink switched off (script): a normal scrolling page */
.no-shrink .scroller { height: auto; }
.no-shrink .page {
  position: relative;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 32px; /* room for the fixed marquee */
}
/* Decorations stay laid out over the first screen */
.no-shrink .decor { bottom: auto; height: 100vh; height: 100svh; }

/* Sticky isolates the page, so it carries the cream itself for the
   background gradient's lighten blend */
.page {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--yellow-100);
}

.bg-grain,
.bg-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg-grain {
  background-image: url("assets/bg-grain.png");
  background-size: 8px 8px;
  /* keep the 2px dots crisp on retina screens instead of smoothed into blobs */
  image-rendering: pixelated;
  opacity: 0.5;
}

.bg-gradient {
  mix-blend-mode: lighten;
  background-image: linear-gradient(171.49deg, #c8c0ff 0%, #fcc7d9 16.903%, #ffec82 27.477%, #fffceb 57.111%);
}

/* Decorations sit above the content (pointer-events off so nothing is blocked).
   Each one is centred at its Figma spot as a % of the screen, then clamped so
   it never runs off an edge. --s shrinks them on smaller screens. */
.decor {
  --s: 1;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.decor img {
  --half: calc(var(--w) * var(--s) / 2);
  position: absolute;
  left: clamp(calc(var(--half) + 4px), var(--x), calc(100% - var(--half) - 4px));
  top: clamp(calc(var(--half) + 4px), var(--y), calc(100% - var(--half) - 4px));
  width: calc(var(--w) * var(--s));
  height: auto;
  transform: translate(-50%, -50%);
}

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

.header {
  position: fixed;
  top: 24px;
  left: 24px;
  right: 25px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* The app's logo (v1.5 assets/brand/logo.png); the sparkle sits above its 48px box */
.logo {
  display: block;
  width: 133px;
  height: auto;
  margin-top: -8.39px;
}

.contact {
  display: flex;
  gap: 8px;
  margin-top: 1px;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 28px;
  padding: 10px;
  background: var(--yellow-100);
  border: 1.4px solid #000;
  border-radius: 28px;
  box-shadow: 0 1px 0 #000;
  font-size: 13px;
  line-height: 17px;
  font-weight: 500;
  color: #000;
  white-space: nowrap;
}

.pill:hover { background: #fff; }

.pill img { display: block; flex: none; }
.pill-email { width: 100px; }
.pill-x { width: 32px; }

/* ---------- Content ---------- */

.content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
}

/* Spacing from Figma */
.space { flex: none; width: 100%; }
.space-top { height: 110px; }
.space-mid { height: 88px; }
/* Height set by the script so that, scrolled to the end, the iPhone sits
   centred between the top of the screen and the marquee */
.space-bottom { height: 0; }

.hero {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 701px;
}

.title {
  margin: 0;
  font-size: 80px;
  line-height: 95px;
  font-weight: 700;
  color: #000;
  text-align: center;
  white-space: nowrap;
}

.headline {
  margin: -4px 0 0; /* 20px under the heading (hero gap is 24) */
  max-width: 700px;
  font-size: 28px;
  line-height: 36px;
  font-weight: 500;
  text-align: center;
  color: var(--grey-300);
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
}

.store {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  box-shadow: 0 1px 0 #000;
  font-family: var(--font);
  font-size: 16px;
  line-height: 9px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.store img { display: block; flex: none; }

.store-apple {
  background: #000;
  border: 2px solid #000;
  color: var(--yellow-100);
}

/* The icon's outline runs just past its 18×20 box */
.playstore-icon {
  position: relative;
  flex: none;
  width: 18px;
  height: 20px;
}

.playstore-icon img {
  position: absolute;
  left: -0.53px;
  top: -0.5px;
}

.store-google {
  background: #fff;
  border: 2px solid var(--grey-300);
  color: #000;
}


/* ---------- Phones ---------- */

/* Figma: iPhone 17 Pro 360×761 in the middle, 290×630 mockups either side
   (all 20px apart). The row is wider than the screen, so the
   outer mockups run off both edges. --k scales the whole row. */
.phones {
  --k: 1;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --shrink is set from the scroll position (script): 1 at the top of the page,
   smaller by the bottom so all five screens come into view. Anchored at the
   top so the gap under the buttons holds; a matching negative margin lets
   the copyright follow the phone up. */
.phones-row {
  position: relative;
  touch-action: pan-y; /* the page keeps vertical scrolling; sideways swipes drive the row */
  height: calc(630.09px * var(--k));
  width: 100%;
  transform: scale(var(--shrink, 1));
  transform-origin: top center;
  will-change: transform;
}

.mock {
  display: block;
  flex: none;
  width: calc(290px * var(--k));
  height: calc(630.09px * var(--k));
  object-fit: cover;
  border: calc(2px * var(--k)) solid #000;
  border-radius: calc(29.84px * var(--k));
  background: #fff;
}

/* Mock holding a real screenshot: image fills it, island on top */
.mock-shot {
  position: relative;
  overflow: hidden;
}

.mock-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The centre iPhone's island, scaled to the 290px-wide mock (×0.85) */
.mock-island {
  position: absolute;
  top: calc(8.2px * var(--k));
  left: 50%;
  width: calc(90.2px * var(--k));
  height: calc(26.5px * var(--k));
  transform: translateX(-50%);
  border-radius: 999px;
  background: #000;
}


/* The reel runs behind the iPhone; each screen is placed by the script
   (translateX from the centre), 290px wide every 310px */
.reel {
  position: absolute;
  inset: 0;
}

.reel .mock {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: calc(-145px * var(--k));
  will-change: transform;
}

.reel .mock[hidden] { display: none; }

.device {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  margin-left: calc(-180px * var(--k));
  width: calc(360px * var(--k));
  height: calc(760.75px * var(--k));
}

/* Thick black edge is an outside stroke (0–4.2px), then cream; the thin line
   is a 2px inside stroke on the screen's edge, drawn over the screen */
.device-body {
  position: absolute;
  inset: 0;
  background: var(--yellow-100);
  border: calc(4.245px * var(--k)) solid #000;
  border-radius: calc(46.585px * var(--k));
}

.device-line {
  position: absolute;
  z-index: 1;
  inset: calc(9.34px * var(--k));
  border: calc(2px * var(--k)) solid #000;
  border-radius: calc(37.245px * var(--k));
  pointer-events: none;
}

.device-screen {
  position: absolute;
  inset: calc(9.34px * var(--k));
  overflow: hidden;
  border-radius: calc(37.245px * var(--k));
}

.device-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.device-island {
  position: absolute;
  left: calc(121.84px * var(--k));
  top: calc(18.96px * var(--k));
  width: calc(106.13px * var(--k));
  height: calc(31.13px * var(--k));
  border-radius: calc(37.36px * var(--k));
  background: #000;
}

/* ---------- Copyright (under the phone, where "Only available on iOS" was) ---------- */

.copyright {
  margin: 16px 0 0;
  padding: 0 16px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  color: #635817;
  opacity: 0.4;
  text-align: center;
}

/* Hidden on screen, still read by screen readers and search engines */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Marquee ---------- */

/* Fixed to the bottom of the screen. Being fixed isolates it from the page,
   so it carries the page's cream itself for the gradient to lighten against. */
.marquee {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 32px;
  background-color: var(--yellow-100);
  border-top: 1px solid #000;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.marquee::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--strip-gradient);
  mix-blend-mode: lighten;
  pointer-events: none;
}

.marquee-track {
  position: relative;
  display: flex;
  padding-left: 24px;
  will-change: transform;
}

.marquee-row {
  display: flex;
  flex: none;
  align-items: center;
  gap: 16px;
  padding-right: 16px;
}

.marquee-item {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: #000;
  text-transform: uppercase;
  white-space: nowrap;
}

.marquee-item img { display: block; flex: none; filter: brightness(0); } /* star in black */

/* ---------- Beta dialog ---------- */

.beta {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 2px solid #000;
  border-radius: 24px;
  background: var(--yellow-100);
  color: var(--grey-300);
  box-shadow: 0 1px 0 #000;
  font-family: var(--font);
}

.beta::backdrop { background: rgba(38, 38, 38, 0.6); }

/* Confetti over the popup (as on the check-up card); clicks pass through */
.beta { overflow: hidden; }
.beta-confetti {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.beta-confetti[hidden] { display: none; }

.beta-form {
  position: relative;
  padding: 24px;
  /* Both steps share one cell, so the popup keeps the form's height after
     the email is sent */
  display: grid;
}

.beta-step { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 20px; }
.beta-step[hidden] { display: flex; visibility: hidden; }

/* Done step: photo and text centred in the space above the button */
.beta-step[data-step="done"] .beta-head { flex: 1; justify-content: center; }
.beta-step[data-step="done"] .beta-avatar { margin-top: 0; }

.beta-head { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.beta-head h2 { padding: 0 24px; } /* clears the × */

/* As the tournament details avatar, 48px; ring matches the focused input (2px) */
.beta-avatar {
  display: block;
  width: 48px;
  height: 48px;
  margin: 16px auto 16px; /* top: 40px from the popup edge; bottom: + the head's 8px gap = 24px */
  border: 2px solid #000;
  border-radius: 50%;
  object-fit: cover;
}

.beta h2 {
  margin: 0;
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  color: var(--grey-300);
}

.beta-head p {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: 0.16px;
  color: var(--grey-200);
}

/* Form field — from the app's form in Figma */
.field { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-size: 16px;
  line-height: 18px;
  letter-spacing: 0.16px;
  font-weight: 400;
  color: var(--grey-200);
}

.field-input {
  height: 48px;
  padding: 0 15px;
  border: 1.4px solid #d3cfb4;
  border-radius: 999px;
  background: #fff;
  font-family: var(--font);
  font-size: 17px;
  line-height: 21px;
  font-weight: 500;
  color: var(--grey-300);
  outline: none;
}

.field-input::placeholder { color: #b4b4b4; }
/* As the app's Field: 2px black when focused (padding drops 0.6px so the
   text doesn't shift as the border thickens); red on error */
.field-input:focus { border: 2px solid #000; padding: 0 14.4px; }
.field-input[aria-invalid="true"] { border-color: #ca2d2f; }

.field-caption {
  margin-top: -4px; /* 4px under the field */
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.14px;
  color: var(--grey-150);
}

.field-caption.beta-error { color: #b3261e; }

/* Same pill as the "Download for iOS" button */
.beta-submit {
  height: 48px;
  padding: 0 16px;
  border: 2px solid #000;
  border-radius: 999px;
  background: #000;
  color: var(--yellow-100);
  box-shadow: 0 1px 0 #000;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}

.beta-submit:disabled { opacity: 0.6; cursor: default; } /* while saving */

.beta-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  font-family: var(--font);
  font-size: 26px;
  line-height: 1;
  color: var(--grey-200);
  cursor: pointer;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .decor { --s: 0.85; }
}

@media (max-width: 600px) {
  /* The break after "kobo" left it alone on a line: let it wrap naturally */
  .headline br { display: none; }
  /* Store buttons stacked, each full width */
  .stores { flex-direction: column; align-items: stretch; gap: 12px; width: 100%; }
  .store { width: 100%; }
  .header { position: absolute; left: 16px; right: 16px; top: 20px; } /* scrolls away on phones */
  .decor { --s: 0.65; }
  .space-top { height: 104px; }
  .space-mid { height: 48px; }
  .phones { --k: 0.7; }
  .hero { gap: 16px; }
  .title { font-size: 36px; line-height: 43px; }
  /* Sized to the screen so it always fits 2 rows, the first one the longer */
  .headline { font-size: clamp(13px, (100vw - 32px) * 0.046, 18px); line-height: 1.45; }
  .copyright { font-size: 13px; line-height: 18px; }
}

@media (max-width: 600px) {
  .beta-form { padding: 24px 20px 20px; }
  /* Too narrow for the set line breaks: let the subtitle wrap on its own */
  .beta-head p br { display: none; }
  .beta-head p { text-wrap: balance; }
}

@media (max-width: 380px) {
  .beta-head p { font-size: 15px; letter-spacing: 0; }
}

@media (max-width: 360px) {
  .beta-head p { font-size: 14px; }
  .title { font-size: 32px; line-height: 38px; }
}
