:root {
  --bg: #05060A;
  --text: #E8ECF2;
  --soft: #C9D1DC;
  --muted: #9AA4B2;
  --accent: #A78BFA;
  --live: #22C55E;
  --warn: #FACC15;
}

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* The page is a fixed 1920x1080 canvas, scaled to fit the window and centred. Nothing is clipped. */
.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: var(--bg);
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  transform-origin: center;
}

/* Nebula and stars copied from design/Hook.dc.html. */
.nebula {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.nebula-purple {
  left: 13.5%;
  top: 5.6%;
  width: 57.3%;
  height: 64.8%;
  background: radial-gradient(closest-side, rgba(124, 58, 237, 0.22), rgba(124, 58, 237, 0));
}

.nebula-teal {
  left: 46.9%;
  top: 38.9%;
  width: 52.1%;
  height: 59.3%;
  background: radial-gradient(closest-side, rgba(45, 212, 191, 0.12), rgba(45, 212, 191, 0));
}

.stars {
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background-image:
    radial-gradient(1.4px 1.4px at 23px 41px, #ffffff, transparent),
    radial-gradient(1px 1px at 131px 87px, #C9D1DC, transparent),
    radial-gradient(1.2px 1.2px at 197px 173px, #ffffff, transparent),
    radial-gradient(1px 1px at 61px 201px, #9AA4B2, transparent),
    radial-gradient(1.6px 1.6px at 171px 23px, #E8ECF2, transparent);
  background-size: 240px 240px;
  pointer-events: none;
}

.stars2 {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.8px 1.8px at 90px 120px, #ffffff, transparent),
    radial-gradient(1.2px 1.2px at 310px 260px, #C4B5FD, transparent),
    radial-gradient(1.4px 1.4px at 420px 60px, #BFDBFE, transparent);
  background-size: 520px 520px;
  animation: twinkle 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes twinkle {
  50% { opacity: 0.25; }
}

.brand,
.controls,
.clock,
.bigclock,
.bar {
  z-index: 2;
}

.brand {
  position: absolute;
  left: 56px;
  top: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand span {
  color: var(--accent);
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--soft);
  letter-spacing: 0;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live);
  display: inline-block;
  animation: blink 1.6s ease-in-out infinite;
}

.controls {
  position: absolute;
  right: 56px;
  top: 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.controls button {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(5, 6, 10, 0.6);
  color: var(--soft);
  font: 600 14px Inter, system-ui, sans-serif;
  cursor: pointer;
}

.controls button[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.18);
  color: var(--text);
}

.controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.clock {
  position: absolute;
  left: 56px;
  top: 92px;
  margin: 0;
  color: var(--muted);
  font: 14px 'JetBrains Mono', ui-monospace, monospace;
}

#space {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  font-family: Inter, system-ui, sans-serif;
}

.bigclock {
  position: absolute;
  left: 50%;
  top: 34px;
  transform: translateX(-50%);
  margin: 0;
  font: 800 46px Inter, system-ui, sans-serif;
  letter-spacing: -0.5px;
  color: var(--text);
  white-space: nowrap;
  text-shadow: 0 0 24px rgba(167, 139, 250, 0.45);
}

.bigclock[hidden] {
  display: none;
}

.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 56px;
  box-sizing: border-box;
  background: rgba(5, 6, 10, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}

.bar p {
  margin: 0;
}

.totals {
  display: flex;
  gap: 18px;
  font: 14px 'JetBrains Mono', ui-monospace, monospace;
  color: var(--soft);
}

.totals strong {
  color: var(--text);
  font-weight: 700;
}

.status {
  color: var(--muted);
}

.status.warn {
  color: var(--warn);
  font-weight: 600;
}

.beta {
  color: var(--muted);
}

.commit-pulse {
  animation: commit 3s ease-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.core {
  animation: core 2.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.ring {
  animation: ring 3s ease-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes blink {
  50% { opacity: 0.2; }
}

@keyframes core {
  50% { transform: scale(1.25); opacity: 0.55; }
}

@keyframes ring {
  from { transform: scale(0.4); opacity: 0.9; }
  to { transform: scale(2.6); opacity: 0; }
}

/* In a replay, each event flashes as the play-head reveals it. */
#space.replay .evt {
  animation: flash 0.9s ease-out;
}

@keyframes flash {
  0% { filter: brightness(2.6) drop-shadow(0 0 6px #FFFFFF); }
  100% { filter: none; }
}

@keyframes commit {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(3.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .stars2,
  .live-dot,
  .commit-pulse,
  .core,
  .ring {
    animation: none;
  }
}

/* ---------- Landing page: the map sits dimmed behind the question ---------- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
}

.hero .viewport {
  position: absolute;
  inset: 0;
}

.hero:not(.watching) .stage {
  opacity: 0.4;
}

.hero:not(.watching) .controls,
.hero:not(.watching) .brand,
.hero:not(.watching) .clock,
.hero:not(.watching) .bigclock,
.hero:not(.watching) .bar {
  display: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  box-sizing: border-box;
  text-align: center;
}

.hero.watching .overlay,
.hero.watching .watch {
  display: none;
}

.overlay h1 {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 56px);
  font-weight: 800;
  letter-spacing: -1px;
  text-shadow: 0 6px 40px rgba(0, 0, 0, 0.8);
}

.pick {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #C9D1DC;
}

.apps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 200px));
  gap: 12px;
  justify-content: center;
}

.app-btn,
.more,
.watch,
.unwatch,
.landing-card a.open {
  min-height: 56px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(11, 13, 18, 0.85);
  color: var(--text);
  font: 700 17px Inter, system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
}

.app-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.app-btn[aria-pressed="true"] {
  border-color: var(--text);
  background: rgba(167, 139, 250, 0.2);
}

.light {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 6px;
  flex-shrink: 0;
}

.more {
  font-size: 15px;
  color: var(--soft);
}

.landing-card {
  width: min(720px, 92vw);
  padding: 20px 22px;
  border-radius: 18px;
  border: 1px solid #262C38;
  background: rgba(20, 24, 33, 0.96);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.landing-card[hidden] {
  display: none;
}

.landing-card h2 {
  font-size: 24px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-card .line {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  color: var(--soft);
}

.landing-card .meaning {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.landing-card a.open {
  align-self: flex-start;
  color: var(--text);
}

.watch {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
}

.unwatch {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 4;
  min-height: 40px;
  font-size: 14px;
}

.hero.watching .unwatch {
  display: block;
}

.hero:not(.watching) .unwatch {
  display: none;
}

/* ---------- Scroll sections ---------- */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px;
  box-sizing: border-box;
}

.section h2 {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 12px;
}

.section .pulse {
  font-size: 40px;
}

.section .note {
  color: var(--muted);
  font-size: 15px;
}

.section .list,
.section .levels {
  font-size: 17px;
  line-height: 1.6;
  color: var(--soft);
}

.downloads {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  font-size: 16px;
}

.downloads a {
  display: block;
  padding: 12px 14px;
  border: 1px solid #262C38;
  border-radius: 12px;
  background: #141821;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid #262C38;
}

.foot p {
  margin: 0;
}

/* Phones: buttons two per row, text smaller, nothing overflows. */
@media (max-width: 640px) {
  .apps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .app-btn {
    font-size: 16px;
    min-height: 52px;
  }

  .pick {
    font-size: 16px;
  }

  .section {
    padding: 40px 18px;
  }

  .section h2 {
    font-size: 24px;
  }
}

/* Phones: the hero grows with its content, and the watch button sits in the normal flow. */
@media (max-width: 640px) {
  .hero {
    height: auto;
    min-height: 100vh;
    padding-bottom: 24px;
  }

  .overlay {
    position: relative;
    inset: auto;
    padding: 40px 18px 16px;
  }

  .watch {
    position: static;
    transform: none;
    margin-top: 8px;
  }
}

/* Round 4: no empty gap. The hero follows its content; "Watch it live" sits right under the pulse line. */
.hero {
  height: auto;
  min-height: 100vh;
}

.hero:not(.watching) .overlay {
  position: relative;
  inset: auto;
  min-height: 100vh;
  padding: 56px 24px 48px;
}

.hero:not(.watching) .watch {
  position: static;
  transform: none;
  margin-top: 6px;
}

.hero.watching {
  position: fixed;
  inset: 0;
  height: 100vh;
  min-height: 0;
  z-index: 50;
}

.pulse-line {
  margin: 14px 0 0;
  font-size: clamp(30px, 4.2vw, 56px);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #FFFFFF;
  text-shadow: 0 0 18px rgba(196, 181, 253, 0.85), 0 0 46px rgba(124, 58, 237, 0.7);
}

.pulse-count {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #E8ECF2;
}

.pulse-count strong {
  color: #FFFFFF;
  font-weight: 800;
}

.legend-line {
  margin: 4px 0 0;
  font-size: 14px;
  color: #C9D1DC;
}

.legend-line a {
  color: #C4B5FD;
  font-weight: 700;
}

.app-btn {
  flex-direction: column;
  gap: 4px;
}

.app-name-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.app-btn .word {
  font-size: 12px;
  font-weight: 600;
  color: #9AA4B2;
}

/* The map's own headline is hidden on the landing page: the page has its own. It returns in "Watch it live". */
.hero:not(.watching) #space text[font-size="60"],
.hero:not(.watching) #space text[y="918"] {
  display: none;
}

/* No empty gap: in the normal view the hero is only as tall as its content. */
.hero:not(.watching) {
  min-height: 0;
}

.hero:not(.watching) .overlay {
  min-height: 0;
  padding-bottom: 40px;
}

/* Speed landing: the map at full brightness, a big real number over it, then the calls to action. */
.hero:not(.watching) {
  height: 100vh;
  min-height: 640px;
}

.hero:not(.watching) .stage {
  opacity: 1;
}

.hero:not(.watching) .overlay {
  position: absolute;
  inset: 0;
  justify-content: flex-start;
  padding: 12vh 24px 24px;
  gap: 10px;
  pointer-events: none;
}

.overlay p,
.overlay .fact {
  margin: 0;
}

.big-number {
  font-size: clamp(64px, 11vw, 168px);
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  color: #FFFFFF;
  text-shadow: 0 0 28px rgba(196, 181, 253, 0.8), 0 4px 40px rgba(0, 0, 0, 0.9);
}

.big-caption {
  font-size: clamp(16px, 1.6vw, 22px);
  color: #E8ECF2;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.95);
  max-width: 900px;
}

.per-second {
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 700;
  color: #FDE68A;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.95);
}

.fact {
  margin-top: 18px;
  padding: 14px 22px;
  border-radius: 16px;
  background: rgba(5, 6, 10, 0.72);
  border: 1px solid #262C38;
  max-width: 820px;
}

.fact-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #A78BFA;
}

.fact-text {
  margin-top: 4px;
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 800;
  color: #FFFFFF;
}

.since {
  font-size: 15px;
  color: #C9D1DC;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.95);
}

.since strong {
  color: #FFFFFF;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.pulse-section {
  text-align: center;
}

.pulse-section .pulse-line {
  margin: 0;
  font-size: clamp(32px, 4.5vw, 60px);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.cta {
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 14px;
  border: 1px solid #A78BFA;
  background: rgba(167, 139, 250, 0.18);
  color: #FFFFFF;
  font: 800 17px Inter, system-ui, sans-serif;
  cursor: pointer;
}

.pick {
  text-align: center;
}

.pick-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.pick-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pick-app {
  padding: 6px 12px;
  border: 1px solid #3A4252;
  border-radius: 999px;
  color: #C9D1DC;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.pick-app:hover {
  color: #FFFFFF;
  border-color: #A78BFA;
}

@media (max-width: 640px) {
  .hero:not(.watching) {
    height: auto;
  }

  .hero:not(.watching) .overlay {
    position: relative;
    inset: auto;
    min-height: 100vh;
    padding: 56px 18px 24px;
  }
}

/* Headline over the live map: map at full brightness, a soft dark gradient behind the text. */
.hero:not(.watching) .overlay {
  background: radial-gradient(ellipse 60% 55% at 50% 40%, rgba(5, 6, 10, 0.85) 0%, rgba(5, 6, 10, 0.55) 55%, rgba(5, 6, 10, 0) 100%);
  justify-content: flex-start;
  padding-top: 9vh;
  text-align: center;
}

.hero:not(.watching) .overlay .cta,
.hero:not(.watching) .overlay .since {
  pointer-events: auto;
}

.head-1 {
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -1px;
  color: #FFFFFF;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.9);
}

.head-2 {
  font-size: clamp(30px, 4.6vw, 62px);
  font-weight: 800;
  letter-spacing: -1px;
  color: #E8ECF2;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.9);
}

.head-2 .num {
  color: #C4B5FD;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-shadow: 0 0 24px rgba(124, 58, 237, 0.9), 0 2px 26px rgba(0, 0, 0, 0.9);
  display: inline-block;
}

.head-2 .num.pulse {
  animation: numpulse 1.4s ease-out;
}

@keyframes numpulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.head-3 {
  font-size: 16px;
  color: #C9D1DC;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.95);
}

@media (prefers-reduced-motion: reduce) {
  .head-2 .num.pulse {
    animation: none;
  }
}

/* Headline: a centred column, below the map's date ticks and clear of the app names on the right. */
.hero:not(.watching) .overlay {
  left: 50%;
  right: auto;
  width: min(1100px, 92vw);
  transform: translateX(-50%);
  padding-top: 16vh;
}

@media (max-width: 640px) {
  .hero:not(.watching) .overlay {
    width: auto;
    transform: none;
    left: auto;
  }
}
