/* Base: font, colors, outlined text, buttons and panels. Measurements in --u (1% of the shorter side), taken from the portrait design
   (1024 px wide = 100u). Layout of each screen in screens.css. */
@font-face {
  font-family: 'Nunito';
  font-weight: 900;
  font-display: block;
  src: url(../fonts/nunito-latin-900.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-weight: 900;
  font-display: block;
  src: url(../fonts/nunito-latin-ext-900.woff2) format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, 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: 'Nunito';
  font-weight: 900;
  font-display: block;
  src: url(../fonts/nunito-cyrillic-900.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --u: 1vmin;
  --sx: 0px; /* extra space on each side of the central stage (ultrawide landscape) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --ink: #3a1470; /* text outline (dark violet) */
  --ink2: #24094d;
  --white: #ffffff;
  --mint: #6fe6ff;
  --gold: #ffd23a;
  --night: #1a0c4a;
  --pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* CJK: Nunito does not have it; system fallback, same weight */
  --font:
    'Nunito', 'Hiragino Maru Gothic ProN', 'Yu Gothic', '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: var(--night);
}
body {
  font-family: var(--font);
  font-weight: 900;
  color: var(--white);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
img {
  -webkit-user-drag: none;
  user-select: none;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  position: relative;
}
button:focus {
  outline: none;
}
button:focus-visible {
  outline: calc(var(--u) * 0.5) solid #ffffffaa;
  outline-offset: calc(var(--u) * 0.4);
  border-radius: 999px;
}
[hidden] {
  display: none !important;
}

#bg {
  position: fixed;
  inset: 0;
  background: #2a1470 url(../assets/bg/bg-portrait.webp) center / cover no-repeat;
}
body.land #bg {
  background-image: url(../assets/bg/bg-landscape.webp);
}
/* worlds 2 to 4: same framing as world 1, another theme */
body[data-world='2'] #bg {
  background-image: url(../assets/bg/w2-portrait.webp);
}
body[data-world='3'] #bg {
  background-image: url(../assets/bg/w3-portrait.webp);
}
body[data-world='4'] #bg {
  background-image: url(../assets/bg/w4-portrait.webp);
}
body.land[data-world='2'] #bg {
  background-image: url(../assets/bg/w2-landscape.webp);
}
body.land[data-world='3'] #bg {
  background-image: url(../assets/bg/w3-landscape.webp);
}
body.land[data-world='4'] #bg {
  background-image: url(../assets/bg/w4-landscape.webp);
}
/* ultrawide (wider than 21:10): panorama with the sides extended, without enlarging and cropping the floor */
@media (min-aspect-ratio: 21/10) {
  body.land #bg {
    background-image: url(../assets/bg/bg-wide.webp);
  }
  body.land[data-world='2'] #bg {
    background-image: url(../assets/bg/w2-wide.webp);
  }
  body.land[data-world='3'] #bg {
    background-image: url(../assets/bg/w3-wide.webp);
  }
  body.land[data-world='4'] #bg {
    background-image: url(../assets/bg/w4-wide.webp);
  }
}
#cv {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}
#fx {
  position: fixed;
  inset: 0;
  display: block;
  pointer-events: none;
}
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#ui button,
#ui .modal,
#ui [role='slider'],
#map-scroll {
  pointer-events: auto;
}

/* outlined text: ring of 24 + 12 copies (round corners; no -webkit-text-stroke), short shadow below */
.face,
.lbl,
.num,
.badge,
.plaque b,
.rowtxt {
  --o: 0.14em;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    calc(var(--o) * 0.5) 0 0 var(--ink),
    calc(var(--o) * 0.483) calc(var(--o) * 0.129) 0 var(--ink),
    calc(var(--o) * 0.433) calc(var(--o) * 0.25) 0 var(--ink),
    calc(var(--o) * 0.354) calc(var(--o) * 0.354) 0 var(--ink),
    calc(var(--o) * 0.25) calc(var(--o) * 0.433) 0 var(--ink),
    calc(var(--o) * 0.129) calc(var(--o) * 0.483) 0 var(--ink),
    0 calc(var(--o) * 0.5) 0 var(--ink),
    calc(var(--o) * -0.129) calc(var(--o) * 0.483) 0 var(--ink),
    calc(var(--o) * -0.25) calc(var(--o) * 0.433) 0 var(--ink),
    calc(var(--o) * -0.354) calc(var(--o) * 0.354) 0 var(--ink),
    calc(var(--o) * -0.433) calc(var(--o) * 0.25) 0 var(--ink),
    calc(var(--o) * -0.483) calc(var(--o) * 0.129) 0 var(--ink),
    calc(var(--o) * -0.5) 0 0 var(--ink),
    calc(var(--o) * -0.483) calc(var(--o) * -0.129) 0 var(--ink),
    calc(var(--o) * -0.433) calc(var(--o) * -0.25) 0 var(--ink),
    calc(var(--o) * -0.354) calc(var(--o) * -0.354) 0 var(--ink),
    calc(var(--o) * -0.25) calc(var(--o) * -0.433) 0 var(--ink),
    calc(var(--o) * -0.129) calc(var(--o) * -0.483) 0 var(--ink),
    0 calc(var(--o) * -0.5) 0 var(--ink),
    calc(var(--o) * 0.129) calc(var(--o) * -0.483) 0 var(--ink),
    calc(var(--o) * 0.25) calc(var(--o) * -0.433) 0 var(--ink),
    calc(var(--o) * 0.354) calc(var(--o) * -0.354) 0 var(--ink),
    calc(var(--o) * 0.433) calc(var(--o) * -0.25) 0 var(--ink),
    calc(var(--o) * 0.483) calc(var(--o) * -0.129) 0 var(--ink),
    calc(var(--o) * 0.25) 0 0 var(--ink),
    calc(var(--o) * 0.217) calc(var(--o) * 0.125) 0 var(--ink),
    calc(var(--o) * 0.125) calc(var(--o) * 0.217) 0 var(--ink),
    0 calc(var(--o) * 0.25) 0 var(--ink),
    calc(var(--o) * -0.125) calc(var(--o) * 0.217) 0 var(--ink),
    calc(var(--o) * -0.217) calc(var(--o) * 0.125) 0 var(--ink),
    calc(var(--o) * -0.25) 0 0 var(--ink),
    calc(var(--o) * -0.217) calc(var(--o) * -0.125) 0 var(--ink),
    calc(var(--o) * -0.125) calc(var(--o) * -0.217) 0 var(--ink),
    0 calc(var(--o) * -0.25) 0 var(--ink),
    calc(var(--o) * 0.125) calc(var(--o) * -0.217) 0 var(--ink),
    calc(var(--o) * 0.217) calc(var(--o) * -0.125) 0 var(--ink),
    0 calc(var(--o) * 0.75) 0 var(--ink2);
}

/* --- buttons: art + live text on the FACE --- */
.rb,
.bb,
.pb,
.hb,
.x,
.sw {
  display: block;
}
/* real press (src/ui/fx.js sets data-p=dn while the finger is on the button): the art switches to the pressed one (-down),
   the text and icon go down with it (--pd) and, on release, the button springs back. Uses scale/--pd (not transform) so it does not
   fight the entrance animations. */
button {
  transition: scale 0.26s var(--pop);
}
[data-p='dn'] {
  scale: 0.965;
  --pd: calc(var(--u) * 0.45);
  transition-duration: 0.05s;
}
.rb,
.x {
  background: url(../assets/ui/round-down.webp) center / 96% 96% no-repeat;
}
.hb {
  background: url(../assets/ui/helper-down.webp) center / 96% 96% no-repeat;
}
.rb[data-p='dn'] > img:first-child,
.x[data-p='dn'] > img:first-child,
.hb[data-p='dn'] > img:first-child {
  opacity: 0;
}
.bb[data-p='dn'][data-nd],
.pb[data-p='dn'][data-nd] {
  background-image: var(--nine-down) !important;
}
.lrow[data-p='dn'],
.node[data-p='dn'],
.sw[data-p='dn'],
.mcard[data-p='dn'],
.outfit[data-p='dn'],
.zb[data-p='dn'] {
  filter: brightness(0.9);
}
[data-p='dn'] .ic {
  translate: 0 var(--pd);
}
.rb > img:first-child,
.hb > img:first-child,
.x > img:first-child {
  display: block;
  width: 100%;
  height: 100%;
}
.ic {
  position: absolute;
  left: 22%;
  top: 20%;
  width: 56%;
  height: 56%;
  object-fit: contain;
  pointer-events: none;
}
.rb {
  width: max(44px, calc(var(--u) * 8.2));
  height: max(44px, calc(var(--u) * 8.2));
}
.x {
  position: absolute;
  width: max(44px, calc(var(--u) * 7));
  height: max(44px, calc(var(--u) * 7));
}
.x .ic {
  left: 27%;
  top: 25%;
  width: 46%;
  height: 46%;
}

/* face = smooth area of the art; the text is centered on it (top / right / bottom / left in % of the art) */
.face {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
/* FACE MEASUREMENT: the text box covers the whole piece and the text is centered on it; --cap corrects the font
   (Nunito 900 ink sits below the middle of the line) and --fy is the offset of each art's face. No per-button tweaks. */
.face {
  translate: 0 calc(var(--fy, 0px) + var(--cap, 0.025em) + var(--pd, 0px));
}
/* big 9-slice button: each screen uses the design proportion (Play 2.6:1, Next 3.7:1) without stretching corner or shine.
   Thicker bottom border = the art's 3D step; the text is centered on the smooth face. */
.bb {
  width: calc(var(--u) * 45);
  height: calc(var(--u) * 15);
  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);
}
.bb .face {
  inset: calc(var(--u) * -4.2) calc(var(--u) * -3) calc(var(--u) * -5.2);
  font-size: calc(var(--u) * 7.6);
}
/* 9-slice pill: in the design it is flatter than the art (3:1 to 4:1); only the middle stretches */
.pb {
  width: max(98px, calc(var(--u) * 27));
  height: max(44px, calc(var(--u) * 7.4));
  border: calc(var(--u) * 2.6) solid transparent;
  border-image: url(../assets/ui/pill.webp) 62 fill / calc(var(--u) * 3.7);
}
.pb .face {
  inset: calc(var(--u) * -2.6) calc(var(--u) * -0.6);
  font-size: calc(var(--u) * 4.2);
}
/* pill with icon: icon + text form a centered group (never an icon stuck to the edge and text left over on the right) */
/* the pill grows with the text (long languages: "Play again"), up to a ceiling; beyond that the font shrinks. Never wraps to 2 lines. */
.pb.ico {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 1.2);
  width: auto;
  min-width: max(96px, calc(var(--u) * 26));
  max-width: calc(var(--u) * 62);
  padding: 0 calc(var(--u) * 4.2);
}
.pb.ico .pi {
  width: calc(var(--u) * 4.4);
  height: calc(var(--u) * 4.4);
  object-fit: contain;
  flex: none;
  pointer-events: none;
  translate: 0 calc(var(--fy, 0px) + var(--pd, 0px));
  margin-left: calc(var(--u) * -1);
}
.pb.ico .face {
  position: static;
  display: block;
  min-width: 0;
  max-width: calc(var(--u) * 46);
  margin-right: calc(var(--u) * -1);
}
.pb.ico {
  --fy: calc(var(--u) * 0.2);
} /* the flat face of this pill is slightly below the middle of the picture; icon and text move down together */
.ribbon {
  position: absolute;
  width: calc(var(--u) * 52);
  aspect-ratio: 640 / 118;
  left: 50%;
  translate: -50% 0;
  pointer-events: none;
}
.ribbon > img {
  display: block;
  width: 100%;
  height: 100%;
}
/* STRAIGHT ribbon (painted art): straight text, centered on the front strip (the folded ends do not receive text) */
.ribbon .face {
  inset: 0% 11.8% 25.4% 11.6%;
  font-size: calc(var(--u) * 4.3);
} /* 62u ribbon: a long title fits with room to spare (languages) */

/* hints: big green button with icon and counter badge */
.hb {
  width: calc(var(--u) * 14.5);
  height: calc(var(--u) * 14.5);
}
.hb .ic {
  left: 21%;
  top: 19%;
  width: 58%;
  height: 58%;
}
.badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 42%;
  height: 42%;
  display: grid;
  place-items: center;
  background: url(../assets/ui/badge.webp) center / 100% 100%;
  font-size: calc(var(--u) * 3.4);
  --o: 0.14em;
  padding-top: 0.14em;
}
.hb.empty {
  filter: saturate(0.35) brightness(0.8);
}

/* 9 slices assembled on canvas by nine.js (no seam at the joint): the .nine class turns off the browser's border-image and uses
   the pasted image as the whole background */
.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;
}
/* 9-slice panel */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 6, 48, 0.35);
  -webkit-backdrop-filter: blur(2.5px) brightness(0.8);
  backdrop-filter: blur(2.5px) brightness(0.8);
}
/* a panel with its own kitten: the kitten of the screen hides (no second kitten behind the panel) */
body.modal-mascot #mascot {
  visibility: hidden;
}
.ribbon .face,
.bb .face,
.tap .face {
  text-transform: uppercase;
}
#b-save .face {
  text-transform: none;
} /* "+30 s": unit does not become uppercase */
.panel {
  position: relative;
  width: calc(var(--u) * 72);
  padding: calc(var(--u) * 5.5) 0 calc(var(--u) * 1.5);
  border: calc(var(--u) * 6) solid transparent;
  border-image: url(../assets/ui/panel.webp) 80 fill / calc(var(--u) * 6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 2.4);
}
.panel > .ribbon {
  top: calc(var(--u) * -10.6);
  width: calc(var(--u) * 62);
} /* a single ribbon size on all panels; the ribbon mounts on the top edge */
.panel > .x {
  right: calc(var(--u) * -4.6);
  top: calc(var(--u) * -4.6);
  translate: 50% -50%;
} /* X centered on the top right corner of the frame */
.modal.in .panel {
  animation: pop-in 0.32s var(--pop) both;
} /* .in leaves at the end: changing a setting does not re-animate the panel */
@keyframes pop-in {
  from {
    transform: scale(0.82);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
body.reduced .modal.in .panel {
  animation: fade-in 0.18s both;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* setting rows */
.row-set {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2.4);
  min-height: calc(var(--u) * 10);
}
.ri {
  width: calc(var(--u) * 9);
  height: calc(var(--u) * 9);
  object-fit: contain;
  flex: none;
}
.lbl {
  font-size: calc(var(--u) * 4.8);
  flex: 1;
  min-width: 0;
} /* no overflow:hidden: it clipped the leg of the g/j/p at the bottom */
.sw {
  width: calc(var(--u) * 12.2);
  height: calc(var(--u) * 6.8);
  flex: none;
}
.sw img {
  width: 100%;
  height: 100%;
  display: block;
}
/* touch area of at least 44 px (switch, volume bar, small pill): the drawing does not change, only the target grows */
.sw::before,
.slider::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
}
.pb::before {
  content: '';
  position: absolute;
  inset: calc(var(--u) * -2.6 - 4px);
}
.slider {
  position: relative;
  width: calc(var(--u) * 33);
  height: calc(var(--u) * 7.4);
  flex: none;
  touch-action: none;
  pointer-events: auto;
  cursor: pointer;
}
/* track and fill in 9 slices: only the middle stretches, the round ends stay whole */
.slider .trk {
  position: absolute;
  left: 0;
  right: 0;
  top: 28%;
  height: 44%;
  border: calc(var(--u) * 1.3) solid transparent;
  border-image: url(../assets/ui/slider-track.webp) 28 fill / calc(var(--u) * 1.3);
}
.slider .fill {
  position: absolute;
  left: 0;
  top: 30%;
  height: 40%;
  min-width: calc(var(--u) * 2.6);
  border: calc(var(--u) * 1.2) solid transparent;
  border-image: url(../assets/ui/slider-fill.webp) 26 fill / calc(var(--u) * 1.2);
}
.slider .knob {
  position: absolute;
  top: 10%;
  height: 80%;
  aspect-ratio: 1;
  translate: -50% 0;
}
/* settings: icon | label on the left | control on the right (switch, bar or language pill) */
.row-set .lbl {
  text-align: left;
}
#m-settings .panel,
#m-sound .panel {
  width: calc(var(--u) * 80);
}
#m-sound .slider {
  width: calc(var(--u) * 30);
}
#b-lang {
  width: calc(var(--u) * 31);
  flex: none;
}
#b-lang .face {
  font-size: calc(var(--u) * 3.8);
}
/* text with lowercase (pills): the body of the letters is lower than that of capitals, so it goes up a hair */
.pb .face {
  --cap: -0.02em;
}

/* plaque (victory) */
.plaque {
  position: relative;
  width: 100%;
  height: calc(var(--u) * 11);
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2.4);
  padding: 0 calc(var(--u) * 3);
  border: calc(var(--u) * 2.4) solid transparent;
  border-image: url(../assets/ui/plaque.webp) 40 fill / calc(var(--u) * 3);
}
.plaque .pi {
  height: calc(var(--u) * 7);
  width: calc(var(--u) * 7);
  object-fit: contain;
}
.plaque .lbl {
  font-size: calc(var(--u) * 4.2);
} /* a single line: shrinks, does not wrap (fit.js) */
.plaque b {
  font-size: calc(var(--u) * 4.2);
  width: calc(var(--u) * 15);
  height: calc(var(--u) * 7);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: calc(var(--u) * 2) solid transparent;
  border-image: url(../assets/ui/pill.webp) 62 fill / calc(var(--u) * 3.2);
}

/* kitten: elastic stretch from the feet, feet on the ground */
#mascot {
  position: absolute;
  transform-origin: 50% 100%;
  animation: breathe 2.6s ease-in-out infinite;
  pointer-events: none;
  filter: drop-shadow(0 calc(var(--u) * 0.8) calc(var(--u) * 0.6) rgba(20, 0, 50, 0.35));
}
#mascot.boing {
  animation:
    boing 0.5s var(--pop),
    breathe 2.6s ease-in-out 0.5s infinite;
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(1.015, 0.985);
  }
}
@keyframes boing {
  0% {
    transform: scale(0.92, 1.08);
  }
  40% {
    transform: scale(1.06, 0.95);
  }
  100% {
    transform: scale(1, 1);
  }
}
body.reduced #mascot {
  animation: none;
}
/* End of css/base.css (complete file). */
