/* Mode picker (GameModeSelection.prefab): cards 960x284, spacing 56, padding 50/48. */
.modes {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background-color: #c6f2d6;
  background-size: cover;
  background-position: center;
}
.modes__scroll {
  flex: 1;
  min-height: 0;
}
.modes__list {
  display: flex;
  flex-direction: column;
  gap: calc(56 * var(--u));
  /* the top padding keeps the first robot's cap clear of the header's edge on the shortest phones, where the
     robot rises 48u above its card (the prefab's 48u left it a few pixels under the band) */
  padding: calc(76 * var(--u)) calc(50 * var(--u)) calc(var(--safe-bottom) + 40 * var(--u));
}

.mode-card {
  --mode: #feb90b;
  position: relative;
  display: block;
  width: 100%;
  height: calc(284 * var(--u));
  text-align: left;
  border-radius: calc(70 * var(--u));
  animation: mode-in var(--t-slow) var(--ease-out) both;
  animation-delay: calc(var(--i) * 45ms);
  transition: transform var(--t-fast) var(--ease-out);
}
.mode-card:active {
  transform: translateY(calc(6 * var(--u))) scale(0.99);
}
@keyframes mode-in {
  from {
    opacity: 0;
    transform: translateY(calc(24 * var(--u)));
  }
}
/* GameModeSelectionButtonBackground.png tinted: saturated face, darker 28u lower lip, soft shadow */
.mode-card__face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--mode);
  box-shadow:
    inset 0 calc(-28 * var(--u)) 0 color-mix(in srgb, var(--mode) 74%, #1b2559),
    inset 0 0 0 calc(5 * var(--u)) color-mix(in srgb, var(--mode) 86%, #1b2559),
    0 calc(10 * var(--u)) calc(18 * var(--u)) rgba(27, 37, 89, 0.18);
}
.mode-card:hover .mode-card__face {
  filter: brightness(1.04);
}
/* RobotArt: 222x284 at x=145 (centre), standing on y=26 */
.mode-card__robot {
  position: absolute;
  left: calc(34 * var(--u));
  bottom: calc(26 * var(--u));
  width: calc(222 * var(--u));
  height: calc(306 * var(--u));
}
.mode-card__text {
  position: absolute;
  left: calc(280 * var(--u));
  right: calc(50 * var(--u));
  top: calc(36 * var(--u));
  bottom: calc(44 * var(--u));
  display: flex;
  flex-direction: column;
  gap: calc(4 * var(--u));
}
/* Title TMP Rubik-Bold 50 white with TrueShadow size 2, spread 0.8, offset 1 down, colour #1B2559:
   a thin ink outline that is a little heavier underneath. Offsets in em so it scales with the type. */
.mode-card__title {
  display: flex;
  flex-direction: column;
  font-weight: var(--w-bold);
  font-size: calc(50 * var(--u));
  line-height: 1.02;
  color: #fff;
  text-transform: uppercase;
  text-shadow:
    0 0.075em 0.02em #1b2559,
    0.045em 0 0 #1b2559,
    -0.045em 0 0 #1b2559,
    0 0.045em 0 #1b2559,
    0 -0.045em 0 #1b2559,
    0.032em 0.032em 0 #1b2559,
    -0.032em 0.032em 0 #1b2559,
    0.032em -0.032em 0 #1b2559,
    -0.032em -0.032em 0 #1b2559;
}
.mode-card__hint {
  font-weight: var(--w-medium);
  font-size: calc(38 * var(--u));
  line-height: 1.18;
  color: #fff;
  text-shadow: var(--on-colour-shadow);
  /* no single word left alone on the last line */
  text-wrap: pretty;
}
/* hint phrases (split after a comma or middle dot) stay together, so a wrap falls between them */
.mode-card__phrase {
  display: inline-block;
}
/* the separator dot belongs to the phrase before it; once the phrases stand on separate lines it has no job
   and is hidden (it keeps its width, so the wrap does not change), never left dangling at a line's end */
.mode-card__hint.is-wrapped .mode-card__dot {
  visibility: hidden;
}
/* OnlineInviteBadge: 244x62 at top-right (-44, +32), corner radius 22, solid 6u gold drop shadow */
.mode-card__badge {
  position: absolute;
  right: calc(44 * var(--u));
  top: calc(-32 * var(--u));
  display: grid;
  place-items: center;
  min-width: calc(244 * var(--u));
  height: calc(62 * var(--u));
  padding: 0 calc(18 * var(--u));
  border-radius: calc(22 * var(--u));
  background: #ffe577;
  color: #825b23;
  font-weight: var(--w-bold);
  font-size: calc(22 * var(--u));
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 calc(6 * var(--u)) 0 #ba924c;
}

/* ---- Wide (>= 760 px) ---------------------------------------------------------------------
   Every card keeps the phone card's composition and proportions (robot box, text column, lip,
   badge), scaled from its own height with container units, so all five cards are identical in
   size and their robots rise above the card top exactly as on the phone. The card height comes
   from the space under the header, so the picker fills the screen:
   - landscape: three rows, Category Master centred on top of a 2x2 grid;
   - portrait (or near-square): one column of five cards, like the phone.
   Card proportions in card heights (284u): robot box 222x306 at left 34 standing on 26; text
   column from 280 to 50 before the right edge; title 50, hint 38; lip 28; corner 70. */
.layout-wide .modes__scroll {
  container: modes / size;
}
.layout-wide .modes__list--grid {
  /* robots and the badge rise ~0.17 of a row above their card: the row gap and top padding keep them
     clear. Three rows + two gaps + top and bottom padding = 3.84 rows. */
  --side: clamp(20px, 3cqw, 72px);
  --row: clamp(130px, calc((100cqh - var(--safe-bottom)) / 3.84), 300px);
  --gap-y: calc(var(--row) * 0.24);
  --gap-x: clamp(20px, calc(var(--row) * 0.16), 40px);
  --card-w: min(calc((100cqw - 2 * var(--side) - var(--gap-x)) / 2), calc(var(--row) * 3.3));
  display: grid;
  grid-template-columns: repeat(4, calc((var(--card-w) - var(--gap-x)) / 2));
  grid-auto-rows: var(--row);
  justify-content: center;
  align-content: center;
  gap: var(--gap-y) var(--gap-x);
  min-height: 100cqh;
  padding: var(--gap-y) var(--side) calc(var(--row) * 0.12 + var(--safe-bottom));
}
.layout-wide .modes__list--grid > .mode-card {
  grid-column: span 2;
}
.layout-wide .modes__list--grid > .mode-card:first-child {
  grid-column: 2 / span 2;
}
@container modes (aspect-ratio < 1.15) {
  .layout-wide .modes__list--grid {
    /* five rows + four gaps + padding = 6.32 rows; cards no longer than the phone card allows text to fill */
    --row: clamp(130px, calc((100cqh - var(--safe-bottom)) / 6.32), 240px);
    --card-w: min(calc(100cqw - 2 * var(--side)), calc(var(--row) * 3.9));
    grid-template-columns: var(--card-w);
  }
  .layout-wide .modes__list--grid > .mode-card,
  .layout-wide .modes__list--grid > .mode-card:first-child {
    grid-column: 1;
  }
}

.layout-wide .modes__list--grid .mode-card {
  container-type: size;
  height: auto;
  border-radius: calc(var(--row) * 0.246);
}
.layout-wide .modes__list--grid .mode-card__face {
  border-radius: 24.6cqh;
  box-shadow:
    inset 0 -9.9cqh 0 color-mix(in srgb, var(--mode) 74%, #1b2559),
    inset 0 0 0 1.76cqh color-mix(in srgb, var(--mode) 86%, #1b2559),
    0 3.5cqh 6.3cqh rgba(27, 37, 89, 0.18);
}
.layout-wide .modes__list--grid .mode-card__robot {
  left: 12cqh;
  bottom: 9.15cqh;
  width: 78.2cqh;
  height: 107.7cqh;
}
/* The text block starts 25cqh down in every card, so titles share a line across a row whatever
   the hint's line count: a one-line hint sits just above the face's centre, a two-line hint just
   below it. The spacer before the title gives way first when a long translation needs more lines,
   so the text never comes closer than 17cqh (7cqh above the 9.9cqh lip) to the card's bottom. */
.layout-wide .modes__list--grid .mode-card__text {
  left: 98.6cqh;
  right: 17.6cqh;
  top: 12cqh;
  bottom: 17cqh;
  justify-content: flex-start;
  gap: 1.4cqh;
}
.layout-wide .modes__list--grid .mode-card__text::before {
  content: '';
  flex: 0 1 11.6cqh;
}
.layout-wide .modes__list--grid .mode-card__title,
.layout-wide .modes__list--grid .mode-card__hint {
  flex-shrink: 0;
}
/* one line when the column allows it (title width ~10.2 em), wrapping in balance only on narrow cards */
.layout-wide .modes__list--grid .mode-card__title {
  display: block;
  font-size: clamp(20px, min(17.6cqh, calc((100cqw - 116.2cqh) / 10.2)), 50px);
  line-height: 1.04;
  text-wrap: balance;
}
.layout-wide .modes__list--grid .mode-card__hint {
  font-size: clamp(15px, 11cqh, 34px);
  /* the hint may run on past the title's column towards the card's edge (10cqh from it, like the robot's
     12cqh on the left), so the longest one, "Run through biomes, relics and bosses", stays on one line
     wherever the card has the room */
  margin-right: -7.6cqh;
  text-wrap: balance;
}
/* the tab shares the text column's left edge: it reads as a tag over the title */
.layout-wide .modes__list--grid .mode-card__badge {
  left: 98.6cqh;
  right: auto;
  top: -11.3cqh;
  min-width: 86cqh;
  height: 21.8cqh;
  padding: 0 6.3cqh;
  border-radius: 7.75cqh;
  font-size: 7.75cqh;
  box-shadow: 0 2.1cqh 0 #ba924c;
}
