:root {
  color-scheme: dark;
  --bg: #000;
  --ink: #f5f5f7;
  --dim: #a1a1a6;
  --faint: #6e6e73;
  --line: rgba(255, 255, 255, 0.12);
  --hair: rgba(255, 255, 255, 0.08);
  --glass: rgba(18, 18, 20, 0.58);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.chrome { display: contents; }

button { font: inherit; color: inherit; }

#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  background: #000;
}

#c.dragging { cursor: grabbing; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.62), transparent 22%),
    linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent 26%),
    radial-gradient(ellipse at 58% 46%, transparent 42%, rgba(0, 0, 0, 0.42) 100%);
}

header, main, footer { pointer-events: none; }

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 28px 0;
}

.brand, .tools, .clock, #card, #list, #status, #fail, .credits, .made {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  line-height: 0;
}

.brand img {
  height: 22px;
  width: auto;
}

.tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.segment, .clock, #spin, #sun, #fail {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
}

.segment {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
}

.segment button, #now, #spin, #sun {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--dim);
  cursor: pointer;
}

.segment button[aria-checked="true"],
#now[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.clock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 14px 3px 3px;
  border-radius: 999px;
}

#sim {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

#spin, #sun {
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
}

#sun[aria-pressed="true"] {
  background: rgba(255, 206, 140, 0.18);
  color: #f7ead4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.segment button:hover, #now:hover, #spin:hover, #sun:hover { color: var(--ink); }
#sun[aria-pressed="true"]:hover { color: #f7ead4; }
.segment button:focus-visible, #now:focus-visible, #spin:focus-visible, #sun:focus-visible, .brand:focus-visible, #list button:focus-visible, .stream a:focus-visible, .made a:focus-visible, .slw-consent-reopen:focus-visible, .slw-consent__choice:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

main {
  position: fixed;
  z-index: 2;
  top: 78px;
  left: 28px;
  width: min(400px, calc(100vw - 56px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 132px);
  overflow: hidden;
}

#card, #list {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 30px 70px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(32px) saturate(1.45);
  -webkit-backdrop-filter: blur(32px) saturate(1.45);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

#card {
  flex: 0 0 auto;
  max-height: 72%;
  overflow: auto;
  margin: 0;
  padding: 22px 24px 20px;
}

#card.idle .label,
#card.idle .count,
#card.idle .when,
#card.idle .place,
#card.idle .note { display: none; }

#card.idle .watch { margin-top: 14px; color: var(--dim); }

.kicker, .label {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 0;
  font-weight: 600;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.meta, .when, .note, .stream {
  margin: 8px 0 0;
  color: var(--dim);
}

.meta { font-size: 14px; letter-spacing: -0.01em; }

.count {
  margin: 18px 0 0;
  font-weight: 200;
  font-size: 58px;
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.when { margin-top: 8px; font-size: 15px; color: var(--ink); letter-spacing: -0.01em; }

.label { margin-top: 18px; }

.place, .watch {
  margin: 4px 0 0;
  font-size: 15px;
  letter-spacing: -0.014em;
  line-height: 1.4;
}

.place-name, .place-sub { display: block; }
.place-sub { color: var(--dim); margin-top: 2px; }

.note {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--faint);
}

.stream a {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.stream a:hover { text-decoration: underline; }

#list {
  list-style: none;
  margin: 0;
  padding: 6px;
  flex: 1 1 auto;
  overflow: auto;
  min-height: 92px;
}

#list:empty { display: none; }

#list button {
  width: 100%;
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 1px 12px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 14px;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--ink);
  transition: background 180ms ease;
}

#list button:hover { background: rgba(255, 255, 255, 0.05); }

#list button[aria-current="true"] {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 2px 0 0 #f5f5f7;
}

#list .t {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  padding-top: 2px;
}
#list .nm {
  grid-column: 2;
  grid-row: 1;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
#list .pd { grid-column: 2; color: var(--faint); font-size: 12px; }

footer {
  position: fixed;
  z-index: 2;
  left: 28px;
  right: 28px;
  bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

#status, .made {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: -0.01em;
}
#status { max-width: 36rem; }

.made {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.made a {
  color: inherit;
  text-decoration: none;
}
.made a:hover { color: var(--ink); }
.heart {
  width: 0.875rem;
  height: 0.875rem;
  fill: #ef4444;
  flex: none;
}
.credits {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.slw-consent-reopen {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 12px;
  letter-spacing: -0.01em;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
  white-space: nowrap;
}
.slw-consent-reopen:hover { color: var(--ink); }

.made:has(a:hover) .heart {
  animation: heart-pulse 1s ease-in-out infinite;
}
@keyframes heart-pulse {
  50% { opacity: 0.45; }
}

#fail {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 999px;
  color: #f5f5f7;
  font-size: 13px;
}

@media (min-width: 1240px) {
  .clock {
    position: absolute;
    left: 50%;
    top: 22px;
    transform: translateX(-50%);
  }
}

@media (max-width: 1239px) {
  .tools { flex-wrap: wrap; }
  .clock { flex: 1 1 100%; }
}

@media (max-width: 800px) {
  #c { transform: translateY(-14%); }
  /* Header, the sheet, and the footer stack. The sheet is the only
     scroller, so a swipe reaches every launch. The gap above it stays
     on the globe. */
  .chrome {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 2;
    inset: 0;
    box-sizing: border-box;
    padding:
      max(12px, env(safe-area-inset-top))
      12px
      max(12px, env(safe-area-inset-bottom));
    gap: 8px;
    pointer-events: none;
  }
  header, main, footer {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
  }
  header {
    flex: 0 0 auto;
    padding: 4px 4px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .tools {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .segment { flex: 1 1 100%; }
  .segment button {
    flex: 1;
    padding-inline: 10px;
    white-space: nowrap;
  }
  main {
    flex: 0 1 auto;
    min-height: 0;
    margin-top: auto;
    max-height: 50dvh;
    width: auto;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    pointer-events: auto;
  }
  h1 { font-size: 28px; }
  .count { font-size: 42px; margin-top: 10px; }
  .label { margin-top: 12px; }
  #card, #list {
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
    touch-action: pan-y;
  }
  #card { padding: 16px 16px 12px; border-radius: 20px; }
  #list { min-height: 0; border-radius: 18px; }
  footer {
    flex: 0 0 auto;
    left: auto;
    right: auto;
    bottom: auto;
    padding-top: 8px;
    flex-wrap: wrap;
    gap: 6px 16px;
  }
  .credits { margin-left: auto; }
}

.slw-consent {
  position: fixed;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 20px;
  align-items: center;
  max-height: 40vh;
  overflow: auto;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(12, 12, 14, 0.82);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 -16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  font-size: 13px;
  line-height: 1.4;
}
.slw-consent[hidden] { display: none; }
.slw-consent:focus { outline: none; }
.slw-consent:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: -2px; }
.slw-consent__text { margin: 0; color: var(--dim); }
.slw-consent__actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(9rem, 1fr);
  gap: 8px;
}
.slw-consent__choice {
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.slw-consent__choice[data-choice="granted"] {
  background: var(--ink);
  color: #000;
  border-color: transparent;
}
.slw-consent__choice:hover { border-color: rgba(255, 255, 255, 0.4); }
.slw-consent__choice[data-choice="granted"]:hover { border-color: transparent; }

html.slw-consent-open footer {
  bottom: calc(12px + var(--slw-consent-offset, 0px));
}
html.slw-consent-open main {
  max-height: calc(100vh - 132px - var(--slw-consent-offset, 0px));
}
html.slw-consent-open #fail {
  bottom: calc(22px + var(--slw-consent-offset, 0px));
}

@media (max-width: 800px) {
  .slw-consent {
    grid-template-columns: 1fr;
    padding-inline: 16px;
  }
  .slw-consent__actions { grid-auto-columns: minmax(0, 1fr); }
  html.slw-consent-open .chrome {
    padding-bottom: var(--slw-consent-offset, 0px);
  }
  html.slw-consent-open footer { bottom: auto; }
  html.slw-consent-open main { max-height: 50dvh; }
}

@media (prefers-reduced-motion: reduce) {
  #c { cursor: default; }
  #list button { transition: none; }
  .made:has(a:hover) .heart { animation: none; }
}
