/* /speed2, the free wifi map. Tokens, fonts, buttons and fields come from /styles.css. */

.s2-page {
  --up: #5b83ff;
  --shade: 11 11 12;                       /* the page colour, for gradients over the map */
  --panel: var(--panel);         /* glass sheets over the map */
  --sheet: #151518;                        /* solid sheets */
  --scrim: rgba(5, 5, 7, 0.55);
  --shadow: rgba(0, 0, 0, 0.45);
  --map-bg: #0f1012;
  min-height: 100dvh;
}
/* Light mode follows the phone. The passport stays a dark object either way. */
@media (prefers-color-scheme: light) {
  .s2-page {
    --ground: #f5f5f2;
    --ink: #0b0b0c;
    --ink-2: rgb(11 11 12 / 0.66);
    --ink-3: rgb(11 11 12 / 0.46);
    --glass: rgb(11 11 12 / 0.05);
    --glass-line: rgb(11 11 12 / 0.11);
    --up: #3d68f5;
    --shade: 245 245 242;
    --panel: rgba(255, 255, 255, 0.88);
    --sheet: #ffffff;
    --scrim: rgba(20, 20, 24, 0.28);
    --shadow: rgba(0, 0, 0, 0.12);
    --map-bg: #e9e9e6;
    color-scheme: light;
  }
  .s2-google { box-shadow: inset 0 0 0 1px var(--glass-line); }
}
.s2-top .wordmark-svg path { fill: var(--ink); }
body[data-screen="map"] { overflow: hidden; }

/* Header: logo in the middle, back on the left, your data on the right. It floats over the map,
   softened by a blur that fades to nothing instead of an edge. */
.s2-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
}
.s2-top::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0; bottom: -36px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(var(--shade) / 0.78) 0%, rgb(var(--shade) / 0.4) 55%, rgb(var(--shade) / 0) 100%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
}
.s2-top-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 64px;
  padding: 0 14px;
  max-width: 720px;
  margin: 0 auto;
}
.s2-slot { display: flex; }
.s2-slot.is-right { justify-content: flex-end; }
.s2-top .wordmark { width: 92px; margin: 0; }
.s2-top .wordmark-svg { display: block; width: 100%; height: auto; overflow: visible; }
.s2-top .letter { transform-box: fill-box; transform-origin: 50% 100%; }
.s2-top.is-intro .letter { animation: s2-drop 0.95s both; }
.s2-top .letter[data-letter="1"] { animation-delay: 0.08s; }
.s2-top .letter[data-letter="2"] { animation-delay: 0.16s; }
.s2-top .letter[data-letter="3"] { animation-delay: 0.24s; }
@keyframes s2-drop {
  0% { opacity: 0; transform: translateY(-460px) scaleX(0.9) scaleY(1.15); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  42% { opacity: 1; transform: translateY(0) scaleX(0.92) scaleY(1.1); animation-timing-function: ease-out; }
  54% { transform: translateY(0) scaleX(1.25) scaleY(0.72); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  76% { transform: translateY(-40px) scaleX(0.96) scaleY(1.05); }
  100% { opacity: 1; transform: none; }
}

.s2-icon, .s2-pill {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 0;
  box-shadow: inset 0 0 0 1px var(--glass-line);
  cursor: pointer;
  animation: rise 0.4s var(--ease) both;
}
.s2-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.s2-pill {
  height: 36px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.s2-pill svg { color: var(--up); }
.s2-icon:focus-visible, .s2-pill:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 1. The map, edge to edge, with a sheet at the bottom. */
.s2-mapwrap { position: fixed; inset: 0; }
.s2-map { position: absolute; inset: 0; background: var(--map-bg); }
.s2-you {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 3px #fdfdfd, 0 0 0 0 rgba(91, 131, 255, 0.55);
  animation: s2-ping 2s ease-out infinite;
}
@keyframes s2-ping { 0% { box-shadow: 0 0 0 3px #fdfdfd, 0 0 0 0 rgba(91, 131, 255, 0.55); } 100% { box-shadow: 0 0 0 3px #fdfdfd, 0 0 0 26px rgba(91, 131, 255, 0); } }
.s2-mapwrap .maplibregl-ctrl-bottom-right { top: calc(64px + env(safe-area-inset-top)); bottom: auto; }
.s2-mapwrap .maplibregl-ctrl-attrib { background: rgb(var(--shade) / 0.6); color: var(--ink-3); font-size: 11px; }
.s2-mapwrap .maplibregl-ctrl-attrib a { color: var(--ink-2); }
.s2-mapwrap .maplibregl-ctrl-attrib-button { filter: invert(1); }

.s2-sheet {
  position: absolute;
  left: 12px; right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  padding: 22px 20px 16px;
  border-radius: 28px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: inset 0 0 0 1px var(--glass-line), 0 20px 60px var(--shadow);
  animation: rise 0.45s var(--ease) both;
}
.s2-sheet.is-place { padding-top: 20px; }
.s2-title { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; margin: 0 40px 6px 0; }
.s2-eyebrow { font-size: 14px; color: var(--ink-3); margin: 0 0 4px; }
.s2-line { font-size: 16px; line-height: 1.45; color: var(--ink-2); margin: 0 0 16px; }
.s2-line strong { color: var(--ink); font-weight: 500; }
.s2-note { font-size: 14px; color: var(--ink-3); margin: -6px 0 14px; }
.s2-action { width: 100%; }
.s2-link {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  font: inherit;
  font-size: 15px;
  color: var(--ink-3);
  background: none;
  border: 0;
  cursor: pointer;
}
.s2-link:hover { color: var(--ink); }
.s2-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 0;
  font: 400 24px/1 var(--font);
  color: var(--ink-2);
  background: var(--glass);
  cursor: pointer;
}

/* Find free wifi: the map holds the top of the screen, the list of spots in the ring scrolls below. */
body[data-screen="near"], body[data-screen="passport"] { overflow: hidden; }
body[data-screen="near"] .s2-mapwrap, body[data-screen="passport"] .s2-mapwrap { bottom: auto; height: calc(40dvh + env(safe-area-inset-top)); }
body[data-screen="near"] .s2-mapwrap::after, body[data-screen="passport"] .s2-mapwrap::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--ground));
}
.s2-near {
  position: fixed;
  top: calc(40dvh + env(safe-area-inset-top));
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  scroll-padding: 112px 0 24px;
  background: var(--ground);
}
.s2-near.has-place { padding-bottom: 360px; scroll-padding-bottom: 340px; }
.s2-near > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.s2-near-head { position: sticky; top: 0; z-index: 1; padding: 6px 0 10px; background: var(--ground); }

/* The radius slider: a glowing fill up to a big thumb, the distance and walk above it. */
.s2-radius { padding: 0 4px; }
.s2-radius-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 2px; font-size: 15px; color: var(--ink-3); }
.s2-radius-head strong {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  animation: s2-tick 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.s2-radius-walk { margin-left: auto; }
.s2-radius-scale { display: flex; justify-content: space-between; margin: -2px 2px 0; font-size: 12px; color: var(--ink-3); }
.s2-radius-input {
  --fill: linear-gradient(90deg, #8fa8ff 0%, var(--up) var(--p), var(--glass-line) var(--p));
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
.s2-radius-input:focus { outline: none; }
.s2-radius-input::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: var(--fill);
  box-shadow: 0 0 18px color-mix(in srgb, var(--up) 35%, transparent);
}
.s2-radius-input::-moz-range-track { height: 10px; border-radius: 999px; background: var(--fill); }
.s2-radius-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -10px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--up) 30%, transparent), 0 6px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s;
}
.s2-radius-input::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--up) 30%, transparent), 0 6px 16px rgba(0, 0, 0, 0.3);
}
.s2-radius-input:active::-webkit-slider-thumb { transform: scale(1.18); box-shadow: 0 0 0 9px color-mix(in srgb, var(--up) 22%, transparent), 0 8px 20px rgba(0, 0, 0, 0.3); }
.s2-radius-input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--ink), 0 6px 16px rgba(0, 0, 0, 0.3); }
.s2-near-count { margin: 0 0 6px; font-size: 15px; color: var(--ink-3); }
.s2-near-list { list-style: none; margin: 0; padding: 0; }
.s2-near-list li + li { border-top: 1px solid var(--glass-line); }
.s2-near-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 4px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.s2-near-row:hover, .s2-near-row.is-selected { background: var(--glass); }
.s2-near-rank {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  color: var(--ground);
  background: var(--ink);
}
.s2-near-rank.is-tested { color: #fff; background: var(--up); }
.s2-near-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.s2-near-name { font-size: 17px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s2-near-meta { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.s2-near-reward {
  flex: none;
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--up);
  background: color-mix(in srgb, var(--up) 16%, transparent);
}
.s2-near-empty { padding: 18px 4px; }
.s2-near-empty .s2-action + .s2-action { margin-top: 10px; }
.s2-sheet.is-floating { position: fixed; z-index: 15; }
.s2-sheet .s2-action + .s2-action { margin-top: 10px; }

/* Screens 3 to 6: a column with its one action at the bottom. */
.s2-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(84px + env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  animation: rise 0.45s var(--ease) both;
}
.s2-center { text-align: center; }
.s2-spacer { flex: 1 1 24px; }
.s2-headline { font-size: clamp(32px, 9vw, 40px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 14px; }
.s2-chart { height: 230px; margin: 10px -12px 6px; }
.s2-verdict { font-size: 18px; color: var(--ink); min-height: 2.9em; }
.s2-field { margin-bottom: 10px; }
.s2-field.is-bad { border-color: var(--danger); }
.s2-dim { color: var(--ink-3); }
.s2-fine { font-size: 13px; color: var(--ink-3); text-align: center; margin: 14px 0 0; }

/* 4. Reward */
.s2-amount {
  margin: 8vh 0 10px;
  font-size: 88px;
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--up);
  animation: s2-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.s2-amount.is-small { font-size: 48px; color: var(--ink); }
@keyframes s2-pop { 0% { opacity: 0; transform: scale(0.4); } 100% { opacity: 1; transform: none; } }
.s2-stamp {
  --tilt: -6deg;
  align-self: center;
  display: grid;
  gap: 2px;
  margin: 26px auto 22px;
  padding: 16px 22px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  transform: rotate(var(--tilt));
  text-align: center;
  animation: s2-stamp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s both;
}
@keyframes s2-stamp { 0% { opacity: 0; transform: rotate(var(--tilt)) scale(1.8); } 100% { opacity: 1; transform: rotate(var(--tilt)) scale(1); } }
.s2-stamp-city { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.s2-stamp-date { font: 500 13px ui-monospace, Menlo, monospace; color: var(--ink-2); }
.s2-stamp-mark { font-size: 13px; color: var(--up); font-weight: 600; }
.s2-save { display: block; }

/* 5. Passport */
.s2-stamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0 6px; }
.s2-stamp.is-small { margin: 0; padding: 12px 6px; border-width: 2px; border-radius: 12px; animation-delay: 0s; }
.s2-stamp.is-small .s2-stamp-city { font-size: 16px; }
.s2-stamp.is-small .s2-stamp-date, .s2-stamp.is-small .s2-stamp-mark { font-size: 11px; }
.s2-stamp.is-empty { display: grid; place-items: center; margin: 0; min-height: 84px; border: 2px dashed var(--glass-line); border-radius: 12px; color: var(--ink-3); font-size: 22px; transform: none; animation: none; }
.s2-list { list-style: none; padding: 0; margin: 18px 0 0; }
.s2-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--glass-line); font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .s2-top .letter, .s2-sheet, .s2-screen, .s2-amount, .s2-stamp, .s2-icon, .s2-pill, .s2-you { animation: none !important; }
}

/* ---- Round two: the /speed test inside /speed2, the passport, and the celebration. ---- */

.button.is-glass { margin-top: 10px; color: var(--ink); background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-line); }
.s2-reward {
  display: inline-block;
  margin: 0 0 16px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: #0b0b0c;
  background: var(--up);
}
.s2-reward.is-none { color: var(--ink-2); background: var(--glass); font-weight: 500; }
.s2-pill-n { display: inline-block; animation: s2-tick 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes s2-tick { 0% { transform: translateY(8px) scale(0.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* The test screen is /speed's, under the floating header. */
.s2-speed { padding-top: calc(56px + env(safe-area-inset-top)); padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.s2-speed .speed-app { padding-top: 12px; }
.s2-at { text-align: center; margin-bottom: 6px; }
.s2-card {
  margin: 26px auto 0;
  max-width: 460px;
  padding: 20px 18px 12px;
  border-radius: 24px;
  text-align: left;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-line);
  animation: rise 0.5s var(--ease) both;
}
.s2-card.is-quiet { padding-bottom: 4px; }
.s2-card.is-quiet .s2-line { color: var(--ink-3); }
.s2-card-title { margin: 0 0 6px; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }

/* The passport */
.s2-book { display: grid; gap: 16px; margin-top: 8px; }
.pp { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(91, 131, 255, 0.12); }
.pp text { font-family: var(--font); fill: #eef1f7; }
.pp-kicker { font-weight: 700; font-size: 13px; letter-spacing: -0.01em; fill: #8fa8ff !important; }
.pp-title { font-weight: 600; font-size: 13px; }
.pp-small { font-size: 10px; fill: #8b92a5 !important; letter-spacing: 0.04em; }
.pp-label { font-size: 8.5px; fill: #8b92a5 !important; letter-spacing: 0.03em; }
.pp-value { font-size: 14px; font-weight: 600; }
.pp-value.is-small { font-size: 11.5px; }
.pp-mrz { font: 500 11px ui-monospace, Menlo, monospace !important; letter-spacing: 0.08em; fill: #c3c9d8 !important; }
.pp-empty { font-size: 14px; fill: #8b92a5 !important; }
.pp-stamp-city { font-weight: 700; letter-spacing: -0.01em; }
.pp-stamp-date { font: 600 9px ui-monospace, Menlo, monospace; }
.pp-stamp-mark { font-size: 9px; font-weight: 600; letter-spacing: 0.04em; }
.pp-stamp-body { transform-box: fill-box; transform-origin: center; }

/* Check-in to reward: page rises, stamp slams, the page shakes, the data counts up. */
.s2-celebrate {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(76px + env(safe-area-inset-top)) 22px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  text-align: center;
  background: radial-gradient(120% 70% at 50% 18%, rgba(91, 131, 255, 0.22), rgb(var(--shade) / 0) 60%), var(--ground);
}
.s2-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.s2-celebrate-page { width: min(100%, 360px); perspective: 900px; animation: s2-page-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
.s2-celebrate-page .pp { transform-origin: 50% 100%; }
.s2-stamped.is-stamp .s2-celebrate-page .pp, .s2-stamped.is-count .s2-celebrate-page .pp { animation: s2-shake 0.42s ease-out 1.05s both; }
@keyframes s2-page-in { 0% { opacity: 0; transform: translateY(60px) rotateX(28deg) scale(0.9); } 100% { opacity: 1; transform: none; } }
@keyframes s2-shake {
  0% { transform: none; } 18% { transform: translate(-5px, 4px) rotate(-1.2deg); } 36% { transform: translate(5px, -3px) rotate(1deg); }
  56% { transform: translate(-3px, 2px) rotate(-0.5deg); } 78% { transform: translate(2px, -1px); } 100% { transform: none; }
}
.pp-stamp.is-fresh .pp-stamp-body { animation: s2-slam 0.5s cubic-bezier(0.5, 0, 0.75, 0) 0.6s both; }

@keyframes s2-slam {
  0% { opacity: 0; transform: scale(3.2) rotate(-18deg); }
  80% { opacity: 1; transform: scale(0.92) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.s2-celebrate-amount {
  margin: 22px 0 6px;
  font-size: clamp(64px, 20vw, 96px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--up);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: scale(0.6);
}
.s2-stamped.is-count .s2-celebrate-amount, .s2-stamped.is-done .s2-celebrate-amount { animation: s2-amount 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes s2-amount { to { opacity: 1; transform: none; } }
.s2-celebrate-copy { width: min(100%, 420px); opacity: 0; transform: translateY(16px); pointer-events: none; }
.s2-stamped.is-done .s2-celebrate-copy { opacity: 1; transform: none; pointer-events: auto; transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.s2-celebrate-copy .s2-line { color: var(--ink); font-size: 18px; margin-bottom: 8px; }
.s2-celebrate-copy .s2-note { margin: 0 0 18px; }
.s2-row { display: flex; gap: 10px; margin-top: 10px; }
.s2-chip {
  flex: 1 1 0;
  height: 46px;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  background: var(--glass);
  border: 0;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--glass-line);
  cursor: pointer;
}
.s2-chip.is-solid { flex: 0 0 auto; padding: 0 18px; color: var(--ground); background: var(--ink); }
.s2-chip:disabled { opacity: 0.5; }
.s2-inline { display: flex; gap: 8px; margin-top: 14px; }
.s2-inline .field { height: 46px; font-size: 16px; }

@media (min-width: 900px) {
  .s2-book { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .s2-celebrate-page, .s2-celebrate-page .pp, .pp-stamp.is-fresh .pp-stamp-body, .s2-celebrate-amount, .s2-card, .s2-pill-n { animation: none !important; }
  .s2-celebrate-amount, .s2-celebrate-copy { opacity: 1; transform: none; pointer-events: auto; }
}

/* ---- Round three: the test is home, over a dimmed map; Google sign-in. ---- */

.s2-mapwrap { z-index: 0; }
.s2-map { transition: opacity 0.7s var(--ease), filter 0.7s var(--ease); }
.s2-map.is-dim { opacity: 0.55; filter: saturate(0.7); pointer-events: none; }
body[data-screen="juno"] .s2-mapwrap,
body[data-screen="celebrate"] .s2-mapwrap { visibility: hidden; }
body[data-screen="test"] { overflow: auto; }
.s2-front { position: relative; z-index: 2; }
.s2-front[hidden] { display: none; }
.s2-front .s2-speed .speed-app { text-shadow: 0 1px 18px rgb(var(--shade) / 0.6); }

/* The veil over the map: dark at the top for the headline, clear through the middle where the
   chart draws, dark again below where the results read; the edges blur rather than cut. */
.s2-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(var(--shade) / 0.92) 0%, rgb(var(--shade) / 0.45) 24%, rgb(var(--shade) / 0.28) 44%, rgb(var(--shade) / 0.7) 70%, rgb(var(--shade) / 0.96) 100%);
}
.s2-veil::before, .s2-veil::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.s2-veil::before { top: 0; height: 34%; -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent); mask-image: linear-gradient(180deg, #000 30%, transparent); }
.s2-veil::after { bottom: 0; height: 46%; -webkit-mask-image: linear-gradient(0deg, #000 35%, transparent); mask-image: linear-gradient(0deg, #000 35%, transparent); }

.s2-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; background: #fff; color: #1f1f1f; }
.s2-google svg { flex: 0 0 auto; }
.s2-celebrate-copy .s2-google { width: 100%; }

/* ---- Round four: land on the globe, test, then the reward slides up. ---- */

.s2-landing {
  position: fixed;
  left: 12px; right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 3;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 18px;
  border-radius: 28px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: inset 0 0 0 1px var(--glass-line), 0 20px 60px var(--shadow);
  text-align: center;
  animation: rise 0.7s var(--ease) 0.9s both;
}
.s2-landing-title { text-wrap: balance; margin: 0 0 8px; font-size: clamp(26px, 7.4vw, 32px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.08; }
.s2-veil.is-light { background: linear-gradient(180deg, rgb(var(--shade) / 0.7) 0%, rgb(var(--shade) / 0) 22%, rgb(var(--shade) / 0) 52%, rgb(var(--shade) / 0.75) 100%); }
.s2-veil.is-light::after { height: 40%; }
.s2-map.is-dim { opacity: 0.5; }
body[data-screen="home"] .s2-map.is-dim { opacity: 1; filter: none; }
/* The test has the screen to itself: the map fades out behind it. */
body[data-screen="test"] .s2-map.is-dim { opacity: 0; }
body[data-screen="home"] { overflow: hidden; }

/* A still picture of the chart while a sheet covers it (see SpeedTest). */
.speed-chart.is-still { position: relative; }
.speed-chart.is-still > :not(.speed-chart-still) { visibility: hidden; }
.speed-chart-still { position: absolute; pointer-events: none; }

/* The reward sheet */
.s2-sheet-wrap { position: fixed; inset: 0; z-index: 25; }
.s2-sheet-back { position: absolute; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: s2-fade 0.4s ease both; }
@keyframes s2-fade { from { opacity: 0; } }
.s2-celebrate.is-sheet {
  position: absolute;
  inset: auto 0 0 0;
  max-height: 94dvh;
  padding: 58px 22px max(22px, env(safe-area-inset-bottom));
  border-radius: 30px 30px 0 0;
  box-shadow: 0 -20px 60px var(--shadow), inset 0 1px 0 var(--glass-line);
  animation: s2-sheet-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes s2-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.s2-grabber { position: absolute; top: 9px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--glass-line); }
.s2-celebrate.is-sheet .s2-close { top: 14px; right: 14px; z-index: 5; }
.s2-stamped { width: 100%; display: flex; flex-direction: column; align-items: center; }
.s2-ask { width: min(100%, 420px); padding: 26px 0 6px; text-align: center; }
.s2-ask .s2-field { text-align: left; }
.s2-celebrate-amount.is-static { opacity: 1; transform: none; margin: 4px 0 2px; font-size: 64px; }
.s2-working { color: var(--ink-3); animation: speed-breathe 1.4s ease-in-out infinite; }
.s2-fine.is-tight { margin: 8px 0 4px; }
@media (prefers-reduced-motion: reduce) {
  .s2-celebrate.is-sheet, .s2-sheet-back, .s2-landing { animation: none; }
}

/* A spot, with everything behind it dimmed: how to get online first, then speed, then one action. */
.s2-spot-wrap { position: fixed; inset: 0; z-index: 25; }
.s2-spot {
  position: absolute;
  inset: auto 0 0 0;
  max-width: 560px;
  max-height: 88dvh;
  margin: 0 auto;
  overflow-y: auto;
  padding: 30px 22px max(18px, env(safe-area-inset-bottom));
  border-radius: 30px 30px 0 0;
  background: var(--sheet);
  box-shadow: 0 -20px 60px var(--shadow), inset 0 1px 0 var(--glass-line);
  animation: s2-sheet-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.s2-spot .s2-close { top: 16px; right: 16px; }
.s2-spot .s2-title { font-size: 26px; margin: 0 44px 4px 0; }
.s2-spot .s2-eyebrow { margin: 0 0 22px; }
/* The street at the spot. The frame keeps its shape while the photo loads, so nothing jumps. */
.s2-spot-photo { margin: -8px 0 20px; }
.s2-spot-photo-frame {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(100deg, var(--glass) 30%, var(--glass-line) 50%, var(--glass) 70%) 0 0 / 300% 100%;
  box-shadow: inset 0 0 0 1px var(--glass-line);
  animation: s2-shimmer 1.4s linear infinite;
}
.s2-spot-photo-frame.is-shown { animation: none; }
.s2-spot-photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.35s ease; }
.s2-spot-photo-frame.is-shown img { opacity: 1; }
.s2-spot-photo figcaption { margin: 6px 2px 0; font-size: 12px; color: var(--ink-3); }
@keyframes s2-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .s2-spot-photo-frame { animation: none; } }
.s2-spot-label { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); }
.s2-spot-how {
  margin: 0 0 18px;
  padding: 4px 16px;
  border-radius: 18px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-line);
}
.s2-spot-how > div { display: grid; grid-template-columns: 78px 1fr; gap: 12px; padding: 11px 0; }
.s2-spot-how > div + div { border-top: 1px solid var(--glass-line); }
.s2-spot-how dt { font-size: 15px; color: var(--ink-3); }
.s2-spot-how dd { margin: 0; font-size: 16px; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.s2-spot-speed { display: grid; grid-template-columns: 78px 1fr; gap: 12px; margin: 0 0 22px; padding: 0 16px; font-size: 15px; }
.s2-spot-speed span { color: var(--ink-3); }
.s2-spot-speed strong { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.s2-spot-speed strong.is-none { color: var(--ink-2); }
.s2-spot-speed em { font-style: normal; color: var(--ink-3); }
.s2-spot .s2-link { margin-top: 4px; font-size: 16px; color: var(--ink-2); }
.s2-spot-earn { margin: -4px 0 0; text-align: center; font-size: 13px; color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .s2-spot { animation: none; } }

/* Landing: one button. Finding wifi and turning on location are quieter, as links. */
.s2-locate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 18px;
  padding: 0;
  font: inherit;
  font-size: 15px;
  color: var(--ink-2);
  background: none;
  border: 0;
  cursor: pointer;
}
.s2-locate svg { flex: none; color: var(--up); }
.s2-locate strong { font-weight: 600; color: var(--up); }
.s2-locate.is-off { display: block; cursor: default; color: var(--ink-3); }
.s2-landing .s2-locate { justify-content: center; }
.s2-landing-find { margin-top: 8px; font-size: 16px; font-weight: 500; color: var(--ink); }


/* Your map: the city as a scratch card above, how far you've got below. */
.s2-mine {
  position: fixed;
  top: calc(40dvh + env(safe-area-inset-top));
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--ground);
}
.s2-mine > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.s2-mine-title { margin: 0 0 6px; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.s2-mine-progress { margin: 0 0 8px; font-size: 17px; color: var(--ink-2); }
.s2-mine-progress strong { font-size: 22px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.s2-mine-bar { height: 8px; margin-bottom: 12px; border-radius: 999px; background: var(--glass-line); overflow: hidden; }
.s2-mine-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8fa8ff, var(--up)); box-shadow: 0 0 14px color-mix(in srgb, var(--up) 45%, transparent); animation: s2-grow 1.1s var(--ease) 0.3s both; }
@keyframes s2-grow { from { width: 0; } }
.s2-mine-next {
  display: grid;
  width: 100%;
  margin: 4px auto 18px;
  padding: 14px 16px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: color-mix(in srgb, var(--up) 10%, transparent);
  border: 0;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--up) 28%, transparent);
  cursor: pointer;
}
.s2-mine-next-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--up); }
.s2-mine-next-name { margin: 2px 0; font-size: 18px; font-weight: 600; }
.s2-mine-next-meta { font-size: 14px; color: var(--ink-2); }
.s2-mine-section { margin: 8px auto 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); }
.s2-mine-list { list-style: none; padding: 0; margin: 0 auto 16px; }
.s2-mine-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--glass-line); }
.s2-mine-name { font-size: 16px; font-weight: 500; }
.s2-mine-name em { display: block; font-style: normal; font-size: 13px; font-weight: 400; color: var(--ink-3); }
.s2-mine-count { flex: none; font-size: 14px; color: var(--up); font-weight: 600; }
.s2-mine-empty { margin: 8px auto 18px; color: var(--ink-2); }
.s2-mine-cities { display: flex; gap: 10px; margin: 0 auto 18px; font-size: 14px; color: var(--ink-2); }
.s2-mine-cities span { color: var(--ink-3); }
.s2-mine-actions .s2-google { width: 100%; }
.s2-mine-links { display: flex; justify-content: center; gap: 8px; margin: 4px auto 0; }
.s2-mine-links .s2-link { width: auto; }

/* The reveal after a test: the neighborhood traces its edge, fills in, and the spot glows. */
.s2-reveal { margin: 0; padding: 14px 14px 16px; border-radius: 22px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-line); text-align: center; }
.s2-reveal svg { display: block; width: 100%; height: auto; overflow: visible; }
.s2-reveal-edge { fill: none; stroke: var(--up); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: s2-trace 1.1s cubic-bezier(0.65, 0, 0.35, 1) 0.2s forwards; }
.s2-reveal-fill { fill: var(--up); opacity: 0; animation: s2-fill 0.6s ease 1.2s forwards; }
.s2-reveal-spot { fill: #fff; stroke: var(--up); stroke-width: 3; opacity: 0; transform-box: fill-box; transform-origin: center; animation: s2-spot 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 1.3s forwards; }
@keyframes s2-trace { to { stroke-dashoffset: 0; } }
@keyframes s2-fill { to { opacity: 0.22; } }
@keyframes s2-spot { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: none; } }
.s2-reveal figcaption { display: grid; gap: 2px; margin-top: 8px; }
.s2-reveal figcaption span { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--up); }
.s2-reveal figcaption strong { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  .s2-reveal-edge { stroke-dashoffset: 0; animation: none; }
  .s2-reveal-fill { opacity: 0.22; animation: none; }
  .s2-reveal-spot { opacity: 1; animation: none; }
  .s2-mine-bar span { animation: none; }
}

/* The reward in two beats: first the amount alone with the confetti, then the neighborhood, one
   line and one button. The sheet keeps its height so the second beat doesn't jolt it. */
.s2-celebrate.is-sheet.is-celebrate { display: flex; flex-direction: column; min-height: min(78dvh, 640px); }
.s2-stamped { flex: 1; }
.s2-stamped.is-earn { justify-content: center; padding-bottom: 6dvh; }
.s2-stamped.is-earn .s2-celebrate-amount, .s2-stamped.is-story .s2-celebrate-amount { animation: s2-amount 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.s2-stamped.is-story .s2-celebrate-amount { animation: none; opacity: 1; transform: none; font-size: clamp(52px, 15vw, 72px); margin-top: 8px; transition: font-size 0.5s var(--ease); }
.s2-celebrate-why { text-wrap: balance; max-width: 22em; margin: 0 auto 20px; font-size: 18px; line-height: 1.4; color: var(--ink-2); animation: s2-fade 0.5s ease 0.45s both; }
.s2-celebrate-story { display: grid; gap: 12px; width: min(100%, 420px); animation: rise 0.6s var(--ease) both; }
.s2-celebrate-story .s2-celebrate-page { width: 100%; padding: 0; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; animation: none; }
.s2-celebrate-story .s2-note { margin: 0; }
.s2-celebrate-story .s2-google, .s2-celebrate-story .s2-action { width: 100%; margin-top: 4px; }
.s2-celebrate-story .s2-link { margin-top: -4px; }
@media (prefers-reduced-motion: reduce) {
  .s2-celebrate-why, .s2-celebrate-story { animation: none; }
}

/* Getting there: one button, the maps app it opens, and a one-time choice on iPhones. */
.s2-spot > .s2-action + .s2-spot-earn { margin: 8px 0 0; }
.s2-change { padding: 0; font: inherit; color: var(--up); background: none; border: 0; cursor: pointer; }
.s2-spot-apps { display: grid; gap: 10px; }
.s2-spot-apps .s2-spot-earn { margin: 0 0 2px; }
.s2-spot-apps .s2-action { margin: 0; }

/* Hello: where "Get started" lands. The map stays a faint globe behind it. */
body[data-screen="hello"] .s2-map { opacity: 0.22; transition: opacity 0.4s ease; }
.s2-hello { text-align: left; }
.s2-hello .s2-headline, .s2-hello > .s2-line { text-align: left; }
.s2-hello-badge { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 7px 12px; border-radius: 999px; font-size: 14px; color: var(--ink); background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-line); }
.s2-hello-balance { margin: 18px 0 0; padding: 16px 18px; border-radius: 18px; font-size: 16px; color: var(--ink-2); background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-line); }
.s2-hello-balance strong { display: block; font-size: 34px; line-height: 1.1; font-weight: 600; color: var(--up); font-variant-numeric: tabular-nums; }
.s2-hello-label { margin: 28px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); }
.s2-hello-actions { display: grid; gap: 10px; }
.s2-hello-action {
  display: grid; grid-template-columns: 44px 1fr 20px; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border: 0; border-radius: 18px; text-align: left; color: var(--ink-3); cursor: pointer;
  background: var(--sheet); box-shadow: inset 0 0 0 1px var(--glass-line); transition: transform 0.15s ease;
}
.s2-hello-action:active { transform: scale(0.98); }
.s2-hello-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: var(--ink); background: var(--glass-line); }
.s2-hello-text { display: grid; gap: 2px; min-width: 0; }
.s2-hello-text strong { font-size: 17px; font-weight: 500; color: var(--ink); }
.s2-hello-text em { font-style: normal; font-size: 14px; color: var(--ink-3); }
.s2-hello-invite { margin: 0 0 12px; }
.s2-hello-share { display: inline-flex; align-items: center; gap: 8px; }

/* ---- Round five: one column, one map band, sheets as cards on wide screens. ---- */

/* Signed in, and the spot list and your map: the map is a band across the top of the screen that
   fades into the page, and everything else reads below it. On hello it scrolls away with the page. */
body[data-screen="hello"] .s2-mapwrap,
body[data-screen="near"] .s2-mapwrap,
body[data-screen="passport"] .s2-mapwrap {
  bottom: auto;
  height: calc(30dvh + env(safe-area-inset-top));
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 40%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 40%, transparent 100%);
}
body[data-screen="hello"] .s2-mapwrap { position: absolute; }
body[data-screen="near"] .s2-mapwrap::after, body[data-screen="passport"] .s2-mapwrap::after { display: none; }
body[data-screen="hello"] .s2-map { opacity: 1; }
body[data-screen="hello"] .s2-veil { display: none; }
.s2-hello.s2-screen { min-height: 0; max-width: 560px; padding-top: calc(30dvh - 8px + env(safe-area-inset-top)); }
.s2-near, .s2-mine { top: calc(30dvh + env(safe-area-inset-top)); }

/* One column for every screen: its edges come from the container's padding, so no child can slip
   out to the window's edge. Inside it, screens read from the left. */
.s2-near, .s2-mine { padding-left: max(20px, calc((100% - 560px) / 2)); padding-right: max(20px, calc((100% - 560px) / 2)); }
.s2-near > *, .s2-mine > * { max-width: none; }
.s2-mine .s2-fine { text-align: left; }

/* Wide screens: sheets become a card in the middle of the dimmed page, the close button inside its
   corner, and no grabber, since there's nothing to drag. */
@keyframes s2-card-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@media (min-width: 720px) {
  .s2-celebrate.is-sheet, .s2-spot {
    inset: 0;
    width: min(480px, calc(100% - 48px));
    height: fit-content;
    max-height: calc(100dvh - 48px);
    margin: auto;
    overflow-y: auto;
    border-radius: 28px;
    box-shadow: 0 30px 90px var(--shadow), inset 0 0 0 1px var(--glass-line);
    animation: s2-card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .s2-celebrate.is-sheet { padding: 44px 32px 28px; }
  .s2-celebrate.is-sheet.is-celebrate { min-height: min(70dvh, 600px); }
  .s2-spot { width: min(520px, calc(100% - 48px)); padding: 28px 28px 24px; }
  .s2-celebrate.is-sheet .s2-grabber, .s2-spot .s2-grabber { display: none; }
  .s2-celebrate.is-sheet .s2-close, .s2-spot .s2-close { top: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) { .s2-celebrate.is-sheet, .s2-spot { animation: none; } }
