:root {
  --sky-top: #8fd3ff;
  --sky-bottom: #ffd6ba;
  --ink: #142033;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

[hidden] {
  display: none !important;
  pointer-events: none !important;
}

body {
  overflow: hidden;
}

html:has(body.policy),
body.policy {
  height: auto;
  overflow: auto;
}

body {
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  color: #fff;
  background: #081018;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
}

#app,
#stage,
canvas,
.overlay {
  touch-action: none;
}

#stage {
  position: relative;
  height: 100dvh;
  width: min(100vw, calc(100dvh * 9 / 16));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding:
    calc(16px + env(safe-area-inset-top))
    16px
    calc(16px + env(safe-area-inset-bottom));
}

.overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}

#end-screen {
  align-items: center;
}

#title-screen .card {
  max-height: none;
}

#mute[aria-pressed="false"] #mute-off,
#mute[aria-pressed="true"] #mute-on {
  display: none;
}

.fine a {
  color: #fff;
  font-weight: 800;
}

.card {
  width: min(100%, 340px);
  max-height: 100%;
  overflow: hidden;
  background: rgba(10, 18, 34, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  padding: 26px 22px 18px;
  text-align: center;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.28);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.8;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(34px, 9vw, 46px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.lede,
.fine,
.best-line,
.end-detail {
  margin: 0;
}

.lede {
  font-size: 15px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
}

.best-line {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.best-line strong {
  font-size: 18px;
}

.fine {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.75;
}

button {
  font: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.primary,
.ghost {
  border-radius: 999px;
  min-height: 52px;
  padding: 12px 18px;
  font-weight: 800;
  font-size: 17px;
}

.primary {
  display: block;
  width: 100%;
  margin-top: 16px;
  border: 0;
  background: #fff;
  color: var(--ink);
}

.ghost {
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

.row .ghost {
  flex: 1;
}

.primary:active,
.ghost:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .primary:hover {
    transform: translateY(-1px);
  }

  .ghost:hover {
    background: rgba(255, 255, 255, 0.16);
  }
}

.text-link {
  display: inline-block;
  margin-top: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
}

#hud,
.hud-top,
.score-pill,
.combo,
#banner-slot,
.toast {
  pointer-events: none;
}

#mute {
  pointer-events: auto;
}

.score-pill {
  display: flex;
  flex-direction: column;
  min-width: 112px;
  padding: 8px 12px 10px;
  border-radius: 18px;
  background: rgba(8, 16, 32, 0.32);
  backdrop-filter: blur(10px);
}

.score-kicker,
#best-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
}

#score {
  font-size: 40px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

#score.pop {
  animation: pop 180ms ease-out;
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

#mute {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(8, 16, 32, 0.32);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
}

.combo {
  align-self: flex-start;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
}

.end-score {
  margin: 4px 0 0;
  font-size: 72px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.end-detail {
  margin-top: 6px;
  font-size: 15px;
  opacity: 0.9;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 4;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(8, 16, 32, 0.82);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}

#banner-slot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
}

#banner-slot:empty,
html.ads-gamemonetize #banner-slot {
  display: none;
}

#banner-slot > * {
  pointer-events: auto;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #142033;
  color: #fff;
}

html.record-mode #app {
  background: #000;
}

html.record-mode #stage {
  height: min(100dvh, calc(100vw * 16 / 9));
  width: min(100vw, calc(100dvh * 9 / 16));
}

html.record-mode .chrome {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.policy {
  overflow: auto;
  height: auto;
  min-height: 100dvh;
  background: #efe8dc;
  color: #1c2430;
}

.policy main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

.policy h1 {
  font-size: 40px;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #142033;
}

.policy h2 {
  margin: 28px 0 8px;
  font-size: 18px;
}

.policy p,
.policy li {
  font-size: 16px;
  line-height: 1.55;
}

.policy a {
  color: #1d4e89;
  font-weight: 700;
}
