/* ---------------------------------------------------------------------------
   world.css — the world queue (/world): the way in, the queue, a match's
   cards and live board over its game, and the ranking.

   The chrome is the hub's: achromatic, with --attract for what is active.
   Each card between rounds glows in the dealt game's own colours (--g-*),
   as a game night's do. The buttons, the timer bar and Again are the
   session's (session.css).
--------------------------------------------------------------------------- */

.world-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1.2rem;
  padding: 1rem var(--pad-x);
  --views-bg: rgba(12, 9, 16, 0.6);
  --views-line: var(--hair-bright);
  --views-on-bg: var(--light);
  --views-on-ink: var(--room-deep);
}
.world-head__brand {
  color: var(--light);
  text-decoration: none;
  font-variation-settings: 'wdth' 100, 'wght' 800;
  letter-spacing: 0.01em;
}
.world-head__brand span {
  color: var(--dust);
  font-variation-settings: 'wdth' 100, 'wght' 500;
}
.world-head__side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem 0.9rem;
  min-width: 0;
}

.world {
  padding: clamp(1rem, 0.6rem + 2vw, 2.5rem) var(--pad-x) 4rem;
  display: grid;
  gap: clamp(1.4rem, 1rem + 1.5vw, 2.4rem);
}

/* --- the hero: what the queue is, and how it stands ---------------------------- */

.world-hero {
  max-width: 52rem;
}
.world-hero__title {
  margin: 0.2rem 0 0.6rem;
  font-size: var(--step-3);
  line-height: 1;
  font-variation-settings: 'wdth' 112, 'wght' 880;
  letter-spacing: -0.01em;
}
.world-hero__lede {
  margin: 0 0 1rem;
  color: var(--dust);
  font-size: var(--step-1);
  max-width: 46rem;
}
.world-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  min-height: 2rem;
}
.world-stats__item {
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  background: var(--riser);
  border: 1px solid var(--edge);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.world-stats__item:empty {
  display: none;
}

/* --- the way in, the queue, and a match seen from the page ---------------------- */

.world-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1rem, 0.6rem + 1.5vw, 2rem);
  align-items: start;
}
@media (max-width: 52rem) {
  .world-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.world-panel {
  padding: clamp(1rem, 0.8rem + 1vw, 1.6rem);
  background: var(--room);
  border: 1px solid var(--edge);
  border-radius: 1rem;
}
.world-panel h2 {
  margin: 0.15rem 0 0.6rem;
  font-size: var(--step-2);
  line-height: 1.15;
  font-variation-settings: 'wdth' 104, 'wght' 820;
}
.world-panel .notice {
  margin: 0.6rem 0;
}
.world-join__names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0 0.3rem;
}
.world-join__name {
  border-radius: 2rem;
  padding: 0.45rem 0.95rem;
  font-weight: 650;
}
.world-join__name[aria-checked='true'] {
  background: var(--light);
  color: var(--room-deep);
  border-color: transparent;
}
.world-join__mine {
  margin: 0.9rem 0 0.3rem;
  font-size: var(--step-2);
  line-height: 1.15;
  font-variation-settings: 'wdth' 104, 'wght' 820;
  overflow-wrap: anywhere;
}
.world-join__act {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.2rem;
  margin: 1rem 0 0.4rem;
}
.world-join__note {
  margin: 0.35rem 0 0;
  font-size: var(--step--1);
}
.world-queue__name {
  overflow-wrap: anywhere;
}
.world-queue__count {
  margin: 0;
  font-size: var(--step-1);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.world-queue__clock {
  margin: 0.2rem 0 0.8rem;
  color: var(--attract);
  font-size: var(--step-1);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.world-queue__act,
.world-watch__act,
.world-card__act {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.world-queue .eyebrow::before {
  content: '';
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-inline-end: 0.45rem;
  border-radius: 50%;
  background: var(--attract);
  animation: world-beat 1.4s ease-in-out infinite;
}
@keyframes world-beat {
  50% {
    opacity: 0.25;
  }
}

/* --- the ladder: the field, round by round ----------------------------------------- */

.world-ladder__label {
  margin: 0 0 0.6rem;
  color: var(--dust);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--step--1);
}
.world-ladder__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.35rem;
}
.world-ladder__step {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: var(--step-1);
  font-variant-numeric: tabular-nums;
}
/* An arrow between two steps, centred in the gap before each: the final's step is a pill of the number alone. */
.world-ladder__step + .world-ladder__step {
  margin-inline-start: 1.7rem;
  position: relative;
}
.world-ladder__step + .world-ladder__step::before {
  content: '→';
  position: absolute;
  inset-inline-end: 100%;
  width: 1.7rem;
  text-align: center;
  color: var(--dust-dim);
  font-weight: 500;
}
[dir='rtl'] .world-ladder__step + .world-ladder__step::before {
  content: '←';
}
.world-ladder__step.is-final {
  padding: 0 0.5rem;
  border-radius: 0.4rem;
  background: var(--attract);
  color: var(--attract-ink);
}
.world-ladder__points {
  margin: 0.8rem 0 0;
  color: var(--dust);
}
.world-rules {
  margin: -0.6rem 0 0;
  max-width: 52rem;
}

/* --- standings, as rows: a round's results, and the match watched from the page --- */

.world-rows {
  list-style: none;
  margin: 0.8rem 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.world-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.7rem;
  background: var(--riser);
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.world-row__place {
  font-weight: 800;
  color: var(--dust);
}
.world-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.world-row__value {
  font-weight: 700;
}
.world-row.is-you {
  border-color: var(--attract);
}
.world-row.is-out {
  opacity: 0.55;
}

/* --- the layer over the game: the card, the results, the podium ---------------------- */

.world-card {
  position: relative;
  overflow: hidden;
  width: min(36rem, 100%);
  padding: 1.6rem 1.5rem 1.4rem;
  border-radius: 1rem;
  border: 1px solid var(--edge);
  background:
    radial-gradient(120% 70% at 50% -20%, color-mix(in srgb, var(--g-glow) 26%, transparent), transparent 62%),
    var(--room);
  box-shadow: 0 1.6rem 4rem -1.2rem color-mix(in srgb, var(--g-glow) 55%, transparent);
  outline: none;
  animation: pop 420ms both cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.world-card__head {
  margin: 0.4rem 0 0.4rem;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem);
  line-height: 1.1;
  font-variation-settings: 'wdth' 106, 'wght' 860;
}
.world-card__field {
  margin: 0 0 0.6rem;
  color: var(--dust);
  font-weight: 650;
}
.world-card__clock {
  margin: 0.6rem 0 0;
  color: var(--attract);
  font-size: var(--step-1);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.world-card__you {
  justify-self: start;
  width: fit-content;
  margin: 0.2rem 0 0.4rem;
  padding: 0.25rem 0.85rem;
  border-radius: 2rem;
  background: var(--riser);
  border: 1px solid var(--edge);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.world-card__line {
  margin: 0;
  color: var(--dust);
  font-weight: 650;
}
.world-card__points {
  margin: 0.4rem 0 0;
  color: var(--attract);
  font-size: var(--step-2);
  font-weight: 880;
}
.world-card.is-through .world-card__head {
  color: var(--attract);
  text-shadow: 0 0 1.2rem color-mix(in srgb, var(--attract) 45%, transparent);
}
.world-card.is-results.is-out .world-card__head {
  animation: shake 420ms ease-in-out 300ms;
}

/* After a round: the rating, the guess at the AI model and how the game was
   made, a game night's own cards (session.css), wider for six models and the
   reveal's tiles. */
.world-card.is-rate,
.world-card.is-guess {
  text-align: center;
}
.world-card.is-guess {
  width: min(52rem, 100%);
}
.world-card.is-data {
  width: min(62rem, 100%);
}
.world-card.is-data .data__verdict {
  margin: 0.4rem 0 0;
}
.world-podium {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.world-podium__step {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.6rem;
  background: var(--riser);
  border: 1px solid transparent;
  animation: place-in 460ms both cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.world-podium__step.is-1 {
  font-size: var(--step-1);
  border-color: color-mix(in srgb, var(--attract) 60%, transparent);
  animation-delay: 600ms;
}
.world-podium__step.is-2 {
  animation-delay: 350ms;
}
.world-podium__step.is-you {
  outline: 2px solid var(--attract);
  outline-offset: 2px;
}
.world-podium__medal {
  font-size: 1.4em;
}
.world-podium__name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.world-podium__points {
  color: var(--attract);
  font-weight: 800;
}

/* How the round is played (parallel, a ghost race and its heat, one shared world and its host), and why the final is played so. */
.world-card__mode {
  margin: 0 0 0.5rem;
  font-weight: 700;
}
.world-card__why {
  margin: -0.2rem 0 0.6rem;
  font-size: var(--step--1);
}

/* Before the final: each other finalist, and the round trip to them as it is measured. */
.world-pings {
  list-style: none;
  margin: 0.8rem 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.world-pings__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.5rem;
  background: var(--riser);
  font-variant-numeric: tabular-nums;
}
.world-pings__ms {
  color: var(--attract);
  font-weight: 800;
}

/* --- over the game: the live board -------------------------------------------------- */

.world-board {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  z-index: 5;
  min-width: 12rem;
  max-width: min(19rem, 48vw);
  padding: 0.25rem 0.45rem 0.45rem;
  border-end-start-radius: 6px;
  background: rgba(12, 9, 16, 0.66);
  color: var(--light);
  font: 600 0.8rem/1.25 Archivo, system-ui, sans-serif;
  opacity: 0.9;
  transition: opacity 0.2s;
}
.world-board:hover {
  opacity: 1;
}
.player.is-folded .world-board,
.player.is-bare .world-board,
.world-board[hidden] {
  display: none;
}
.world-board__toggle {
  display: block;
  width: 100%;
  padding: 0.15rem 0.2rem;
  border: 0;
  background: none;
  font-weight: 500;
  text-align: start;
}
.world-board__head {
  margin: 0.15rem 0.2rem 0.25rem;
  color: var(--dust);
  font-weight: 500;
}
.world-board__rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.world-board__row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.4rem;
  padding: 0.12rem 0.2rem;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
.world-board__place {
  color: var(--dust);
}
.world-board__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.world-board__value {
  text-align: end;
}
.world-board__row.is-you {
  background: color-mix(in srgb, var(--attract) 22%, transparent);
}
.world-board__row.is-you.is-below {
  background: color-mix(in srgb, #e8443a 30%, transparent);
}
.world-board__row.is-out {
  opacity: 0.5;
}
.world-board__line {
  margin: 0.15rem 0.2rem 0;
  padding-top: 0.15rem;
  border-top: 1px dashed var(--hair-bright);
  color: var(--dust);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- the ranking --------------------------------------------------------------------- */

.world-ranking {
  max-width: 60rem;
}
.world-ranking .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--hair);
}
.world-ranking .section-head__title {
  margin: 0;
  font-size: var(--step-2);
  line-height: 1.1;
  font-variation-settings: 'wdth' 106, 'wght' 820;
}
.world-ranking .section-head__note {
  margin: 0;
  color: var(--dust);
  font-size: var(--step--1);
}
.world-ranking__me {
  margin: 0 0 0.8rem;
  font-weight: 800;
  color: var(--attract);
}
.world-ranking__profile {
  color: inherit;
  font-weight: 700;
}
.hint .world-ranking__profile {
  color: var(--light);
}
.world-ranking__table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.world-ranking__table th {
  padding: 0.4rem 0.6rem;
  color: var(--dust);
  font-weight: 600;
  font-size: var(--step--1);
  text-align: start;
  border-bottom: 1px solid var(--hair);
}
.world-ranking__table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--hair);
}
.world-ranking__table th:nth-child(n + 3),
.world-ranking__table td:nth-child(n + 3) {
  text-align: end;
}
.world-ranking__table td:nth-child(3) {
  font-weight: 800;
}
.world-ranking__table tr.is-you td {
  background: color-mix(in srgb, var(--attract) 14%, transparent);
}
.world-ranking__guest {
  color: var(--dust-dim);
  font-size: var(--step--1);
}
@media (max-width: 30rem) {
  .world-ranking__table th:nth-child(4),
  .world-ranking__table td:nth-child(4) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .world-card,
  .world-podium__step,
  .world-queue .eyebrow::before {
    animation: none;
  }
}

/* At the top, over the game and its cards, while the page's socket is down: what it shows is not live until it is back. */
.world-down {
  position: fixed;
  top: max(0.8rem, env(safe-area-inset-top));
  left: 50%;
  z-index: 95;
  margin: 0;
  padding: 0.45rem 0.9rem;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--riser);
  border: 1px solid var(--edge);
  font-size: 0.9rem;
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.45);
}
.world-down[hidden] {
  display: none;
}
