/* A board-game box: die-cut cardboard tiles on grape. A played tile leaves a punched-out hole. */
:root {
  --grape: #34156b;
  --hole: #210b49;
  --ink: #1d0a3a;
  --paper: #fff3d9;
  --right: #12703f;
  --wrong: #b52a18;

  /* One colour per board column; the clue screen opens in the same colour. */
  --c1: #ff6a45;
  --c2: #ff8fc2;
  --c3: #ffc62e;
  --c4: #52c9f5;
  --c5: #3ddcaa;
  --c6: #c9f24f;

  --display: "Bagel Fat One", "Arial Black", sans-serif;
  --body: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--body);
  background: var(--grape);
  color: var(--paper);
  min-height: 100dvh;
  padding: clamp(10px, 1.6vw, 28px);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Some components set display themselves; hidden must still win. */
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 4px solid var(--paper);
  outline-offset: 3px;
}

.modal :focus-visible,
.setup-screen :focus-visible,
#finalModal :focus-visible {
  outline-color: var(--ink);
}

.wordmark {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.2vw, 3.4rem);
  line-height: 1;
  color: var(--c3);
  white-space: nowrap;
}

/* ---------- Setup screens ---------- */

.setup-screen,
.view-selection {
  max-width: 680px;
  margin: clamp(10px, 5vh, 60px) auto;
}

.setup-screen h2,
.view-selection h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.2;
  margin: 28px 0 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-group label {
  font-weight: 700;
}

.form-group small {
  opacity: 0.85;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 8px;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  column-gap: 16px;
}

.category-input {
  display: none;
}

.category-input[data-category="1"] label { color: var(--c1); }
.category-input[data-category="2"] label { color: var(--c2); }
.category-input[data-category="3"] label { color: var(--c3); }
.category-input[data-category="4"] label { color: var(--c4); }
.category-input[data-category="5"] label { color: var(--c5); }
.category-input[data-category="6"] label { color: var(--c6); }

.setup-guide {
  margin-bottom: 22px;
  line-height: 1.6;
}

.setup-guide summary {
  cursor: pointer;
  font-weight: 700;
}

.setup-guide ol {
  margin: 10px 0 0 1.4em;
}

.setup-guide a {
  color: var(--c4);
}

.view-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.view-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 22px;
  text-align: left;
  color: var(--ink);
  background: var(--cat);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--cat) 62%, var(--ink));
  cursor: pointer;
}

.view-option strong {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.2rem;
  line-height: 1;
}

/* ---------- Game layout ---------- */

.container {
  max-width: 1800px;
  min-height: calc(100dvh - 2 * clamp(10px, 1.6vw, 28px));
  margin: 0 auto;
  flex-direction: column;
  gap: clamp(10px, 1.4vw, 22px);
}

.game-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px clamp(14px, 3vw, 48px);
}

/* The scores are the paper pad you keep score on at the table. */
.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(6px, 1vw, 16px);
}

.player {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  padding: 0.4em 0.9em;
  color: var(--ink);
  background: var(--paper);
  border-radius: 4px;
  font-size: clamp(0.85rem, 1.5vw, 1.6rem);
}

.player:nth-child(odd) {
  transform: rotate(-1.2deg);
}

.player:nth-child(even) {
  transform: rotate(0.9deg);
}

/* Seven or more players: stack name over score so they stay on one row. */
.scoreboard:has(.player:nth-child(7)) .player {
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  padding: 0.3em 0.75em;
}

.player-name {
  font-weight: 600;
}

.player-score {
  font-family: var(--display);
  font-size: 1.45em;
  line-height: 1;
}

.player {
  transition: background-color 0.15s, color 0.15s, scale 0.15s;
}

.player.score-up,
.player.score-down {
  color: #fff;
  scale: 1.12;
}

.player.score-up {
  background: var(--right);
}

.player.score-down {
  background: var(--wrong);
}

#scoreChips {
  position: fixed;
  top: clamp(10px, 2vh, 24px);
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 32px;
  pointer-events: none;
}

#scoreChips .score-chip {
  /* The paper outline keeps it readable on every column colour, red included. */
  box-shadow: 0 0 0 4px var(--paper);
  transform: none;
  scale: 1;
  font-size: clamp(1.1rem, 2.2vw, 2.6rem);
  animation: chipInOut 1.9s ease-out both;
}

.score-delta {
  font-family: var(--display);
  line-height: 1;
}

@keyframes chipInOut {
  0% {
    opacity: 0;
    translate: 0 -40px;
  }
  10%,
  85% {
    opacity: 1;
    translate: 0 0;
  }
  100% {
    opacity: 0;
    translate: 0 -12px;
  }
}

/* ---------- Board ---------- */

.board {
  flex: 1;
  display: grid;
  grid-template-rows: auto repeat(5, minmax(52px, 1fr));
  gap: clamp(4px, 0.8vw, 14px);
}

.category {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2px 2px 4px;
  text-align: center;
  color: var(--cat);
  font-weight: 800;
  font-size: clamp(0.6rem, 1.7vw, 2rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.clue {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  font-family: var(--display);
  font-size: clamp(0.8rem, 3.6vw, 4.6rem);
  line-height: 1;
  color: var(--ink);
  background: var(--cat);
  border: 0;
  border-radius: clamp(6px, 1vw, 18px);
  /* The hard lower edge is the thickness of the cardboard. */
  box-shadow: 0 clamp(3px, 0.5vw, 8px) 0 color-mix(in srgb, var(--cat) 62%, var(--ink));
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}

button.clue {
  cursor: pointer;
}

button.clue:not(.used):hover {
  transform: translateY(-3px);
}

button.clue:not(.used):active,
.view-option:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--cat) 62%, var(--ink));
}

.clue.used {
  background: var(--hole);
  box-shadow: inset 0 clamp(3px, 0.5vw, 8px) 0 #16062f;
  cursor: default;
}

/* In edit mode a played tile can still be clicked. */
button.clue.used:not(:disabled) {
  cursor: pointer;
}

.connection-status {
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.8;
}

.media-warning {
  padding: 12px 16px;
  color: var(--ink);
  background: var(--paper);
  border-left: 8px solid var(--wrong);
  font-weight: 600;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- Buttons ---------- */

button {
  cursor: pointer;
}

.btn-start {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 16px;
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--ink);
  background: var(--c3);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c3) 62%, var(--ink));
}

.btn-start:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--c3) 62%, var(--ink));
}

.btn-quiet {
  padding: 9px 16px;
  color: var(--paper);
  background: transparent;
  border: 2px solid currentColor;
  border-radius: 999px;
  font-weight: 600;
}

.setup-screen .btn-quiet {
  display: block;
  margin: 18px auto 0;
}

.btn-quiet:hover {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--paper);
}

.btn-show,
.btn-close,
.btn-correct,
.btn-wrong {
  padding: 12px 22px;
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  font-weight: 700;
  border-radius: 999px;
}

.btn-show {
  color: var(--paper);
  background: var(--ink);
  border: 3px solid var(--ink);
}

.btn-close {
  color: var(--ink);
  background: transparent;
  border: 3px solid var(--ink);
}

.btn-close:hover {
  color: var(--paper);
  background: var(--ink);
}

.btn-correct,
.btn-wrong {
  color: #fff;
  border: 0;
}

.btn-correct {
  background: var(--right);
}

.btn-wrong {
  background: var(--wrong);
}

.btn-show:hover,
.btn-correct:hover,
.btn-wrong:hover {
  filter: brightness(1.2);
}

/* ---------- Clue screen: the tile you picked grows to fill the screen ---------- */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  color: var(--ink);
  background: var(--cat, var(--c3));
}

.modal.active {
  display: block;
  animation: tileGrow 0.28s cubic-bezier(0.2, 0.8, 0.25, 1);
}

@keyframes tileGrow {
  from {
    transform: scale(0.1);
    border-radius: 60px;
  }
}

.modal .modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: clamp(16px, 3vw, 48px);
  text-align: center;
}

#presenterClueContent,
#editClueForm {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  width: 100%;
  max-width: 1300px;
}

#editClueForm {
  max-width: 700px;
  text-align: left;
}

.clue-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  width: 100%;
  margin-bottom: clamp(10px, 2vh, 24px);
}

.clue-category {
  font-weight: 800;
  font-size: clamp(1.1rem, 2.4vw, 2.6rem);
  text-align: left;
}

.clue-value {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 5rem);
  line-height: 1;
}

.clue-text {
  max-width: 24ch;
  margin: auto 0;
  padding: 14px 0;
  font-weight: 700;
  font-size: clamp(1.6rem, 4.4vw, 4.6rem);
  line-height: 1.12;
  text-wrap: balance;
}

.clue-media {
  width: 100%;
}

.clue-media:empty {
  display: none;
}

.clue-media img,
.clue-media video {
  display: block;
  max-width: 100%;
  max-height: 58dvh;
  margin: 0 auto;
  background: #fff;
  border: clamp(5px, 0.7vw, 12px) solid var(--paper);
  border-radius: 8px;
}

/* The host needs room for the answer and score buttons on one laptop screen. */
#presenterClueMedia img,
#presenterClueMedia video {
  max-height: 34dvh;
}

#presenterClueMedia:not([style*="none"]) + .clue-text {
  margin: 0;
  padding: 8px 0 0;
  max-width: none;
  font-size: clamp(1.2rem, 2.4vw, 2.6rem);
}

#presenterClueMedia:not([style*="none"]) ~ .answer {
  margin-top: 8px;
  padding: 8px 20px;
  font-size: clamp(1.2rem, 2.4vw, 2.6rem);
}

#playerModal .clue-media {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#playerModal .clue-media img,
#playerModal .clue-media video {
  max-height: 100%;
  min-height: 0;
}

.clue-media audio {
  width: min(100%, 600px);
  margin: 0 auto;
}

.host-reading,
.media-waiting {
  margin: auto 0;
  font-weight: 700;
  font-size: clamp(1.4rem, 3.4vw, 3.6rem);
  line-height: 1.15;
}

.media-waiting + .host-reading {
  margin-top: 0;
  font-weight: 500;
  font-size: clamp(1rem, 1.8vw, 1.8rem);
}

.answer {
  display: none;
  margin-top: 14px;
  padding: 14px 28px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 6px;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.6vw, 3.8rem);
  line-height: 1.1;
}

.answer.show {
  display: block;
  animation: answerStamp 0.22s ease-out;
}

@keyframes answerStamp {
  from {
    transform: scale(1.25);
    opacity: 0;
  }
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.player-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 36px;
  margin-top: 16px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 6px 18px;
  width: 100%;
}

#presenterPlayerButtons {
  width: 100%;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.score-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.score-row .btn-correct,
.score-row .btn-wrong {
  flex: none;
  padding: 8px 12px;
  font-size: 0.95rem;
}

.score-group p {
  margin-bottom: 8px;
  font-weight: 700;
}

.score-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.daily-double,
.double-nothing {
  margin: 8px 0 20px;
  font-family: var(--display);
  font-size: clamp(2.4rem, 7vw, 7rem);
  line-height: 1;
  animation: answerStamp 0.3s ease-out;
}

.wager-input {
  display: none;
  margin: 20px 0;
}

.wager-input.active {
  display: block;
}

.wager-input h3 {
  margin-bottom: 14px;
  font-size: clamp(1.4rem, 3vw, 2.4rem);
}

.wager-input input {
  display: block;
  width: 240px;
  margin: 0 auto 14px;
  padding: 12px;
  text-align: center;
  font-family: var(--display);
  font-size: 2rem;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 8px;
}

.edit-form {
  width: 100%;
  margin-top: 16px;
}

#editClueForm h3 {
  font-size: 2rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 700;
}

.check-row input {
  width: 20px;
  height: 20px;
}

.edit-section {
  display: none;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.5;
}

.edit-section.active {
  display: block;
}

.edit-section ul {
  margin: 8px 0 0 1.2em;
}

/* ---------- Final screen ---------- */

#finalModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  color: var(--ink);
  background: var(--c3);
}

#finalModal.active {
  display: block;
}

#finalScreen {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 70px) 16px;
  text-align: center;
}

.final-title {
  font-weight: 700;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
}

.winner-name {
  margin-top: 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 8vw, 7rem);
  line-height: 1;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.winner-score {
  margin: 12px 0 34px;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

#finalScoreboard {
  display: grid;
  gap: 8px;
}

/* The TV can't scroll, so more than four players read down two columns. */
@media (min-width: 640px) {
  #finalScoreboard:has(.final-row:nth-child(5)) {
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }

  #finalScoreboard:has(.final-row:nth-child(9)) {
    grid-template-rows: repeat(5, auto);
  }
}

.final-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  font-weight: 700;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  background: var(--paper);
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.final-row.is-winner {
  color: var(--paper);
  background: var(--ink);
}

#finalScreen .btn-start {
  margin-top: 34px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: none;
}

.app-notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--paper);
  border-bottom: 6px solid var(--wrong);
  font-weight: 700;
  text-align: center;
}

/* ---------- Joining ---------- */

.join-panel {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 12px;
  line-height: 1.4;
}

.join-qr {
  flex: none;
  width: 150px;
  padding: 6px;
  line-height: 0;
  background: #fff;
  border-radius: 8px;
}

.join-qr:empty {
  display: none;
}

.join-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.join-title {
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1.1;
}

.join-warning {
  margin-top: 6px;
  color: var(--wrong);
  font-weight: 700;
}

.lobby-count {
  margin-top: 10px;
  font-weight: 700;
}

.lobby-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  list-style: none;
}

.lobby-list li {
  padding: 3px 12px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
  font-weight: 700;
}

/* Host lobby: names are buttons, tapping one removes that player. */
.lobby-screen .lobby-count {
  font-size: 1.3rem;
}

.lobby-hint {
  margin-top: 2px;
  opacity: 0.85;
}

.lobby-list-host {
  gap: 8px;
  margin: 12px 0 4px;
}

.lobby-list-host li {
  padding: 0;
  background: none;
}

.lobby-list-host button {
  padding: 6px 14px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 999px;
}

.lobby-list-host button:hover {
  text-decoration: line-through;
}

.btn-start:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Phone buzzer: a double tap must never zoom the page. */
.buzzer-mode,
.buzzer-mode body {
  touch-action: manipulation;
}

.join-panel .buttons {
  justify-content: flex-start;
  margin-top: 12px;
}

/* On the TV the join code takes the whole screen until the game starts. */
#playerView.waiting .board,
#playerView.waiting .scoreboard,
#playerView:not(.waiting) .join-panel-tv {
  display: none;
}

.join-panel-tv {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  text-align: center;
  color: var(--paper);
  background: none;
}

.join-panel-tv .join-title {
  font-size: clamp(2rem, 5vw, 4.5rem);
  color: var(--c3);
}

.join-panel-tv .join-qr {
  width: min(44dvh, 420px);
  padding: 14px;
}

/* The red used on paper is too dark on grape. */
.join-panel-tv .join-warning {
  color: var(--c1);
}

.join-panel-tv .lobby-count {
  font-size: clamp(1rem, 1.8vw, 1.6rem);
}

.join-panel-tv .lobby-list {
  justify-content: center;
  max-width: 1200px;
  gap: 10px;
  font-size: clamp(1rem, 2vw, 1.8rem);
}

.join-panel-tv .lobby-list li {
  color: var(--ink);
  background: var(--paper);
}

@media (max-width: 560px) {
  .join-panel:not(.join-panel-tv) {
    flex-direction: column;
    align-items: stretch;
  }

  .join-panel:not(.join-panel-tv) .join-qr {
    align-self: center;
  }
}

/* ---------- Phone buzzer ---------- */

.buzzer-view {
  flex-direction: column;
  max-width: 520px;
  min-height: calc(100dvh - 2 * clamp(10px, 1.6vw, 28px));
  margin: 0 auto;
}

.buzzer-play {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.buzzer-me {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  align-self: stretch;
  padding: 0.5em 0.9em;
  color: var(--ink);
  background: var(--paper);
  border-radius: 4px;
  font-weight: 700;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.buzzer-score {
  font-family: var(--display);
  font-size: 1.6em;
  line-height: 1;
  white-space: nowrap;
}

/* The buzzer is a big round board tile: coloured when live, a punched-out hole when locked. */
.buzzer-button {
  width: min(78vw, 46dvh, 360px);
  aspect-ratio: 1;
  margin: auto 0;
  padding: 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 14vw, 4.5rem);
  color: var(--ink);
  background: var(--cat);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 12px 0 color-mix(in srgb, var(--cat) 62%, var(--ink));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.buzzer-button:active:not(:disabled) {
  transform: translateY(9px);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--cat) 62%, var(--ink));
}

.buzzer-button:disabled {
  color: color-mix(in srgb, var(--paper) 40%, transparent);
  background: var(--hole);
  box-shadow: inset 0 10px 0 #16062f;
  cursor: default;
}

.buzzer-button.is-first:disabled {
  color: var(--ink);
  background: var(--cat);
  box-shadow: 0 0 0 10px var(--paper);
}

.buzzer-removed {
  margin-bottom: 16px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--paper);
  border-left: 8px solid var(--wrong);
  font-weight: 700;
}

.buzzer-first {
  padding: 0.25em 0.9em;
  color: var(--paper);
  background: var(--ink);
  border: 3px solid var(--paper);
  border-radius: 999px;
  font-family: var(--display);
  font-size: clamp(1.4rem, 7vw, 2.2rem);
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
}

.buzzer-first.is-me {
  color: var(--ink);
  background: var(--cat);
}

.buzzer-status {
  min-height: 2.6em;
  text-align: center;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.3;
}

/* ---------- Buzz order ---------- */

.buzz-place {
  display: inline-grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  margin-right: 0.4em;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
  font-size: 0.85em;
}

.score-row.is-first {
  padding: 4px 4px 4px 12px;
  background: var(--paper);
  border-radius: 999px;
}

.buzz-order {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  list-style: none;
  counter-reset: buzz;
}

.buzz-order:empty {
  display: none;
}

.buzz-order li {
  padding: 0.2em 0.8em;
  background: var(--paper);
  border-radius: 999px;
  font-weight: 800;
  font-size: clamp(1rem, 2vw, 2rem);
  counter-increment: buzz;
}

.buzz-order li::before {
  content: counter(buzz) ". ";
}

.buzz-order li:first-child {
  color: var(--paper);
  background: var(--ink);
  font-size: clamp(1.4rem, 3.4vw, 3.6rem);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  /* Keep the score change readable instead of fading it out instantly. */
  .score-chip {
    animation: none !important;
  }
}

/* Start screen: join with a room code */
.join-form {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 2px dashed color-mix(in srgb, var(--paper) 35%, transparent);
}

.join-form .buttons {
  align-items: center;
}

.join-form .buttons .btn-quiet {
  margin: 0;
}

#gameRoomId {
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.form-error {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--wrong);
  color: var(--paper);
  font-weight: 600;
}

/* The code players type when they can't scan */
.room-code {
  font-weight: 600;
}

.room-code strong {
  font-family: var(--display);
  font-size: 1.5em;
  letter-spacing: 0.15em;
  margin-left: 0.4em;
}
