/* Start and menu: the live camp scene is the canvas behind; logo on top, buttons at the bottom.
   Landscape and ultrawide keep the same composition (logo above, buttons below), centered in the stage. */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
}
.screen.on {
  display: flex;
}
.logo {
  display: block;
  width: min(86%, calc(var(--u) * 330));
  height: auto;
  margin-top: calc(var(--u) * 64);
  filter: drop-shadow(0 calc(var(--u) * 2) calc(var(--u) * 2) rgba(6, 16, 20, 0.24));
  flex: none;
}

/* corner: sound + gear, same place on the menu and in battle */
/* above the panel layer (#modal, z 10): tapping it with a panel open switches panels */
#corner {
  position: absolute;
  top: calc(var(--u) * 10);
  right: calc(var(--u) * 10);
  display: flex;
  gap: calc(var(--u) * 8);
  z-index: 11;
}
#corner .corner-glyph {
  width: 78%;
  height: 78%;
  overflow: visible;
  filter: drop-shadow(0 1px 0 #0e2028);
}
#corner .glyph-body {
  fill: #e2f3f3;
  stroke: #142b35;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
#corner .sound-waves,
#corner .sound-mute {
  fill: none;
  stroke: #76e7c1;
  stroke-width: 2.3;
  stroke-linecap: round;
}
#corner .sound-mute {
  display: none;
  stroke: #ffab93;
}
#soundBtn.muted .sound-waves {
  display: none;
}
#soundBtn.muted .sound-mute {
  display: inline;
}
/* under any panel the screen (logo, menu buttons, HUD, hand) fades out: only the dimmed scene stays behind it.
   Opacity only: main.js layout() still reads their boxes */
.screen {
  transition: opacity 0.18s;
}
#app:has(.modal.on) .screen {
  opacity: 0;
  pointer-events: none;
}
#stage[data-screen='start'] #corner {
  display: none;
}

/* start */
#start {
  cursor: pointer;
}
#start .tap {
  margin-bottom: calc(var(--u) * 70);
  font-size: calc(var(--u) * 22);
  padding: 0 calc(var(--u) * 10);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  50% {
    transform: scale(1.04);
  }
}

/* menu */
#menu .coins-pill {
  position: absolute;
  top: calc(var(--u) * 10);
  left: calc(var(--u) * 10);
  font-size: calc(var(--u) * 20);
  z-index: 3;
}
.menu-foot {
  display: grid;
  width: min(92%, calc(var(--u) * 360));
  gap: calc(var(--u) * 10) calc(var(--u) * 12);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: 'stage stage stage' 'play play play' 'heroes bestiary ups';
  margin-bottom: calc(var(--u) * 34);
  justify-items: stretch;
}
.menu-foot .stage-btn {
  grid-area: stage;
  justify-self: center;
  height: calc(var(--u) * 46);
  font-size: calc(var(--u) * 18);
  min-width: calc(var(--u) * 130);
}
.menu-foot .play {
  grid-area: play;
}
.menu-foot .heroes {
  grid-area: heroes;
}
.menu-foot .ups {
  grid-area: ups;
}
.menu-foot .bestiary {
  grid-area: bestiary;
}
.menu-foot .play .ic {
  width: 0.8em;
  height: 0.8em;
}

@media (min-aspect-ratio: 4/3) {
  .logo {
    width: auto;
    height: min(30%, calc(var(--u) * 190));
    margin-top: calc(var(--u) * 14);
  }
  .menu-foot {
    width: min(94%, calc(var(--u) * 440));
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas: 'stage stage stage stage stage stage' '. play play play play .' 'heroes heroes bestiary bestiary ups ups';
    align-items: end;
    margin-bottom: calc(var(--u) * 18);
  }
  #start .tap {
    margin-bottom: calc(var(--u) * 40);
  }
}

@media (min-width: 850px) and (min-height: 501px) and (min-aspect-ratio: 4/3) and (pointer: fine) {
  #menu .menu-foot {
    --u: min(100vw / 475, 100dvh / 585, 1.5px);
    --touch: max(44px, calc(var(--u) * 48));
    margin-bottom: calc(var(--u) * 18 + 8px);
  }
}

@media (max-aspect-ratio: 4/3) {
  .logo {
    width: min(84%, 410px, calc(var(--u) * 315));
    max-height: 30dvh;
    object-fit: contain;
    margin-top: max(62px, calc(var(--touch) + var(--u) * 18));
  }
  #start .tap {
    margin-bottom: clamp(18px, 7dvh, 68px);
  }
  .menu-foot {
    margin-bottom: clamp(12px, 4dvh, 32px);
  }
}

/* phone landscape: short, everything a bit tighter (touch stays 44 px) */
@media (min-aspect-ratio: 4/3) and (max-height: 500px) {
  .logo {
    height: min(27%, 104px);
    margin-top: 6px;
  }
  .menu-foot .play {
    height: 54px;
    font-size: 23px;
  }
  .menu-foot {
    margin-bottom: 8px;
    gap: 6px 10px;
  }
}

/* ---------------------------------------------------------------- level grid (inside a panel) */
.worlds {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 10);
  margin: 0 0 calc(var(--u) * 10);
}
.worlds .wname {
  min-width: calc(var(--u) * 150);
  max-width: calc(var(--u) * 210);
  white-space: nowrap;
  text-align: center;
  font-size: calc(var(--u) * 19);
}
.worlds .btn.sq[disabled] {
  opacity: 0.35;
}
.flip {
  transform: scaleX(-1);
}
.lvgrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: calc(var(--u) * 8);
}
.lvl {
  position: relative;
  aspect-ratio: 1 / 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-style: solid;
  border-color: transparent;
  border-image: url(../assets/ui/inner.webp) 36 fill;
  border-width: calc(var(--u) * 7);
  min-height: 44px;
  min-width: 44px;
  padding-top: var(--cap);
}
.lvl b {
  font-size: calc(var(--u) * 24);
  line-height: 1;
}
.lvl .st {
  display: flex;
  gap: 1px;
  margin-top: calc(var(--u) * 4);
}
.lvl .st img {
  width: calc(var(--u) * 13);
  height: calc(var(--u) * 13);
}
.lvl .lock {
  width: calc(var(--u) * 26);
  height: calc(var(--u) * 26);
}
.lvl.cur::after {
  content: '';
  position: absolute;
  inset: calc(var(--u) * -6);
  border-radius: calc(var(--u) * 12);
  border: calc(var(--u) * 3) solid var(--em);
  box-shadow: 0 0 calc(var(--u) * 10) rgba(47, 191, 127, 0.7);
  pointer-events: none;
}
.lvl.locked {
  filter: saturate(0.4) brightness(0.8);
  cursor: default;
}
/* End of screens.css */
/* The opening fire grows with loading progress. */
.lfire {
  position: relative;
  width: calc(var(--u, 1px) * 90);
  height: calc(var(--u, 1px) * 96);
  margin: calc(var(--u, 1px) * 4) auto 0;
  flex: none;
}
.lfire .logs {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  translate: -50% 0;
}
.lfire .fl {
  position: absolute;
  left: 50%;
  bottom: 20%;
  width: 70%;
  transform-origin: 50% 100%;
  translate: -50% 0;
  scale: calc(0.15 + var(--p, 0) * 0.85);
  opacity: 0;
  transition: scale 0.25s ease-out;
  animation: lflame 0.36s steps(1) infinite;
}
.lfire .f1 {
  animation-delay: -0.12s;
}
.lfire .f2 {
  animation-delay: -0.24s;
}
@keyframes lflame {
  0% {
    opacity: 1;
  }
  33.4%,
  100% {
    opacity: 0;
  }
}
.calm .lfire .fl {
  animation: none;
}
.calm .lfire .f0 {
  opacity: 1;
}
.screen-sweep {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: linear-gradient(108deg, transparent 34%, #cfe9cc2b 47%, #fff0c966 51%, transparent 66%) no-repeat;
  background-size: 300% 100%;
  animation: screenSweep 360ms cubic-bezier(0.22, 0.65, 0.37, 1) both;
}
@keyframes screenSweep {
  from {
    background-position: right;
    opacity: 0.72;
  }
  50% {
    opacity: 0.72;
  }
  to {
    background-position: left;
    opacity: 0;
  }
}
.lfire {
  transition: opacity 0.5s 0.3s;
}
.lfire.lit {
  opacity: 0;
} /* loaded: the scene's own fire carries on */

.field-crossfade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
/* End of css/screens.css (complete file). */
