/* The duel: table, cards, heroes, acorns and bell. Every piece is placed by src/battle/layout.js (pose = its centre). */
#shake {
  position: absolute;
  inset: 0;
  will-change: transform;
}
#field {
  position: absolute;
  inset: 0;
}
#field > *,
#drag > .card {
  position: absolute;
  left: 0;
  top: 0;
}

/* ---- card ---- */
.card {
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
  margin: calc(var(--cw) * -0.7) 0 0 calc(var(--cw) * -0.5);
  z-index: 5;
  will-change: transform;
  touch-action: none;
}
.c-in {
  position: absolute;
  inset: 0;
  transform-origin: 50% 62%;
}
.c-in::before {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  top: 6%;
  bottom: -2%;
  border-radius: 12%;
  background: rgba(0, 0, 0, 0.32);
  filter: blur(calc(var(--cw) * 0.045));
  transform: translateY(calc(var(--cw) * 0.05));
}
.c-win {
  position: absolute;
  left: var(--win-l);
  top: var(--win-t);
  right: var(--win-r);
  bottom: calc(var(--bar-b) + 1%);
  border-radius: 9% / 7%;
  overflow: hidden;
  background: #123a34;
}
.c-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.c-art {
  position: absolute;
  left: 5%;
  top: 9%;
  width: 90%;
  height: 66%;
  object-fit: contain;
  object-position: 50% 100%;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 calc(var(--cw) * 0.02) calc(var(--cw) * 0.02) rgba(0, 0, 0, 0.35));
}
.t-trick .c-art {
  top: 16%;
  height: 60%;
}
.on-board .c-art {
  animation: breathe 3.2s ease-in-out infinite;
  animation-delay: var(--idle, 0s);
}
.c-frame,
.c-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.c-back {
  display: none;
}
.card.back .c-back {
  display: block;
}
.card.back .c-in > :not(.c-back) {
  visibility: hidden;
}

/* cost seal: the box IS the disc (so the number centres on it); the picture, with its acorn, hangs around it (--seal) */
.c-cost {
  position: absolute;
  left: -1%;
  top: -1.1%;
  width: 21%;
  aspect-ratio: 1;
}
.c-cost img {
  position: absolute;
  left: calc(50% - var(--seal) * 50%);
  top: calc(50% - var(--seal) * 50%);
  width: calc(var(--seal) * 100%);
  height: calc(var(--seal) * 100%);
  max-width: none;
}
.c-hp img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.c-cost b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--cw) * 0.15);
  padding-bottom: 0.04em;
}
.c-fam {
  position: absolute;
  left: 19.5%;
  top: 0.8%;
  width: 14.5%;
  aspect-ratio: 1;
  opacity: 0.95;
  filter: drop-shadow(0 calc(var(--cw) * 0.008) calc(var(--cw) * 0.01) rgba(0, 0, 0, 0.45));
}
.card.big .c-fam {
  top: 12%;
  left: 3%;
} /* the name plate takes the top of the big card */
/* name plate (big card only): centred on the top of the window, clear of the seal, one or two lines */
.c-name {
  position: absolute;
  left: 50%;
  top: 2.4%;
  translate: -50% 0;
  width: max-content;
  min-width: 34%;
  max-width: 50%;
  padding: calc(var(--cw) * 0.014) calc(var(--cw) * 0.04);
  display: none;
  place-items: center;
  text-align: center;
  border-radius: calc(var(--cw) * 0.045);
  background: linear-gradient(#0d4a42, #06302b);
  box-shadow:
    0 0 0 calc(var(--cw) * 0.009) rgba(255, 226, 140, 0.9),
    0 calc(var(--cw) * 0.012) calc(var(--cw) * 0.02) rgba(0, 0, 0, 0.45);
}
.c-name span {
  font-size: calc(var(--cw) * var(--nk, 0.072));
  --o: 0.13em;
  line-height: 1.08;
  padding-bottom: var(--cap);
  white-space: normal;
  text-wrap: balance;
  overflow-wrap: normal;
} /* a long single word shrinks (fit), never breaks */
.card.big .c-name {
  display: grid;
}
.c-atk {
  position: absolute;
  left: 7%;
  bottom: 6.6%;
  height: 11.5%;
  display: flex;
  align-items: center;
  gap: calc(var(--cw) * 0.008);
}
.c-atk img {
  height: 100%;
  width: auto;
}
.c-atk b {
  font-size: calc(var(--cw) * 0.165);
  --o: 0.16em;
  transition: color 0.2s;
}
.c-hp b,
.c-fx b {
  font-size: calc(var(--cw) * 0.175);
  --o: 0.16em;
  transition: color 0.2s;
}
.c-hp {
  position: absolute;
  right: -4.5%;
  bottom: -1.5%;
  width: 36%;
  aspect-ratio: 230 / 205;
}
.c-hp b {
  position: absolute;
  inset: 5.5% 0 4.5% 0;
  display: grid;
  place-items: center;
} /* the body of the heart, a little under its lobes */
.c-ab {
  position: absolute;
  left: 49.5%;
  bottom: 4%;
  width: 20%;
  aspect-ratio: 1;
  transform: translateX(-50%);
}
.c-ab img {
  width: 100%;
  height: 100%;
}
.c-ab2 {
  position: absolute;
  left: 4%;
  top: 30%;
  width: 20%;
  aspect-ratio: 1;
}
.c-ab2 img {
  width: 100%;
  height: 100%;
}
.c-fx {
  position: absolute;
  left: 50%;
  bottom: 7%;
  height: 15%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: calc(var(--cw) * 0.02);
  padding: 0 calc(var(--cw) * 0.07);
  border-radius: 999px;
  background: rgba(4, 40, 35, 0.9);
  white-space: nowrap;
}
.c-fx img {
  height: 78%;
  width: auto;
}
/* overlapped hand (#field.tight): life, ability and the trick badge sit on the left part, the part in sight */
#field.tight .in-hand .c-hp {
  right: auto;
  left: 34%;
}
#field.tight .in-hand .c-ab {
  left: 4%;
  bottom: auto;
  top: 50%;
  transform: none;
}
#field.tight .in-hand .c-fx {
  left: 6%;
  transform: none;
}
.c-atk b.up,
.c-hp b.up {
  color: #a8ffab;
}
.c-hp b.down {
  color: #ffc49a;
}

/* shield: a bubble around the card; frozen: ice over it */
.c-shield {
  position: absolute;
  inset: 0.8% 1%;
  z-index: -1;
  border-radius: 10% / 7.4%;
  box-shadow:
    0 0 0 calc(var(--cw) * 0.026) rgba(232, 251, 255, 1),
    0 0 calc(var(--cw) * 0.09) calc(var(--cw) * 0.045) rgba(40, 190, 255, 1);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.card.on-board.shielded .c-shield,
.card.show.shielded .c-shield {
  opacity: 1;
  animation: shieldglow 2.6s ease-in-out infinite;
}
@keyframes shieldglow {
  0%,
  100% {
    opacity: 0.78;
  }
  50% {
    opacity: 1;
  }
}
body.calm .card.shielded .c-shield {
  animation: none;
}
/* frozen: frost on the rim and a light cold tint; the critter and its numbers stay readable, a small flake in a corner */
.c-ice {
  position: absolute;
  inset: -1.5%;
  background: url(../assets/fx/frost.webp) center / 100% 100% no-repeat;
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity 0.22s,
    transform 0.3s var(--pop);
  pointer-events: none;
} /* the frost art (5:7, like the card) */
.c-ice img {
  position: absolute;
  right: 5%;
  top: 6%;
  width: 24%;
  filter: drop-shadow(0 calc(var(--cw) * 0.01) calc(var(--cw) * 0.015) rgba(0, 40, 80, 0.6));
}
.card.frozen .c-ice {
  opacity: 1;
  transform: none;
}
.card.frozen .c-art {
  animation-play-state: paused;
}

/* hand states */
/* the glow of a playable card is a shadow BEHIND it (cheap), never a filter around an animated child (slow in Safari) */
.in-hand.can .c-in::after {
  content: '';
  position: absolute;
  inset: 1.2% 1.6%;
  z-index: -1;
  border-radius: 10% / 7.4%;
  box-shadow:
    0 0 calc(var(--cw) * 0.03) calc(var(--cw) * 0.022) #fff3b0,
    0 0 calc(var(--cw) * 0.1) calc(var(--cw) * 0.05) rgba(255, 206, 70, 0.9);
}
.in-hand.cant .c-in {
  filter: brightness(0.82);
}
.in-hand.cant .c-cost b {
  color: #ffb991;
}
/* the hand has no idle animation on purpose: seven overlapped cards moving all the time cost too much in Safari (measured: 6 fps -> 29 fps without it) */
.card.held {
  z-index: 30;
}
@media (hover: hover) and (pointer: fine) {
  .in-hand:not(.held):hover {
    z-index: 29 !important;
  }
  .in-hand:not(.held):hover .c-in {
    translate: 0 -9%;
    scale: 1.06;
    transition:
      translate 0.16s cubic-bezier(0.3, 1.7, 0.5, 1),
      scale 0.16s cubic-bezier(0.3, 1.7, 0.5, 1);
  }
  .in-hand:not(.held) .c-in {
    transition:
      translate 0.32s ease-out,
      scale 0.32s ease-out;
  }
} /* up with a spring, down slowly: a sweep of the mouse is a wave of piano keys */
.card.big {
  z-index: 60;
}

/* ---- slots of the lanes: the slot art (a recess carved in wood, with a leaf), its strength set per table; no drawn lane column ---- */
#s-battle {
  --slot-a: 0.62;
}
#s-battle[data-world='marsh'] {
  --slot-a: 0.62;
}
#s-battle[data-world='marsh'] .scene-img {
  filter: saturate(0.8) brightness(0.96);
}
#s-battle[data-world='beach'] {
  --slot-a: 0.7;
}
#s-battle[data-world='snow'] {
  --slot-a: 0.74;
}
#s-battle[data-world='storm'] {
  --slot-a: 0.8;
}
.slot {
  width: calc(var(--cw) * 0.98);
  height: calc(var(--cw) * 1.372);
  margin: calc(var(--cw) * -0.686) 0 0 calc(var(--cw) * -0.49);
  z-index: 1;
  transition: opacity 0.16s;
  pointer-events: none;
}
.slot::before,
.slot::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url(../assets/fx/slot2.webp) center / 100% 100% no-repeat;
  opacity: var(--slot-a);
  transition: opacity 0.16s;
}
/* the valid slot: the golden rim art over it (the slot is placed by a transform, so it is NEVER scaled or moved: only the
   opacity of its two pictures changes). ok = a card may go here; hot = the card is over it right now. */
.slot::after {
  inset: -1.5%;
  background-image: url(../assets/fx/slotglow.webp);
  opacity: 0;
}
.slot.foe {
  opacity: 0.75;
}
.slot.full {
  opacity: 0;
}
.slot.ok,
.slot.hot {
  opacity: 1;
}
.slot.ok::after {
  opacity: 0.75;
}
.slot.hot::before {
  opacity: calc(var(--slot-a) * 0.7);
}
.slot.hot::after {
  opacity: 1;
}
.slot.full.ok,
.slot.full.hot {
  opacity: 0;
}
/* a card that can be the target (swap my critter, or aim a trick): the card itself glows */
.card.t-ok .c-in {
  filter: drop-shadow(0 0 calc(var(--cw) * 0.03) #fff3b0)
    drop-shadow(0 0 calc(var(--cw) * 0.09) rgba(255, 206, 70, 0.9));
}
.card.t-hot {
  z-index: 7;
}
.card.t-hot .c-in {
  scale: 1.07;
  filter: drop-shadow(0 0 calc(var(--cw) * 0.04) #fff) drop-shadow(0 0 calc(var(--cw) * 0.14) rgba(255, 214, 90, 1));
  transition: scale 0.15s var(--pop);
}
/* a trick with no target: the whole table is the target */
/* a trick with no lane: what it really hits glows (enemy medallion, my medallion, my pile, the enemy cards) */
.pile.aim img {
  filter: drop-shadow(0 0 calc(var(--pw) * 0.08) #fff3b0)
    drop-shadow(0 0 calc(var(--pw) * 0.22) rgba(255, 206, 70, 0.95));
}
.hero.aim .face {
  box-shadow:
    0 0 0 calc(var(--hd) * 0.03) #fff3b0,
    0 0 calc(var(--hd) * 0.2) rgba(255, 214, 90, 0.9);
}

/* ---- heroes (medallion sized by the hole of the ring) ---- */
.hero {
  width: var(--hd);
  height: var(--hd);
  margin: calc(var(--hd) * -0.5) 0 0 calc(var(--hd) * -0.5);
  z-index: 4;
}
.hero .face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: radial-gradient(#1f6e62, #0b3a34);
  transform-origin: 50% 100%;
  animation: breathe 3.4s ease-in-out infinite;
}
.hero .face.cardface {
  object-fit: contain;
  padding: 4% 4% 0;
}
.hero .ringart {
  position: absolute;
  width: calc(var(--rw) * 100%);
  height: calc(var(--rh) * 100%);
  left: calc(50% - var(--rx));
  top: calc(50% - var(--ry));
  max-width: none;
}
.hero .life {
  position: absolute;
  right: -16%;
  bottom: -12%;
  width: 52%;
  aspect-ratio: 230 / 205;
}
.hero .life img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero .life b {
  position: absolute;
  inset: 9.5% 0 0.5% 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--hd) * 0.215);
}
.hero.aim .ringart {
  filter: brightness(1.45) drop-shadow(0 0 calc(var(--hd) * 0.1) #ffe27a);
}
.hero .ringart {
  transition: filter 0.15s;
}
.hero.ko .face,
.hero.ko .ringart {
  filter: grayscale(0.9) brightness(0.72);
  animation: none;
}

.pile {
  width: var(--pw);
  height: calc(var(--pw) * 1.4);
  margin: calc(var(--pw) * -0.7) 0 0 calc(var(--pw) * -0.5);
  z-index: 3;
}
.pile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(calc(var(--pw) * 0.05) calc(var(--pw) * 0.07) 0 rgba(4, 30, 26, 0.8));
}
.pile b {
  position: absolute;
  left: -30%;
  right: -30%;
  top: 102%;
  text-align: center;
  font-size: calc(var(--pw) * 0.58);
}
.pile.empty img {
  opacity: 0.35;
}

#fhand {
  width: 0;
  height: 0;
  z-index: 3;
}
#fhand .fb {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--fw);
  height: calc(var(--fw) * 1.4);
  margin: calc(var(--fw) * -0.7) 0 0 calc(var(--fw) * -0.5);
  transition: transform 0.25s var(--pop);
}
#fhand .fb img {
  width: 100%;
  height: 100%;
  display: block;
}

/* the pill grows with the seats (--n, set by setEnergy): 8 acorns and "8/8" always fit with room to spare */
#energy {
  --h: calc(var(--u) * 10);
  width: calc(var(--n, 1) * var(--u) * 3.6 + var(--u) * 17.4);
  min-width: calc(var(--u) * 26);
  margin: 0;
  translate: -50% -50%;
  z-index: 4;
}
#energy > .in {
  justify-content: center;
  gap: calc(var(--u) * 1.6);
}
#acorns {
  display: flex;
  align-items: center;
}
#acorns i {
  flex: none;
  width: calc(var(--u) * 3.2);
  height: calc(var(--u) * 4);
  margin-right: calc(var(--u) * 0.4);
  background: url(../assets/ui/fx-acorn.webp) center / contain no-repeat;
  position: relative;
  filter: grayscale(0.75) brightness(0.42);
  transition: filter 0.12s;
}
#acorns i:not(.on) {
  background-image: url(../assets/fx/acorn-shell.webp);
  filter: brightness(0.92);
} /* a spent acorn is an empty shell (art) */
#acorns i.on {
  filter: drop-shadow(0 0 calc(var(--u) * 0.5) rgba(255, 214, 90, 0.9));
}
#acorns i:last-child {
  margin-right: 0;
}
#energy-n {
  font-size: calc(var(--u) * 4);
}

#bell {
  width: var(--bd);
  height: var(--bd);
  margin: calc(var(--bd) * -0.5) 0 0 calc(var(--bd) * -0.5);
  z-index: 4;
  transition:
    transform 0.13s var(--pop),
    filter 0.2s;
}
#bell .art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* the bell (box x .354 w .298 h .326 of the art) sits --bdy lower, so bell + label are centred on the face */
#bell {
  --bdy: 8%;
}
#bell .icon {
  position: absolute;
  left: 35.4%;
  width: 29.8%;
  top: calc(8.5% + var(--bdy));
  height: 32.6%;
  pointer-events: none;
}
#bell span {
  position: absolute;
  left: 17%;
  right: 17%;
  top: calc(44% + var(--bdy) * 0.5);
  bottom: calc(15% - var(--bdy) * 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: calc(var(--bd) * 0.142);
  text-transform: uppercase;
  line-height: 0.98;
}
body:not(.land) #bell span {
  padding-top: calc(var(--u) * 0.5);
} /* standing, the label sits 0.25u lower under the lowered bell */
#bell.off {
  filter: grayscale(0.85) brightness(0.72);
}
/* with plays left the bell stays still; with nothing left it is a little brighter and calls with a swing now and then (bell.js) */
#bell.ready .art {
  filter: brightness(1.12);
}

/* ---- banner of the turn and the tutorial tip ---- */
#banner {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 0;
  height: 0;
  display: grid;
  place-items: center;
  z-index: 45;
  pointer-events: none;
}
#banner .tag {
  --h: calc(var(--u) * 11.5);
  white-space: nowrap;
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% -50%;
} /* centred ON the point (a 0x0 grid let it hang to the right) */
#banner .tag > b {
  letter-spacing: 0.06em;
} /* "RIVAL": the I and the V were touching */
#tip {
  position: absolute;
  left: var(--tip-x, 50%);
  top: var(--tip-y, 30%);
  width: var(--tip-w, 80%);
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  z-index: 46;
}
#tip .panel {
  --k: calc(var(--u) * 0.034);
  width: 100%;
}
#tip p {
  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) * 0.6) 0;
  font-size: calc(var(--u) * 3.7);
  text-align: center;
  --o: 0.13em;
  line-height: 1.18;
}
/* End of css/battle.css (complete file). */
