/* Base: font, colours, clean text, buttons, pills, panels, controls. Sizes follow --u (set by src/main.js). */
@font-face {
  font-family: Game;
  font-weight: 100 900;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC;
}
@font-face {
  font-family: Game;
  font-weight: 100 900;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-600.woff2) format('woff2');
  unicode-range: U+0100-02AF, U+1E00-1EFF;
}
@font-face {
  font-family: Game;
  font-weight: 100 900;
  font-display: swap;
  src: url(../assets/fonts/rubik-cyrillic-600.woff2) format('woff2');
  unicode-range: U+0400-04FF;
}

:root {
  --cap: 0.08em; /* Fredoka draws its capitals a little low in the line: labels centred on a face lift by half of this */
  --u: 4px;
  --stage-x: 0px;
  --stage-y: 0px;
  --hud-x: 0px;
  --hud-y: 0px;
  --ink: #06302c;
  --teal: #0b4a43;
  --teal-d: #073530;
  --green: #2fb46a;
  --gold: #ffd24a;
  --white: #fffdf2;
  --sat: calc(env(safe-area-inset-top, 0px) + var(--stage-y));
  --sab: calc(env(safe-area-inset-bottom, 0px) + var(--stage-y));
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --pop: cubic-bezier(0.3, 1.6, 0.5, 1);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #082a27;
  color: var(--white);
  font-family:
    Game, 'Hiragino Sans', 'Yu Gothic', 'Malgun Gothic', 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
  font-weight: 600;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  overscroll-behavior: none;
}
#app {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  outline: none;
}
button:focus-visible {
  outline: calc(var(--u) * 0.5) solid rgba(255, 255, 255, 0.7);
  outline-offset: calc(var(--u) * 0.4);
  border-radius: 999px;
}
[hidden] {
  display: none !important;
}

/* Clean text: no thick outline around the letters. The plate behind the text gives the contrast; the letters carry
   only a short drop and a soft dark halo. --o is the size of that shadow, --og how strong the halo is (0..1): text that
   sits straight on the scenery (floating numbers, counters) asks for a stronger one. */
.ol,
.float {
  --o: 0.17em;
  --oc: rgba(3, 30, 26, 0.8);
  --og: 0.5;
  color: var(--white);
  letter-spacing: 0.012em;
  line-height: 1.05;
  text-shadow:
    0 calc(var(--o) * 0.42) 0 var(--oc),
    0 0 calc(var(--o) * 1.1) rgba(3, 30, 26, var(--og)),
    0 0 calc(var(--o) * 2.6) rgba(3, 30, 26, calc(var(--og) * 0.7));
}
.float,
.touch,
.pile b,
.node b {
  --og: 1;
}
.num {
  font-variant-numeric: tabular-nums;
}

.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #082a27;
}
.scene-back {
  position: absolute;
  left: -8%;
  top: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  filter: blur(calc(var(--u) * 3.2)) brightness(0.68) saturate(1.05);
}
.scene-img {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  max-width: none;
}
.scene.soft .scene-img {
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    rgba(0, 0, 0, 0.35) 9%,
    #000 30%,
    #000 70%,
    rgba(0, 0, 0, 0.35) 91%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    rgba(0, 0, 0, 0.35) 9%,
    #000 30%,
    #000 70%,
    rgba(0, 0, 0, 0.35) 91%,
    transparent
  );
} /* long, eased edge: no hard seam between the sharp stage and the blurred sides */
.scene.softv .scene-img {
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 9%, #000 91%, transparent);
}

/* Buttons: art in 9 slices, live text on the face. Press: sinks and comes back with a spring. */
.btn {
  --h: calc(var(--u) * 14.5);
  position: relative;
  display: block;
  transition:
    transform 0.13s var(--pop),
    filter 0.13s;
}
.btn.primary.big {
  --h: calc(var(--u) * 21);
}
.btn.small {
  --h: calc(var(--u) * 11);
}
.btn > span {
  position: absolute;
  inset: calc(var(--ft) - var(--bt)) calc(var(--fr) - var(--br)) calc(var(--fb) - var(--bb)) calc(var(--fl) - var(--bl));
  display: grid;
  place-items: center;
  text-align: center;
  font-size: calc(var(--h) * 0.36);
  text-transform: uppercase;
  white-space: nowrap;
  padding-bottom: var(--cap);
}
.btn.primary.big > span {
  font-size: calc(var(--h) * 0.42);
}
.btn .bi {
  position: absolute;
  left: calc(var(--fl) - var(--bl) - var(--h) * 0.02);
  top: 50%;
  height: calc(var(--h) * 0.5);
  transform: translateY(-54%);
}
.btn .bi + span {
  left: calc(var(--fl) - var(--bl) + var(--h) * 0.5);
}
.btn:active,
.rb:active,
#bell:active {
  transform: scale(0.94);
  filter: brightness(0.9);
}
.btn.off,
.btn.dim,
.btn:disabled {
  filter: grayscale(0.9) brightness(0.75);
}

/* Touch targets: a small round button or a short button gets an invisible hit area of 45 px (44 + rounding); the
   drawing keeps its size. A round button: a square around its centre; a 9-slice button: grows up and down from its art. Inside a
   panel shrunk to fit (fitPanel sets --ps), the area grows back by the same factor, so it is 45 px on the screen. */
.rb::before {
  content: '';
  position: absolute;
  inset: min(0px, calc(50% - 22.5px / var(--ps, 1)));
}
.btn::before {
  content: '';
  position: absolute;
  left: calc(var(--bl, 0px) * -1);
  right: calc(var(--br, 0px) * -1);
  top: calc(var(--bt, 0px) * -1 + min(0px, (var(--h, 45px) - 45px / var(--ps, 1)) / 2));
  bottom: calc(var(--bb, 0px) * -1 + min(0px, (var(--h, 45px) - 45px / var(--ps, 1)) / 2));
}

/* Round buttons (sound, gear, back) */
.rb {
  position: relative;
  flex: none;
  width: calc(var(--u) * 11.5);
  height: calc(var(--u) * 11.5);
  background: url(../assets/ui/btn-round.webp) center / contain no-repeat;
  transition:
    transform 0.13s var(--pop),
    filter 0.13s;
}
.rb.small {
  width: calc(var(--u) * 9);
  height: calc(var(--u) * 9);
}
.rb .ic {
  position: absolute;
  left: 21%;
  top: 19%;
  width: 58%;
  height: 58%;
  object-fit: contain;
}
.rb .ic.flip {
  transform: scaleX(-1);
}
#corner {
  position: absolute;
  right: calc(var(--sar) + var(--u) * 2.5 + var(--hud-x));
  top: calc(env(safe-area-inset-top, 0px) + var(--hud-y) + var(--u) * 2.5);
  display: flex;
  gap: calc(var(--u) * 1.6);
  z-index: 40;
}

.pill {
  --h: calc(var(--u) * 10);
  position: relative;
  display: block;
}
.pill > .in {
  position: absolute;
  inset: calc(var(--ft) - var(--bt)) calc(var(--h) * 0.34 - var(--br)) calc(var(--fb) - var(--bb))
    calc(var(--h) * 0.34 - var(--bl));
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.tag {
  --h: calc(var(--u) * 9.5);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tag > b {
  margin: 0 calc(var(--fl) - var(--bl));
  position: relative;
  top: calc((var(--ft) - var(--fb)) / 2);
  font-size: calc(var(--h) * 0.42);
  text-transform: uppercase;
  white-space: nowrap;
  padding-bottom: var(--cap);
}

/* Panels: centred on both axes, never pushed down */
.ov {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(4, 22, 20, 0.56);
  padding: calc(var(--sat) + var(--u) * 5) calc(var(--sar) + var(--u) * 5) calc(var(--sab) + var(--u) * 5)
    calc(var(--sal) + var(--u) * 5);
} /* 5u: room for the close button that sits on the corner of the wood */
.panel {
  --k: calc(var(--u) * 0.066);
  position: relative;
  width: calc(var(--u) * 88);
  max-width: 100%;
}
.panel > .in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 3);
  margin: calc(var(--ft) - var(--bt)) calc(var(--fr) - var(--br)) calc(var(--fb) - var(--bb))
    calc(var(--fl) - var(--bl));
  padding: calc(var(--u) * 2) calc(var(--u) * 1);
}
.panel h2 {
  font-size: calc(var(--u) * 7);
  text-transform: uppercase;
  text-align: center;
}
.ov.under {
  background: transparent;
}
.ov.under .panel {
  visibility: hidden;
}
.panel .x {
  position: absolute;
  right: calc(var(--k) * 27 - var(--br) - var(--u) * 4.5);
  top: calc(var(--k) * 30 - var(--bt) - var(--u) * 4.5);
  z-index: 2;
} /* centred on the top right corner of the wood */
.panel .in > .btn {
  width: 100%;
  max-width: calc(var(--u) * 58);
}
.tray {
  --k: calc(var(--u) * 0.13);
  position: relative;
}

/* Rows of the sound and settings panels */
.row {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2.5);
  width: 100%;
  min-height: calc(var(--u) * 12);
}
.row > img.ri {
  width: calc(var(--u) * 8.5);
  height: calc(var(--u) * 8.5);
  object-fit: contain;
  flex: none;
}
.row > .lb {
  flex: 1;
  min-width: 0;
  font-size: calc(var(--u) * 4.6);
  text-align: left;
  white-space: nowrap;
}
.row.help > .lb {
  white-space: normal;
}
.row > .val {
  font-size: calc(var(--u) * 4.2);
  color: #bff5c8;
  max-width: 40%;
  text-align: right;
}
button.row {
  text-align: left;
}
.switch {
  position: relative;
  flex: none;
  width: calc(var(--u) * 19);
  height: calc(var(--u) * 9.5);
  background: url(../assets/screens/switch-off-track.webp) center / 100% 100% no-repeat;
}
.switch:not([aria-checked='true']) {
  filter: saturate(0.15) brightness(0.82);
}
.switch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url(../assets/screens/switch-on-track.webp) center / 100% 100% no-repeat;
  opacity: 0;
  transition: opacity 0.16s;
}
.switch[aria-checked='true']::after {
  opacity: 1;
}
/* the knob: its own art (cut from the switch), rolls from one end to the other with a spring */
.switch .kn {
  position: absolute;
  z-index: 1;
  top: 47.5%;
  left: 24.5%;
  width: 33.5%;
  aspect-ratio: 1;
  translate: -50% -50%;
  background: url(../assets/screens/switch-knob.webp) center / contain no-repeat;
  transition: left 0.42s cubic-bezier(0.3, 1.55, 0.5, 1);
}
.switch[aria-checked='true'] .kn {
  left: 75.1%;
}
body.calm .switch .kn {
  transition: none;
}
.slider {
  position: relative;
  flex: 1;
  height: calc(var(--u) * 11);
  touch-action: none;
  cursor: pointer;
}
.slider .tr {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: calc(var(--u) * 6.4);
  transform: translateY(-50%);
  background: url(../assets/ui/slider-track.webp) center / 100% 100% no-repeat;
}
.slider .fl {
  position: absolute;
  left: 0;
  top: 50%;
  height: calc(var(--u) * 6.4);
  width: 100%;
  transform: translateY(-50%);
  background: url(../assets/ui/slider-fill.webp) left center / 100% 100% no-repeat;
  clip-path: inset(0 calc(100% - var(--v, 50%)) 0 0 round 999px);
}
.slider .kn {
  position: absolute;
  top: 50%;
  left: var(--v, 50%);
  width: calc(var(--u) * 10);
  height: calc(var(--u) * 10);
  transform: translate(-50%, -50%);
  background: url(../assets/ui/slider-knob.webp) center / contain no-repeat;
}
.langs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--u) * 1.6);
  width: 100%;
}
.langs .btn {
  --h: calc(var(--u) * 10.5);
  width: 100%;
}
.langs .btn > span {
  text-transform: none;
  font-size: calc(var(--h) * 0.4);
}
.btn > span:lang(ja),
.btn > span:lang(ko),
.btn > span:lang(zh) {
  padding-bottom: 0;
} /* CJK glyphs fill the em box: no capital lift */
.langs .btn.sel {
  filter: brightness(1.25) saturate(1.3);
}

/* Effects above everything, never catching the pointer */
#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 70;
  pointer-events: none;
}
#floats {
  position: absolute;
  inset: 0;
  z-index: 71;
  pointer-events: none;
  overflow: hidden;
}
body.veil #fx,
body.veil #floats,
body.fx-under #fx,
body.fx-under #floats {
  z-index: 49;
} /* a panel is open over the duel: the effects of the duel stay under it (the victory confetti does not: the result panel is no veil; the defeat panel is: fx-under) */
#drag {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}
.float {
  position: absolute;
  font-size: calc(var(--u) * 10);
  --o: 0.2em;
  white-space: nowrap;
  will-change: transform, opacity;
}
.float.f-heal {
  color: #9dffa0;
}
.float.f-buff {
  color: #ffe27a;
}
.float.f-info {
  font-size: calc(var(--u) * 6.2);
  --o: 0.22em;
}

/* Characters: alive, growing from the feet. Cast shadow = the sprite in black, laid on the ground behind it (up and to
   the right: one light for everybody, whatever way the character faces), soft and fading away from the feet. --pad =
   empty rows under the feet in the picture (measured by setChar), so the feet are the pivot. */
.char {
  display: block;
  transform-origin: 50% calc(100% - var(--pad, 0) * 100%);
  animation: breathe 3.2s ease-in-out infinite;
}
.shade {
  position: absolute;
  left: 0;
  bottom: calc(var(--pad, 0) * -100%);
  height: 100%;
  width: auto;
  max-width: none;
  translate: -50% 0;
  pointer-events: none;
  transform-origin: 50% calc(100% - var(--pad, 0) * 100%);
  transform: skewX(-56deg) scaleY(0.4) scaleX(var(--flip, 1));
  filter: brightness(0) blur(calc(var(--u) * 0.5));
  opacity: 0.5;
  -webkit-mask-image: linear-gradient(to top, #000 20%, rgba(0, 0, 0, 0.6) 65%, transparent 100%);
  mask-image: linear-gradient(to top, #000 20%, rgba(0, 0, 0, 0.6) 65%, transparent 100%);
}
.shadow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -2.5%;
  height: 7%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.38), transparent);
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(1.012, 1.03);
  }
}
@keyframes hype {
  0%,
  100% {
    transform: rotate(-1.2deg) scale(1.03);
  }
  50% {
    transform: rotate(1.2deg) scale(1.03);
  }
}
@keyframes cheer {
  0%,
  100% {
    transform: scale(1, 1);
  }
  45% {
    transform: scale(0.97, 1.06) translateY(-3%);
  }
}
.char.hype {
  animation: hype 0.34s ease-in-out infinite;
}
.char.cheer {
  animation: cheer 0.5s ease-in-out infinite;
}
body.calm .char,
body.calm .c-art {
  animation: none !important;
}
/* End of css/base.css (complete file). */
