/* Truco Showdown - the table. Every piece is absolutely placed in % of the stage (--pw / --ph); the table is part of the
   background art. In landscape
   the middle is only for the cards played, in a diamond; deck, vira and trump chip are on
   the left, under the left rival's card. Portrait: (partner | rival, deck, vira, rival | chip | you).
   ONE sum places everything: the room between the back edge of the table (--y0) and the top of your hand (--hand-top)
   gives the size of every card; nothing is moved or resized when you play or when somebody asks. */

/* ---------- cards ---------- */
.card {
  position: relative;
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
  border-radius: calc(var(--cw) * 0.09);
  flex: none;
}
.card.face {
  background: #fff;
  box-shadow:
    inset 0 0 0 calc(var(--cw) * 0.012) #c9cde0,
    0 calc(var(--cw) * 0.04) calc(var(--cw) * 0.08) rgba(5, 10, 40, 0.35);
  color: var(--black);
}
.card.red {
  color: var(--red);
}
.card .suit,
.rail .suit {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: contain;
}
.card .idx {
  position: absolute;
  left: 6%;
  top: 3%;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30%;
  line-height: 0.85;
}
.card .idx b {
  font-size: calc(var(--cw) * 0.36);
  font-weight: 700;
  letter-spacing: -0.04em;
}
.card .idx .suit {
  width: 62%;
  margin-top: 6%;
}
.card .pip {
  position: absolute;
  width: 22%;
  transform: translate(-50%, -50%);
}
.card .pip.ace {
  width: 44%;
}
.card .court {
  position: absolute;
  left: 22%;
  top: 18%;
  width: 74%;
  height: 79%;
  object-fit: contain;
  object-position: 50% 100%;
}
.card.trump {
  box-shadow:
    inset 0 0 0 calc(var(--cw) * 0.03) #ffcf3a,
    0 0 calc(var(--cw) * 0.12) rgba(255, 207, 58, 0.8),
    0 calc(var(--cw) * 0.04) calc(var(--cw) * 0.08) rgba(5, 10, 40, 0.35);
}
.card.back {
  background: url(../assets/img/ui/back.webp) center / 100% 100% no-repeat;
  box-shadow: 0 calc(var(--cw) * 0.04) calc(var(--cw) * 0.07) rgba(5, 10, 40, 0.35);
}

/* ---------- placement helper: --x --y --w --h in % of the stage ---------- */
:where(#s-table) > *,
:where(.seat) {
  position: absolute;
  left: calc(var(--pw) * var(--x));
  top: calc(var(--ph) * var(--y));
  width: calc(var(--pw) * var(--w));
  height: calc(var(--ph) * var(--h));
}
#seats {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- score: US | trick dots | THEM, the hand value on the lower edge of its middle ---------- */
/* tall windows: score and chip go up into the spare sky (--up), right under the corner buttons (portrait) or beside them */
#s-table {
  --up: max(0px, var(--vh) - var(--sh) + var(--ph) * 5.6 - 76px);
  --us: #0fb3a2;
  --them: #dd1478;
}
.score {
  margin-top: calc(var(--up) * -1);
}
.score {
  --x: 20.5;
  --y: 5.6;
  --w: 59;
  --h: 5.3;
  --sch: calc(var(--ph) * var(--h));
  z-index: 5;
  display: flex;
  --score-w: min(
    var(--pw) * 59,
    var(--vw) - 140px - (var(--vw) - var(--sw)) / 2 - var(--pw) * 20.5 +
      max(0px, (var(--vh) - var(--sh) + var(--ph) * 5.6 - 74px) * 99)
  );
  width: var(--score-w);
} /* never under the corner buttons (full width when it is below them) */
/* each piece has a ready-made shadow with its own rounded shape (one for the three left a straight edge in the corners
   between them). It ends well inside the piece: one that reaches its edge shows as a thin light line. Never a `filter` on the score: with the value chip inside, it took the deal on WebKit from 45 to 28 fps
   (1854 x 1285, measured in turns). The chip keeps its own small one: it costs nothing that can be measured */
.score > .sc {
  position: relative;
}
.score > .sc::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 8% calc(var(--sch) * -0.32) 11%;
  border-radius: calc(var(--sch) * 0.28);
  box-shadow: 0 calc(var(--sch) * 0.085) calc(var(--sch) * 0.09) rgba(5, 10, 40, 0.55);
  pointer-events: none;
}
.score > .sc.mid::before {
  left: calc(var(--sch) * -0.26);
  right: calc(var(--sch) * -0.26);
  bottom: 13%;
}
/* score: three pictures, teal button | navy plate | magenta button */
.sc {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--pw) * 1.4);
  padding-bottom: calc(var(--sch) * 0.11);
  font-weight: 700;
  min-width: 0;
  border: solid transparent;
  border-width: 0 calc(var(--sch) * 0.36);
  border-image: var(--art) 0 40 fill;
}
.sc.us {
  flex: 0 0 38%;
  --art: url(../assets/img/ui/btn-teal.webp);
}
.sc.mid {
  flex: 1 1 0;
  margin: 0 calc(var(--sch) * -0.12);
  padding-bottom: calc(var(--sch) * 0.34);
  border-width: 0 calc(var(--sch) * 0.3);
  border-image: url(../assets/img/ui/plate.webp) 0 26 fill;
}
.sc.them {
  flex: 0 0 38%;
  --art: url(../assets/img/ui/btn-magenta.webp);
}
.sc span,
.sc b {
  font-size: calc(var(--ph) * 3.2);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.sc span {
  margin-left: calc(var(--sch) * -0.15);
}
.sc b {
  margin-right: calc(var(--sch) * -0.15);
}
.sc b {
  display: block;
}
.sc.mid small {
  display: none;
} /* only the three trick dots are shown */
/* on the smallest phones the score is narrow (the corner buttons): the dots stay inside the plate */
.tdots {
  display: flex;
  gap: min(var(--pw) * 1.2, var(--score-w) * 0.021);
}
.tdots i {
  width: min(var(--ph) * 1.8, var(--score-w) * 0.064);
  aspect-ratio: 1;
  background: url(../assets/img/ui/dot-slate.webp) center / contain no-repeat;
}
.tdots i.t0 {
  background-image: url(../assets/img/ui/dot-teal.webp);
}
.tdots i.t1 {
  background-image: url(../assets/img/ui/dot-magenta.webp);
}
.tdots i.tie {
  filter: brightness(1.5) saturate(0);
}
/* the value of the hand: a whole piece IN FRONT of the navy plate, over its lower edge, under the dots (they went up a
   little for it) and centred on the score, whatever the size of the score. Its soft shadow follows its own picture */
.chip {
  --h: 2.8;
  --cw: min(calc(var(--ph) * 5.9), var(--mid-w, 99px));
  --ch: calc(var(--ph) * var(--h));
  width: var(--cw);
  height: var(--ch);
  z-index: 2;
  filter: drop-shadow(0 calc(var(--ch) * 0.07) calc(var(--ch) * 0.1) rgba(3, 8, 34, 0.75));
  display: grid;
  place-content: center;
  padding-bottom: calc(var(--ch) * 0.12);
  border: solid transparent;
  border-width: 0 calc(var(--ch) * 0.45);
  border-image: url(../assets/img/ui/chip.webp) 0 30 fill;
  font-size: calc(var(--ph) * 2.1);
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}
.score > .chip {
  --mid-w: calc(var(--score-w) * 0.22);
  position: absolute;
  left: calc(50% - var(--cw) / 2);
  top: calc(var(--sch) * 0.6);
}

/* ---------- seats: partner on the back edge of the table, rivals on its sides; frame, fan of backs, name plate ---------- */
.seat {
  pointer-events: none;
}
.seat {
  --name-y: 97%;
}
.seat[data-side='top'] {
  --x: 37.4;
  --y: 21.9;
  --w: 25.2;
  --h: 14.8;
}
.seat[data-side='left'] {
  --x: 1.4;
  --y: 32.2;
  --w: 24.8;
  --h: 15;
}
.seat[data-side='right'] {
  --x: 73.8;
  --y: 32.2;
  --w: 24.8;
  --h: 15;
}
/* phones: from the widest ring around a frame to the window's edge there are at least 8 px (--off: how much to come in) */
@media (orientation: portrait) {
  #seats {
    --off: max(0px, 9px - var(--pw) * 0.1 - (var(--vw) - var(--sw)) / 2);
  }
  .seat[data-side='left'] {
    margin-left: var(--off);
  }
  .seat[data-side='right'] {
    margin-left: calc(var(--off) * -1);
  }
}
.seat .frame {
  position: absolute;
  inset: 0;
  border-radius: 40% 40% 26% 26% / 34% 34% 24% 24%;
  background: radial-gradient(circle at 50% 35%, #a774ff, #5a2fc6 80%);
  box-shadow:
    0 0 0 calc(var(--pw) * 0.6) #fff,
    0 calc(var(--ph) * 0.5) calc(var(--ph) * 1) rgba(5, 10, 40, 0.45);
}
.seat .frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
  scale: 1.12;
  transform-origin: 50% 100%;
  clip-path: inset(-10% 5.4% 0 5.4% round 0 0 26% 26% / 0 0 24% 24%);
} /* the bust fills the frame, only the head comes out of it */
/* the turn ring is a ready-made layer behind the bust: only its opacity changes */
.seat .frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    0 0 0 calc(var(--pw) * 0.8) var(--yellow),
    0 0 calc(var(--pw) * 3) rgba(255, 210, 31, 0.85);
  opacity: 0;
  transition: opacity 0.2s;
}
.seat.turn .frame::before,
.seat.says .frame::before {
  opacity: 1;
}
/* whoever speaks (asks, accepts, runs): the frame takes the colour of the team */
.seat.says .frame::before {
  --team: var(--them);
  box-shadow:
    0 0 0 calc(var(--pw) * 0.85) var(--team),
    0 0 calc(var(--pw) * 1.8) calc(var(--pw) * 0.8) var(--team);
}
.seat.says[data-team='us'] .frame::before {
  --team: var(--us);
}
.seat.says .frame {
  box-shadow: 0 0 0 calc(var(--pw) * 0.4) #fff;
}
.seat .fan {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 3%;
  height: 25%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
} /* an open fan on the frame's base, its bottom behind the name plate */
.seat .fan .card {
  --cw: calc(var(--pw) * var(--w) * 0.27);
  margin: 4% calc(var(--cw) * -0.07) 0;
  flex: none;
  transform: translateY(calc(var(--i) * var(--i) * 4%)) rotate(calc(var(--i) * 9deg));
  transform-origin: 50% 100%;
}
.seat .name {
  --nh: calc(var(--ph) * var(--h) * 0.21);
  position: absolute;
  z-index: 3;
  left: 7%;
  right: 7%;
  top: var(--name-y);
  height: var(--nh);
  display: grid;
  place-items: center;
  padding: 0 0 calc(var(--nh) * 0.12);
  border: solid transparent;
  border-width: 0 calc(var(--nh) * 0.4);
  border-image: url(../assets/img/ui/plate.webp) 0 26 fill;
  font-size: calc(var(--ph) * 2);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  filter: drop-shadow(0 calc(var(--ph) * 0.3) calc(var(--ph) * 0.4) rgba(5, 10, 40, 0.4));
}
.seat[data-side='top'] .name {
  left: 0;
  right: 0;
}
.seat .name span {
  display: block;
  margin: 0 calc(var(--nh) * -0.2);
  white-space: nowrap;
}
/* hand of eleven: the partner's cards under her name plate (never on her face), labelled */
.seat .show {
  position: absolute;
  z-index: 6;
  left: -40%;
  right: -40%;
  top: calc(var(--name-y) + 23%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--ph) * 0.4);
}
.seat .show .cs {
  display: flex;
  justify-content: center;
  gap: calc(var(--pw) * 1);
}
.seat .show .card {
  --cw: calc(var(--pw) * 9);
}
.seat .show .lbl {
  --nh: calc(var(--ph) * 2.6);
  display: grid;
  place-items: center;
  height: var(--nh);
  padding: 0 0 calc(var(--nh) * 0.12);
  border: solid transparent;
  border-width: 0 calc(var(--nh) * 0.4);
  border-image: url(../assets/img/ui/plate.webp) 0 26 fill;
  font-size: calc(var(--ph) * 1.6);
  text-transform: uppercase;
  white-space: nowrap;
}
/* end of a hand: a short note in a free row (portrait: under the chip; landscape: the partner's empty place), never on
   the deck or the vira, gone by itself */
.hand-note {
  --x: 2.5;
  --y: 65;
  --w: 95;
  --h: 8;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--ph) * 0.8);
  pointer-events: none;
}
.hand-note > span {
  --nh: calc(var(--ph) * 5.4);
  display: grid;
  place-items: center;
  height: var(--nh);
  min-width: 0;
  padding: 0 0 calc(var(--nh) * 0.12);
  border: solid transparent;
  border-width: 0 calc(var(--nh) * 0.4);
  border-image: url(../assets/img/ui/band-teal.webp) 0 30 fill;
  font-size: calc(var(--ph) * 2.6);
  text-transform: uppercase;
  white-space: nowrap;
}
.hand-note.them > span {
  border-image-source: url(../assets/img/ui/band-magenta.webp);
}
.hand-note.tie > span {
  border-image-source: url(../assets/img/ui/band-slate.webp);
}
#answers:empty {
  pointer-events: none;
} /* empty, it must not take the touch of the button below */
/* "see the cards" goes in the dock, in the place of TRUCO (empty at the end of a hand), so the note has its whole row */
.hand-note {
  --nb: calc(var(--ph) * (100 - var(--y) - var(--h)));
  --see-r: 6;
  --see-w: 47;
}
.hand-note .pill {
  --h: max(calc(var(--dock) * 0.74), 46px);
  position: absolute;
  right: calc(var(--pw) * var(--see-r));
  bottom: calc(var(--below) * -1 + (var(--dock) - var(--h)) / 2 - var(--nb));
  width: calc(var(--pw) * var(--see-w));
  min-width: 0;
  pointer-events: auto;
  font-size: calc(var(--h) * 0.36);
}

/* ---------- centre: the cards lie on the table (tilted back by --f-tilt, FEEL.css: about 2/3 of the real height shows,
   so nothing on them has to be stretched back). Portrait: three rows and the chip share the room. ---------- */
#s-table {
  --y0: calc(var(--ph) * 41.1);
  --gap: calc(var(--ph) * 0.4);
  --clear: calc(var(--ph) * 2.2);
  --rail-fs: calc(var(--ph) * 2.6);
  --rail-h: calc(var(--rail-fs) * 1.42);
  --lie: 0.94; /* the height a lying card takes / its width: 1.4 x cos(tilt) */
  --room: calc(
    var(--sh) - var(--hand-top) - var(--clear) - var(--y0)
  ); /* back edge of the table .. clear space above your hand */
  --lh: calc((var(--room) - var(--rail-h) - var(--gap) * 3) / 3);
  --lw: min(var(--lh) / var(--lie), var(--pw) * 18.6);
  --row2: calc(var(--y0) + var(--lh) + var(--gap));
  --rail-y: calc(var(--row2) + var(--lh) + var(--gap));
  --mine-y: calc(var(--rail-y) + var(--rail-h) + var(--gap));
  --side-y: var(--row2);
  --side-dx: calc(var(--lw) * 1.72);
  --mid: calc(var(--row2) + var(--lh) / 2);
  --deck-w: var(--lw);
  --deck-h: var(--lh);
  --deck-y: var(--row2);
  --deck-x: calc(var(--pw) * 50 - var(--lw) * 1.06);
}
#s-table > :is(.slot, .deck, .mid) {
  width: var(--lw);
  height: var(--lh);
  left: calc(var(--pw) * 50 - var(--lw) / 2);
  perspective: calc(var(--pw) * 90);
  z-index: 2;
}
#s-table > .mid {
  width: 0;
  height: 0;
  left: calc(var(--pw) * 50);
  top: var(--mid);
  perspective: none;
  z-index: 6;
} /* the centre of the cards played: points, thrown cards and ties use it */
#s-table > .slot[data-side='top'] {
  top: var(--y0);
}
#s-table > .slot[data-side='left'] {
  top: var(--side-y);
  left: calc(var(--pw) * 50 - var(--side-dx) - var(--lw) / 2);
}
#s-table > .slot[data-side='right'] {
  top: var(--side-y);
  left: calc(var(--pw) * 50 + var(--side-dx) - var(--lw) / 2);
}
#s-table > .slot[data-side='bottom'] {
  top: var(--mine-y);
  z-index: 4;
}
/* deck on the left, the vira whole and face up on its right, side by side; Mineiro has no vira: the deck alone */
#s-table > .deck {
  width: var(--deck-w);
  height: var(--deck-h);
  left: var(--deck-x);
  top: var(--deck-y);
}
.deck > * {
  --lw: var(--deck-w);
}
.slot > .card,
.deck > .card,
.vira > .card {
  --cw: var(--lw);
  position: absolute;
  left: 0;
  top: calc(50% - var(--cw) * 0.7);
  transform-origin: 50% 50%; /* its own centre: a flight that grows from it starts where it should */
  transform: rotateX(var(--f-tilt)) rotate(var(--turn, 0deg));
  transition:
    transform 0.3s cubic-bezier(0.2, 1.5, 0.4, 1),
    opacity 0.25s;
}
.slot[data-side='left'] {
  --turn: -3deg;
}
.slot[data-side='right'] {
  --turn: 3deg;
}
.deck > .card.back + .card.back {
  margin-top: calc(var(--ph) * -0.4);
}
.vira {
  position: absolute;
  z-index: 2;
  left: 112%;
  top: 0;
  width: 100%;
  height: 100%;
  perspective: calc(var(--pw) * 90);
}
.slot > .card.win {
  z-index: 3;
  transform: rotateX(var(--f-tilt)) translateY(-6%) scale(var(--lift, 1.12));
}
.slot > .card.lose {
  opacity: 0.72;
  scale: 0.94;
  transition:
    opacity 0.25s,
    scale 0.25s;
}
.slot > .card.even {
  opacity: 0.85;
}
.vira > .card.face,
.hand > .card.face {
  box-shadow:
    inset 0 0 0 max(1.5px, calc(var(--cw) * 0.028)) #5f6c94,
    0 calc(var(--cw) * 0.06) calc(var(--cw) * 0.09) rgba(15, 20, 45, 0.6),
    0 0 0 1px rgba(15, 20, 45, 0.35);
}
.deck > .card.back {
  box-shadow: 0 calc(var(--cw) * 0.06) calc(var(--cw) * 0.08) rgba(20, 25, 50, 0.55);
}
/* whose card it is: an edge in the team's colour, face up or covered. No glow: the glow (gold, under the card) is the winner's */
.slot {
  --team: var(--us);
}
.slot[data-team='them'] {
  --team: var(--them);
}
.slot > .card {
  box-shadow:
    inset 0 0 0 max(2.5px, calc(var(--cw) * 0.034)) var(--team),
    0 calc(var(--cw) * 0.05) calc(var(--cw) * 0.08) rgba(15, 20, 45, 0.5);
}
/* a covered card: the edge goes OUTSIDE the white border of the back (inside, teal on the teal back could not be seen) */
.slot > .card.back {
  box-shadow:
    0 0 0 max(2.5px, calc(var(--cw) * 0.034)) var(--team),
    0 calc(var(--cw) * 0.08) calc(var(--cw) * 0.08) rgba(15, 20, 45, 0.5);
}

#s-table > .calls {
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 30;
}
#s-table > #sigs {
  z-index: 29;
}
#s-table > .rail:empty {
  display: none;
}
/* trump chip: ONE line in every language and window: the plate grows with its content, suits and gaps are in em */
#s-table > .rail {
  left: calc(var(--pw) * 50);
  top: var(--rail-y);
  translate: -50% 0;
  width: max-content;
  height: var(--rail-h);
  max-width: calc(var(--pw) * 96);
  z-index: 3;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3em;
  padding: 0 0.62em 0.12em;
  font-size: var(--rail-fs);
}
.rail,
.band-sub {
  margin: 0;
  border: 0 solid transparent;
  border-image: url(../assets/img/ui/plate.webp) 24 26 28 26 fill;
  border-image-width: calc(var(--ph) * 0.9);
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  filter: drop-shadow(0 calc(var(--ph) * 0.3) calc(var(--ph) * 0.5) rgba(5, 10, 40, 0.4));
}
.rail > span {
  flex: none;
  margin-right: 0.2em;
}
.rail .suit {
  flex: none;
  width: 1em;
  height: 1em;
}
.rail i.m {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.1em;
  font-style: normal;
}
/* the question of the hand of eleven, under the band (no card is on the table then) */
.band-sub {
  --x: 12;
  --y: 70.6;
  --w: 76;
  --h: 3.4;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: calc(var(--ph) * 0.35);
  font-size: calc(var(--ph) * 2.2);
}
.band-sub:empty,
.rail:empty,
.chip:empty {
  display: none;
}

/* the band of the hand of eleven (requests speak in a balloon: css/call.css) */
.band-wrap {
  --x: 30;
  --w: 67.5;
}
.band-wrap {
  --x: 2.5;
  --y: 65;
  --w: 95;
  --h: 5;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
}
.band-wrap .band {
  --bh: calc(var(--ph) * var(--h));
  width: 100%;
  font-size: calc(var(--bh) * 0.74);
}
.band-wrap.in {
  animation: band-in var(--band-ms, 420ms) cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.band-wrap.out {
  animation: band-out 0.25s ease-in both;
}
@keyframes band-in {
  from {
    opacity: 0;
    transform: scale(0.18);
  }
  60% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.less-motion .band-wrap.in {
  animation-duration: 1ms;
}
/* trick tag ("Trick: Zeca", "Tie"), never on a card: a friend's lies over their name plate, at least as big as it, and
   grows toward the free side; yours and the tie's are beside your place on the table, at its foot */
.trick-tag {
  position: absolute;
  z-index: 5;
  --nh: calc(var(--ph) * 3.3);
  height: var(--nh);
  display: grid;
  place-items: center;
  width: max-content;
  padding: 0 0 calc(var(--nh) * 0.12);
  border: solid transparent;
  border-width: 0 calc(var(--nh) * 0.4);
  border-image: url(../assets/img/ui/band-teal.webp) 0 30 fill;
  font-size: calc(var(--nh) * 0.6);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.trick-tag.them {
  border-image-source: url(../assets/img/ui/band-magenta.webp);
}
.trick-tag.tie {
  border-image-source: url(../assets/img/ui/band-slate.webp);
}
.trick-tag > span {
  display: block;
  margin: 0 calc(var(--nh) * -0.12);
  white-space: nowrap;
} /* a little over the round ends, like the name plates */
.seat > .trick-tag {
  top: calc(var(--name-y) - 2%);
  min-width: 100%;
  max-width: calc(var(--pw) * 37.4);
}
.seat[data-side='top'] > .trick-tag {
  left: 50%;
  translate: -50% 0;
  max-width: calc(var(--pw) * 40);
}
.seat[data-side='left'] > .trick-tag {
  left: calc(var(--off, 0px) * -0.5);
}
.seat[data-side='right'] > .trick-tag {
  right: calc(var(--off, 0px) * -0.5);
}
.slot > .trick-tag:not(.zap) {
  left: calc(100% + var(--pw) * 2.4);
  bottom: 4%;
  max-width: calc(var(--pw) * 36);
}
/* your turn: the dock glows and the hand rises a little; in the first hands a small pill by the hand says so and goes away */
.hand.turn .card {
  translate: 0 calc(var(--cw) * -0.08);
}
.turn-tip {
  --th: clamp(36px, calc(var(--ph) * 5), 62px);
  left: calc(var(--pw) * 50);
  translate: -50% 0;
  top: auto;
  bottom: calc(var(--hand-top) + 14px);
  z-index: 12;
  margin: 0;
  display: grid;
  place-items: center;
  width: max-content;
  height: var(--th);
  padding: 0 0 calc(var(--th) * 0.1);
  border: solid transparent;
  border-width: 0 calc(var(--th) * 0.45);
  border-image: url(../assets/img/ui/band-yellow.webp) 0 30 fill;
  color: var(--navy);
  font-size: calc(var(--th) * 0.56);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  animation:
    pop-in 0.3s cubic-bezier(0.2, 1.6, 0.4, 1) backwards,
    tip-out 0.3s ease-in 2400ms forwards;
}
@keyframes tip-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}
.less-motion .turn-tip {
  animation-duration: 1ms;
}
#s-table:has(.answers .pill:nth-child(2)) .turn-tip,
#s-table:has(.band-wrap.in) .turn-tip,
#s-table:has(.dock-tip:not([hidden])) .turn-tip {
  display: none;
}
@keyframes band-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: scaleY(0.6);
  }
}

/* ---------- bottom block, on the window's bottom (the stage's bottom), above the phone's safe area: --below = minus that
   area. --hand-cw = width of a card of your hand: ONE size, the whole match. --hand-top = from the window's bottom to the
   top of the hand (its highest corner). --btn = cover / signal; --tx / --tw = the dock. ---------- */
#s-table {
  --below: calc(var(--safe-b) * -1);
  --dock: max(calc(var(--ph) * 7.4), 56px);
  --btn: max(calc(var(--dock) - 12px), 46px);
  --tx: 7;
  --tw: 86;
  --hand-cw: calc(var(--pw) * 20.6);
  --hand-up: calc(var(--safe-b) + var(--dock) - 4px);
  --hand-top: calc(var(--hand-up) + var(--hand-cw) * 1.45);
}
#s-table:has(.answers .pill:nth-child(2)) {
  --tx: 2;
  --tw: 96;
}
/* portrait, a request: the answers go in the dock, so no card moves; Cover (nothing to cover now) gives its place to Signal */
@media (orientation: portrait) {
  #s-table:has(.answers .pill:nth-child(2)) #b-cover:has(+ #b-signal:not([hidden])) {
    visibility: hidden;
  }
  #s-table:has(.answers .pill:nth-child(2)) #b-signal {
    left: 2px;
  }
}
.tray,
.hand,
.answers {
  top: auto;
}

/* ---------- answers: TRUCO on the dock's right; a request = three equal buttons in the dock ---------- */
.answers {
  --x: 60;
  --w: 31;
  --ah: max(calc(var(--dock) * 0.74), 46px);
  height: var(--ah);
  bottom: calc(var(--below) * -1 + (var(--dock) - var(--ah)) / 2);
  z-index: 25;
  display: flex;
  justify-content: center;
  gap: max(calc(var(--pw) * 1.6), 8px);
}
.answers:has(.pill:nth-child(2)) {
  --left: calc(var(--pw) * 2 + min(14px, var(--dock) * 0.2) + var(--btn) + 8px);
  left: var(--left);
  width: calc(var(--pw) * 98 - 10px - var(--left));
  gap: max(var(--pw), 5px);
}
.answers .pill {
  --h: var(--ah);
  flex: 1 1 0;
  min-width: 0;
  font-size: calc(var(--ph) * 3.4);
}
.answers .pill.truco {
  font-size: calc(var(--ph) * 3.6);
}
.answers .pill.in {
  animation: pop-in 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
}
.answers .pill:nth-child(2) {
  animation-delay: 80ms;
}
.answers .pill:nth-child(3) {
  animation-delay: 160ms;
}
.less-motion .answers .pill.in {
  animation-duration: 1ms;
  animation-delay: 0s;
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* ---------- dock: a thin navy bar; cover + signal side by side on the left; the hand rises over it ---------- */
/* dock: the navy panel in 9 pieces; your turn = a teal glow around it */
.tray {
  --x: var(--tx);
  --w: var(--tw);
  height: var(--dock);
  bottom: calc(var(--below) * -1);
  z-index: 8;
  border: min(14px, calc(var(--dock) * 0.2)) solid transparent;
  border-image: url(../assets/img/ui/panel.webp) 40 40 46 40 fill;
}
/* its shadow and its glow are ready-made layers: a `filter` on the dock cost half of the fps of the deal on WebKit */
.tray::before,
.tray::after {
  content: '';
  position: absolute;
  inset: calc(min(14px, var(--dock) * 0.2) * -1 + 2px);
  border-radius: calc(var(--dock) * 0.14);
  pointer-events: none;
}
.tray::after {
  box-shadow: 0 calc(var(--ph) * -0.2) calc(var(--ph) * 1.2) rgba(5, 10, 40, 0.4);
}
.tray::before {
  box-shadow:
    0 0 calc(var(--pw) * 0.5) calc(var(--pw) * 0.15) #2be0cb,
    0 0 calc(var(--pw) * 1.6) calc(var(--pw) * 0.2) rgba(43, 224, 203, 0.8);
  opacity: 0;
  transition: opacity 0.25s;
}
.tray.mine::before {
  opacity: 1;
}
.tbtn {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  height: var(--btn);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
#b-cover {
  left: 2px;
}
#b-signal {
  left: calc(var(--btn) + 12px);
}
.tbtn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.tbtn.on img {
  filter: drop-shadow(0 0 calc(var(--pw) * 1.2) #2be0cb) drop-shadow(0 0 calc(var(--pw) * 0.6) #2be0cb);
}
.tbtn .no {
  display: none;
  position: absolute;
  right: -2%;
  bottom: 0;
  width: 42%;
  height: 42%;
}
/* Cover: not your turn = a little quieter; not in this trick, or rule off = clearly shut, with a padlock (it still answers the touch) */
#b-cover[data-why='wait'] > img:first-child {
  filter: saturate(0.75);
}
#b-cover:is([data-why='when'], [data-why='rule']) > img:first-child {
  filter: grayscale(0.85) brightness(0.62);
}
#b-cover:is([data-why='when'], [data-why='rule']) .no {
  display: block;
}
.dock-tip {
  --th: clamp(34px, calc(var(--ph) * 4.4), 60px);
  left: calc(var(--pw) * var(--tx) + 4px);
  top: auto;
  bottom: calc(var(--safe-b) + var(--dock) + 4px);
  z-index: 27;
  margin: 0;
  width: max-content;
  max-width: calc(var(--pw) * 92);
  height: var(--th);
  display: grid;
  place-items: center;
  padding: 0 0 calc(var(--th) * 0.1);
  border: solid transparent;
  border-width: 0 calc(var(--th) * 0.45);
  border-image: url(../assets/img/ui/band-yellow.webp) 0 30 fill;
  color: var(--navy);
  font-size: max(14px, calc(var(--th) * 0.44));
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.hand {
  --x: 4;
  --w: 92;
  bottom: var(--hand-up);
  --cw: var(--hand-cw);
  height: calc(var(--cw) * 1.4);
  z-index: 9;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.hand .card {
  margin: 0 calc(var(--cw) * -0.05);
  transform: rotate(calc(var(--i) * 5deg)) translateY(calc(var(--d, 0) * var(--cw) * -0.06));
  transform-origin: 50% 100%;
  transition:
    transform 0.26s cubic-bezier(0.2, 1.4, 0.4, 1),
    translate 0.26s cubic-bezier(0.2, 1.4, 0.4, 1),
    scale 0.2s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.hand.mine .card.legal {
  cursor: pointer;
}
.hand.mine .card.legal[data-down] {
  transform: rotate(calc(var(--i) * 6deg)) translateY(calc(var(--ph) * -1.8));
  scale: 1.05;
}
@media (hover: hover) {
  .hand.mine .card.legal:hover {
    transform: rotate(calc(var(--i) * 6deg)) translateY(calc(var(--ph) * -1.4));
  }
}
/* your turn: a soft still glow on the cards you can play, the dock's colour (cover mode keeps its own hard ring) */
.hand.mine:not(.coverMode) .card.legal {
  box-shadow:
    inset 0 0 0 max(1.5px, calc(var(--cw) * 0.028)) #5f6c94,
    0 0 calc(var(--cw) * 0.16) calc(var(--cw) * 0.03) rgba(43, 224, 203, 0.85);
}
.hand.wait .card {
  filter: brightness(0.92);
}
.hand.coverMode .card.legal {
  box-shadow:
    0 0 0 calc(var(--cw) * 0.03) #2be0cb,
    0 calc(var(--cw) * 0.04) calc(var(--cw) * 0.08) rgba(5, 10, 40, 0.35);
}
/* a card of your hand turned face down: the same back as every card, and a small index that only you see */
.hand .card > .cov {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: url(../assets/img/ui/back.webp) center / 100% 100% no-repeat;
  pointer-events: none;
}
.hand .card[data-cov] > .cov {
  opacity: 1;
}
.cov > b {
  --nh: calc(var(--cw) * 0.36);
  position: absolute;
  left: 7%;
  top: 5%;
  height: var(--nh);
  display: flex;
  align-items: center;
  gap: 0.12em;
  padding: 0 0 calc(var(--nh) * 0.1);
  border: solid transparent;
  border-width: 0 calc(var(--nh) * 0.22);
  border-image: url(../assets/img/ui/plate.webp) 0 26 fill;
  color: #fff;
  font-size: calc(var(--nh) * 0.7);
  line-height: 1;
  font-weight: 700;
  font-style: normal;
}
.cov > b .suit {
  width: 0.85em;
  height: 0.85em;
}
.flying {
  position: fixed !important;
  z-index: 55;
  left: 0;
  top: 0;
  margin: 0 !important;
  pointer-events: none;
  transition: none !important;
}

/* ---------- landscape ---------- */
@media (orientation: landscape) {
  #s-table {
    --up: max(0px, var(--vh) - var(--sh));
  }
  .score {
    --x: 32;
    --y: 0.9;
    --w: 36;
    --h: 9.4;
    --score-w: calc(var(--pw) * 36);
  }
  .sc span,
  .sc b {
    font-size: calc(var(--ph) * 5.6);
  }
  .tdots i {
    width: calc(var(--ph) * 2.7);
  }
  .tdots {
    gap: calc(var(--pw) * 0.7);
  }
  .chip {
    --h: 4.8;
    --cw: calc(var(--ph) * 10.2);
    font-size: calc(var(--ph) * 3.4);
  }
  .seat[data-side='top'] {
    --x: 43.5;
    --y: 16.6;
    --w: 13;
    --h: 22.4;
  }
  .seat[data-side='left'] {
    --x: 2.8;
    --y: 46;
    --w: 13;
    --h: 22.8;
  }
  .seat[data-side='right'] {
    --x: 84.2;
    --y: 46;
    --w: 13;
    --h: 22.8;
  }
  .seat .name {
    font-size: calc(var(--ph) * 3.4);
  }
  .seat .show {
    top: calc(var(--name-y) + 22%);
  }
  .seat .show .card {
    --cw: calc(var(--pw) * 5.6);
  }
  .seat .show .lbl {
    position: absolute;
    right: calc(50% + var(--pw) * 10);
    top: 30%;
  }
  .hand-note {
    --x: 25;
    --y: 52;
    --w: 50;
    --h: 10;
    --see-r: -10.4;
    --see-w: 22;
  }
  .hand-note > span {
    --nh: calc(var(--ph) * 7);
    font-size: calc(var(--ph) * 3.6);
  }
  /* the diamond: partner and you share the room (--lh each), the rivals at half height. Deck, vira and chip fill what is
     left between the left rival's card and the dock; the table's left edge is at 16% of the stage down there */
  #s-table {
    --y0: calc(var(--ph) * 45.7);
    --gap: var(--ph);
    --rail-fs: max(calc(var(--ph) * 3.1), 13px);
    --rail-h: calc(var(--rail-fs) * 1.42);
    --lh: calc((var(--room) - var(--gap)) / 2);
    --lw: min(var(--lh) / var(--lie), var(--pw) * 14);
    --mine-y: calc(var(--y0) + var(--lh) + var(--gap));
    --mid: calc(var(--mine-y) - var(--gap) / 2);
    --side-dx: calc(var(--pw) * 16);
    /* the left column, from the dock up: chip, deck and vira, the left rival's card. The vira is 95.5% of a card played (or
       what is left); side by side, between the table's slanted edge (20% of the stage at the top of the deck) and the hand
       (38.8%), there is room for 9.3% + 8.3%: the deck is the smaller one. The rivals' cards go up just what the vira
       needs, never above the partner's. */
    --rail-y: calc(var(--sh) - var(--safe-b) - var(--dock) - var(--rail-h) - var(--gap));
    --col: calc(var(--rail-y) - var(--gap) * 0.8);
    --vira-w: min(
      var(--lw) * 0.955,
      (var(--col) - var(--gap) * 1.2 - var(--lh) - var(--y0) - var(--ph) * 0.3) / var(--lie)
    );
    --vira-h: calc(var(--vira-w) * var(--lie));
    --deck-w: calc(var(--vira-w) * 0.88);
    --deck-h: calc(var(--deck-w) * var(--lie));
    --deck-y: calc(var(--col) - var(--deck-h));
    --side-y: min(
      var(--mid) - var(--lh) / 2 - var(--ph) * 0.9,
      var(--col) - var(--vira-h) - var(--gap) * 1.2 - var(--lh)
    );
    --deck-x: calc(var(--pw) * 24.64 - (var(--deck-y) - var(--ph) * 48.6) * 0.4117 + var(--deck-w) * 0.035);
    --edge: calc(var(--pw) * 24.8 - (var(--rail-y) - var(--ph) * 47.8) * 0.4117);
  } /* the table's left edge at the chip's top */
  .vira {
    --lw: var(--vira-w) !important;
    left: calc(100% + var(--vira-w) * 0.085);
    top: auto;
    bottom: 0;
    width: var(--vira-w);
    height: var(--vira-h);
  }
  /* a long chip (Mineiro) grows to the left up to the table's edge, never under the hand; more than that, its letters shrink */
  #s-table > .rail {
    --to-hand: calc(var(--pw) * 31.1 - var(--hand-cw) * 1.55);
    left: calc(var(--pw) * 18.4);
    translate: min(0px, var(--to-hand) - 100%) 0;
    max-width: calc(var(--pw) * 18.4 + var(--to-hand) - var(--edge));
  }
  .trick-tag:not(.zap) {
    --nh: calc(var(--ph) * 4.9);
    max-width: calc(var(--pw) * 15.6);
  }
  /* centred on the frame; a longer one stops at the stage's edge and grows toward the table */
  .seat > .trick-tag {
    max-width: calc(var(--pw) * 19);
  }
  .seat[data-side='left'] > .trick-tag {
    left: 50%;
    translate: max(-50%, var(--pw) * -8.9) 0;
  }
  .seat[data-side='right'] > .trick-tag {
    right: 50%;
    translate: min(50%, var(--pw) * 8.9) 0;
  }
  .seat[data-side='top'] > .trick-tag {
    max-width: calc(var(--pw) * 26);
  }
  .slot > .trick-tag:not(.zap) {
    left: calc(100% + var(--pw) * 1.2);
  }
  .band-sub {
    --x: 38.9;
    --w: 22.2;
    --y: 69;
    --h: 3.4;
    font-size: calc(var(--ph) * 2.6);
  }
  .band-wrap {
    --x: 38.9;
    --y: 61;
    --w: 22.2;
    --h: 7;
  } /* between the vira and the right side of the table */
  #s-table {
    --dock: max(calc(var(--ph) * 12.6), 56px);
    --tx: 13.8;
    --tw: 72.4;
    --hand-up: calc(var(--safe-b) + min(8px, var(--ph) * 0.9));
    --hand-cw: calc(var(--ph) * 13.3);
    --hand-top: calc(var(--hand-up) + var(--hand-cw) * 1.45);
  }
  .turn-tip {
    --th: clamp(28px, calc(var(--ph) * 6), 76px);
    left: calc(var(--pw) * 70.5);
    bottom: calc(var(--safe-b) + var(--dock) + 8px);
  } /* right of the hand, above TRUCO */
  /* lying down the plate takes the place of "Your turn" (over nothing), above your balloon when you have asked */
  .dock-tip {
    --th: clamp(30px, calc(var(--ph) * 5.6), 70px);
    left: calc(var(--pw) * 74);
    translate: -50% 0;
    max-width: calc(var(--pw) * 25.6);
    bottom: calc(var(--safe-b) + var(--dock) + 8px);
  }
  #s-table:has(#calls .call[data-side='bottom']) .dock-tip {
    bottom: calc(var(--safe-b) + var(--dock) + var(--pw) * 9);
  }
  .answers {
    --x: 68;
    --w: 16.5;
  }
  /* a request: the hand stays where it is; the answers take the dock's right and, in wide windows, some room beside the stage */
  #s-table:has(.answers .pill:nth-child(2)) {
    --ext: clamp(0px, (var(--vw) - var(--sw)) / 2 - 8px, var(--pw) * 5);
    --tx: 5;
    --tw: 90;
  }
  #s-table:has(.answers .pill:nth-child(2)) .tray {
    left: calc(var(--pw) * 5 - var(--ext));
    width: calc(var(--pw) * 90 + var(--ext) * 2);
  }
  .answers:has(.pill:nth-child(2)) {
    left: calc(var(--pw) * 62);
    width: calc(var(--pw) * 32 + var(--ext));
    gap: max(calc(var(--pw) * 0.7), 6px);
  }
  .answers .pill {
    font-size: calc(var(--ph) * 4.4);
  }
  .answers .pill.truco {
    font-size: calc(var(--ph) * 6);
  }
  .hand {
    --x: 32;
    --w: 36;
  }
  .hand .card {
    margin: 0 calc(var(--pw) * -0.5);
  }
}
/* big windows: a bigger trump chip. Its width has a hard limit: from the table's edge to your hand there is 20.9% of the
   stage (388 px at 1854), and one line takes 10.9 times the size of its letters (11.8 with the old spaces): 35.4 px, not
   more. So the spaces are tighter and the plate takes the free strip between the deck and the dock (--col stays where the
   smaller chip put it, so no card moves) */
@media (orientation: landscape) and (min-height: 700px) {
  #s-table {
    --rail-fs: calc(var(--ph) * 3.38);
    --rail-h: calc(var(--ph) * 5.2);
    --rail-y: calc(var(--sh) - var(--safe-b) - var(--dock) - var(--rail-h) - var(--ph) * 0.4);
    --col: calc(var(--sh) - var(--safe-b) - var(--dock) - var(--ph) * 4.402 - var(--gap) * 1.8);
  }
  #s-table > .rail {
    gap: 0.2em;
    padding: 0 0.42em 0.12em;
  }
  #s-table > .rail > span {
    margin-right: 0.1em;
  }
}
/* phones lying down: a lower dock, a smaller hand (each card still takes a 44 px touch) and bigger cards on the table */
@media (orientation: landscape) and (max-height: 499px) {
  #s-table {
    --dock: max(calc(var(--ph) * 12.3), 48px);
    --hand-cw: max(calc(var(--ph) * 11.8), 44px);
    --clear: calc(var(--ph) * 1.95);
  }
  .hand .card {
    margin: 0;
  }
  .band-wrap,
  .band-sub {
    --x: 42;
    --w: 20;
  } /* right of the bigger vira */
  /* the partner's hand of eleven on a phone lying down: bigger cards, a readable label to their left */
  .seat .show .card {
    --cw: calc(var(--pw) * 6.4);
  } /* taller would touch the band of the hand of eleven */
  .seat .show .lbl {
    --nh: max(calc(var(--ph) * 2.6), 20px);
    right: calc(50% + var(--pw) * 11.4);
    font-size: clamp(11px, calc(var(--pw) * 1.75), 12px);
  } /* 11 px on the smallest (640 x 360), or a long label reaches the left portrait */
  /* a request on a phone lying down: the three answers were 81 px each and the longest word set the letters of all three
     (8 px in Russian). They take the whole free side of the window, and each one is as wide as its own word */
  #s-table:has(.answers .pill:nth-child(2)) {
    --ext: clamp(0px, (var(--vw) - var(--sw)) / 2 - 8px, var(--pw) * 12);
  }
  .answers:has(.pill:nth-child(2)) .pill {
    flex: 1 1 auto;
  }
}
/* End of css/table.css (complete file). */
