:root {
  --night: #0b1030;
  --cyan: #9fe8ff;
  --snow: #eaf4ff;
  --green: #5cffb0;
  --gold: #ffd27a;
  --lime: #e6ff6a;
  --pink: #ff4fc8;
  --lilac: #b9a4ff;
  /* the score colours: acid lime through mint to ice, stamped with a hard pink shadow */
  --pop: linear-gradient(180deg, #f4ff7c 6%, #7dffb0 52%, #6fe3ff 96%);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Motion is driven from the game clock (GSAP), so nothing here animates itself. */
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  color: var(--snow);
  font-family: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  font-stretch: condensed;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

/* always on: holds the eye in the middle and gives the scene its depth */
#shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 95% 62% at 50% 54%, rgba(6, 9, 30, 0) 52%, rgba(6, 9, 30, 0.34) 86%, rgba(4, 6, 22, 0.6) 100%),
    linear-gradient(180deg, rgba(6, 9, 30, 0.3) 0%, rgba(6, 9, 30, 0) 20%);
}

#title {
  position: absolute;
  left: 0; right: 0;
  top: calc(var(--top) + 13vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.86;
  font-size: min(27vw, 150px);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--snow);
}
#title span { display: block; white-space: nowrap; }
#title b { display: inline-block; font-weight: inherit; will-change: transform, opacity; }
#title span:first-child b { text-shadow: 0.045em 0.045em 0 var(--pink), 0 0 26px rgba(159, 232, 255, 0.5); }
#title span:last-child { letter-spacing: 0.2em; margin-left: 0.2em; }
#title span:last-child b {
  background: var(--pop);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0.045em 0.045em 0 #7a5cff);
}

#score, #endScore {
  background: var(--pop);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0.05em 0.05em 0 var(--pink)) drop-shadow(0 0 14px rgba(11, 16, 48, 0.55));
  font-weight: 800;
}
#score {
  position: absolute;
  left: 0; right: 0;
  top: calc(var(--top) + 62px);
  font-size: min(18vw, 92px);
  line-height: 1;
  letter-spacing: 0.02em;
  opacity: 0;
  font-variant-numeric: tabular-nums;
}
.attract #score, .dead #score { opacity: 0 !important; }

/* callouts are stickers: lime chip, night text, pink edge */
#toast {
  position: absolute;
  left: 50%;
  top: calc(var(--top) + 62px + min(18vw, 92px) + 12px);
  width: -webkit-max-content;
  width: max-content;
  padding: 7px 15px 5px 18px;
  border-radius: 10px;
  font-size: min(5vw, 23px);
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: var(--night);
  background: var(--lime);
  box-shadow: 3px 3px 0 var(--pink);
  opacity: 0;
}

#power {
  position: absolute;
  left: 0; right: 0;
  top: calc(var(--top) + 62px + min(18vw, 92px) + 12px);
  opacity: 0;
}
#powerLabel {
  font-size: min(6.4vw, 30px);
  font-weight: 800;
  letter-spacing: 0.2em;
  background: linear-gradient(90deg, #7dffb0, #6fe3ff 35%, #b9a4ff 65%, #ff6fd8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 2px 0 rgba(11, 16, 48, 0.9));
}
#powerBar {
  width: min(56vw, 260px);
  height: 9px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: rgba(11, 16, 48, 0.6);
  box-shadow: 0 0 0 2px rgba(234, 244, 255, 0.85);
  overflow: hidden;
}
#powerFill {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, #7dffb0, #6fe3ff 35%, #b9a4ff 65%, #ff6fd8);
  transform-origin: 0 50%;
}

#hint {
  position: absolute;
  left: 0; right: 0;
  top: 47vh;
  opacity: 0;
}
#hintText {
  font-size: min(6.4vw, 30px);
  letter-spacing: 0.26em;
  margin-top: 14px;
  text-shadow: 2px 2px 0 rgba(11, 16, 48, 0.9), 0 0 14px rgba(11, 16, 48, 0.9);
}
#thumb {
  width: 54px; height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid var(--lime);
  background: rgba(230, 255, 106, 0.2);
  box-shadow: 3px 3px 0 var(--pink), 0 0 22px rgba(125, 255, 176, 0.5);
}

/* points at the lantern when it is off screen: an arrowhead with a pink tip, so its direction cannot be misread.
   No CSS filter and its own layer: a filtered element moved every frame left ghost slivers behind on iOS. */
#chev {
  position: absolute;
  left: 0; top: 0;
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
  opacity: 0;
  visibility: hidden;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
#chev svg { display: block; overflow: visible; }

#vig {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 78% 46% at 50% 50%, rgba(11, 16, 48, 0) 55%, rgba(11, 16, 48, 0.62) 80%, rgba(7, 10, 34, 0.9) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.dead #vig { opacity: 1; transition: opacity 0.7s ease 0.35s; }

#end {
  position: absolute;
  inset: 0;
  display: none;
}
.dead #end { display: block; }
#endLabel {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top) + 60px);
  font-size: min(4.8vw, 23px);
  letter-spacing: 0.32em;
  color: #ff9be4;
  text-shadow: 2px 2px 0 rgba(11, 16, 48, 0.95), 0 0 14px rgba(11, 16, 48, 1);
}
#endScore {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top) + 84px);
  font-size: min(30vw, 150px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#endBest {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top) + 84px + min(30vw, 150px) + 6px);
  width: -webkit-max-content;
  width: max-content;
  margin: 0 auto;
  padding: 4px 10px 3px 14px;
  font-size: min(4.8vw, 22px);
  letter-spacing: 0.3em;
  color: var(--snow);
  text-shadow: 2px 2px 0 rgba(11, 16, 48, 0.95), 0 0 12px rgba(11, 16, 48, 1);
}
#endBest.new {
  color: var(--night);
  background: var(--lime);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--pink);
  text-shadow: none;
}
/* the one thing on the card that takes a tap of its own */
#lb {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top) + 84px + min(30vw, 150px) + 54px);
  width: -webkit-max-content;
  width: max-content;
  margin: 0 auto;
  padding: 12px 20px 10px 24px;
  font-size: min(4.4vw, 20px);
  font-weight: 800;
  letter-spacing: 0.24em;
  color: var(--night);
  background: linear-gradient(90deg, #7dffb0, #6fe3ff);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--pink);
  pointer-events: auto;
  cursor: pointer;
}
#lb:active { box-shadow: 1px 1px 0 var(--pink); background: var(--lime); }
#again {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--bottom) + 24vh);
  font-size: min(6.2vw, 30px);
  letter-spacing: 0.24em;
  text-shadow: 2px 2px 0 var(--pink), 0 0 16px rgba(11, 16, 48, 1);
}

/* the lake chip: quiet glass, one tap moves to the next lake. Shown on the title and end screens only. */
#lake {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--bottom) + 12vh);
  width: -webkit-max-content;
  width: max-content;
  margin: 0 auto;
  padding: 8px 20px 9px 24px;
  border-radius: 16px;
  background: rgba(11, 16, 48, 0.46);
  box-shadow: inset 0 0 0 1.5px rgba(234, 244, 255, 0.3);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.attract #lake { opacity: 1; visibility: visible; transition: opacity 0.6s ease 2.6s, visibility 0s linear 0s; }
.dead #lake { opacity: 1; visibility: visible; transition: opacity 0.5s ease 1.1s, visibility 0s linear 0s; }
#lake:active { background: rgba(11, 16, 48, 0.66); }
#lakeLabel {
  font-size: min(3.2vw, 14px);
  letter-spacing: 0.3em;
  color: var(--lilac);
}
#lakeRow { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 3px; }
#lakeName {
  display: inline-block;
  font-size: min(5.6vw, 26px);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--snow);
  text-shadow: 2px 2px 0 rgba(11, 16, 48, 0.8);
}
/* a small drawn chevron: tap for the next lake */
#lakeNext {
  width: 9px; height: 9px;
  border-top: 2.5px solid var(--lime);
  border-right: 2.5px solid var(--lime);
  transform: rotate(45deg);
  margin-left: -2px;
}
#lakeDots { display: flex; justify-content: center; gap: 7px; margin-top: 6px; }
#lakeDots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(234, 244, 255, 0.3); }
#lakeDots i.on { background: var(--lime); box-shadow: 0 0 6px rgba(230, 255, 106, 0.7); }

/* the lake change: a still of the leaving lake that melts away over the new one */
#sweep {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
}

#wipe {
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 260%;
  background: linear-gradient(100deg, rgba(234, 244, 255, 0) 0%, rgba(234, 244, 255, 0.96) 28%, #eaf4ff 50%, rgba(234, 244, 255, 0.96) 72%, rgba(234, 244, 255, 0) 100%);
  opacity: 0;
}

#dbg {
  position: absolute;
  left: 8px; bottom: 8px;
  font: 11px/1.3 ui-monospace, Menlo, monospace;
  text-align: left;
  text-transform: none;
  color: var(--green);
  white-space: pre;
}
