/* Layout of each screen, portrait and landscape (measurements from the design inventory, in --u).
   Portrait: 1u = 1% of the design width (1024). Landscape: 1u = 1% of the design height (1024). */
.screen {
  position: absolute;
  inset: 0;
  display: none;
}
body[data-screen='start'] #s-start,
body[data-screen='menu'] #s-menu,
body[data-screen='map'] #s-map,
body[data-screen='game'] #s-game {
  display: block;
}
.screen.enter {
  animation: fade-in 0.25s both;
}
.globe-box {
  position: absolute;
  pointer-events: none;
}

/* top right corner (all screens) */
#corner {
  position: absolute;
  top: calc(var(--u) * 2.4 + var(--sat));
  right: calc(var(--u) * 2.4 + var(--sar));
  display: flex;
  gap: calc(var(--u) * 2.1);
  z-index: 3;
}
body.land #corner .rb {
  width: max(44px, calc(var(--u) * 7.5));
  height: max(44px, calc(var(--u) * 7.5));
}

/* --- start and menu (portrait): logo on top, globe in the middle, buttons at the bottom --- */
.logo {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  top: calc(var(--u) * 5 + var(--sat));
  width: calc(var(--u) * 48);
  pointer-events: none;
  filter: drop-shadow(0 calc(var(--u) * 1) calc(var(--u) * 0.8) rgba(20, 0, 50, 0.4));
  animation: floaty 3.6s ease-in-out infinite;
}
@keyframes floaty {
  50% {
    translate: -50% calc(var(--u) * -1);
  }
}
body.reduced .logo {
  animation: none;
}
/* start and menu globe: centered in the space between the logo and the buttons (on a tall phone it moves down; before it stuck to the logo) */
#s-start .globe-box,
#s-menu .globe-box {
  left: 50%;
  translate: -50% 0;
  top: calc(var(--u) * 31 + var(--sat));
  bottom: calc(var(--u) * 43 + var(--sab));
  width: calc(var(--u) * 76);
  min-height: calc(var(--u) * 60);
}
.tap {
  position: absolute;
  left: 50%;
  bottom: calc(var(--u) * 20 + var(--sab));
  translate: -50% 0;
  width: calc(var(--u) * 60);
  height: calc(var(--u) * 16);
  animation: nudge 1.8s ease-in-out infinite;
  border-style: solid;
  border-color: transparent;
  border-width: calc(var(--u) * 4.2) calc(var(--u) * 6) calc(var(--u) * 5.2);
  border-image: url(../assets/ui/btn-big.webp) 70 92 88 fill / calc(var(--u) * 4.2) calc(var(--u) * 6)
    calc(var(--u) * 5.2);
}
.tap .face {
  inset: calc(var(--u) * -4.2) calc(var(--u) * -3) calc(var(--u) * -5.2);
  font-size: calc(var(--u) * 4.7);
}
body.land .tap .face {
  font-size: calc(var(--u) * 4.4);
} /* long languages fit without shrinking ("Touchez pour jouer") */
@keyframes nudge {
  50% {
    transform: scale(1.04);
  }
}
body.reduced .tap {
  animation: none;
}
#s-start {
  pointer-events: auto;
  cursor: pointer;
}
.menu-col {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--u) * 5 + var(--sab));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 2);
}
#b-map {
  width: calc(var(--u) * 30);
  border-image-source: url(../assets/ui/btn-big.webp);
  border-image-slice: 70 92 88 fill;
}
.menu-row {
  display: flex;
  gap: calc(var(--u) * 3);
}
#b-album .ic,
#b-modes .ic {
  left: 14%;
  top: 12%;
  width: 72%;
  height: 72%;
}
#b-how.small,
#b-album.small,
#b-modes.small {
  width: calc(var(--u) * 12.5);
  height: calc(var(--u) * 12.5);
}

/* --- start and menu (landscape): globe on the left, logo and buttons on the right --- */
body.land .logo {
  left: auto;
  right: calc(var(--u) * 6 + var(--sar) + var(--sx));
  translate: 0 0;
  top: calc(var(--u) * 12);
  width: calc(var(--u) * 58);
}
@keyframes floaty-land {
  50% {
    translate: 0 calc(var(--u) * -1);
  }
}
body.land .logo {
  animation-name: floaty-land;
}
body.land #s-start .globe-box,
body.land #s-menu .globe-box {
  left: calc(var(--u) * 14 + var(--sal) + var(--sx));
  translate: 0 0;
  top: calc(var(--u) * 9);
  bottom: auto;
  width: calc(var(--u) * 72);
  height: calc(var(--u) * 72);
  min-height: 0;
}
body.land .tap,
body.land .menu-col {
  left: auto;
  translate: 0 0;
  right: calc(var(--u) * 13 + var(--sar) + var(--sx));
}
body.land .tap {
  bottom: calc(var(--u) * 20);
  width: calc(var(--u) * 54);
  right: calc(var(--u) * 8 + var(--sar) + var(--sx));
} /* does not touch the globe on the left */
body.land .menu-col {
  bottom: calc(var(--u) * 10);
}

/* --- game (portrait) --- */
#b-pause {
  position: absolute;
  left: calc(var(--u) * 2.4 + var(--sal));
  top: calc(var(--u) * 2.4 + var(--sat));
}
/* pills in the middle, between pause and the sound/gear corner (which are at least 44 px): they never touch */
#hud-pills {
  position: absolute;
  --rb: max(44px, calc(var(--u) * 8.2));
  left: calc(var(--u) * 4.4 + var(--rb) + var(--sal));
  right: calc(var(--u) * 6.5 + var(--rb) * 2 + var(--sar));
  top: calc(var(--u) * 3 + var(--sat));
  display: flex;
  justify-content: center;
  gap: calc(var(--u) * 2.2);
}
.hp {
  position: relative;
  height: calc(var(--u) * 7);
  min-width: calc(var(--u) * 19);
  padding: 0 calc(var(--u) * 2.4);
  border: calc(var(--u) * 2.2) solid transparent;
  border-image: url(../assets/ui/hud-pill.webp) 60 fill / calc(var(--u) * 3.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 1.2);
}
#hud-pills .hp:first-child {
  border-image-source: url(../assets/ui/btn-big.webp);
  border-image-slice: 70 92 88 fill;
}
.hp .face {
  position: static;
  font-size: calc(var(--u) * 4);
}
.hp .pi {
  width: calc(var(--u) * 4.4);
  height: calc(var(--u) * 4.4);
  object-fit: contain;
}
.hp {
  --fy: calc(var(--u) * 0.1);
} /* face of the HUD pill */
#hud-time-box.low .face {
  color: #ffd0dc;
}
/* centered panel open: pills and bar disappear (they peeked out behind the title ribbon) */
#hud-pills,
#hud-prog {
  transition: opacity 0.18s;
}
body.modal-open #hud-pills,
body.modal-open #hud-prog {
  opacity: 0;
}
/* remaining items: progress bar under the pills (fills as the globe empties) */
#hud-prog {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  top: calc(var(--u) * 11.2 + var(--sat));
  width: calc(var(--u) * 40);
  height: calc(var(--u) * 2.6);
  border-radius: 99px;
  background: rgba(16, 10, 60, 0.55);
  box-shadow: inset 0 0 0 calc(var(--u) * 0.35) rgba(111, 230, 255, 0.55);
}
#hud-prog-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(#b8f4ff, #3fc6f0);
  transition: width 0.35s var(--pop);
}
#hud-prog img {
  position: absolute;
  right: calc(var(--u) * -2.2);
  top: 50%;
  translate: 0 -50%;
  width: calc(var(--u) * 5.4);
}
body.land #hud-prog {
  top: calc(var(--u) * 9 + var(--sat));
  width: calc(var(--u) * 34);
}
#game-globe {
  left: 50%;
  translate: -50% 0;
  top: calc(var(--u) * 15 + var(--sat));
  bottom: calc(var(--u) * 41 + var(--sab));
  width: calc(var(--u) * 88);
}

#zoom {
  position: absolute;
  right: calc(var(--u) * 1.8 + var(--sar));
  top: calc(var(--u) * 20 + var(--sat));
  width: calc(var(--u) * 7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 2.6);
  touch-action: none;
}
.zb {
  position: relative;
  width: max(40px, calc(var(--u) * 7));
  height: max(40px, calc(var(--u) * 7));
}
.zb > img {
  width: 100%;
  height: 100%;
  display: block;
  filter: saturate(0.7) brightness(0.92);
} /* does not draw the eye more than the items */
#zoom .zi {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 50%;
  translate: -50% -58%;
  pointer-events: none;
} /* painted icons: full outline, no CSS cross */

/* portrait track: rotated art (slider-track-v) in 9 slices, only the middle stretches */
#ztrack::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 44px;
  translate: -50% 0;
} /* 44 px touch area; the drawing stays thin */
#ztrack {
  position: relative;
  width: calc(var(--u) * 3.4);
  height: calc(var(--u) * 24);
  border: calc(var(--u) * 1.7) solid transparent;
  border-image: url(../assets/ui/slider-track-v.webp) 28 fill / calc(var(--u) * 1.7);
}
#zfill {
  position: absolute;
  left: calc(var(--u) * -0.9);
  right: calc(var(--u) * -0.9);
  bottom: calc(var(--u) * -1.2);
  border-radius: 99px;
  background: linear-gradient(#b8f4ff, #3fc6f0);
}
#zthumb {
  position: absolute;
  left: 50%;
  top: 0;
  width: calc(var(--u) * 4.4);
  height: calc(var(--u) * 4.4);
  margin: calc(var(--u) * -2.2) 0 0 calc(var(--u) * -2.2);
}

#tray {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--u) * 14.7 + var(--sab));
  width: calc(var(--u) * 97.7);
  height: calc(var(--u) * 24);
}
#tray {
  border: calc(var(--u) * 6) solid transparent;
  border-image: url(../assets/ui/tray.webp) 64 fill / calc(var(--u) * 6);
}
#slots {
  position: absolute;
  left: calc(var(--u) * -1.6);
  right: calc(var(--u) * -1.6);
  top: calc(var(--u) * -1.3);
  bottom: calc(var(--u) * -2.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slot {
  width: calc(var(--u) * 12.3);
  height: auto;
}
body.land .slot {
  width: calc(var(--u) * 10.6);
}
#helpers {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--u) * 2.3 + var(--sab));
  display: flex;
  gap: calc(var(--u) * 9.9);
}
body[data-screen='map'] #mascot {
  display: none;
}

/* --- game (landscape): tray along the full base, hints to the right of it, globe left of center --- */
body.land #hud-pills {
  top: calc(var(--u) * 1.2 + var(--sat));
}
body.land .hp {
  height: calc(var(--u) * 6.4);
  min-width: calc(var(--u) * 23);
}
body.land #game-globe {
  left: 50%;
  width: calc(var(--u) * 73);
  translate: -50% 0;
  top: calc(var(--u) * 12.6 + var(--sat));
  bottom: calc(var(--u) * 21);
} /* below the bar (9 + 2.6u): the globe never touches the HUD */
body.land #zoom {
  top: calc(var(--u) * 21);
  right: calc(var(--u) * 2.4 + var(--sar));
}
body.land #ztrack {
  height: calc(var(--u) * 30);
}
body.land #tray {
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--u) * 1.6 + var(--sab));
  width: calc(var(--u) * 86);
  height: calc(var(--u) * 16);
}
body.land #slots {
  top: calc(var(--u) * -2.3);
  bottom: calc(var(--u) * -3.1);
}
body.land #helpers {
  left: auto;
  translate: 0 0;
  right: calc(var(--u) * 3 + var(--sar));
  bottom: calc(var(--u) * 3 + var(--sab));
  gap: calc(var(--u) * 1.6);
}
body.land .hb {
  width: max(42px, calc(var(--u) * 10.5));
  height: max(42px, calc(var(--u) * 10.5));
}

/* --- level select (back) --- */
#b-back {
  position: absolute;
  left: calc(var(--u) * 2.4 + var(--sal));
  top: calc(var(--u) * 2.4 + var(--sat));
  z-index: 2;
}

/* --- juice --- */
/* tray almost full: soft amber glow that breathes (does not blink) */
#tray.warn {
  filter: drop-shadow(0 0 calc(var(--u) * 1.6) rgba(255, 196, 70, 0.85));
  animation: warn 1.6s ease-in-out infinite;
}
@keyframes warn {
  50% {
    filter: drop-shadow(0 0 calc(var(--u) * 2.6) rgba(255, 196, 70, 0.55));
  }
}
/* last 10 s: the time pill beats like a heart every second (src/fx/stage.js, along with the tick) */
body.reduced #tray.warn {
  animation: none;
}
/* victory stars and confetti: css/fx.css + src/ui/party.js */
/* living background (src/ui/ambient.js, pieces in css/fx.css) and golden level */
#amb {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body[data-special='gold'] #bg {
  filter: saturate(1.15) brightness(1.06) sepia(0.18);
}
/* item and outfit album */
#album-grid {
  display: grid;
  grid-template-columns: repeat(4, calc(var(--u) * 14));
  gap: calc(var(--u) * 2);
}
.alb {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(28, 14, 80, 0.45);
  display: grid;
  place-items: center;
}
.alb img {
  width: 86%;
  filter: brightness(0) invert(0.82) opacity(0.4);
} /* light silhouette: you can see which one is missing */
.alb {
  box-shadow: inset 0 0 0 calc(var(--u) * 0.5) rgba(111, 230, 255, 0.35);
}
.alb.on img {
  filter: none;
}
#outfit-row {
  display: flex;
  gap: calc(var(--u) * 2);
}
.outfit {
  position: relative;
  width: calc(var(--u) * 14);
  aspect-ratio: 406 / 517;
  border-radius: calc(var(--u) * 3);
  background: rgba(28, 14, 80, 0.45);
}
.outfit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.outfit.on {
  box-shadow: 0 0 0 calc(var(--u) * 0.7) #6fe6ff;
}
.outfit.lock img {
  filter: brightness(0.35) saturate(0);
}
/* locked outfit: number + drawn star (never the character ★), centered group */
.outfit .req {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 0.6);
}
.outfit .req .face {
  position: static;
  font-size: calc(var(--u) * 3.6);
}
.outfit .req img {
  width: calc(var(--u) * 3.8);
  height: calc(var(--u) * 3.8);
  filter: none;
  flex: none;
}
.album-h {
  font-size: calc(var(--u) * 5);
  flex: none;
}
/* combo badge */
.combo-pop.word {
  font-size: calc(var(--u) * 7.4);
  white-space: nowrap;
}
.combo-pop {
  position: fixed;
  z-index: 4;
  translate: -50% -50%;
  font-size: calc(var(--u) * 8 * var(--k));
  --o: 0.14em;
  pointer-events: none;
  color: #fff6b0;
  text-shadow:
    calc(var(--o) * 0.5) 0 0 var(--ink),
    calc(var(--o) * -0.5) 0 0 var(--ink),
    0 calc(var(--o) * 0.5) 0 var(--ink),
    0 calc(var(--o) * -0.5) 0 var(--ink),
    calc(var(--o) * 0.35) calc(var(--o) * 0.35) 0 var(--ink),
    calc(var(--o) * -0.35) calc(var(--o) * 0.35) 0 var(--ink),
    calc(var(--o) * 0.35) calc(var(--o) * -0.35) 0 var(--ink),
    calc(var(--o) * -0.35) calc(var(--o) * -0.35) 0 var(--ink),
    0 calc(var(--o) * 0.8) 0 var(--ink2);
  animation: combo 0.95s var(--pop) forwards;
}
/* level-start notice: enters, stays still to be read (2.6 s) and leaves rising */
.combo-pop.aviso {
  animation-name: aviso;
  animation-duration: 2.6s;
}
@keyframes aviso {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  10% {
    transform: scale(1.08);
    opacity: 1;
  }
  16% {
    transform: scale(1);
  }
  82% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(calc(var(--u) * -6)) scale(0.96);
    opacity: 0;
  }
}
@keyframes combo {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  25% {
    transform: scale(1.1);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translateY(calc(var(--u) * -8)) scale(1);
    opacity: 0;
  }
}

/* --- kitten of the title, menu and game screens: standing on the asteroid rock that comes out of the left edge.
   --bw = width of the rock; --bb = height of its base. --- */
:root {
  --bw: calc(var(--u) * 40);
  --bb: calc(var(--u) * 24 + var(--sab));
}
body.land {
  --bw: calc(var(--u) * 42);
  --bb: calc(var(--u) * 6 + var(--sab));
}
#branch {
  position: absolute;
  display: none;
  pointer-events: none;
  width: var(--bw);
  bottom: var(--bb);
}
/* in the game too: the kitten never floats, it always stands on the rock (which comes out of the edge, in any proportion) */
/* in portrait, the base of the rock is only 2.2u below the top of the tray (14.7u + 24u = 38.7u): the thick rock shows in full
   above it (with 28.5u the tray covered most of its thickness and the rock looked like a thin plank) */
body[data-screen='game'] {
  --bw: calc(var(--u) * 35);
  --bb: calc(var(--u) * 36.5 + var(--sab));
}
body.land[data-screen='game'] {
  --bw: calc(var(--u) * 37);
  --bb: calc(var(--u) * 4 + var(--sab));
}
body[data-screen='start'] #branch,
body[data-screen='menu'] #branch,
body[data-screen='game'] #branch {
  display: block;
}
/* asteroid rock (assets/ui/branch.webp, 600x208): solid rock
   from x 0 to 470, rows 0 to 207; the ground under the feet (0.30 to 0.65 of the width) is at row 17 of 208 (the rims
   of the craters reach row 9), 116 thick there (= 0.193 bw), thicker at the left and thinner at the tip.
   --ml = left of the kitten; the rock starts 0.10 bw before it, so both feet (x 0.33 to 0.67 of the kitten
   picture = 0.34 to 0.60 bw of the rock) always land on the flat part. In the game the rock goes further under the kitten. */
body {
  --ml0: calc(var(--bw) * -0.02);
  --ml: var(--ml0);
} /* title/menu: rock at -0.12 bw, its tip does not reach the button */
body[data-screen='game'] {
  --ml0: calc(var(--bw) * 0.08);
}
/* landscape with a side notch: the body of the kitten moves out of the notch; the rock comes along, from the edge */
body.land {
  --ml: max(var(--ml0), var(--sal));
}
#branch {
  left: calc(var(--ml) - var(--bw) * 0.1);
}
/* foot: the sole (row 449 of the 458 of the picture, 0.0185 bw above the bottom of the image) sinks 19 px of 600 (0.0317 bw) into the
   top face of the rock (only touching the top line looked like floating; more than this would step on the
   front of the rock). Ground = (208 - 17) / 600 = 0.3183 bw above --bb: 0.3183 - 0.0317 - 0.0185 = 0.268. */
body[data-screen='start'] #mascot,
body[data-screen='menu'] #mascot,
body[data-screen='game'] #mascot {
  width: calc(var(--bw) * 0.74);
  left: var(--ml);
  bottom: calc(var(--bb) + var(--bw) * 0.268);
}

/* --- level select: title, world stars, 5x3 grid between two arrows, world dots --- */
.map-title {
  top: calc(var(--u) * 3 + var(--sat));
  width: calc(var(--u) * 62);
}
#map-stars {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  top: calc(var(--u) * 21 + var(--sat));
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1.6);
  height: calc(var(--u) * 8);
  padding: 0 calc(var(--u) * 3.2) 0 calc(var(--u) * 1.4);
  border: calc(var(--u) * 2) solid transparent;
  border-image: url(../assets/ui/hud-pill.webp) 60 fill / calc(var(--u) * 3.4);
}
#map-stars img {
  width: calc(var(--u) * 6.4);
}
#map-stars .face {
  position: static;
  font-size: calc(var(--u) * 4.4);
}
.node.cur .face {
  --fy: calc(var(--u) * 0.3);
} /* the current level's art has the bubble slightly lower */
#map-page {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 0.6);
}
#map-grid {
  display: grid;
  grid-template-columns: repeat(5, calc(var(--u) * 13.4));
  gap: calc(var(--u) * 5) calc(var(--u) * 1.2);
  padding: calc(var(--u) * 2) calc(var(--u) * 1) calc(var(--u) * 5);
  border: calc(var(--u) * 4) solid transparent;
  border-image: url(../assets/ui/panel.webp) 80 fill / calc(var(--u) * 5);
}
.arrow.next .ic {
  transform: scaleX(-1);
}
.arrow {
  width: max(40px, calc(var(--u) * 7));
  height: max(40px, calc(var(--u) * 7));
  flex: none;
}
.arrow:disabled {
  opacity: 0.45;
  filter: saturate(0.3);
  pointer-events: none;
}
.node {
  position: relative;
  width: 100%;
  aspect-ratio: 349 / 316;
  pointer-events: auto;
  animation: pop-in 0.35s var(--pop) both;
}
.node > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.node.cur > img {
  transform: scale(1.12);
}
.node .face {
  inset: 10% 14% 30% 14%;
  font-size: calc(var(--u) * 5.2);
}
.node .st {
  position: absolute;
  left: 50%;
  top: 92%;
  translate: -50% 0;
  display: flex;
  width: 86%;
  justify-content: center;
}
.node .st img {
  width: 33%;
}
.node.locked .st {
  opacity: 0.35;
}
.node.no {
  animation: no 0.3s;
}
@keyframes no {
  25% {
    translate: -6px 0;
  }
  75% {
    translate: 6px 0;
  }
}
body.reduced .node {
  animation: none;
}
#map-dots {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--u) * 8.5 + var(--sab));
  display: flex;
  gap: calc(var(--u) * 0.6);
}
/* world dots: art (lit / unlit), tappable to jump worlds; locked ones carry a little padlock */
#map-dots {
  align-items: center;
  pointer-events: auto;
}
.mdot {
  position: relative;
  width: max(40px, calc(var(--u) * 8.4));
  height: max(40px, calc(var(--u) * 8.4));
  display: grid;
  place-items: center;
}
.mdot > img:first-child {
  width: calc(var(--u) * 5.4);
  height: calc(var(--u) * 5.4);
  transition: transform 0.2s var(--pop);
}
.mdot.on > img:first-child {
  width: calc(var(--u) * 7.4);
  height: calc(var(--u) * 7.4);
}
.mdot .ml {
  position: absolute;
  width: calc(var(--u) * 3.2);
  height: calc(var(--u) * 3.2);
  right: calc(50% - var(--u) * 3.6);
  bottom: calc(50% - var(--u) * 3.6);
}
.mdot:active > img:first-child {
  transform: scale(0.9);
}
body.land #map-stars {
  top: calc(var(--u) * 17 + var(--sat));
}
/* portrait: the ribbon moves down below the corner buttons (it passed under the sound) and the grid is narrower, with the arrows
   half over the frame border: all within a screen of 360 px and up */
body:not(.land) .map-title {
  top: calc(var(--u) * 3.4 + max(44px, var(--u) * 8.2) + var(--sat));
}
body:not(.land) #map-stars {
  top: calc(var(--u) * 15.5 + max(44px, var(--u) * 8.2) + var(--sat));
}
body:not(.land) #map-grid {
  grid-template-columns: repeat(5, calc(var(--u) * 12.6));
}
body:not(.land) .arrow {
  margin: 0 calc(var(--u) * -3);
  z-index: 1;
}
body.land #map-page {
  translate: -50% -42%;
}
body.land #map-grid {
  grid-template-columns: repeat(5, calc(var(--u) * 13.4));
  gap: calc(var(--u) * 3.6) calc(var(--u) * 3);
  padding-bottom: calc(var(--u) * 4.6);
}
body.land #map-page {
  gap: calc(var(--u) * 3);
}
body.land #map-dots {
  bottom: calc(var(--u) * 3 + var(--sab));
}
body[data-screen='map'] #mascot {
  display: none;
}

/* --- modes: big cards with icon, title, explanation and record/streak --- */
.mcard {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 3);
  min-height: calc(var(--u) * 19);
  padding: calc(var(--u) * 2.8) calc(var(--u) * 3);
  border-radius: calc(var(--u) * 4);
  background: rgba(28, 14, 80, 0.45);
  box-shadow: inset 0 0 0 calc(var(--u) * 0.5) rgba(111, 230, 255, 0.3);
  text-align: left;
}
.mic {
  width: calc(var(--u) * 15);
  height: calc(var(--u) * 15);
  object-fit: contain;
  flex: none;
}
.mtx {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 0.8);
  flex: 1;
  min-width: 0;
}
.mtt {
  font-size: calc(var(--u) * 5.4);
}
.msub,
.mstat {
  font-size: calc(var(--u) * 4);
  line-height: 1.15;
  white-space: pre-line;
  opacity: 0.95;
}
:lang(ja) .msub {
  word-break: keep-all;
} /* Japanese breaks only where the text marks it (
 after 、 and ：), never mid-word */
.mstat {
  color: #ffe27a;
}
.mcard.done {
  filter: saturate(0.55) brightness(0.9);
}
.mcard.done[data-p='dn'] {
  scale: 1;
  filter: saturate(0.55) brightness(0.9);
} /* daily challenge done: does not sink */
.mcard.no {
  animation: no 0.3s;
}
.mtt,
.msub,
.mstat {
  --o: 0.14em;
  text-shadow:
    0 calc(var(--o) * 0.6) 0 var(--ink2),
    calc(var(--o) * 0.5) 0 0 var(--ink),
    calc(var(--o) * -0.5) 0 0 var(--ink),
    0 calc(var(--o) * 0.5) 0 var(--ink),
    0 calc(var(--o) * -0.5) 0 var(--ink);
}
#m-modes .panel {
  width: calc(var(--u) * 82);
  gap: calc(var(--u) * 2.4);
}
/* time attack result */
.rush-big {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.rush-big .num {
  font-size: calc(var(--u) * 16);
  line-height: 1;
}
.rush-big .lbl,
.rush-best {
  font-size: calc(var(--u) * 4.6);
  flex: none;
}
.rush-new {
  color: #ffe27a;
  font-size: calc(var(--u) * 5);
  flex: none;
}
#m-rule #rule-img {
  width: calc(var(--u) * 60);
  height: calc(var(--u) * 40);
  object-fit: contain;
}
#m-rule .how-row {
  height: auto;
  min-height: calc(var(--u) * 13);
}
body.land #m-rule .how-row {
  height: calc(var(--u) * 40);
}
body.land #m-rule #rule-img {
  width: calc(var(--u) * 48);
  height: calc(var(--u) * 34);
}
body.land #m-rule .how-txt {
  font-size: calc(var(--u) * 4.6);
  max-width: none;
}
#slots .slot[hidden] {
  display: none;
}
#tray.tight {
  width: calc(var(--u) * 72);
}
body.land #tray.tight {
  width: calc(var(--u) * 64);
}

/* --- specific panels --- */
.hm {
  position: absolute;
  width: calc(var(--u) * 15);
  left: calc(var(--u) * -2.5);
  bottom: calc(var(--u) * -3);
  aspect-ratio: 406 / 517;
  pointer-events: none;
} /* portrait on the bottom frame, inside the panel (half outside looked cut off) */
#m-lose .panel {
  width: calc(var(--u) * 76);
}
#m-lose .bb {
  width: calc(var(--u) * 54);
  height: calc(var(--u) * 14);
}
#m-win .pair .pb .face,
#m-lose .pair .pb .face {
  font-size: calc(var(--u) * 4);
} /* end of level: Play again | Home, same size */
#m-win .pair .pb,
#m-lose .pair .pb {
  height: max(46px, calc(var(--u) * 8.4));
}
/* wide and low pause panel: kitten at the left, buttons at the right */
#m-pause .panel {
  width: calc(var(--u) * 88);
}
.prow {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2);
  width: 100%;
}
.prow .pm {
  width: calc(var(--u) * 19);
  flex: none;
}
.pcol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 2);
  flex: 1;
}
.pcol .bb {
  width: calc(var(--u) * 46);
  height: calc(var(--u) * 11);
}
.pcol .bb .face {
  font-size: calc(var(--u) * 6.6);
}
/* fixed proportion (kitten picture 406x517): the panel knows its height before the image loads, so it does not jump */
.pm,
.wm {
  aspect-ratio: 406 / 517;
  object-fit: contain;
}
.pm {
  width: calc(var(--u) * 26);
}
.pair {
  display: flex;
  gap: calc(var(--u) * 2.4);
}
.pair {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
} /* pill pair: both with the width of the larger one */
.pair .pb {
  width: auto;
  max-width: none;
  padding: 0;
}
.pair .pb .face {
  font-size: calc(var(--u) * 3.4);
}
.pb.wide {
  width: calc(var(--u) * 46);
}
.pb.wide .face {
  font-size: calc(var(--u) * 4.6);
}
#m-win .panel {
  width: calc(var(--u) * 78);
  padding-top: calc(var(--u) * 2.5);
  gap: calc(var(--u) * 1.8);
}
#m-win .plaque {
  height: calc(var(--u) * 10);
}
#b-replay {
  min-height: 46px;
}
.wm {
  position: absolute;
  width: calc(var(--u) * 34);
  left: 50%;
  translate: -50% 0;
  top: calc(var(--u) * -52.6);
  z-index: -1;
} /* feet on top of the ribbon */
/* landscape: the kitten cheers beside the panel, not on top of it */
body.land .wm {
  left: calc(var(--u) * -42.6);
  translate: 0 0;
  top: auto;
  bottom: calc(var(--u) * 16.98);
  width: calc(var(--u) * 42);
}
/* landscape: the kitten cheers ON TOP of an asteroid rock that comes from the LEFT (it never
   floats), as in the game: the picture keeps its natural side (cut end at the left, off the screen at 16:9; free tip under the
   front foot). 64u: from -58.1u to -8u (opaque up to 0.783), 2.3u before the frame (which starts at -5.7u). On screens wider or
   narrower than 16:9 the cut end shows: it fades out (mask on the first 16%, the picture is not distorted). Ground
   = median of the top under the feet; the sole sinks 19% of the thickness: .wm at 16.98u. */
.wc {
  display: none;
}
body.land .wc {
  display: block;
  position: absolute;
  z-index: -1;
  pointer-events: none;
  width: calc(var(--u) * 64);
  left: calc(var(--u) * -58.1);
  bottom: calc(var(--u) * 0.22);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%);
  mask-image: linear-gradient(90deg, transparent, #000 16%);
}
.stars {
  display: flex;
  align-items: flex-end;
  gap: calc(var(--u) * 1.5);
}
.stars img {
  width: calc(var(--u) * 17);
}
.stars img:nth-child(2) {
  width: calc(var(--u) * 18.5);
  margin-bottom: calc(var(--u) * 2);
}

#m-win .bb,
#m-rush .bb {
  width: calc(var(--u) * 54);
  height: calc(var(--u) * 14);
} /* same big button on victory and on the end of time attack */
#m-win .bb .face,
#m-rush .bb .face {
  font-size: calc(var(--u) * 7.2);
}
/* how to play: one step at a time (big illustration, big text, dots, Next) */
#m-how {
  background: rgba(16, 6, 40, 0.78);
}
.panel.how {
  width: calc(var(--u) * 80);
  gap: calc(var(--u) * 3);
}
.how-card {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 2.5);
  padding: calc(var(--u) * 4);
  border-radius: calc(var(--u) * 4);
  background: rgba(28, 14, 80, 0.42);
  box-shadow: inset 0 calc(var(--u) * 0.5) 0 rgba(255, 255, 255, 0.08);
}
#how-img {
  width: calc(var(--u) * 56);
  height: calc(var(--u) * 38);
  object-fit: contain;
  filter: drop-shadow(0 calc(var(--u) * 1) calc(var(--u) * 1) rgba(20, 0, 50, 0.35));
}
#how-img.swap {
  animation: pop-in 0.3s var(--pop) both;
}
.how-row {
  width: 100%;
  height: calc(var(--u) * 13);
  display: flex;
  align-items: center;
  justify-content: center;
} /* 2 fixed lines: nothing jumps */
.how-row .num {
  position: absolute;
  left: calc(var(--u) * 2.4);
  top: calc(var(--u) * 2.4);
  width: calc(var(--u) * 9);
  height: calc(var(--u) * 9);
  display: grid;
  place-items: center;
  background: url(../assets/ui/helper.webp) center / 100% 100%;
  font-size: calc(var(--u) * 5);
  padding-top: calc(var(--u) * 0.4);
}
.how-txt {
  max-width: calc(var(--u) * 62);
  font-size: calc(var(--u) * 5);
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}
.how-dots {
  display: flex;
  gap: calc(var(--u) * 2.4);
}
.how-dots i {
  width: calc(var(--u) * 3.2);
  height: calc(var(--u) * 3.2);
  border-radius: 50%;
  background: rgba(170, 220, 255, 0.45);
  box-shadow: 0 0 0 calc(var(--u) * 0.45) var(--ink);
  transition:
    transform 0.2s var(--pop),
    background 0.2s;
}
.how-dots i.on {
  background: #6fe6ff;
  transform: scale(1.25);
}
#how-next,
#m-rule .bb {
  width: calc(var(--u) * 48);
  height: calc(var(--u) * 13);
}
#how-next .face,
#m-rule .bb .face {
  font-size: calc(var(--u) * 6.4);
} /* "Verstanden", "Berikutnya": fit without shrinking */
/* landscape: two columns (illustration on the left, text on the right) instead of a narrow column */
body.land .panel.how {
  width: calc(var(--u) * 118);
}
body.land .how-card {
  flex-direction: row;
  gap: calc(var(--u) * 3);
  padding: calc(var(--u) * 3) calc(var(--u) * 4) calc(var(--u) * 3) calc(var(--u) * 3);
}
body.land #how-img {
  width: calc(var(--u) * 52);
  height: calc(var(--u) * 40);
  flex: none;
}
body.land .how-row {
  height: calc(var(--u) * 40);
  flex: 1;
}
body.land .how-txt {
  font-size: calc(var(--u) * 5.4);
}
/* language: grid with all 14 in view (2 columns portrait, 3 landscape), no scrolling; tapping switches instantly */
.panel.tall {
  width: calc(var(--u) * 84);
}
body.land .panel.tall {
  width: calc(var(--u) * 120);
}
#lang-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--u) * 2.4) calc(var(--u) * 1.6);
}
body.land #lang-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.lrow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--u) * 9);
  padding: 0 calc(var(--u) * 1);
  border: calc(var(--u) * 1.6) solid transparent;
  border-image: url(../assets/ui/row.webp) 26 fill / calc(var(--u) * 2.2);
}
.lrow.on {
  border-image-source: url(../assets/ui/row-on.webp);
}
.lrow::before {
  content: '';
  position: absolute;
  inset: calc(var(--u) * -2.8) calc(var(--u) * -2.4);
} /* touch: half of the gap between the rows (40 px at 360) */
.lrow .rowtxt {
  font-size: calc(var(--u) * 3.4);
  min-width: 0;
  max-width: 100%;
  text-align: center;
  translate: 0 0.03em;
}
.lrow .chk {
  position: absolute;
  right: calc(var(--u) * -1.2);
  top: calc(var(--u) * -1.8);
  width: calc(var(--u) * 4.4);
  visibility: hidden;
} /* corner badge: the name stays centered on the whole row */
.lrow.on .chk {
  visibility: visible;
}
/* End of css/screens.css (complete file). */
