/* Game screen: ball tray, rivals, cards, plates and buttons. */
#s-game {
  flex-direction: row;
  align-items: stretch;
  gap: calc(var(--u) * 2);
  padding-top: calc(var(--u) * 15);
}
#g-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--u) * 1.8);
}
#g-side {
  display: none;
  position: relative;
  width: calc(var(--u) * 46);
}
#g-side .globe {
  position: absolute;
  right: calc(var(--u) * -6);
  top: calc(var(--u) * 15);
  height: calc(var(--u) * 50);
}
#g-side .fox {
  position: absolute;
  left: calc(var(--u) * 19);
  bottom: 0;
  height: 76%;
  transform: translateX(-50%);
}

/* ball: white art + live letter and number */
.ball {
  --b: url(../../assets/ui/ball-b.webp);
  flex: none;
  width: calc(var(--u) * 9.6);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--b) center / contain no-repeat;
  color: var(--ink);
  line-height: 0.9;
}
.ball small {
  font-size: 0.3em;
  font-size: calc(var(--u) * 2.2);
}
.ball b {
  font-size: calc(var(--u) * 3.6);
  font-weight: 600;
}
.ball[data-l='B'] {
  --b: url(../../assets/ui/ball-b.webp);
}
.ball[data-l='I'] {
  --b: url(../../assets/ui/ball-i.webp);
}
.ball[data-l='N'] {
  --b: url(../../assets/ui/ball-n.webp);
}
.ball[data-l='G'] {
  --b: url(../../assets/ui/ball-g.webp);
}
.ball[data-l='O'] {
  --b: url(../../assets/ui/ball-o.webp);
}
.ball:not([data-l]) {
  visibility: hidden;
}

#tray {
  --pb: calc(var(--u) * 13);
  flex-direction: row;
  justify-content: center;
  gap: calc(var(--u) * 3);
  width: 100%;
  max-width: calc(var(--u) * 96);
  height: calc(var(--u) * 21);
  padding: 0 calc(var(--u) * 2);
}
#ball {
  width: calc(var(--u) * 17);
}
#ball small {
  font-size: calc(var(--u) * 3.6);
}
#ball b {
  font-size: calc(var(--u) * 6.8);
}
#prev {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: calc(var(--u) * 1.6);
  min-width: calc(var(--pb) * 4 + var(--u) * 4.8);
}
#prev .ball {
  width: var(--pb);
}
#prev .ball small {
  font-size: calc(var(--u) * 2.8);
}
#prev .ball b {
  font-size: calc(var(--u) * 5);
}
.land #tray {
  --pb: calc(var(--u) * 10);
}
.land #prev .ball small {
  font-size: calc(var(--u) * 2.2);
}
.land #prev .ball b {
  font-size: calc(var(--u) * 3.9);
}

/* rivals: face, name and bar, all the same width */
#rivals {
  display: flex;
  gap: calc(var(--u) * 1.6);
  width: 100%;
  max-width: calc(var(--u) * 96);
}
.rival {
  flex: 1;
  min-width: 0;
  height: calc(var(--u) * 10.5);
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1.2);
  padding: 0 calc(var(--u) * 1);
  border-style: solid;
  border-width: calc(var(--u) * 1.6);
  border-image: url(../../assets/ui/row.webp) 36 fill / 1 / 0 stretch;
}
.face {
  position: relative;
  flex: none;
  height: calc(var(--u) * 7.6);
  aspect-ratio: 1;
}
.rinfo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 0.8);
}
.rival span {
  font-size: calc(var(--u) * 2.7);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.rival u {
  display: block;
  height: calc(var(--u) * 1.5);
  border-radius: 99px;
  background: #0a0730;
  overflow: hidden;
}
.rival u b {
  display: block;
  height: 100%;
  width: 6%;
  border-radius: 99px;
  background: var(--green);
  transition:
    width 0.5s var(--pop),
    background 0.2s;
}

/* cards: layout.js sets on EACH card --c (height of the square) and --ar (width / height of the square). Changed a frame or a gap? Fix W0 and H0 there. */
#cards {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), max-content);
  align-content: center;
  justify-content: center;
  gap: calc(var(--u) * 2);
}
.card {
  border-style: solid;
  border-width: calc(var(--c) * 0.36);
  border-image: url(../../assets/ui/card.webp) 66 fill / 1 / 0 stretch;
  transition: filter 0.2s;
}
.grid {
  display: grid;
  grid-template-columns: repeat(5, calc(var(--c) * var(--ar, 1)));
  gap: calc(var(--c) * 0.04);
  padding: calc(var(--c) * 0.04);
  margin: calc(var(--c) * -0.13);
  border-radius: calc(var(--c) * 0.14);
  background: var(--navy);
  overflow: hidden;
  box-shadow: 0 0 0 calc(var(--c) * 0.05) var(--navy);
} /* covers the white left between the square and the frame */
#cards[data-cols='2'] .card:nth-child(3):last-child {
  grid-column: 1 / -1;
  justify-self: center;
} /* 3 cards in 2 columns: the last one in the centre */
.head {
  height: calc(var(--c) * 0.66);
  display: grid;
  place-items: center;
  font-size: calc(var(--c) * 0.56);
  line-height: 1;
}
.head span {
  transform: translateY(-0.065em);
  text-shadow: 0 0.05em 0.06em #0005;
}
.head:nth-child(1) {
  background: #2a6df0;
}
.head:nth-child(2) {
  background: #e0283b;
}
.head:nth-child(3) {
  background: #f2a81a;
}
.head:nth-child(4) {
  background: #23a94a;
}
.head:nth-child(5) {
  background: #8b3fe0;
}
.cell {
  position: relative;
  height: var(--c);
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: inset 0 calc(var(--c) * -0.04) 0 #d9dcef;
  color: var(--ink);
  font-size: calc(var(--c) * 0.58);
  line-height: 1;
  font-weight: 600;
}
.cell span {
  position: relative;
  transform: translateY(-0.03em);
} /* with the shadow under the square, the number sits at the centre of the face without rising */
.cell::before {
  content: '';
  position: absolute;
  inset: 4%;
  background: var(--stamp, url(../../assets/ui/stamp.webp)) center / contain no-repeat;
  transform: scale(0);
  opacity: 0;
}
.cell.on::before {
  transform: scale(1);
  opacity: 0.9;
}
.cell.on.new::before {
  animation: stamp 0.22s ease-out;
}
/* drops, hits flattened and settles */
@keyframes stamp {
  0% {
    transform: scale(1.9) rotate(-28deg);
    opacity: 0;
  }
  45% {
    transform: scale(1.04, 0.9) rotate(2deg);
    opacity: 1;
  }
  72% {
    transform: scale(0.97, 1.04) rotate(0);
  }
  100% {
    transform: scale(1);
  }
}
.cell.free {
  background: #6a2fc4;
  box-shadow: none;
  color: #fff;
}
.cell.free::before {
  inset: 3% 20% 33%;
  background-image: url(../../assets/ui/star.webp);
  opacity: 1;
}
.cell.free span {
  align-self: end;
  margin-bottom: calc(var(--c) * 0.07);
  font-size: calc(var(--c) * 0.25);
  letter-spacing: 0.03em;
}
.card[data-tiny] .cell.free::before {
  inset: 10%;
}
.card[data-tiny] .cell.free span {
  display: none;
}
.cell.win:not(.free)::before {
  background-image: url(../../assets/ui/stamp-win.webp);
  animation: stamp 0.3s ease-out;
}
.cell.called {
  box-shadow: inset 0 0 0 calc(var(--c) * 0.05) var(--gold);
}

/* pattern, balls and points plates: the same width */
#info {
  display: flex;
  gap: calc(var(--u) * 1.6);
  width: 100%;
  max-width: calc(var(--u) * 96);
}
#info .plate {
  flex: 1;
  height: calc(var(--u) * 10.5);
}
#info .plate:first-child {
  flex-direction: row;
  gap: calc(var(--u) * 1.6);
}
.pat {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8%;
  width: calc(var(--u) * 6.4);
  aspect-ratio: 1;
}
.pat b {
  background: #3a3596;
  border-radius: 12%;
}
.pat b.y,
.pat b[data-s='y'] {
  background: var(--gold);
}
.pat b[data-s='m'] {
  background: #4df06a;
}

#actions {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2.5);
  width: 100%;
  max-width: calc(var(--u) * 96);
}
#b-bingo {
  flex: 1;
}
.power {
  position: relative;
  flex: none;
  width: calc(var(--u) * 18);
  aspect-ratio: 1;
  transition:
    transform 0.09s,
    filter 0.09s;
}

/* landscape: fox and globe on the left, game in the centre, rivals and plates on the right */
.land #s-game {
  padding-top: calc(var(--u) * 3);
}
.land #g-side {
  display: block;
}
.land #g-main {
  display: grid;
  align-items: stretch;
  justify-items: stretch;
  grid-template-columns: 1fr calc(var(--u) * 40);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: calc(var(--u) * 1.6) calc(var(--u) * 2.5);
}
.land #tray {
  grid-column: 1;
  height: calc(var(--u) * 15);
  justify-self: center;
  width: calc(var(--u) * 70);
}
.land #ball {
  width: calc(var(--u) * 12.5);
}
.land #ball small {
  font-size: calc(var(--u) * 2.7);
}
.land #ball b {
  font-size: calc(var(--u) * 5);
}
.land #cards {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  height: 100%;
}
.land #actions {
  grid-column: 1;
  grid-row: 3;
  justify-self: center;
  width: calc(var(--u) * 80);
}
.land #rivals {
  grid-column: 2;
  grid-row: 1 / 3;
  flex-direction: column;
  align-self: start;
  margin-top: calc(var(--u) * 12);
}
.land .rival {
  flex: none;
}
.land #info {
  grid-column: 2;
  grid-row: 2 / 4;
  flex-direction: column;
  align-self: end;
}
.land #info .plate {
  flex: none;
}
.land .power {
  width: calc(var(--u) * 14);
}
.land #b-bingo.big {
  min-height: calc(var(--u) * 13);
  font-size: calc(var(--u) * 6.4);
}

/* the globe only shows with 1 card: with more, the space belongs to the cards */
.land:not(.one) #g-side {
  width: calc(var(--u) * 38);
}
.land:not(.one) #g-side .globe {
  display: none;
}
.land.one #g-side {
  width: calc(var(--u) * 50);
}

/* portrait with 1 card: the fox stays beside the card */
.port.one #g-side {
  display: contents;
}
.port.one #g-side .globe {
  display: none;
}
.port.one #g-side .fox {
  left: calc(var(--u) * 13);
  bottom: calc(var(--u) * 33.5);
  height: calc(var(--u) * 66);
  pointer-events: none;
}
.port.one #cards {
  justify-content: end;
  padding-left: calc(var(--u) * 22);
}
.port.one .card,
.land .card {
  position: relative;
  z-index: 1;
}

/* tall phone with 1 card: logo on top and the globe beside the tray */
.glogo {
  display: none;
}
.port.one.tall .glogo {
  display: block;
  position: absolute;
  top: calc(var(--u) * 2.5);
  left: 50%;
  width: calc(var(--u) * 44);
  transform: translateX(-50%);
}
.port.one.tall #s-game {
  padding-top: calc(var(--u) * 29);
}
.port.one.tall #g-side .globe {
  display: block;
  left: calc(var(--u) * 1.5);
  right: auto;
  top: calc(var(--u) * 15);
  height: calc(var(--u) * 37);
}
.port.one.tall #tray {
  --pb: calc(var(--u) * 10);
  width: calc(var(--u) * 67);
  align-self: flex-end;
  gap: calc(var(--u) * 2);
  padding: 0;
}
.port.one.tall #prev {
  gap: calc(var(--u) * 0.8);
  min-width: calc(var(--pb) * 4 + var(--u) * 2.4);
}
.port.one.tall #prev .ball small {
  font-size: calc(var(--u) * 2.2);
}
.port.one.tall #prev .ball b {
  font-size: calc(var(--u) * 3.9);
}
.port.one.tall #rivals {
  margin-top: calc(var(--u) * 1.5);
}
.port.one.tall .rival {
  height: calc(var(--u) * 14);
  padding: 0;
}
.port.one.tall .face {
  height: calc(var(--u) * 10.6);
}
.port.one.tall .rival span {
  font-size: calc(var(--u) * 3.3);
}
.port.one.tall .rival u {
  height: calc(var(--u) * 2);
}
.port.one.tall #g-side .fox {
  left: calc(var(--u) * 15.5);
  height: calc(var(--u) * 79);
}

.reduced .cell.on.new::before,
.reduced .cell.win::before {
  animation: none;
}
/* End of src/ui/game.css (complete file). */
