/* Slice Parade: panels (pause, sound, settings, language, how to play, win, defeat). All through the SAME system (tokens in css/base.css):
   equal title ribbon (--rh), --sp-4 breathing room on all four sides measured from the smooth face of the panel art, --sp-3 gap between rows
   of the same group and --sp-5 between groups ([data-g] marks the start of a group), type only in the 5 steps --t1..--t5. Panel always centered on both
   axes; if it does not fit, it shrinks evenly (src/ui/modal.js, fitPanel). Entry and exit in steps by src/ui/uifx.js (changing a setting does not re-animate). */
.modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  padding: var(--sat) var(--sar) var(--sab) var(--sal);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(34, 72, 140, 0.38);
  -webkit-backdrop-filter: blur(calc(var(--u) * 0.5));
  backdrop-filter: blur(calc(var(--u) * 0.5));
  transition: opacity 0.2s ease-out;
}
/* the veil (src/ui/modal.js, data-dim): off = cleared (opening or closing: darkens and lightens by transition); cut = clears at once; jump = lights at once
   (one panel hands over to the other: the veil neither blinks nor doubles). A panel stored underneath (data-away) is not drawn. */
.modal[data-dim='off']::before {
  opacity: 0;
}
.modal[data-dim='cut']::before {
  opacity: 0;
  transition: none;
}
.modal[data-dim='jump']::before {
  transition: none;
}
.modal[data-away] {
  display: none;
}
body.reduced .modal::before {
  transition-duration: 1ms;
}
.panel {
  --pb: calc(var(--u) * 5.6);
  --fi: calc(var(--u) * 2.9); /* --fi: from the outer edge to the smooth face of the panel art */
  --pw: calc(var(--u) * 86 * var(--lk));
  --xs: calc(var(--u) * 10 * var(--lk));
  position: relative;
  width: var(--pw);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  padding: calc(var(--rh) * 0.966 + var(--sp-4) - var(--pb)) calc(var(--sp-4) - var(--pb) + var(--fi))
    calc(var(--sp-4) - var(--pb) + var(--fi) + var(--u) * 0.3);
  border: var(--pb) solid transparent;
  border-image: url(../assets/ui/panel.webp) 56 fill / var(--pb);
}
.panel > [data-g] {
  margin-top: calc(var(--sp-5) - var(--sp-3));
}
.panel > .ribbon {
  --h: var(--rh);
  --fd: var(--fd-band);
  --sc: calc(var(--rh) / 147);
  position: absolute;
  z-index: 2;
  left: calc(var(--pb) * -1);
  top: calc(var(--pb) * -1);
  width: calc(100% + var(--pb) * 2);
  height: var(--rh);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: solid transparent;
  border-width: calc(var(--sc) * 39) calc(var(--sc) * 61);
  border-image: url(../assets/ui/band.webp) 39 61 fill / calc(var(--sc) * 39) calc(var(--sc) * 61);
  pointer-events: none;
}
.ribbon .face {
  font-size: var(--t4);
  letter-spacing: 0.01em;
}
.panel > .x {
  position: absolute;
  z-index: 3;
  right: calc(var(--pb) * -1 + var(--u) * 0.4);
  top: calc(var(--pb) * -1 - var(--xs) * 0.29);
  width: max(44px, var(--xs));
  height: max(44px, var(--xs));
  background: url(../assets/ui/close.webp) center / 100% 100% no-repeat;
}
.pwrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel > .pb {
  align-self: stretch;
}

/* ---- pause: 4 equal large buttons, stacked ---- */

/* ---- list rows (sound and settings): card with icon, label and control; small-button height, letter --t2 ---- */
.row-set {
  --h: var(--bh-s);
  position: relative;
  height: var(--h);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  border-radius: calc(var(--u) * 3.4 * var(--lk));
  background: linear-gradient(#fdfafd, #f3ebf3);
  box-shadow:
    0 calc(var(--u) * 0.5) calc(var(--u) * 0.55) rgba(170, 125, 155, 0.55),
    inset 0 calc(var(--u) * 0.12) 0 #fff,
    inset 0 0 0 calc(var(--u) * 0.22) rgba(228, 206, 222, 1);
}
.row-set > .lbl {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--t1);
  text-align: left;
  translate: 0 var(--cap);
}
.row-set .ri {
  width: 1.7em;
  height: 1.7em;
  font-size: var(--t1);
  flex: none;
  object-fit: contain;
  pointer-events: none;
} /* icons already trimmed: the box is what you see; one size for all */
.slider {
  --k: calc(var(--u) * 7.2 * var(--lk));
  --v: 0.5;
  position: relative;
  flex: none;
  width: calc(var(--u) * 30 * var(--lk));
  height: var(--k);
  touch-action: none;
  cursor: pointer;
}
.slider .trk,
.slider .fill {
  --sh: calc(var(--k) * 0.97);
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  translate: 0 -50%;
  height: var(--sh);
  border: 0 solid transparent;
  border-width: 0 calc(var(--sh) * 0.577);
}
.slider .trk {
  border-image: url(../assets/ui/slider-track.webp) 0 30 fill / 0 calc(var(--sh) * 0.577);
}
.slider .fill {
  border-image: url(../assets/ui/slider-fill.webp) 0 30 fill / 0 calc(var(--sh) * 0.577);
  clip-path: inset(0 calc((1 - var(--v)) * (100% - var(--k)) + var(--k) / 2 - var(--u) * 0.1) 0 0 round calc(var(--u) * 2.6));
}
.slider .knob {
  position: absolute;
  top: 0;
  width: var(--k);
  height: var(--k);
  left: calc(var(--v) * (100% - var(--k)));
  filter: drop-shadow(0 calc(var(--u) * 0.3) calc(var(--u) * 0.35) rgba(40, 40, 90, 0.3));
  pointer-events: none;
}
#m-settings .row-set {
  cursor: pointer;
}
.sw {
  position: relative;
  flex: none;
  height: var(--ch);
  font-size: calc(var(--ch) * 0.52);
  aspect-ratio: 600 / 226;
}
.sw img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.16s;
}
.sw .on {
  opacity: 0;
}
.sw[aria-pressed='true'] .on {
  opacity: 1;
}
.sw[aria-pressed='true'] .off {
  opacity: 0;
}
body.reduced .sw img {
  transition: none;
}
.sw-t {
  position: absolute;
  top: 50%;
  width: 46%;
  white-space: nowrap;
  text-align: center;
  font-size: 1em;
  line-height: 1;
  translate: 0 calc(-50% + var(--cap) - 0.02em);
  letter-spacing: 0.02em;
  pointer-events: none;
} /* -.02em: the face of the switch is a hair higher */
.sw-on {
  left: 6%;
  color: #fff;
  opacity: 0;
  text-shadow: 0 0.06em 0 rgba(160, 24, 84, 0.4);
}
.sw-off {
  right: 6%;
  color: #1c3a72;
}
.sw[aria-pressed='true'] .sw-on {
  opacity: 1;
}
.sw[aria-pressed='true'] .sw-off {
  opacity: 0;
}
#b-lang {
  --h: var(--ch);
  --fs: var(--t1);
  --px: calc(var(--h) * 0.55);
  --w: calc(var(--u) * 24 * var(--lk));
  --wmax: calc(var(--u) * 34 * var(--lk));
  flex: none;
}
#b-lang .face {
  text-transform: none;
}
#b-lang {
  top: calc(var(--h) * 0.054);
} /* the art face is higher than the piece: the button moves down so its text sits on the label line */

/* ---- language: grid with everything in view (2 columns portrait, 3 landscape); tapping switches at once ---- */
#lang-list {
  --cols: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
} /* the last row, if incomplete, stays centered */
.lrow {
  width: calc((100% - (var(--cols) - 1) * var(--sp-2)) / var(--cols));
  font-size: var(--t2);
  --h: calc(var(--u) * 10.2 * var(--lk));
  --sc: calc(var(--h) / 166);
  --edge: 65;
  --cw: calc(var(--sc) * var(--edge));
  --fd: var(--fd-lang);
  position: relative;
  height: var(--h);
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0 solid transparent;
  border-width: 0 var(--cw);
  border-image: url(../assets/ui/lang-off.webp) 0 var(--edge) fill / 0 var(--cw);
}
.lrow::after {
  content: '';
  position: absolute;
  left: calc(var(--cw) * -1);
  right: calc(var(--cw) * -1);
  top: 50%;
  translate: 0 -50%;
  height: calc(100% + var(--sp-2));
} /* touch area: covers the gap to the neighbouring row */
.lrow.on {
  border-image-source: url(../assets/ui/lang-on.webp);
}
.lrow .rowtxt {
  flex: none;
  max-width: none;
  font-size: 1em;
  color: var(--ink);
  translate: 0 calc(var(--cap) + var(--fd) * var(--h) + var(--pd, 0px));
}
.lrow.on .rowtxt {
  color: #fff;
  text-shadow: 0 0.045em 0 rgba(160, 24, 84, 0.38);
}
body.land #m-lang .panel {
  --pw: calc(var(--u) * 118 * var(--lk));
}
body.land #lang-list {
  --cols: 3;
}

/* ---- how to play: scene on top, 3 illustrated steps, GOT IT ---- */
.how-scene {
  position: relative;
  width: 100%;
  height: calc(var(--u) * 34 * var(--lk));
  flex: none;
  overflow: hidden;
  border-radius: calc(var(--u) * 2.2 * var(--lk));
  background: url(../assets/ui/howto-wide.webp) center / cover no-repeat;
  box-shadow: inset 0 0 0 calc(var(--u) * 0.3) rgba(255, 255, 255, 0.6);
}
.how-steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
}
.how-step {
  --h: calc(var(--u) * 20.6 * var(--lk));
  position: relative;
  display: flex;
  align-items: center;
  height: var(--h);
  padding: 0 var(--sp-3) 0 var(--sp-2);
  gap: var(--sp-2);
  border-radius: calc(var(--u) * 2.4 * var(--lk));
  background: linear-gradient(#fff, #f8f2f7);
  box-shadow:
    0 calc(var(--u) * 0.3) calc(var(--u) * 0.6) rgba(190, 150, 175, 0.35),
    inset 0 0 0 calc(var(--u) * 0.25) rgba(246, 205, 224, 0.9);
}
.how-step .num {
  position: absolute;
  left: calc(var(--u) * 1.4 * var(--lk));
  top: calc(var(--u) * 1.4 * var(--lk));
  z-index: 2;
  width: calc(var(--u) * 5.6 * var(--lk));
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: url(../assets/ui/dot-on.webp) center / 100% 100% no-repeat;
  font-size: var(--t1);
}
.how-step .num b {
  color: #fff;
  font-size: 1em;
  font-weight: 600;
  line-height: 1;
  translate: 0 calc(var(--cap) - 0.04em);
}
.how-art {
  position: relative;
  flex: none;
  width: calc(var(--u) * 21 * var(--lk));
  height: calc(var(--u) * 9.8 * var(--lk));
  margin-left: calc(var(--u) * 4.4 * var(--lk));
}
.how-art > * {
  position: absolute;
  display: block;
  pointer-events: none;
}
.how-step .sep {
  flex: none;
  width: calc(var(--u) * 0.3);
  height: 62%;
  border-radius: 99px;
  background: #c9b7c6;
  opacity: 0.7;
}
:is(:lang(ja), :lang(zh-Hans)) .how-step .lbl {
  word-break: keep-all;
  overflow-wrap: anywhere;
} /* break only at the ​ in the texts ("スラ/イス") */
.how-step .lbl {
  flex: 1 1 0;
  min-width: 0;
  font-size: var(--t1);
  line-height: 1.12;
  white-space: normal;
  text-align: left;
  text-wrap: balance;
}
.how-art .hand {
  animation: hand-tap 1.7s ease-in-out infinite;
}
@keyframes hand-tap {
  0%,
  100% {
    translate: 0 0;
  }
  45% {
    translate: 0 -8%;
  }
  60% {
    translate: 0 4%;
    scale: 0.94;
  }
}
.how-art .fly {
  animation: hop 1.9s ease-in-out infinite;
}
.how-art .glow {
  opacity: 0.85;
}
.how-art .spk {
  height: auto;
}
@keyframes hop {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 8% -4%;
  }
}
body.land #m-how .panel {
  --pw: calc(var(--u) * 150 * var(--lk));
  display: grid;
  grid-template-columns: 38fr 62fr;
  align-items: stretch;
  column-gap: var(--sp-4);
  row-gap: var(--sp-3);
}
body.land .how-scene {
  grid-row: 1 / 3;
  height: auto;
  min-height: 100%;
}
body.land .how-steps {
  grid-column: 2;
}
body.land #how-ok {
  grid-column: 2;
}
body.land .how-scene {
  background-image: url(../assets/ui/howto-tall.webp);
  background-position: center;
}
body.land .how-art {
  width: calc(var(--u) * 22 * var(--lk));
  height: calc(var(--u) * 10.3 * var(--lk));
  margin-left: calc(var(--u) * 4 * var(--lk));
}

/* ---- win and defeat: the panda stays behind the panel (same group, shrinks together). Same system as the other panels ---- */
.result {
  padding-top: calc(var(--sat) + var(--u) * 36);
}
.result .pwrap {
  --pw: calc(var(--u) * 86 * var(--lk));
  width: var(--pw);
}
.result .pd {
  position: absolute;
  z-index: 1;
  left: calc(var(--u) * -0.2);
  top: calc(var(--u) * -51.2);
  width: calc(var(--u) * 84.5);
  height: auto;
  pointer-events: none;
}
.result .panel {
  z-index: 2;
  width: 100%;
  --pw: 100%;
}
.big-lbl {
  font-size: var(--t4);
  color: var(--ink);
  text-align: center;
}
.big-lbl .face {
  text-transform: none;
}
.pb.cakes-pill {
  --h: var(--bh-l);
  --art: 236;
  --edge: 118;
  --img: url(../assets/ui/capsule.webp);
  --fd: var(--fd-capsule);
  --fs: var(--t3);
  --px: 0px;
  justify-content: flex-start;
  gap: 0;
}
.cakes-pill .face {
  flex: 1 1 0;
  min-width: 0;
  margin-right: calc(var(--h) * -0.41);
  text-transform: none;
} /* the text box reaches the face of the capsule: it centers in the space left beside the plate */
.plate-ic {
  width: calc(var(--h) * 1.45);
  flex: none;
  margin-left: calc(var(--h) * -0.28);
}
.plate-ic .plate {
  width: 100%;
}
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
.pair.solo {
  grid-template-columns: minmax(0, 0.5fr);
  justify-content: center;
} /* last level: only REPLAY, centered */
#b-next.live {
  animation: next-live 1.9s ease-in-out infinite;
}
@keyframes next-live {
  50% {
    scale: 1.035;
  }
}
/* win: the box, the panda and the rows enter in steps by src/ui/uifx.js (the ribbon and the rows start at 40 ms: never an empty box) */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti img {
  position: absolute;
  top: 0;
  width: calc(var(--u) * 3.4);
  height: auto;
  will-change: transform;
}
/* defeat: soft, no red; the sad panda rests the plate on the ribbon, behind the panel */
#m-lose {
  padding-top: calc(var(--sat) + var(--u) * 31.5);
}
#m-lose .pd {
  left: calc(var(--u) * 1.2);
  top: calc(var(--u) * -55.6);
  width: calc(var(--u) * 71);
} /* the plate rests on the top edge of the ribbon: nothing covers the title */
.meter {
  --bh: calc(var(--u) * 11.6 * var(--lk));
  display: flex;
  align-items: center;
}
.bar {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: var(--bh);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bar .trk,
.bar .fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--bh);
  border: 0 solid transparent;
  border-width: 0 calc(var(--bh) * 0.623);
}
.bar .trk {
  border-image: url(../assets/ui/bar-track.webp) 0 48 fill / 0 calc(var(--bh) * 0.623);
}
.bar .fill {
  --r: 0;
  border-image: url(../assets/ui/bar-fill.webp) 0 48 fill / 0 calc(var(--bh) * 0.623);
  clip-path: inset(0 calc((1 - var(--r)) * 100%) 0 0 round 999px);
  transition: clip-path 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s;
}
body.reduced .bar .fill {
  transition: none;
}
.bar .face {
  position: relative;
  font-size: var(--t2);
  color: #082a78;
}
.medal {
  position: relative;
  flex: none;
  width: calc(var(--bh) * 0.98);
  aspect-ratio: 231 / 235;
  margin-left: calc(var(--u) * -2.4 * var(--lk));
  background: url(../assets/ui/medallion.webp) center / 100% 100% no-repeat;
}
.medal img {
  position: absolute;
  left: 13%;
  top: 13%;
  width: 74%;
  height: 74%;
  object-fit: contain;
}
.note {
  font-size: var(--t2);
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
} /* one line in any language (fit.js shrinks): the panel does not change height with the language */
#m-lose .panel > .pb.sub {
  align-self: center;
  width: calc(50% - var(--sp-3) / 2);
} /* the small defeat button has the width of one of the two in the win panel */
/* the win/defeat panel brings the panda; the game one, blurred behind, would be hidden so there are not two heads */
#game-root.hide-panda .panda .pbody {
  opacity: 0;
} /* the class is added .34 s after the panel opens (src/ui/results.js): the game panda, blurred behind, was hidden only once the panel one had already entered */

/* landscape (design 14): the whole panda on the left, the panel a little right of center */
body.land .result {
  padding-top: 0;
  padding-left: calc(var(--u) * 86 * var(--lk));
} /* the panda + panel group is centered on the screen (the panda takes the left side, the size of the panel) */
body.land .result .pwrap {
  --pw: calc(var(--u) * 86 * var(--lk));
}
body.land .result .pd {
  left: calc(var(--u) * -66);
  top: calc(var(--u) * 0.7);
  width: calc(var(--u) * 74);
}
body.land #m-lose {
  padding-left: calc(var(--u) * 70 * var(--lk));
}
body.land #m-lose .pd {
  left: calc(var(--u) * -50);
  top: calc(var(--u) * -4);
  width: calc(var(--u) * 58);
}
body.land #m-lose {
  padding-top: 0;
}

/* End of css/panels.css (complete file). */
