:root {
  color-scheme: light;
  --page: #f9f2e8;
  --page-wash: #fffcf6;
  --ink: #151719;
  --muted: #40484d;
  --line: #c0c2b1;
  --accent: #10462c;
  --focus: #17653f;
  --hill: #dbe4bc;
  --tour-top: #edf0dc;
  --tour-bottom: #dce4cc;
  --tour-tabs: #d5ddbf;
  --tour-current: #fffaf0;
  --screen-edge: #345340;
  --hero-image: url("../images/playtime/hero-race-light.webp?v=2");
  --hero-mobile-image: url("../images/playtime/hero-race-mobile-light.webp?v=2");
  --finish-image: url("../images/playtime/finish-race-light.webp?v=2");
  --finish-surface: #094628;
  --finish-text: #fff8eb;
  --finish-accent: #d9edb0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #091d15;
  --page-wash: #132f22;
  --ink: #fff5e8;
  --muted: #e0e3d7;
  --line: #556c5b;
  --accent: #b1e6a2;
  --focus: #bdf4b1;
  --hill: #183e29;
  --tour-top: #0b2118;
  --tour-bottom: #0e2519;
  --tour-tabs: #234534;
  --tour-current: #426b52;
  --tour-current-edge: #83aa8f;
  --screen-edge: #688573;
  --screen-mobile-edge: #6885739c;
  --hero-image: url("../images/playtime/hero-race-dark.webp?v=2");
  --hero-mobile-image: url("../images/playtime/hero-race-mobile-dark.webp?v=2");
  --finish-image: url("../images/playtime/finish-race-dark.webp?v=2");
  --finish-surface: #052219;
  --finish-accent: #b1e6a2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --page: #091d15;
    --page-wash: #132f22;
    --ink: #fff5e8;
    --muted: #e0e3d7;
    --line: #556c5b;
    --accent: #b1e6a2;
    --focus: #bdf4b1;
    --hill: #183e29;
    --tour-top: #0b2118;
    --tour-bottom: #0e2519;
    --tour-tabs: #234534;
    --tour-current: #426b52;
    --tour-current-edge: #83aa8f;
    --screen-edge: #688573;
    --screen-mobile-edge: #6885739c;
    --hero-image: url("../images/playtime/hero-race-dark.webp?v=2");
    --hero-mobile-image: url("../images/playtime/hero-race-mobile-dark.webp?v=2");
    --finish-image: url("../images/playtime/finish-race-dark.webp?v=2");
    --finish-surface: #052219;
    --finish-accent: #b1e6a2;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 42% 9%, var(--page-wash), transparent 37rem), var(--page);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, summary { font: inherit; cursor: pointer; }
a, button, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
img, svg { display: block; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.layout { width: min(calc(100% - clamp(48px, 8vw, 112px)), 1160px); margin-inline: auto; }
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  transform: translateY(-160%);
  padding: 12px 18px;
  color: var(--page);
  background: var(--ink);
  border-radius: 12px;
}
.skip-link:focus { transform: none; }

.intro {
  padding-block: clamp(28px, 3.2vw, 48px) clamp(30px, 3.8vw, 56px);
}

.intro-layout {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(0, 1.12fr);
  align-items: center;
  gap: clamp(22px, 4vw, 64px);
}

.intro-copy h1 {
  font-size: clamp(40px, 4.9vw, 70px);
  line-height: 1.01;
  font-weight: 680;
  letter-spacing: -.049em;
}

.intro-copy h1 span { display: block; color: var(--accent); }

.intro-copy > p {
  max-width: 34ch;
  margin-top: clamp(14px, 1.5vw, 22px);
  color: var(--muted);
  font-family: var(--reading-font);
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.48;
}

.store-link {
  position: relative;
  display: block;
  width: min(100%, 185px);
  aspect-ratio: 566 / 168;
  overflow: hidden;
  border-radius: 7px;
}

.store-link img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 114.14%;
  height: auto;
  transform: translate(-50%, -50%);
}

.intro-copy .store-link { width: clamp(154px, 13.5vw, 188px); margin-top: clamp(18px, 1.8vw, 26px); }

.hero-display {
  container-type: inline-size;
  display: grid;
  align-content: start;
  min-width: 0;
  isolation: isolate;
}

.hero-art {
  aspect-ratio: 1.62;
  border-radius: 26px 26px 26px clamp(26px, 5vw, 76px);
  background: var(--hero-image) center / cover no-repeat;
  pointer-events: none;
}

.app-tour {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding-block: clamp(30px, 3.2vw, 48px) clamp(38px, 3.8vw, 56px);
  background: linear-gradient(180deg, var(--tour-top), var(--tour-bottom));
}

.app-tour::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -9%;
  bottom: -18%;
  width: 119%;
  height: 27%;
  border-radius: 52% 47% 0 0;
  transform: rotate(-6deg);
  background: var(--hill);
  opacity: .65;
}

.tour-heading {
  margin-bottom: clamp(21px, 2vw, 30px);
  padding-bottom: clamp(12px, 1.25vw, 18px);
  border-bottom: 1px solid var(--line);
}

.tour-heading h2, .questions h2, .how-guide h2 {
  font-size: clamp(32px, 3.5vw, 48px);
  line-height: 1.03;
  letter-spacing: -.045em;
  font-weight: 700;
}

.gallery-picker { display: none; }

.gallery-track { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { display: grid; grid-template-rows: 1fr auto; min-width: 0; margin: 0; }
.gallery-slide figcaption { padding: clamp(12px, 1.2vw, 18px) 4px 0; text-align: center; }
.gallery-slide h3 { font-size: clamp(18px, 1.45vw, 21px); line-height: 1.15; font-weight: 680; }
.gallery-slide figcaption p {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--reading-font);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.35;
}

.app-screen { display: grid; place-items: center; }

.app-screen picture {
  display: block;
  width: min(100%, clamp(138px, 18vw, 226px));
  overflow: hidden;
  border: 1px solid var(--screen-edge);
  border-radius: clamp(12px, 1.15vw, 17px);
  background: var(--tour-top);
  box-shadow: 0 3px 10px #1d331f18;
}

.app-screen img { display: block; width: 100%; height: auto; }

.questions {
  display: grid;
  grid-template-columns: minmax(0, .47fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 4.4vw, 64px);
  padding-block: clamp(35px, 4vw, 60px);
}

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 560;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 5px;
}

.faq-list details { border-top: 1px solid var(--line); }
.faq-list details:last-child { border-bottom: 1px solid var(--line); }

.faq-list summary {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  min-height: 44px;
  padding: 12px 4px 12px 0;
  list-style: none;
  font-size: clamp(18px, 1.5vw, 21px);
  font-weight: 660;
  line-height: 1.18;
  letter-spacing: -.032em;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list summary::after {
  content: "";
  flex: none;
  width: .75em;
  aspect-ratio: 1;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
}

.faq-list details[open] summary::after { background-size: 100% 2px, 0 0; }

.faq-list p {
  max-width: 65ch;
  margin: 0 26px 15px 0;
  font-family: var(--reading-font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--muted);
}

.download-banner {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: clamp(14px, 1.5vw, 22px);
  min-height: clamp(210px, 19vw, 272px);
  padding: clamp(27px, 3vw, 42px) clamp(28px, 4vw, 58px);
  border-radius: clamp(20px, 2.4vw, 30px);
  background: var(--finish-surface);
  color: var(--finish-text);
}

.download-banner::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  height: 100%;
  aspect-ratio: 2;
  background: linear-gradient(90deg, var(--finish-surface), transparent 32%),
    linear-gradient(180deg, var(--finish-surface), transparent 21%),
    var(--finish-image) center / cover no-repeat;
  pointer-events: none;
}

.download-banner h2 {
  font-size: clamp(32px, 3.65vw, 54px);
  font-weight: 710;
  letter-spacing: -.045em;
  line-height: .98;
}

.download-banner h2 span { display: block; color: var(--finish-accent); }
.download-banner .store-link { width: clamp(153px, 13vw, 178px); }

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(23px, 2.5vw, 36px);
  border-top: 1px solid var(--line);
  padding-block: 12px 20px;
}

.site-footer .brand-mark { width: 32px; }
.site-footer .brand-name { font-size: 19px; }
.site-footer nav { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 36px); }

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--reading-font);
  font-size: 15px;
  white-space: pre;
}

.site-footer nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 767px) {
  html { scroll-padding-top: 80px; }
  .layout { width: min(calc(100% - 44px), 718px); }
  .tour-heading h2, .questions h2, .how-guide h2 { font-size: clamp(30px, 7vw, 38px); }
  .app-tour { padding-block: 20px 29px; }
  .tour-heading { margin-bottom: 14px; padding-bottom: 0; border: 0; }

  .gallery-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(100%, 290px);
    margin: 12px auto 0;
    padding: 2px;
    border-radius: 999px;
    background: var(--tour-tabs);
  }

  .gallery-picker a {
    display: grid;
    place-items: center;
    min-height: 44px;
    padding-inline: 3px;
    border-radius: inherit;
    font-size: 15px;
    line-height: 1.1;
  }

  .gallery-picker a[aria-current],
  .app-tour:not(:has([aria-current], .gallery-slide:target)) a[href="#screen-home"],
  .app-tour:not(:has([aria-current])):has(#screen-home:target) a[href="#screen-home"],
  .app-tour:not(:has([aria-current])):has(#screen-rewards:target) a[href="#screen-rewards"],
  .app-tour:not(:has([aria-current])):has(#screen-refer:target) a[href="#screen-refer"] {
    background: var(--tour-current);
    box-shadow: inset 0 0 0 1px var(--tour-current-edge, transparent), 0 1px 3px #263b2b2c;
    font-weight: 730;
  }

  .gallery-track {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .gallery-slide { flex: 0 0 100%; scroll-snap-align: start; }
  .app-screen picture {
    width: min(100%, 232px);
    border-width: 0;
    border-radius: 15px;
    box-shadow: 0 0 0 1px var(--screen-mobile-edge, transparent), 0 1px 8px #20352442;
  }
  .gallery-slide figcaption { padding-top: 12px; }
  .gallery-slide h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .gallery-slide figcaption p { margin-top: 0; color: var(--ink); font-family: var(--font); font-size: 16px; font-weight: 640; }
  .questions { grid-template-columns: 1fr; gap: 10px; padding-block: 28px 32px; }
  .support-link { margin-top: 0; color: var(--accent); }
  .faq-list summary { min-height: 48px; }
  .download-banner {
    min-height: clamp(172px, 43vw, 216px);
    padding: 20px clamp(15px, 5vw, 28px);
  }
  .download-banner::before { height: 76%; }
  .download-banner h2 { font-size: clamp(30px, 7.6vw, 41px); }
  .site-footer { gap: 0 16px; padding-block: 8px 14px; }
  .site-footer .brand-mark { width: 28px; }
  .site-footer .brand-name { font-size: 17px; }
  .site-footer nav { gap: 14px; }
  .site-footer nav a { font-size: 14px; }
  .footer-label-extra { display: none; }
}

@media (max-width: 639px) {
  .intro { padding-block: 24px 32px; }
  .intro-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; width: min(calc(100% - 36px), 540px); }
  .intro-copy h1 { font-size: clamp(37px, 10.4vw, 48px); }
  .intro-copy > p { margin-top: 12px; font-size: 16px; line-height: 1.45; }
  .intro-copy .store-link { width: 154px; margin-top: 16px; }
  .hero-art { aspect-ratio: 1.58; border-radius: 20px 20px 20px 35px; background-image: var(--hero-mobile-image); }
}

@media (min-width: 480px) and (max-width: 639px) {
  .intro-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px 18px;
  }
  .intro-copy h1 { grid-row: span 2; font-size: clamp(32px, 7vw, 40px); }
  .intro-copy > p { margin: 0; }
  .intro-copy .store-link { margin: 0; }
  .hero-art { aspect-ratio: 2; background-position: center 10%; }
  .hero-display .hero-selector { margin-block-start: -11%; }
}

@media (min-width: 640px) and (max-width: 767px) {
  .hero-art { background-image: var(--hero-mobile-image); }
  .intro-copy h1 { font-size: clamp(35px, 5.4vw, 40px); }
  .site-header { width: calc(100% - 44px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (forced-colors: active) {
  .gallery-picker a[aria-current] { text-decoration: underline; }
  .faq-list summary::after { background: linear-gradient(ButtonText, ButtonText) center / 100% 2px no-repeat, linear-gradient(ButtonText, ButtonText) center / 2px 100% no-repeat; forced-color-adjust: none; }
}
