@font-face {
  font-family: Geom;
  src: url("./assets/geom-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("./assets/schibsted-grotesk-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("./assets/schibsted-grotesk-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  color: #f9f4ff;
  background: #100b25;
  --ink: #1d102c;
  --muted: #d1c5e5;
  --focus: #ba94c1;
  --pink: #fface5;
  --blue: #a1ecff;
  --chrome: clamp(1rem, 3.1vw, 3.25rem);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: var(--focus); color: #170d23; }

body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: wait; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 5px; }
a { color: inherit; }

.game {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  isolation: isolate;
  overflow: hidden;
  user-select: none;
}

#course, .vignette, .interface { position: absolute; inset: 0; width: 100%; height: 100%; }
#course { display: block; }
.vignette {
  pointer-events: none;
  background: linear-gradient(180deg, #0a071bb0, transparent 17%, transparent 83%, #09071f83);
}
.game[data-state="title"] .vignette {
  background:
    linear-gradient(90deg, #100b27ef 0%, #100b27c7 22%, #100b2758 44%, transparent 66%),
    linear-gradient(180deg, #0a071b8f, transparent 23%, transparent 82%, #09071f72);
}

.top {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  min-height: 4.75rem;
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  gap: 1rem;
  padding: max(.9rem, env(safe-area-inset-top)) max(var(--chrome), env(safe-area-inset-right)) .55rem max(var(--chrome), env(safe-area-inset-left));
  pointer-events: none;
}

.top > * { pointer-events: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: .65rem;
  border-radius: .25rem;
  font-weight: 600;
  font-size: .875rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--pink); }
.brand img { display: block; object-fit: contain; flex: none; }
.top-actions { display: flex; align-items: center; gap: .55rem; justify-self: end; grid-column: 3; }
.best, .score { display: flex; flex-direction: column; gap: .1rem; }
.best { align-items: end; margin-right: .55rem; }
.best span, .score span, .result span { color: var(--muted); font-size: .875rem; }
.best b, .score b, .result b {
  font-family: Geom, system-ui, sans-serif;
  font-size: 1.3rem;
  line-height: 1;
  letter-spacing: .027em;
  font-variant-numeric: tabular-nums;
}
.score b { font-size: clamp(1.5rem, 3.4vw, 2.4rem); }
.icon-button {
  display: grid;
  place-items: center;
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid #efe1ff33;
  border-radius: .55rem;
  background: #1e153bb8;
  color: #f6edff;
}
.icon-button:hover { background: #382551; border-color: #dfc0f48f; }

.speaker, .pause-icon { position: relative; width: 1.2rem; height: 1.2rem; }
.speaker::before {
  position: absolute;
  inset: 1px 40% 1px 0;
  content: "";
  background: currentColor;
  clip-path: polygon(0 31%, 40% 31%, 95% 0, 95% 100%, 40% 69%, 0 69%);
}
.speaker::after {
  content: "";
  position: absolute;
  top: 14%;
  bottom: 14%;
  left: 48%;
  width: 35%;
  border: 1.5px solid currentColor;
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 80% 80% 0;
}
.icon-button[data-muted="true"] .speaker::after {
  top: 46%;
  bottom: auto;
  left: 50%;
  width: 58%;
  height: 1.5px;
  border: 0;
  border-radius: 0;
  background: currentColor;
  transform: rotate(-43deg);
}
.pause-icon::before, .pause-icon::after {
  content: "";
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 25%;
  width: 18%;
  border-radius: 1px;
  background: currentColor;
}
.pause-icon::after { left: 59%; }

.stage { grid-column: 2; width: min(29vw, 15rem); }
.stage-name { display: flex; align-items: baseline; justify-content: space-between; column-gap: .85rem; }
.stage-name > span { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.stage-name strong { font-size: .94rem; font-weight: 600; text-align: right; }
.stage-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: .23rem; margin-top: .55rem; }
.stage-track i { height: .23rem; overflow: hidden; background: #ece1ff30; border-radius: 1rem; }
.stage-track b { display: block; height: 100%; background: var(--stage-color, #fface5); transform-origin: left; transform: scaleX(0); }

.title-screen { position: absolute; inset: 0; display: grid; align-items: center; pointer-events: none; }
.launch {
  width: max-content;
  max-width: calc(100% - 2rem);
  margin-left: max(7.3vw, calc(env(safe-area-inset-left) + 1.3rem));
  margin-top: -.75rem;
  pointer-events: auto;
}
.launch h1 {
  width: max-content;
  margin: 0 0 1.7rem;
  font: 700 clamp(4.5rem, min(10vw, 16vh), 12.25rem)/.78 Geom, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: -.085em;
  transform: skewX(-9deg);
  transform-origin: left center;
}
.launch h1 span { display: block; padding-right: .14em; }
.launch h1 span:first-child {
  color: #fdf5ff;
  text-shadow: .016em .035em #ae6dcca8;
}
.launch h1 span + span {
  padding-bottom: .09em;
  margin-bottom: -.09em;
  color: #ecc8ff;
  background: linear-gradient(104deg, #ff9edf 9%, #d3a9ff 52%, #91ecff 96%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(.016em .045em 0 #5d388e);
}
.objective { margin: 0 0 1.45rem .28rem; font-size: clamp(1rem, 1.48vw, 1.2rem); color: #eae1f6; }
.launch-action { display: flex; align-items: center; margin-left: .28rem; gap: .9rem; }
.primary {
  display: inline-flex;
  gap: .65rem;
  align-items: center;
  justify-content: center;
  min-height: 3.35rem;
  border: 0;
  border-radius: .5rem;
  padding: .66rem 1.2rem;
  background: linear-gradient(110deg, #fface5, #d1b3ff 58%, #a1ecff);
  color: var(--ink);
  box-shadow: inset 0 1px #ffffff91, 0 .3rem 0 #7a529e, 0 7px 23px #ba94c134;
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.25;
}
.primary:hover:not(:disabled) { background: linear-gradient(110deg, #ffcef0, #e2d1ff 58%, #c1f5ff); }
.primary:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 1px #ffffff91, 0 .1rem 0 #7a529e; }
.primary:disabled { opacity: .7; }
.play-icon { width: .8rem; height: .84rem; flex: none; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.65rem;
  height: 1.55rem;
  padding: 0 .25rem;
  border: 1px solid #cab6df52;
  border-bottom-width: 2px;
  border-radius: .3rem;
  background: #1b1239;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  color: #e9dff5;
}
.start-key { align-self: center; color: var(--muted); }
.start-key kbd { height: 1.7rem; padding-inline: .48rem; }
.controls {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  min-height: 1.7rem;
  margin: 1.35rem 0 0 .28rem;
  color: var(--muted);
  font-size: .875rem;
}
.desktop-hint { display: flex; align-items: center; gap: .25rem; }
.desktop-hint span { margin-inline: .3rem; }
.text-button {
  padding: .3rem .2rem;
  border: 0;
  border-radius: .2rem;
  background: transparent;
  color: var(--pink);
  font-size: .875rem;
  text-underline-offset: .2em;
  text-decoration: underline;
  text-decoration-color: #f6ace788;
}
.text-button:hover { color: white; }
.feedback { min-height: 1em; margin: .45rem .28rem 0; color: #ead5ff; font-size: .875rem; }
.game:not([data-mobile="true"]) .mobile-only, .game[data-mobile="true"] .keyboard-only { display: none; }

.run-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 44%, #140a33b8 0%, #0d081fce 58%, #0a0717e6 100%);
  padding: 3.25rem 1rem 1rem;
}
.panel {
  width: min(22rem, 100%);
  text-align: center;
}
.panel h2, .rotate h2 {
  margin: 0;
  font: 700 clamp(2rem, 5vw, 3.5rem)/1 Geom, system-ui, sans-serif;
  letter-spacing: -.06em;
}
.panel h2:focus, .rotate h2:focus { outline: none; }
.panel p:not(.feedback) { margin: .5rem 0 1rem; color: var(--muted); }
.panel .primary { margin-top: .5rem; min-width: 10rem; }
.panel-links { display: flex; justify-content: center; gap: 1rem; margin-top: .85rem; }
.result { display: flex; justify-content: center; gap: 2rem; margin: .88rem auto .55rem; }
.result div { display: flex; flex-direction: column; gap: .35rem; min-width: 5rem; }
.result b { font-size: 1.8rem; }
.count-in {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  padding-bottom: 10vh;
  background: linear-gradient(#0e0a24a0, #0e0a2400 78%);
  font: 700 clamp(3.6rem, 14vh, 9rem)/1 Geom, system-ui, sans-serif;
  text-shadow: 0 .04em #7948a3, 0 0 .4em #c992ff8f;
  pointer-events: none;
}
.funnel-notice {
  position: absolute;
  left: 50%;
  top: max(5.1rem, calc(env(safe-area-inset-top) + 4.65rem));
  transform: translateX(-50%);
  padding: .26rem .65rem;
  border: 1px solid #fbd8ff6b;
  border-radius: .3rem;
  font-size: .875rem;
  background: #1c1039c9;
  color: #ffe7fd;
  white-space: nowrap;
  pointer-events: none;
}
.touch-controls {
  position: absolute;
  z-index: 1;
  inset: auto max(1.1rem, env(safe-area-inset-right)) max(.8rem, env(safe-area-inset-bottom)) max(1.1rem, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.touch-controls button {
  display: grid;
  place-items: center;
  width: clamp(3.5rem, 12vw, 7rem);
  height: clamp(3.25rem, 14vh, 4.5rem);
  border: 1px solid #efceff8f;
  border-radius: .65rem;
  background: #251748bb;
  color: #fff4ff;
  font-size: 2.2rem;
  line-height: .7;
  pointer-events: auto;
  touch-action: none;
}
.touch-controls button:active { background: #8c5db5d6; }
.announcer { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.rotate {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(ellipse at 50% 35%, #2c154ccc, #100b25f7 68%);
  text-align: center;
}
.rotate img { margin-bottom: 1.6rem; }
.rotate h2 { max-width: 17rem; font-size: 2.25rem; }
.rotate p { color: var(--muted); }
.device-icon {
  position: relative;
  width: 4.5rem;
  height: 2.55rem;
  margin-bottom: 1.65rem;
  border-radius: .6rem;
  border: 2px solid #f8b6ff;
  box-shadow: 0 0 22px #e16dff52, inset 0 0 12px #e16dff38;
  transform: rotate(-13deg);
}
.device-icon::before {
  position: absolute;
  top: 30%;
  bottom: 30%;
  left: .27rem;
  width: .12rem;
  border-radius: .1rem;
  background: #f8b6ff;
  content: "";
}
.no-script { position: absolute; inset: auto 0 1rem; text-align: center; }

@media (max-height: 560px) and (orientation: landscape) {
  :root { --chrome: clamp(.75rem, 2.8vw, 1.9rem); }
  .top { min-height: 3.3rem; padding-top: max(.4rem, env(safe-area-inset-top)); padding-bottom: .2rem; }
  .brand img { width: 23px; height: 23px; }
  .icon-button { width: 2.5rem; height: 2.5rem; }
  .launch { margin-top: 1.35rem; }
  .launch h1 { font-size: clamp(3.25rem, min(10vw, 17.5vh), 6.3rem); margin-bottom: .9rem; }
  .objective { margin-bottom: .75rem; font-size: .95rem; }
  .primary { min-height: 2.65rem; padding: .55rem .85rem; font-size: .94rem; }
  .controls { margin-top: .85rem; }
  .feedback { margin-top: .2rem; }
  .funnel-notice { top: max(3.65rem, calc(env(safe-area-inset-top) + 3rem)); }
  .run-panel { padding-top: 3.4rem; }
  .panel h2 { font-size: 2.22rem; }
  .panel p:not(.feedback), .result { margin: .35rem 0; }
  .panel-links { margin-top: .6rem; }
}

@media (max-width: 650px) {
  .top { gap: .65rem; }
  .stage { width: clamp(7.3rem, 30vw, 13rem); }
  .stage-name { column-gap: .4rem; }
  .stage-name strong { font-size: .875rem; }
  .best { margin-right: .1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .primary:active:not(:disabled) { transform: none; }
}

.run-panel { align-items: safe center; overflow-y: auto; }
.launch-action [data-open-scores] { margin-left: .15rem; }
.score-entry { margin: 1rem auto .25rem; }
.score-entry label {
  display: block;
  margin-bottom: .36rem;
  color: var(--muted);
  font-size: .875rem;
}
.score-input { display: flex; justify-content: center; gap: .43rem; }
.score-input input {
  min-width: 0;
  width: 10rem;
  padding: .55rem .6rem;
  border: 1px solid #d599f380;
  border-radius: .4rem;
  background: #180f30;
  color: #fff1ff;
  font: inherit;
}
.score-input input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.score-input input::placeholder { color: #c5b2d6; opacity: 1; font-size: .9rem; }
.secondary {
  flex: none;
  padding: .48rem .6rem;
  border: 1px solid #d9b4f19b;
  border-radius: .4rem;
  background: #382255;
  color: #ffe6ff;
  font-size: .875rem;
  font-weight: 600;
}
.secondary:hover:not(:disabled) { background: #543472; }
.secondary:disabled { opacity: .65; }
.leaderboard {
  width: min(37.5rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 1.45rem);
  padding: clamp(1rem, 3.1vw, 1.65rem);
  border: 1px solid #deafe499;
  border-radius: .7rem;
  background: linear-gradient(124deg, #251641, #1d1737 68%, #171733);
  box-shadow: 0 15px 75px #08030dbb;
  color: #faefff;
}
.leaderboard::backdrop { background: #0b061cec; }
.board-title { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.board-title h2 {
  margin: 0;
  font: 700 clamp(1.75rem, 4.25vw, 2.5rem)/1 Geom, system-ui, sans-serif;
  letter-spacing: -.06em;
}
#board-close { font-size: 1.6rem; }
.board-status { margin: 1rem 0 .4rem; color: var(--muted); }
.rankings { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 1.7rem); margin-top: 1.2rem; }
.rankings table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; table-layout: fixed; }
.rankings th { padding-bottom: .45rem; color: var(--muted); font-size: .875rem; font-weight: 400; }
.rankings th:first-child { width: 22%; }
.rankings th:last-child { width: 40%; }
.rankings td {
  border-top: 1px solid #c4a5ea38;
  padding-top: .55rem;
  padding-bottom: .55rem;
  font: 700 clamp(.95rem, 2.1vw, 1.14rem)/1 Geom, system-ui, sans-serif;
}
.rankings td:first-child { color: #daa4ea; }
.rankings td:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rankings td:last-child, .rankings th:last-child { text-align: right; }

@media (max-width: 480px) and (orientation: portrait) {
  .launch h1 { font-size: clamp(2.7rem, 13vw, 4.25rem); }
  .rankings { grid-template-columns: 1fr; }
}
@media (max-height: 445px) and (orientation: landscape) {
  .score-entry { margin-top: .5rem; }
  .score-entry label { display: inline-block; margin: 0 .36rem 0 0; }
  .score-input { display: inline-flex; }
  .score-input input { width: 8rem; padding: .38rem .45rem; }
  .panel { width: min(24rem, 100%); }
  .rankings { margin-top: .75rem; }
  .rankings td { padding-block: .4rem; }
}
