/* Truco Showdown - the balloon of a request or of its answer (src/ui/call.js), and the snacks on the table.
   The balloon is one picture: body from 4% to 73.8% of its height, the tip of
   the tail at 91.1% x 96%. --tipx / --tipy = where that tip goes, per seat; --bw = its width at rest. The picture is laid
   out --grow times bigger and scaled DOWN at rest, so the letters stay sharp at the size of the impact too; it grows
   away from the tip (--k = the step of the ladder), so a bigger one never comes closer to the face. */
.call {
  --bw: calc(var(--pw) * 29.4);
  --tipx: 0px;
  --tipy: 0px;
  --side: 1;
  position: absolute;
  z-index: 30;
  pointer-events: none;
  width: calc(var(--bw) * var(--grow));
  aspect-ratio: 960 / 456;
  transform-origin: calc(50% + 41.1% * var(--side)) 96%;
  left: calc(var(--tipx) - var(--bw) * var(--grow) * (0.5 + 0.411 * var(--side)));
  top: calc(var(--tipy) - var(--bw) * var(--grow) * 0.456);
  transform: scale(calc(var(--k, 1) / var(--grow)));
}
.call img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  scale: var(--side) 1;
}
.call b {
  position: absolute;
  left: 6.5%;
  right: 6.5%;
  top: 5.5%;
  height: 65.5%;
  display: grid;
  place-items: center;
  font-size: calc(var(--bw) * var(--grow) * 0.19);
  line-height: 1;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.call b > span {
  display: block;
  max-width: 100%;
  white-space: nowrap;
}
/* portrait: over the head of each rival, beside the partner, and yours over your hand, on its right */
.call[data-side='left'] {
  --side: -1;
  --tipx: calc(var(--pw) * 5.4);
  --tipy: calc(var(--ph) * 30.2);
}
.call[data-side='right'] {
  --tipx: calc(var(--pw) * 94.6);
  --tipy: calc(var(--ph) * 30.2);
}
.call[data-side='top'] {
  --side: -1;
  --tipx: calc(var(--pw) * 67);
  --tipy: calc(var(--ph) * 29.6);
}
.call[data-side='bottom'] {
  --bw: calc(var(--pw) * 31);
  --tipx: calc(var(--pw) * 95);
  --tipy: calc(var(--sh) - var(--hand-top) - var(--ph) * 0.2);
}
.tray.says::before {
  opacity: 1;
}
@media (orientation: landscape) {
  .call {
    --bw: calc(var(--pw) * 16.4);
  }
  .call[data-side='left'] {
    --tipx: calc(var(--pw) * 16.3);
    --tipy: calc(var(--ph) * 48);
  }
  .call[data-side='right'] {
    --tipx: calc(var(--pw) * 83.7);
    --tipy: calc(var(--ph) * 48);
  }
  .call[data-side='top'] {
    --tipx: calc(var(--pw) * 58.9);
    --tipy: calc(var(--ph) * 33);
  }
  .call[data-side='bottom'] {
    --bw: calc(var(--pw) * 15.4);
    --tipx: calc(var(--pw) * 76);
    --tipy: calc(var(--sh) - var(--safe-b) - var(--dock) - var(--ph) * 0.3);
  }
}

/* the partner's answer to Signal: the same balloon in our colour, beside her frame, a little wider (it is a sentence) */
.sig {
  --bw: calc(var(--pw) * 33.5);
  --tipx: calc(var(--pw) * 66.8);
  --tipy: calc(var(--ph) * 30.4);
  position: absolute;
  width: var(--bw);
  aspect-ratio: 960 / 456;
  left: calc(var(--tipx) - var(--bw) * 0.089);
  top: calc(var(--tipy) - var(--bw) * 0.456);
  transform-origin: 8.9% 96%;
  pointer-events: none;
}
.sig img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  scale: -1 1;
}
.sig b {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 5.5%;
  height: 65.5%;
  display: grid;
  place-items: center;
  font-size: calc(var(--bw) * 0.15);
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}
.sig b > span {
  display: block;
  max-width: 100%;
  white-space: nowrap;
}
@media (orientation: landscape) {
  .sig {
    --bw: calc(var(--pw) * 19.5);
    --tipx: calc(var(--pw) * 58.9);
    --tipy: calc(var(--ph) * 33);
  }
}

/* waiting for the answer to your request: the frame of who must answer glows and breathes; three dots move beside it,
   outside the frame */
.seat.waits .frame {
  box-shadow: 0 0 0 calc(var(--pw) * 0.4) #fff;
}
/* a navy line between the white and the yellow: the chairs are yellow too */
.seat.waits .frame::before {
  box-shadow:
    0 0 0 calc(var(--pw) * 0.7) var(--navy),
    0 0 0 calc(var(--pw) * 1.3) var(--yellow),
    0 0 calc(var(--pw) * 2.4) calc(var(--pw) * 1.4) rgba(255, 226, 90, 0.95);
  opacity: 1;
  animation: waits var(--f-light) steps(6) infinite;
}
@keyframes waits {
  25%,
  75% {
    opacity: 0.84;
  }
  50% {
    opacity: 0.68;
  }
}
.waiting {
  --nh: max(calc(var(--ph) * 2.6), 16px);
  position: absolute;
  z-index: 4;
  top: 2%;
  left: calc(100% + var(--pw) * 0.9);
  height: var(--nh);
  display: flex;
  align-items: center;
  gap: calc(var(--nh) * 0.14);
  padding: 0 0 calc(var(--nh) * 0.1);
  border: solid transparent;
  border-width: 0 calc(var(--nh) * 0.3);
  border-image: url(../assets/img/ui/plate.webp) 0 26 fill;
}
.seat[data-side='right'] .waiting {
  left: auto;
  right: calc(100% + var(--pw) * 0.9);
}
.waiting img {
  width: calc(var(--nh) * 0.38);
  height: calc(var(--nh) * 0.38);
  animation: waiting-dot var(--f-wait) calc(var(--n) * 0.18s) ease-in-out infinite;
}
@keyframes waiting-dot {
  0%,
  55%,
  100% {
    transform: none;
  }
  25% {
    transform: translateY(-38%);
  }
}
/* portrait: under the partner's name, where there is room between her and who answers */
@media (orientation: portrait) {
  .seat:not([data-side='top']) .waiting {
    top: 54%;
  }
}
@media (orientation: landscape) {
  .waiting {
    --nh: max(calc(var(--ph) * 4.6), 18px);
  }
}

/* snacks, each one with its own shadow in the picture. Only where there is room
   (not on phones lying down, not in portrait). On the smooth part of the table, never on its rim. The
   plate is between the left rival's card and the partner's: above the rival's there are only 35 px for its 41 (at 1672 x
   941), none when that card rises. The partner's open cards (hand of eleven) go there: the plate fades away for them */
.snack {
  display: none;
  pointer-events: none;
  z-index: 1;
}
@media (orientation: landscape) and (min-height: 500px) {
  #s-table > .snack {
    display: block;
    height: auto;
  }
  .snack.s1 {
    --x: 39.89;
    --y: 45.06;
    --w: 4.13;
    transition: opacity 0.25s;
  }
  #s-table:has(.seat .show) > .snack.s1 {
    opacity: 0;
  }
  .less-motion .snack.s1 {
    transition-duration: 1ms;
  }
  .snack.s2 {
    --x: 71.46;
    --y: 44.3;
    --w: 4.19;
  }
  .dock-tip {
    left: calc(var(--pw) * 72.4);
    bottom: calc(var(--ph) * 24.6);
    max-width: calc(var(--pw) * 23);
  } /* above the peanuts, between your card and the right rival's name */
  .snack.s3 {
    --x: 77.53;
    --y: 77.51;
    --w: 4.61;
  }
}
/* End of css/call.css (complete file). */
