/* "Glass bubbles" interface: every piece is art in an image (assets/ui); the CSS only positions it. Live text on top, in 14 languages. */
@font-face {
  font-family: 'Fredoka';
  src: url(assets/fonts/fredoka-latin-600.woff2) format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  src: url(assets/fonts/fredoka-latin-700.woff2) format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  src: url(assets/fonts/fredoka-latin-ext-600.woff2) format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  src: url(assets/fonts/fredoka-latin-ext-700.woff2) format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'NunitoC';
  src: url(assets/fonts/nunito-cyrillic-900.woff2) format('woff2');
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --u: min(4.4vmin, 30px);
  --ink: #fff;
  --orb: 64px;
  --bh: clamp(50px, calc(var(--u) * 3.9), 82px);
  --txt: 0 2px 3px rgba(20, 12, 80, 0.55), 0 0 10px rgba(40, 30, 130, 0.3);
  --font:
    'Fredoka', 'NunitoC', 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', 'Apple SD Gothic Neo', 'Malgun Gothic',
    'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1b1650;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 600;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
canvas#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.hidden {
  display: none !important;
}
button {
  font: inherit;
  color: inherit;
}

/* frame stretched in 9 pieces (assembled on a canvas by src/lib/nine.js, no thread at the joint) */
.fr {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-style: solid;
  border-color: transparent;
}
.nine {
  border-image: none !important;
  background-size: 100% 100% !important;
  background-origin: border-box !important;
  background-clip: border-box !important;
  background-repeat: no-repeat !important;
}
.card > .fr,
.pop > .fr {
  border-width: 46px;
  border-image: url(assets/ui/panel.webp) 150 fill;
}
.btn > .fr {
  border-width: calc(var(--bh) / 2);
  border-image: url(assets/ui/cap-clear.webp) 142 fill;
}
.btn.aqua > .fr,
#toast > .fr {
  border-image-source: url(assets/ui/cap-aqua.webp);
}
#toast > .fr {
  border-width: 22px;
  border-image-slice: 142;
  border-image-repeat: stretch;
}
.row > .fr,
.slide > .fr,
.steps li > .fr {
  border-width: 21px;
  border-image: url(assets/ui/row.webp) 70 fill;
}
.pill > .fr {
  border-width: calc(var(--ph) / 2);
  border-image: url(assets/ui/cap-sm.webp) 92 fill;
}
#intro > .fr {
  border-width: 23px;
  border-image: url(assets/ui/tip.webp) 90 fill;
}

/* round glass buttons */
.orb {
  width: var(--orb);
  height: var(--orb);
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background:
    var(--a) center / 100% 100% no-repeat,
    radial-gradient(circle, rgba(24, 18, 84, 0.62) 0 60%, transparent 68%);
}
.orb.on {
  background:
    var(--a) center / 100% 100% no-repeat,
    radial-gradient(circle, rgba(46, 222, 212, 0.86) 0 62%, transparent 70%);
  filter: drop-shadow(0 0 8px rgba(90, 240, 230, 0.75));
}
.o-back {
  --a: url(assets/ui/back.webp);
}
.o-sound {
  --a: url(assets/ui/sound.webp);
}
.o-gear {
  --a: url(assets/ui/gear.webp);
}
.o-pause {
  --a: url(assets/ui/pause.webp);
}
.o-restart {
  --a: url(assets/ui/restart.webp);
}
.o-grid {
  --a: url(assets/ui/grid.webp);
}
.orb.muted {
  --a: url(assets/ui/mute.webp);
}
.orb.hot {
  --a: url(assets/ui/a-restart.webp);
  --orb: 74px;
  background: var(--a) center / 100% 100% no-repeat;
  filter: drop-shadow(0 0 10px rgba(70, 235, 225, 0.6));
}

/* loose icons and stars */
.ic {
  flex: 0 0 auto;
  width: calc(var(--u) * 1.6);
  height: calc(var(--u) * 1.6);
  background: var(--a) center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(18, 10, 70, 0.7));
}
.ic-vib {
  --a: url(assets/ui/i-vib.webp);
}
.ic-motion {
  --a: url(assets/ui/i-motion.webp);
}
.ic-full {
  --a: url(assets/ui/i-full.webp);
}
.ic-globe {
  --a: url(assets/ui/i-globe.webp);
}
.ic-help {
  --a: url(assets/ui/i-help.webp);
}
.ic-sound {
  --a: url(assets/ui/i-sound.webp);
}
.ic-music {
  --a: url(assets/ui/i-music.webp);
}
.ic-next {
  --a: url(assets/ui/i-next.webp);
  width: 34px;
  height: 30px;
}
.star {
  display: inline-block;
  flex: 0 0 auto;
  aspect-ratio: 1;
  background: url(assets/ui/star-empty.webp) center / contain no-repeat;
}
.star.got {
  background-image: url(assets/ui/star.webp);
}

/* HUD */
#corner {
  position: fixed;
  z-index: 30;
  top: calc(env(safe-area-inset-top) + 14px);
  right: calc(env(safe-area-inset-right) + 12px);
  display: flex;
  gap: 10px;
}
body.panel #hud,
body.panel #hud-level {
  visibility: hidden;
}
#hud {
  position: fixed;
  z-index: 20;
  top: calc(env(safe-area-inset-top) + 14px);
  left: calc(env(safe-area-inset-left) + 12px);
  right: calc(env(safe-area-inset-right) + var(--orb) * 2 + 34px);
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
#hud .orb {
  pointer-events: auto;
}
.pill {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  --ph: 42px;
  height: var(--ph);
  font-weight: 700;
  text-shadow: var(--txt);
}
#hud-stars {
  flex: 0 1 168px;
  min-width: 0;
  margin: 0 auto;
  --ph: calc(var(--orb) * 0.9);
  padding: 0 4px;
}
#hud-st {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
#hud-st .star:not(.got),
.cell .st .star:not(.got) {
  background-image: url(assets/ui/star-line.webp);
  filter: drop-shadow(0 1px 1px rgba(20, 16, 80, 0.65));
}
#hud-st .star {
  width: min(calc(var(--orb) * 0.6), 7vw);
  transition: transform 0.25s cubic-bezier(0.3, 1.8, 0.5, 1);
}
#hud-st .star.got {
  transform: scale(1.14);
}
#hud-st .star.bump {
  animation: starBump 0.5s cubic-bezier(0.3, 2, 0.5, 1);
}
@keyframes starBump {
  0% {
    transform: scale(1.8);
  }
  100% {
    transform: scale(1.14);
  }
}
#hud-level {
  position: fixed;
  z-index: 19;
  top: calc(env(safe-area-inset-top) + var(--orb) + 20px);
  left: 50%;
  transform: translateX(-50%);
  width: 148px;
  height: 44px;
  padding: 0 14px;
  display: grid;
  place-items: center;
  white-space: nowrap;
  overflow: hidden;
  background: url(assets/ui/cap-level.webp) center / 100% 100% no-repeat;
  font-weight: 700;
  font-size: 21px;
  text-shadow: var(--txt);
  pointer-events: none;
}

/* screens */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 0.8);
  padding: calc(env(safe-area-inset-top) + var(--orb) + 18px) 14px calc(env(safe-area-inset-bottom) + 14px);
  text-align: center;
}
#start {
  justify-content: flex-start;
  padding-top: calc(env(safe-area-inset-top) + 11vh);
}
#start {
  pointer-events: none;
} /* the title screen is a level: the finger goes straight through to the rope */
.logo-box {
  position: relative;
  width: min(86vw, 540px);
  pointer-events: none;
  animation: logoFloat 4s ease-in-out infinite;
}
.logo {
  display: block;
  width: 100%;
  filter: drop-shadow(0 0 22px rgba(120, 200, 255, 0.5));
  pointer-events: none;
}
/* a faint glow that sometimes passes over the logo, clipped by the logo drawing itself */
.logo-box::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 44%, rgba(255, 255, 240, 0.7) 50%, transparent 56%) 160% 0 / 250% 100%
    no-repeat;
  -webkit-mask: url(assets/img/logo.webp) center / 100% 100% no-repeat;
  mask: url(assets/img/logo.webp) center / 100% 100% no-repeat;
  animation: logoShine 7s ease-in-out 2s infinite;
}
@keyframes logoShine {
  0%,
  78% {
    background-position: 160% 0;
  }
  100% {
    background-position: -60% 0;
  }
}
/* a real, translated subtitle over the little plaque engraved in the logo (which vanishes, being so small, on a phone) */
.logo-sub {
  position: absolute;
  left: 50%;
  top: 83.5%;
  transform: translate(-50%, -50%);
  min-width: 47%;
  padding: 0.28em 0.9em;
  border-radius: 99px;
  white-space: nowrap;
  text-align: center;
  font-weight: 700;
  font-size: max(11.5px, calc(min(86vw, 540px) * 0.031));
  letter-spacing: 0.04em;
  color: #fff4cf;
  text-shadow: 0 1px 2px rgba(20, 40, 80, 0.8);
  background: linear-gradient(180deg, #2a7f96, #1d4f7a);
  box-shadow:
    0 0 0 1.5px #f3cf73,
    0 2px 8px rgba(10, 30, 70, 0.5);
}
@keyframes logoFloat {
  50% {
    transform: translateY(-6px) rotate(-0.6deg);
  }
}
.pill.total {
  font-size: calc(var(--u) * 1.85);
  min-width: 150px;
  --ph: calc(var(--u) * 3.6);
}
.pill.total .star {
  width: 1.35em;
}
.tap {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: calc(var(--u) * 1.25);
  color: #fff;
  text-shadow:
    var(--txt),
    0 0 18px rgba(120, 230, 255, 0.7);
  animation: tapPulse 1.6s ease-in-out infinite;
}
@keyframes tapPulse {
  50% {
    opacity: 0.6;
    transform: scale(0.97);
  }
}

/* glass capsule buttons */
.btn {
  position: relative;
  isolation: isolate;
  height: var(--bh);
  min-width: 0;
  border: 0;
  padding: 0 calc(var(--bh) * 0.42);
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: calc(var(--bh) * 0.5);
  text-shadow: var(--txt);
  white-space: nowrap;
}
.btn > span {
  display: block;
  min-width: 0;
  max-width: 100%;
}
.btn.big {
  --bh: clamp(68px, calc(var(--u) * 5), 104px);
  width: min(76vw, 420px);
  margin-top: 2vh;
  margin-bottom: 0;
  font-size: calc(var(--bh) * 0.5);
}
.btn.wide {
  width: 100%;
}

/* glass windows */
.card {
  position: relative;
  isolation: isolate;
  width: min(90vw, calc(var(--u) * 21));
  max-height: calc(100dvh - 12px);
  padding: calc(var(--u) * 1.5) calc(var(--u) * 1.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 0.85);
}
.card::before,
.pop::before {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: -2;
  border-radius: 40px;
  background: rgba(34, 28, 112, 0.5);
}
#pause .ribbon {
  font-size: calc(var(--u) * 2.75);
}
#end .ribbon {
  font-size: calc(var(--u) * 2.15);
}
.card.narrow {
  gap: calc(var(--u) * 1.05);
  width: min(72vw, calc(var(--u) * 18.5));
  padding-top: calc(var(--u) * 1.9);
  padding-bottom: calc(var(--u) * 1.9);
}
.ribbon {
  max-width: 100%;
  font-weight: 700;
  font-size: calc(var(--u) * 2.75);
  line-height: 1.12;
  color: #fff;
  text-shadow: var(--txt);
  white-space: nowrap;
}
.card .ribbon {
  font-size: calc(var(--u) * 2.35);
}
#pause {
  justify-content: flex-start;
  padding-top: calc(env(safe-area-inset-top) + 21vh);
}
.sub {
  margin: 0;
  max-width: 100%;
  font-weight: 700;
  font-size: calc(var(--u) * 1.85);
  min-height: 1.2em;
  text-shadow: var(--txt);
}
#end {
  justify-content: flex-start;
  padding-top: calc(env(safe-area-inset-top) + var(--orb) + 54px);
}
#end-stars {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 0.2);
  margin: 2px 0 0;
}
#end-stars .star {
  width: calc(var(--u) * 4.7);
}
#end-stars .star:nth-child(2) {
  width: calc(var(--u) * 5.6);
  transform: translateY(-8%);
}
#end-stars .star:nth-child(2) {
  --y: -8%;
}
#end-stars .star.got.land {
  animation: starLand 0.38s both cubic-bezier(0.3, 1.9, 0.5, 1);
}
@keyframes starLand {
  from {
    transform: translateY(var(--y, 0)) scale(1.3);
  }
  to {
    transform: translateY(var(--y, 0));
  }
}
.row-btn > * {
  animation: btnIn 0.4s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}
.row-btn > *:nth-child(1) {
  animation-delay: 0.62s;
}
.row-btn > *:nth-child(2) {
  animation-delay: 0.7s;
}
.row-btn > *:nth-child(3) {
  animation-delay: 0.78s;
}
@keyframes btnIn {
  from {
    transform: translateY(14px) scale(0.7);
    opacity: 0;
  }
}
#end-stars.lost .star,
#end-stars.lost .star:nth-child(2) {
  width: calc(var(--u) * 3.9);
  transform: none;
  --y: 0;
}
html.calm .confetti {
  position: fixed;
  z-index: 46;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
}
#end-stars.lost ~ .sub {
  font-size: calc(var(--u) * 1.2);
}
@keyframes starIn {
  from {
    transform: translateY(var(--y, 0)) scale(0.2) rotate(-30deg);
    opacity: 0;
  }
  to {
    transform: translateY(var(--y, 0));
    opacity: 1;
  }
}
.row-btn {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  align-items: center;
}
.row-btn .orb {
  --orb: clamp(56px, calc(var(--u) * 3.9), 84px);
}
.row-btn .orb.hot {
  --orb: clamp(78px, calc(var(--u) * 5.6), 118px);
}
.row-btn .btn {
  --bh: clamp(56px, calc(var(--u) * 3.9), 84px);
  flex: 0 1 calc(var(--bh) * 2.1);
}
.row-btn .ic-next {
  width: calc(var(--bh) * 0.6);
  height: calc(var(--bh) * 0.5);
}

/* world map: bubbles with the pond inside */
#worlds,
#levels {
  justify-content: flex-start;
  padding-top: calc(env(safe-area-inset-top) + var(--orb) + 14px);
}
.back {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 14px);
  left: calc(env(safe-area-inset-left) + 12px);
}
#worlds .pill.total {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  --ph: var(--orb);
  min-width: calc(var(--orb) * 2.4);
  font-size: calc(var(--orb) * 0.48);
  padding: 0 20px;
}
/* title of the map and of the level list in the same glass strip as "Level 6" */
#worlds > .ribbon,
#levels > .ribbon {
  border: solid transparent;
  border-width: 0.52em;
  border-image: url(assets/ui/cap-level.webp) 92 fill;
  padding: 0 0.45em;
  margin: 0 auto;
  font-size: calc(var(--u) * 2.1);
  line-height: 1.1;
}
/* path of petals between the worlds */
.ppath {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
#world-list > .wcard {
  z-index: 1;
}
.pp {
  position: absolute;
  width: 14px;
  height: 7px;
  margin: -3.5px 0 0 -7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transform: rotate(var(--a));
}
.pp.on {
  background: linear-gradient(90deg, #ffd1ec, #ff8fc8);
  box-shadow: 0 0 6px rgba(255, 150, 210, 0.85);
}
.pp.new {
  animation: ppOn 0.3s calc(0.55s + var(--k) * 0.06s) both;
}
@keyframes ppOn {
  from {
    background: rgba(255, 255, 255, 0.28);
    box-shadow: none;
    transform: rotate(var(--a)) scale(0.4);
  }
  60% {
    transform: rotate(var(--a)) scale(1.6);
  }
}
#world-list {
  position: relative;
  --w: min(43vw, 320px, calc((100dvh - 140px - var(--u) * 6.6) / 2 - var(--u) * 2.5));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, calc(var(--w) + 18px)));
  gap: 12px 10px;
  justify-content: center;
  margin-top: auto;
  margin-bottom: auto;
  padding-bottom: calc(var(--u) * 3);
}
.wcard {
  position: relative;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #fff;
}
.wb {
  position: relative;
  display: block;
  width: var(--w);
  height: var(--w);
  animation: bobW 4.4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -1.1s);
}
@keyframes bobW {
  50% {
    translate: 0 calc(var(--w, 80px) * -0.03);
  }
}
.wring {
  -webkit-mask: radial-gradient(closest-side, transparent 93.2%, #000 94.2%);
  mask: radial-gradient(closest-side, transparent 93.2%, #000 94.2%);
}
.wring,
.wfill {
  position: absolute;
  inset: 0;
  background: url(assets/ui/ring-empty.webp) center / 100% 100% no-repeat;
}
.wfill {
  inset: 0;
  background-image: url(assets/ui/ring-full.webp);
  -webkit-mask: conic-gradient(#000 calc(var(--p) * 1turn), transparent 0);
  mask: conic-gradient(#000 calc(var(--p) * 1turn), transparent 0);
}
.wb img.lk.fall {
  animation: lockFall 0.85s 0.35s cubic-bezier(0.5, 0, 0.9, 0.5) both;
}
@keyframes lockFall {
  0%,
  20% {
    transform: rotate(0);
    opacity: 1;
  }
  8% {
    transform: rotate(-12deg);
  }
  16% {
    transform: rotate(11deg);
  }
  100% {
    transform: translateY(calc(var(--w, 80px) * 0.9)) rotate(38deg);
    opacity: 0;
  }
}
.wb img {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
  object-fit: contain;
}
.wcard.lock .wb img:first-child {
  filter: saturate(0.92) brightness(0.72);
}
.wb img.lk {
  inset: 40% 41.5%;
  width: 17%;
  height: 20%;
  filter: drop-shadow(0 2px 5px rgba(18, 10, 70, 0.8));
}
.wcard b {
  display: block;
  max-width: 100%;
  font-weight: 700;
  font-size: calc(var(--u) * 1.14);
  line-height: 1.1;
  white-space: nowrap;
  text-shadow: var(--txt);
}
.wcard .wst {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: calc(var(--u) * 0.98);
  text-shadow: var(--txt);
  white-space: nowrap;
  max-width: 100%;
}
.wcard.lock .wst {
  font-size: calc(var(--u) * 0.84);
  white-space: normal;
  line-height: 1.05;
  justify-content: center;
}
.wcard .wst .star {
  width: 1.2em;
}
.wcard.lock {
  cursor: default;
}
.wcard.fresh {
  animation: unlockPop 0.9s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}
@keyframes unlockPop {
  0% {
    transform: scale(0.85);
  }
  100% {
    transform: none;
  }
}

/* level select: glass bubbles */
#grid {
  --c: min(25vw, 124px, calc((100dvh - 128px - var(--u) * 7) / 5 - 8px));
  display: grid;
  grid-template-columns: repeat(3, var(--c));
  gap: 8px clamp(8px, 3.2vw, 18px);
  margin-top: 2px;
}
#iris {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
  display: none;
}
#iris.on {
  display: block;
  pointer-events: auto;
}
.cell {
  width: var(--c);
  height: var(--c);
  border: 0;
  padding: 0;
  color: #fff;
  cursor: pointer;
  background: url(assets/ui/b-done.webp) center / contain no-repeat;
  font-weight: 700;
  font-size: calc(var(--c) * 0.38);
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--c) * 0.03);
  text-shadow: var(--txt);
  animation:
    cellIn 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both,
    bob 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 30ms), calc(var(--i, 0) * -0.37s);
}
.cell.next {
  animation:
    cellIn 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both,
    bob 3.6s ease-in-out infinite,
    nextGlow 1.9s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 30ms), calc(var(--i, 0) * -0.37s), 0s;
}
@keyframes bob {
  50% {
    translate: 0 calc(var(--c, 40px) * -0.05);
  }
}
@keyframes nextGlow {
  50% {
    filter: brightness(1.14) drop-shadow(0 0 8px rgba(90, 240, 230, 0.7));
  }
}
.cell.next {
  background-image: url(assets/ui/b-next.webp);
}
.cell.lock {
  background-image: url(assets/ui/b-lock.webp);
  cursor: default;
}
.cell .st {
  display: flex;
  gap: 0;
}
.cell .st .star {
  width: calc(var(--c) * 0.205);
}
.cell {
  padding-bottom: calc(var(--c) * 0.05);
}
#levels-total > .fr {
  border-image-source: url(assets/ui/cap-level.webp);
}
@keyframes cellIn {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}
#levels-total {
  flex: 0 0 auto;
  --ph: calc(var(--u) * 3.3);
  min-width: 170px;
  font-size: calc(var(--u) * 1.45);
  margin-top: auto;
  margin-bottom: 4px;
}
#levels-total .star {
  width: 1.3em;
}

/* sound and gear panels */
.pop {
  position: fixed;
  z-index: 40;
  isolation: isolate;
  top: calc(env(safe-area-inset-top) + var(--orb) + 34px);
  right: calc(env(safe-area-inset-right) + 12px);
  width: min(calc(var(--u) * 21), 88vw);
  max-height: calc(100dvh - var(--orb) - 26px);
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pop h3 {
  margin: 0 0 2px;
  text-align: center;
  font-weight: 700;
  font-size: calc(var(--u) * 2.3);
  color: #fff;
  text-shadow: var(--txt);
}
.row,
.slide {
  position: relative;
  isolation: isolate;
  min-height: calc(var(--u) * 3.4);
  padding: 0 calc(var(--u) * 0.95);
  font-weight: 600;
  font-size: calc(var(--u) * 1.3);
  text-shadow: var(--txt);
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.row > span {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
}
.row.link {
  border: 0;
  background: none;
  cursor: pointer;
}
.row .chev {
  flex: 0 0 auto;
  width: 13px;
  height: 20px;
  background: url(assets/ui/chevron.webp) center / contain no-repeat;
}
.row select {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 1 auto;
  max-width: 48%;
  min-height: 44px;
  border: 0;
  color: #fff;
  font: inherit;
  text-align: right;
  text-align-last: right;
  padding: 0 16px 0 2px;
  cursor: pointer;
  background: url(assets/ui/chevron.webp) right center / 9px 14px no-repeat;
  text-shadow: var(--txt);
}
.row select option {
  color: #fff;
  background: #2b2678;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: calc(var(--u) * 3.7);
  height: calc(var(--u) * 1.9);
  margin: 0;
  cursor: pointer;
  background: url(assets/ui/toggle-off.webp) center / contain no-repeat;
  transition: transform 0.25s cubic-bezier(0.3, 1.9, 0.45, 1);
}
.switch:checked {
  background-image: url(assets/ui/toggle-on.webp);
}
.switch:active {
  transform: scale(0.92);
}
.slide {
  display: grid;
  grid-template-columns: calc(var(--u) * 1.6) minmax(0, 34%) minmax(104px, 1fr);
  gap: 10px;
  align-items: center;
}
.slide > span {
  min-width: 0;
  text-align: left;
  white-space: nowrap;
}
.sl {
  position: relative;
  height: 40px;
  --f: 0.8;
  display: flex;
  align-items: center;
}
.sl::before,
.sl .fill {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 18px;
  transform: translateY(-50%);
  background: url(assets/ui/track.webp) center / 100% 100% no-repeat;
}
.sl .fill {
  background-image: url(assets/ui/track-full.webp);
  clip-path: inset(0 calc(100% - (19px + (100% - 38px) * var(--f))) 0 0);
}
.sl input {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 40px;
  margin: 0;
  background: none;
  cursor: pointer;
}
.sl input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 38px;
  height: 38px;
  border: 0;
  filter: brightness(1.35);
  background: url(assets/ui/knob.webp) center / contain no-repeat;
}
.sl input::-moz-range-thumb {
  width: 38px;
  height: 38px;
  border: 0;
  filter: brightness(1.35);
  background: url(assets/ui/knob.webp) center / contain no-repeat;
}
#gear-close {
  margin-top: 4px;
  align-self: center;
  width: 76%;
  flex: 0 0 auto;
}
#panel-gear {
  left: 50%;
  right: auto;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(84vw, calc(var(--u) * 21));
  padding: calc(var(--u) * 1.3) calc(var(--u) * 1);
  gap: calc(var(--u) * 0.45);
}
#panel-gear:not(.hidden) {
  animation-name: gearIn;
  transform-origin: center;
}
@keyframes gearIn {
  from {
    transform: translate(-50%, -50%) scale(0.88);
    opacity: 0;
  }
}

/* how to play */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 0.7);
  width: 100%;
}
#howto-ok {
  width: 84%;
}
.steps li {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: calc(var(--u) * 5.2);
  padding: 6px calc(var(--u) * 0.95);
  text-align: left;
  text-wrap: balance;
  font-weight: 600;
  font-size: calc(var(--u) * 1.12);
  line-height: 1.12;
  text-shadow: var(--txt);
}
.steps li > span:last-child {
  min-width: 0;
}
.pic {
  position: relative;
  flex: 0 0 auto;
  width: calc(var(--u) * 4.3);
  height: calc(var(--u) * 4.3);
  display: grid;
  place-items: center;
}
.pic img {
  width: 92%;
  height: 92%;
  object-fit: contain;
}
.pic canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pic canvas + img,
.pic img + canvas {
  z-index: 1;
}
.steps li > .fr {
  filter: brightness(0.6) saturate(1.25);
}
.pic.cut i {
  position: absolute;
  left: 0;
  right: 0;
  top: 46%;
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, #eafcff, transparent);
  box-shadow: 0 0 10px #8fe8ff;
  animation: swipeDemo 1.6s ease-in-out infinite;
}
@keyframes swipeDemo {
  0% {
    transform: translateX(-60%) scaleX(0.3);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  70% {
    transform: translateX(40%) scaleX(1);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

/* new element notice and toast */
#intro {
  position: fixed;
  z-index: 25;
  isolation: isolate;
  left: 50%;
  top: calc(env(safe-area-inset-top) + var(--orb) + 72px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 94vw;
  min-height: 48px;
  padding: 4px 18px 4px 10px;
  animation: introIn 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  pointer-events: none;
  text-shadow: var(--txt);
}
#intro b {
  flex: 0 0 auto;
  padding: 4px 12px;
  background: url(assets/ui/cap-level.webp) center / 100% 100% no-repeat;
  font-weight: 700;
  font-size: 13px;
}
#intro img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}
#intro span {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.1;
}
@keyframes introIn {
  from {
    transform: translate(-50%, -20px) scale(0.8);
    opacity: 0;
  }
}
.pop-txt {
  position: fixed;
  z-index: 44;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-weight: 700;
  font-size: clamp(26px, calc(var(--u) * 2.4), 44px);
  white-space: nowrap;
  color: #ffe58a;
  text-shadow:
    1.5px 0 #7a3a12,
    -1.5px 0 #7a3a12,
    0 1.5px #7a3a12,
    0 -1.5px #7a3a12,
    1px 1px #7a3a12,
    -1px 1px #7a3a12,
    1px -1px #7a3a12,
    -1px -1px #7a3a12,
    0 3.5px 0 #7a3a12,
    0 0 16px rgba(255, 210, 120, 0.8);
  animation: popTxt 1.05s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
@keyframes popTxt {
  0% {
    transform: translate(-50%, -50%) scale(0.3) rotate(-8deg);
    opacity: 0;
  }
  22% {
    transform: translate(-50%, -50%) scale(1.15) rotate(-4deg);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -110%) scale(1) rotate(-4deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -150%) scale(0.95) rotate(-4deg);
    opacity: 0;
  }
}
html.calm .pop-txt {
  animation: popCalm 1.05s both !important;
}
@keyframes popCalm {
  0%,
  75% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%);
  }
}
#toast {
  position: fixed;
  z-index: 45;
  isolation: isolate;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 12vh);
  transform: translateX(-50%);
  padding: 12px 26px;
  max-width: 94vw;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: var(--txt);
  animation: introIn 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

/* screens come in: never flash, they only slide and grow slightly; buttons with a spring */
.screen:not(.hidden) {
  animation: screenIn 0.3s ease-out both;
}
.screen:not(.hidden) .card {
  animation: cardIn 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.pop:not(.hidden) {
  animation: popIn 0.28s cubic-bezier(0.3, 1.5, 0.5, 1) both;
  transform-origin: top right;
}
@keyframes screenIn {
  from {
    opacity: 0;
  }
}
@keyframes cardIn {
  from {
    transform: translateY(24px) scale(0.92);
    opacity: 0;
  }
}
@keyframes popIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}
.btn,
.orb,
.cell,
.wcard,
.row.link {
  transition:
    transform 0.38s cubic-bezier(0.3, 1.9, 0.45, 1),
    filter 0.15s;
}
.btn:active,
.orb:active,
.cell:active,
.wcard:active,
.row.link:active {
  transform: scale(0.92);
  filter: brightness(0.86);
  transition-duration: 0.06s;
}
.tap.gone {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.25s,
    transform 0.25s;
  animation: none;
}
.tap-ring {
  position: fixed;
  z-index: 70;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  pointer-events: none;
  background: url(assets/ui/ring-empty.webp) center / contain no-repeat;
  animation: tapRing 0.5s ease-out both;
}
@keyframes tapRing {
  from {
    transform: scale(0.25);
    opacity: 0.95;
  }
  to {
    transform: scale(1.25);
    opacity: 0;
  }
}
.btn.sheen::after {
  content: '';
  position: absolute;
  inset: 7% 3.5%;
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.34) 50%, transparent 58%) no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
  animation: sheen 8s ease-in-out infinite 2s;
}
@keyframes sheen {
  0%,
  88% {
    background-position: 130% 0;
  }
  100% {
    background-position: -40% 0;
  }
}
.bump {
  display: inline-block;
  animation: numBump 0.5s cubic-bezier(0.3, 1.9, 0.5, 1);
}
@keyframes numBump {
  30% {
    transform: scale(1.22);
  }
}
.fly-star {
  position: fixed;
  z-index: 50;
  width: 44px;
  height: 44px;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 210, 80, 0.9));
}
html.calm *,
html.calm *::before,
html.calm *::after {
  animation: none !important;
  transition: none !important;
}

@media (max-width: 420px) {
  :root {
    --orb: 52px;
  }
}
@media (max-width: 340px) {
  :root {
    --orb: 46px;
  }
  #corner,
  #hud {
    gap: 4px;
  }
  #hud-st .star {
    width: 20px;
  }
  .row,
  .slide {
    padding: 0 12px;
    font-size: 15px;
  }
}

/* landscape: title between the buttons, worlds in a row and levels in 5 x 3 */
@media (orientation: landscape) and (min-height: 521px) {
  :root {
    --u: min(3vmin, 30px);
  }
}
@media (orientation: landscape) {
  #worlds,
  #levels {
    padding-top: calc(env(safe-area-inset-top) + 12px);
    gap: 8px;
  }
  #worlds .ribbon,
  #levels .ribbon {
    max-width: calc(100vw - var(--orb) * 4 - 60px);
  }
  #worlds .pill.total {
    top: calc(env(safe-area-inset-top) + 14px);
    bottom: auto;
    left: calc(env(safe-area-inset-left) + var(--orb) + 26px);
    transform: none;
  }
  #world-list {
    --w: min(19vw, 300px, calc(100dvh - 176px));
    grid-template-columns: repeat(4, minmax(0, calc(var(--w) + 16px)));
    gap: 12px;
    margin-block: auto;
    padding-bottom: 0;
  }
  #grid {
    --c: min(12vw, 136px, calc((100dvh - 104px) / 3 - 8px));
    grid-template-columns: repeat(5, var(--c));
    gap: 6px clamp(10px, 2.6vw, 34px);
    margin-block: auto;
  }
  #worlds .ribbon,
  #levels .ribbon {
    font-size: calc(var(--u) * 2.35);
  }
  #levels-total {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 14px);
    left: calc(env(safe-area-inset-left) + var(--orb) + 26px);
    margin: 0;
    --ph: var(--orb);
    min-width: calc(var(--orb) * 2.7);
    font-size: calc(var(--orb) * 0.42);
    padding: 0 20px;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .screen:not(#worlds):not(#levels) {
    padding-top: calc(env(safe-area-inset-top) + 8px);
    padding-bottom: 6px;
    gap: 6px;
  }
  #start {
    padding-top: calc(env(safe-area-inset-top) + 8px) !important;
  }
  .logo-box {
    width: min(38vw, 300px);
  }
  .logo-sub {
    font-size: max(11px, calc(min(38vw, 300px) * 0.034));
  }
  .btn.big {
    --bh: 56px;
    margin-top: 2px;
    width: min(36vw, 270px);
  }
  #end-stars.lost .star,
  #end-stars.lost .star:nth-child(2) {
    width: calc(var(--u) * 3.6);
  }
  .pic {
    width: 46px;
    height: 46px;
  }
  #end {
    justify-content: center;
    padding-top: 6px;
  }
  #pause {
    justify-content: center;
  }
  .card {
    width: min(66vw, calc(var(--u) * 25));
    padding: 12px 18px 12px;
    gap: 4px;
  }
  .card .ribbon {
    font-size: calc(var(--u) * 1.85);
  }
  .sub {
    font-size: calc(var(--u) * 1.5);
    min-height: 0;
  }
  #end-stars.lost ~ .sub {
    font-size: calc(var(--u) * 1.05);
  }
  #end-stars .star {
    width: calc(var(--u) * 4.3);
  }
  #end-stars .star:nth-child(2) {
    width: calc(var(--u) * 4.9);
  }
  #end-stars.lost .star:nth-child(2) {
    width: calc(var(--u) * 4.3);
  }
  .row-btn .orb {
    --orb: max(52px, calc(var(--u) * 3.6));
  }
  .row-btn .orb.hot {
    --orb: max(60px, calc(var(--u) * 4.2));
  }
  .row-btn .btn {
    --bh: max(52px, calc(var(--u) * 3.6));
  }
  .card.narrow {
    width: min(66vw, 460px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .card.narrow .ribbon,
  .card.narrow #p-resume {
    grid-column: 1 / -1;
    justify-self: center;
  }
  .card.narrow .btn {
    --bh: 48px;
  }
  .steps {
    flex-direction: row;
    gap: 6px;
  }
  .steps li {
    flex: 1 1 0;
    flex-direction: column;
    text-align: center;
    padding: 10px 4px;
    gap: 2px;
    min-height: 0;
    font-size: 13px;
  }
  #howto .btn {
    --bh: 46px;
  }
  .pop {
    overflow: auto;
    padding: 10px 14px 12px;
    gap: 5px;
  }
  .pop h3 {
    font-size: 19px;
  }
  #panel-gear {
    top: calc(env(safe-area-inset-top) + 6px);
    transform: translateX(-50%);
    width: min(560px, 66vw);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 10px 14px 12px;
  }
  #panel-gear:not(.hidden) {
    animation-name: gearInL;
  }
  #panel-gear h3 {
    grid-column: 1 / -1;
  }
  #panel-gear .row {
    min-height: 46px;
    font-size: 14.5px;
    padding: 0 12px;
  }
  #panel-gear .ic {
    width: 20px;
    height: 20px;
  }
  #gear-close {
    display: none;
  }
}
/* landscape with a free side column: stars, level number and the "New!" notice leave the top of the field */
@media (min-aspect-ratio: 115/100) {
  #hud {
    right: auto;
    width: calc(var(--orb) * 2 + 8px);
    flex-wrap: wrap;
  }
  #hud-stars {
    margin: 0;
    flex: 1 0 100%;
  }
  #hud-level {
    left: calc(env(safe-area-inset-left) + 10px);
    width: calc(var(--orb) * 2 + 8px);
    transform: none;
    top: calc(env(safe-area-inset-top) + var(--orb) * 1.82 + 26px);
  }
  #intro {
    left: calc(env(safe-area-inset-left) + 8px);
    top: calc(env(safe-area-inset-top) + var(--orb) * 1.82 + 68px);
    transform: none;
    width: auto;
    max-width: min(28vw, 300px);
    flex-wrap: wrap;
    padding: 10px 14px;
    animation-name: introInSide;
  }
}
@keyframes gearInL {
  from {
    transform: translateX(-50%) scale(0.88);
    opacity: 0;
  }
}
@keyframes introInSide {
  from {
    transform: translateX(-20px) scale(0.85);
    opacity: 0;
  }
}
/* End of style.css (complete file). */
