/*
 * Infinum brand tokens (https://infinum.com/brand/).
 * The typeface is Neue Haas Grotesk. It is licensed, so the font files are not
 * in this repository: a device that has the font uses it, all others fall back
 * to Helvetica or Arial, as the brand guidelines specify.
 */
:root {
  --red: #d82828;
  --black: #000;
  --white: #fff;
  --grey1: #f5f9ff;
  --grey2: #e4ebf5;
  --grey3: #c4cede;
  --grey4: #929eb2;
  --grey5: #525e6c;
  --olive30: #5a8772;
  --sky30: #6479c3;

  --font-display: 'Neue Haas Grotesk Display Pro', 'Neue Haas Grotesk Display', 'Helvetica Neue',
    Helvetica, Arial, sans-serif;
  --font-text: 'Neue Haas Grotesk Text Pro', 'Neue Haas Grotesk Text', 'Helvetica Neue', Helvetica,
    Arial, sans-serif;

  --radius: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --bar-height: clamp(64px, 11vh, 112px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.4;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-wrap: balance;
}

p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--sky30);
  outline-offset: 2px;
}

.theme-stage {
  background: var(--black);
  color: var(--white);
}

.theme-paper {
  background: var(--white);
  color: var(--black);
}

/* Event lockup: the header logos of a quiz in one row, with a line between
   them. All sizes come from --lockup-height, which is the height of a large
   logo. A medium logo has half of that height and a small one a quarter. */
.lockup {
  --lockup-height: 64px;
  display: flex;
  align-items: center;
  gap: calc(var(--lockup-height) * 0.28);
  font-family: var(--font-text);
}

.lockup-item {
  display: grid;
  flex: none;
  gap: calc(var(--lockup-height) * 0.11);
}

.lockup img {
  display: block;
  width: auto;
  max-width: none;
  height: var(--lockup-height);
}

.lockup-medium img {
  height: calc(var(--lockup-height) * 0.5);
}

.lockup-small img {
  height: calc(var(--lockup-height) * 0.25);
}

/* A short line above a logo, for example "Hosted by". */
.lockup-caption {
  color: var(--grey2);
  font-size: calc(var(--lockup-height) * 0.1);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.lockup-divider {
  flex: none;
  width: 1px;
  height: var(--lockup-height);
  background: var(--grey5);
}

/* A quiz without header logos shows its name. */
.lockup-text {
  min-height: var(--lockup-height);
  color: var(--white);
  font-family: var(--font-display);
  font-size: calc(var(--lockup-height) * 0.42);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.qr {
  display: block;
  background: var(--white);
  line-height: 0;
}

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

/* Backdrop of the big-screen pages: a faint pattern of the host logos. The
   pattern is one large square image (src/backdrop.js makes it). It is turned
   by a fixed angle and moves at a constant speed.

   In the pattern, each row starts one logo later than the row above it. A
   move of one cell to the left and one cell down thus gives the same pattern
   again, and the animation is that move, without an end. The image has 16
   columns and 24 rows of cells (COLUMNS and ROWS in src/backdrop.js), so one
   cell is 1/16 of its width and 1/24 of its height. The move goes from half a
   cell on one side of the middle to half a cell on the other side. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.backdrop-pattern {
  /* A square with the diagonal of the screen as its side covers the screen at
     each angle. The 8 % more are for the half cell that the image moves. */
  --side: calc((100vw + 100vh) * 1.08);
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--side);
  max-width: none;
  height: var(--side);
  margin: calc(var(--side) / -2) 0 0 calc(var(--side) / -2);
  opacity: 0.06;
  transform: rotate(-20deg);
  animation: backdrop-pan 14s linear infinite;
}

@supports (width: hypot(1px, 1px)) {
  .backdrop-pattern {
    --side: calc(hypot(100vw, 100vh) * 1.08);
  }
}

@keyframes backdrop-pan {
  from {
    transform: rotate(-20deg) translate(calc(100% / 32), calc(-100% / 48));
  }

  to {
    transform: rotate(-20deg) translate(calc(-100% / 32), calc(100% / 48));
  }
}

/* Menu: a button in the top right corner of each page and a list of the
   pages. The list is a popover, so the browser shows it above all other
   content and closes it on a click outside it or on Escape. */
.menu-button {
  /* The same position on each page. With this distance from the top, the
     button is in the vertical middle of the black header of the quiz page
     (16px padding + 52px lockup + 16px padding = 84px, button 44px). */
  top: 20px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.menu-button svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* The big-screen pages do not scroll as a document, so the button stays in
   the corner. On the other pages it is at the top and scrolls with the page. */
.theme-stage .menu-button {
  position: fixed;
}

.theme-paper .menu-button {
  position: absolute;
}

/* The quiz page has a black header below the button. */
body:has(.quiz-header) .menu-button {
  color: var(--white);
}

.menu {
  position: fixed;
  /* Below the button: 20px + 44px + 6px. */
  inset: 70px 12px auto auto;
  min-width: 13em;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--grey3);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  font-size: 17px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.25);
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.15s,
    transform 0.15s var(--ease),
    display 0.15s allow-discrete,
    overlay 0.15s allow-discrete;
}

.menu:popover-open {
  opacity: 1;
  transform: none;
}

@starting-style {
  .menu:popover-open {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.theme-stage .menu {
  border-color: var(--grey5);
  background: var(--black);
  color: var(--white);
}

.menu a {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 10px 12px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.menu a:hover {
  background: var(--grey2);
}

.theme-stage .menu a:hover {
  background: var(--grey5);
}

/* A red mark shows the current page. The other links have the same space,
   so all names start at the same position. */
.menu a::before {
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  content: '';
}

.menu a[aria-current='page'] {
  font-weight: 700;
}

.menu a[aria-current='page']::before {
  background: var(--red);
}

/* A browser without popovers would show the list all the time. The menu is
   a shortcut and each page works without it, so such a browser does not get it. */
@supports not selector(:popover-open) {
  .menu-button,
  .menu {
    display: none;
  }
}

/* Controls */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 14px 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.1s,
    background-color 0.15s;
}

.button:active:not(:disabled) {
  transform: scale(0.98);
}

.button:disabled {
  background: var(--grey2);
  color: var(--grey4);
  cursor: default;
}

.button-dark {
  background: var(--black);
}

/* A text button for the less important action next to a main button. */
.quiet-button {
  padding: 12px 20px;
  border: 0;
  background: transparent;
  color: var(--grey5);
  font: inherit;
  cursor: pointer;
}

.quiet-button:disabled {
  color: var(--grey3);
  cursor: default;
}

.button-wide {
  width: 100%;
}

.link-button {
  padding: 12px 0;
  border: 0;
  background: none;
  color: var(--grey5);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-link {
  color: inherit;
  text-underline-offset: 3px;
}

input[type='password'],
input[type='number'],
input[type='text'],
input[type='datetime-local'],
input[type='file'],
select,
textarea {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--grey3);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  font: inherit;
}

input[type='password']:focus,
input[type='number']:focus,
input[type='text']:focus,
input[type='datetime-local']:focus,
select:focus,
textarea:focus {
  border-color: var(--black);
}

textarea {
  resize: vertical;
}

/* List of open quizzes, at "/" */

.index {
  max-width: 1100px;
  min-height: 100dvh;
  margin-inline: auto;
  padding: clamp(24px, 6vh, 72px) clamp(20px, 5vw, 96px);
}

.index-logo {
  display: block;
  width: auto;
  height: clamp(18px, 2.2vw, 30px);
}

.index h1 {
  margin: clamp(32px, 8vh, 96px) 0 clamp(20px, 4vh, 40px);
  font-size: clamp(40px, 6vw, 96px);
  letter-spacing: -0.02em;
  line-height: 1;
}

.index-empty {
  color: var(--grey3);
  font-size: clamp(18px, 1.8vw, 26px);
}

.index-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.index-quiz {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px clamp(16px, 2.5vw, 36px);
  padding: clamp(16px, 2.4vh, 26px) clamp(16px, 2.2vw, 30px);
  border: 1px solid var(--grey5);
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.65);
  color: var(--white);
  text-decoration: none;
  transition: border-color 0.15s;
}

.index-quiz:hover {
  border-color: var(--white);
}

.index-code {
  grid-row: span 3;
  color: var(--red);
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 44px);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.index-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 32px);
  font-weight: 700;
  line-height: 1.15;
}

.index-subtitle,
.index-meta {
  grid-column: 2;
  color: var(--grey3);
  font-size: clamp(14px, 1.2vw, 18px);
}

/* Home */

.home {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
  padding: clamp(20px, 4vh, 56px) clamp(20px, 5vw, 96px);
}

.home .lockup {
  --lockup-height: clamp(56px, 7.5vw, 120px);
}

/* One entrance when the page loads: the text comes up line after line, and
   the QR code comes in. */
.home h1,
.home-subtitle,
.home-lede,
.home-url,
.home-actions {
  animation: rise 0.7s var(--ease) both;
}

.home-subtitle {
  animation-delay: 0.08s;
}

.home-lede {
  animation-delay: 0.16s;
}

.home-url {
  animation-delay: 0.22s;
}

.home-actions {
  animation-delay: 0.28s;
}

.home .qr {
  animation: qr-in 0.8s 0.2s var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.5em);
  }
}

@keyframes qr-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

.home-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 5vw, 96px);
  padding-block: clamp(16px, 3vh, 48px);
}

.home h1 {
  font-size: clamp(56px, 9.5vw, 168px);
  letter-spacing: -0.025em;
  line-height: 0.96;
}

.home-subtitle {
  margin-top: 0.5em;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.15;
}

.home-lede {
  max-width: 26em;
  margin-top: clamp(24px, 5vh, 64px);
  font-size: clamp(18px, 1.7vw, 30px);
  line-height: 1.3;
}

.home-url {
  margin-top: 0.5em;
  color: var(--grey3);
  font-size: clamp(18px, 1.7vw, 30px);
  overflow-wrap: anywhere;
}

.home-url strong {
  color: var(--white);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: clamp(24px, 4vh, 48px);
  font-size: clamp(16px, 1.2vw, 20px);
}

/* The button is for a visitor on a phone, who cannot scan a code on the same screen. */
.home-open-quiz {
  display: none;
}

.home .qr {
  width: min(38vw, 62vh);
}

@media (max-width: 760px) {
  .home-body {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .home-open-quiz {
    display: inline-flex;
  }

  .home .qr {
    width: min(100%, 320px);
  }
}

/* Quiz (participant, phone) */

.quiz-header {
  padding: 16px 20px;
  background: var(--black);
}

.quiz-header .lockup {
  --lockup-height: 52px;
  justify-content: center;
}

.quiz {
  max-width: 600px;
  margin-inline: auto;
  padding: 24px 20px 56px;
  overflow-x: clip;
}

/* A new screen comes in from the side that matches the direction: from the
   right for "forward", from the left for "back". */
.quiz > * {
  animation: screen-in 0.32s var(--ease) both;
}

.quiz[data-direction='back'] > * {
  animation-name: screen-in-back;
}

.quiz > .progress {
  animation: none;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes screen-in-back {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
}

.quiz h1 {
  font-size: clamp(24px, 6.4vw, 32px);
  line-height: 1.15;
}

.quiz-note {
  margin: 16px 0 24px;
  padding-inline: 0;
  color: var(--grey5);
}

noscript .quiz-note {
  max-width: 600px;
  margin-inline: auto;
  padding-inline: 20px;
}

.progress {
  margin-bottom: 24px;
}

.progress-text {
  color: var(--grey5);
  font-size: 15px;
}

.progress-track {
  height: 4px;
  margin-top: 8px;
  background: var(--grey2);
}

.progress-fill {
  width: calc(var(--value, 0) * 100%);
  height: 100%;
  background: var(--red);
  transition: width 0.5s var(--ease);
}

.question fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.question legend {
  width: 100%;
  padding: 0;
}

.statement {
  margin-top: 12px;
  color: var(--grey5);
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border: 1.5px solid var(--grey3);
  border-radius: var(--radius);
  line-height: 1.3;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.option input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--grey4);
  border-radius: 50%;
  background: var(--white);
  appearance: none;
  transition:
    border-width 0.15s,
    background-color 0.15s;
}

.option input:checked {
  border: 6px solid var(--white);
  background: var(--red);
}

.option input:focus-visible {
  outline: none;
}

.option:has(input:checked) {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
}

.option:has(input:focus-visible) {
  outline: 3px solid var(--sky30);
  outline-offset: 2px;
}

.option-number {
  flex: none;
  min-width: 1ch;
  font-weight: 700;
}

.question textarea {
  margin-top: 24px;
}

.counter {
  margin-top: 6px;
  color: var(--grey5);
  font-size: 15px;
  text-align: right;
}

.form-error {
  margin-top: 16px;
  padding: 12px 16px;
  border-left: 4px solid var(--red);
  background: var(--grey1);
}

.form-notice {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 4px solid var(--olive30);
  background: var(--grey1);
}

/* The main button, with the back button below it. */
.form-actions {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 24px;
}

.form-actions .button {
  width: 100%;
}

/* Summary after the last question */

.done-mark {
  display: block;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

.done-mark circle {
  fill: var(--red);
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

.done-mark path {
  fill: none;
  stroke: var(--white);
  stroke-dasharray: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
  animation: draw 0.35s 0.3s ease-out both;
}

@keyframes pop {
  from {
    transform: scale(0);
  }
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
}

.quiz h2 {
  margin-top: 40px;
  font-size: 21px;
}

.summary {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.summary-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--grey2);
}

.summary-question {
  grid-column: 1 / -1;
  color: var(--grey5);
  font-size: 15px;
  line-height: 1.3;
}

.summary-answer {
  margin-top: 4px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.summary-answer .muted {
  font-weight: 400;
}

.summary-item .link-button {
  padding: 4px 0;
}

/* Results (presenter, projector) */

html:has(.slides) {
  scroll-snap-type: y mandatory;
  /* No scrollbar: the width of a slide is then the same on the page and in
     the overview, where the page does not scroll. */
  scrollbar-width: none;
  /* A finger can scroll the slides. A pinch does not zoom the page:
     results.js uses it to open and close the overview. */
  touch-action: pan-y;
}

html:has(.slides)::-webkit-scrollbar {
  display: none;
}

.slides-note {
  padding: clamp(24px, 5vh, 72px) clamp(20px, 5vw, 96px);
  color: var(--grey3);
}

.slide {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: clamp(24px, 5vh, 64px) clamp(20px, 5vw, 96px) calc(var(--bar-height) + clamp(16px, 4vh, 48px));
  scroll-snap-align: start;
}

/* Only the current slide shows its content. results.js sets `is-active` on
   the slide that covers the middle of the screen, and `is-entering` for the
   time of its entrance. */
.slide > * {
  transition: opacity 0.25s;
}

.slide:not(.is-active) > * {
  opacity: 0;
}

.slide.is-active > .slide-meta,
.slide.is-active > h2 {
  animation: rise 0.6s var(--ease) both;
}

.slide.is-active > h2 {
  animation-delay: 0.05s;
}

.slide.is-active > .closing {
  animation: rise 1s 0.1s var(--ease) both;
}

/* The short pulse on a value that a new answer changed. */
@keyframes bump {
  40% {
    transform: scale(1.16);
  }
}

@keyframes flash {
  from {
    filter: brightness(1.8);
  }
}

.slide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 1.5em;
  color: var(--grey4);
  font-size: clamp(14px, 1.2vw, 20px);
}

.slide h2 {
  max-width: 30em;
  margin-top: 0.4em;
  font-size: clamp(26px, 3.2vw, 60px);
  line-height: 1.08;
}

.slide-empty {
  margin-top: clamp(24px, 5vh, 56px);
  color: var(--grey3);
  font-size: clamp(18px, 1.7vw, 30px);
}

/* Bars: one hue, value at the tip, square at the baseline, rounded at the data end. */
.bars {
  display: grid;
  gap: clamp(14px, 3.2vh, 40px);
  margin: auto 0;
  padding: clamp(24px, 4vh, 48px) 0 0;
  list-style: none;
}

.bar-label {
  display: block;
  font-size: clamp(17px, 1.9vw, 32px);
  line-height: 1.2;
}

.bar-line {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-top: 0.4em;
  font-size: clamp(17px, 1.9vw, 32px);
}

.bar-fill {
  flex: none;
  width: calc(var(--share, 0) * (100% - 8em));
  min-width: 3px;
  height: clamp(12px, 2.2vh, 24px);
  border-radius: 0 4px 4px 0;
  background: var(--red);
  transition: width 0.6s var(--ease);
}

/* Entrance: the bars grow from the baseline, one after the other. */
.slide:not(.is-active) .bar-fill {
  width: 3px;
  transition: none;
}

.slide.is-entering .bar-fill {
  transition-duration: 0.9s;
  transition-delay: calc(var(--i, 0) * 90ms);
}

.bar-row.is-bumped .bar-fill,
.column.is-bumped .column-fill {
  animation: flash 0.8s ease-out;
}

.bar-row.is-bumped .bar-value {
  transform-origin: left center;
  animation: bump 0.5s var(--ease);
}

.bar-value {
  white-space: nowrap;
}

.bar-share,
.column-share {
  font-variant-numeric: tabular-nums;
}

.bar-count {
  margin-left: 0.7em;
  color: var(--grey4);
  font-size: 0.7em;
  font-variant-numeric: tabular-nums;
}

/* Columns for the scale question. */
.scale {
  margin: auto 0;
  padding-top: clamp(24px, 4vh, 48px);
}

.scale-statement {
  color: var(--grey4);
  font-size: clamp(16px, 1.5vw, 26px);
}

.columns {
  display: grid;
  grid-template-columns: repeat(var(--columns, 5), minmax(0, 1fr));
  /* No gap: the plots touch, so their bottom borders make one baseline. */
  margin: clamp(8px, 2vh, 24px) 0 0;
  padding: 0;
  list-style: none;
}

.column {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.column-plot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: clamp(150px, 36vh, 440px);
  border-bottom: 1px solid var(--grey5);
  font-size: clamp(17px, 1.9vw, 32px);
}

.column-value {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.35em;
  line-height: 1.15;
}

.column-count {
  color: var(--grey4);
  font-size: 0.7em;
  font-variant-numeric: tabular-nums;
}

.column-fill {
  flex: none;
  width: clamp(16px, 2vw, 28px);
  height: calc(var(--share, 0) * (100% - 3em));
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--red);
  transition: height 0.6s var(--ease);
}

.slide:not(.is-active) .column-fill {
  height: 3px;
  transition: none;
}

.slide.is-entering .column-fill {
  transition-duration: 0.9s;
  transition-delay: calc(var(--i, 0) * 90ms);
}

.column.is-bumped .column-value {
  transform-origin: center bottom;
  animation: bump 0.5s var(--ease);
}

.column-number {
  margin-top: 0.5em;
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 34px);
  font-weight: 700;
}

.column-label {
  max-width: 11em;
  padding-inline: 0.4em;
  color: var(--grey2);
  font-size: clamp(13px, 1.3vw, 22px);
  line-height: 1.2;
  text-wrap: balance;
}

/* Open answers */
.open-answers {
  margin-top: clamp(24px, 4vh, 48px);
}

.bubbles {
  margin: 0;
  padding: 0;
  columns: 3 300px;
  column-gap: 16px;
  list-style: none;
}

.bubble {
  margin-bottom: 16px;
  padding: 0.7em 0.9em;
  border-radius: 4px 18px 18px 18px;
  background: var(--white);
  color: var(--black);
  font-size: clamp(16px, 1.5vw, 26px);
  line-height: 1.3;
  overflow-wrap: anywhere;
  break-inside: avoid;
}

/* A new answer has a red ring that fades. */
.bubble.is-new {
  animation: fresh 2.6s ease-out;
}

@keyframes fresh {
  from {
    box-shadow: 0 0 0 5px var(--red);
  }

  to {
    box-shadow: 0 0 0 5px rgb(216 40 40 / 0);
  }
}

.slide-closing {
  justify-content: center;
}

/* Overview: all question slides at one time, as a grid of small screens.
   results.js gives each slide a place (--x, --y) on a large canvas and moves
   the canvas as a camera does: on one slide at full size, or back until the
   full grid is in view. `is-overview` is on the root element while the canvas
   layout is in use, and `is-zoomed-out` while the camera shows the grid. */
html.is-overview {
  overflow: hidden;
  scroll-snap-type: none;
}

.is-overview .slides {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}

.slides.is-moving {
  transition: transform 0.7s cubic-bezier(0.6, 0, 0.2, 1);
}

/* A slide on the canvas has the size of the screen above the bottom bar, so
   it looks the same as on the page when the camera is on it. The line and the
   corner radius are divided by the scale of the grid, so that they have their
   written size on screen in the grid. The line is outside the slide: it is
   off the screen when the camera is on the slide. */
.is-overview .slide {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--tile-width);
  height: var(--tile-height);
  min-height: 0;
  padding-bottom: clamp(16px, 4vh, 48px);
  overflow: hidden;
  border-radius: calc(12px / var(--overview-scale));
  outline: calc(1px / var(--overview-scale)) solid var(--grey5);
}

/* In the grid, each tile has a dark surface, so the marks of the backdrop are
   fainter behind the content of a tile than between the tiles. The surface
   fades in and out while the camera moves, because a slide on the page has
   no surface. */
.is-overview .slide:not(.slide-closing) {
  background-color: rgb(0 0 0 / 0);
  transition: background-color 0.5s;
}

.is-zoomed-out .slide:not(.slide-closing) {
  background-color: rgb(0 0 0 / 0.65);
}

.is-zoomed-out .slide {
  cursor: zoom-in;
  user-select: none;
}

.is-zoomed-out .slide:hover {
  outline-color: var(--white);
}

/* The slide that Z, Enter or Escape opens. */
.is-zoomed-out .slide.is-selected {
  outline-width: calc(3px / var(--overview-scale));
  outline-color: var(--white);
}

/* Each of the first nine tiles shows the number key that opens it, in the
   same style as the key hint on the overview button. The sizes are divided by
   the scale of the grid, as for the line. */
.slides {
  counter-reset: tile;
}

.slide {
  counter-increment: tile;
}

.is-overview .slide:not(.slide-closing):nth-child(-n + 9)::after {
  position: absolute;
  top: calc(8px / var(--overview-scale));
  right: calc(8px / var(--overview-scale));
  min-width: 1.7em;
  padding: 0.1em 0.3em;
  border: calc(1px / var(--overview-scale)) solid var(--grey5);
  border-radius: calc(4px / var(--overview-scale));
  background: var(--black);
  color: var(--grey3);
  font-size: calc(12px / var(--overview-scale));
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  text-align: center;
  content: counter(tile);
  opacity: 0;
  transition: opacity 0.3s;
}

.is-zoomed-out .slide:not(.slide-closing):nth-child(-n + 9)::after {
  opacity: 1;
}

/* The closing statement is not a tile. Its place is below the grid, and it
   fades while the camera moves away from it. */
.is-overview .slide-closing {
  outline: 0;
  transition: opacity 0.4s;
}

.is-zoomed-out .slide-closing {
  opacity: 0;
  pointer-events: none;
}

.closing {
  max-width: 17em;
  font-family: var(--font-display);
  font-size: clamp(34px, 5.4vw, 108px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.03;
  text-wrap: balance;
}

.results-bar {
  position: fixed;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: var(--bar-height);
  padding: 8px clamp(20px, 5vw, 96px);
  border-top: 1px solid var(--grey5);
  background: var(--black);
  /* Above the canvas of the overview. */
  z-index: 1;
}

.results-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 1.6vw, 32px);
}

/* The button that changes between one slide and the overview. */
.view-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.55em;
  padding: 0.5em 0.85em;
  border: 1px solid var(--grey5);
  border-radius: 999px;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: clamp(14px, 1.2vw, 20px);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s;
}

.view-toggle:hover:not(:disabled) {
  border-color: var(--white);
}

.view-toggle:disabled {
  color: var(--grey5);
  cursor: default;
}

.view-toggle-icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* The button has an icon and a label for each of the two views. The two
   icons have the same size. The two labels are in the same grid cell, so the
   cell has the width of the longer one, and the button keeps its width when
   the view changes. */
.view-toggle-icon.view-toggle-single,
.is-zoomed-out .view-toggle-icon.view-toggle-grid {
  display: none;
}

.is-zoomed-out .view-toggle-icon.view-toggle-single {
  display: block;
}

.view-toggle-label {
  display: grid;
  text-align: left;
}

.view-toggle-label > * {
  grid-area: 1 / 1;
}

.view-toggle-label > .view-toggle-single,
.is-zoomed-out .view-toggle-label > .view-toggle-grid {
  visibility: hidden;
}

.is-zoomed-out .view-toggle-label > .view-toggle-single {
  visibility: visible;
}

.view-toggle kbd {
  padding: 0.05em 0.45em;
  border: 1px solid var(--grey5);
  border-radius: 4px;
  color: var(--grey3);
  font: inherit;
  font-size: 0.75em;
}

.results-bar .lockup {
  --lockup-height: calc(var(--bar-height) - 30px);
}

.results-status {
  color: var(--grey3);
  font-size: clamp(14px, 1.2vw, 20px);
  text-align: center;
}

.results-status.is-stale {
  color: var(--white);
  font-weight: 700;
}

/* Red and pulsing while the quiz accepts answers, grey when it does not. */
.live-dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.6em;
  border-radius: 50%;
  background: var(--grey5);
  vertical-align: 0.05em;
}

.results-status.is-live .live-dot {
  background: var(--red);
  animation: live 2s ease-out infinite;
}

@keyframes live {
  from {
    box-shadow: 0 0 0 0 rgb(216 40 40 / 0.7);
  }

  to {
    box-shadow: 0 0 0 0.65em rgb(216 40 40 / 0);
  }
}

.participants {
  display: inline-block;
}

/* Space for three digits of equal width: the status and the button next to
   it stay in position while the number counts up. */
.participants-count {
  display: inline-block;
  min-width: 3ch;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

/* A note continues the sentence directly after the number. */
.results-status:has(.status-note:not(:empty)) .participants-count {
  min-width: 0;
}

.participants.is-bumped {
  animation: bump 0.5s var(--ease);
}

/* The link back to the quiz is for a participant who looks at the results on
   a phone. The projector does not show it. */
.results-back {
  display: none;
  font-size: 15px;
}

.results-join {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  color: var(--grey3);
  font-size: clamp(14px, 1.2vw, 20px);
  line-height: 1.25;
  text-align: right;
}

.results-join strong {
  color: var(--white);
  overflow-wrap: anywhere;
}

.qr-small {
  flex: none;
  width: calc(var(--bar-height) - 16px);
}

@media (max-width: 760px) {
  .results-bar {
    grid-template-columns: 1fr auto;
  }

  .results-bar .lockup,
  .results-join {
    display: none;
  }

  .results-back {
    display: inline;
  }

  .results-status {
    text-align: left;
  }

  .results-center {
    justify-content: space-between;
  }

  /* On a phone the button shows its icon only. Its name is in `aria-label`. */
  .view-toggle {
    padding: 0.6em;
  }

  .view-toggle-label,
  .view-toggle kbd {
    display: none;
  }

  /* A phone has no number keys, and the tiles are small. */
  .is-overview .slide:not(.slide-closing):nth-child(-n + 9)::after {
    content: none;
  }
}

/* Admin */

.admin {
  max-width: 760px;
  margin-inline: auto;
  padding: 32px 20px 72px;
}

.admin h1 {
  font-size: 32px;
}

.admin h2 {
  margin-bottom: 12px;
  font-size: 21px;
}

.admin-login {
  max-width: 400px;
}

.admin-login h1 {
  margin-bottom: 24px;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack .button {
  margin-top: 8px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 24px;
}

.admin-logout .link-button {
  color: inherit;
}

/* Space for the menu button, when the window is too narrow to have it
   beside the column of the page. */
@media (max-width: 880px) {
  .admin-header,
  .admin-login h1 {
    padding-right: 48px;
  }
}

.notice {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-left: 4px solid var(--black);
  background: var(--grey1);
}

.notice-error {
  border-left-color: var(--red);
}

.panel {
  padding: 24px 0;
  border-top: 1px solid var(--grey3);
}

.panel p + form,
.panel p + table {
  margin-top: 16px;
}

.muted {
  color: var(--grey5);
}

.status {
  font-weight: 700;
}

.status::before {
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--grey4);
  content: '';
}

.status-open::before {
  background: var(--olive30);
}

.count-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.count-table th,
.count-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--grey2);
  text-align: left;
  vertical-align: top;
}

.count-table th {
  color: var(--grey5);
  font-weight: 400;
}

.count-table th:last-child,
.count-table td:last-child {
  padding-left: 16px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.danger {
  margin-top: 20px;
}

.danger summary {
  color: var(--red);
  font-weight: 700;
  cursor: pointer;
}

.danger p {
  margin: 12px 0 16px;
}

.admin h3 {
  margin: 28px 0 8px;
  font-family: var(--font-display);
  font-size: 17px;
}

.admin code {
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

/* A text to copy, for example the instructions for an AI assistant. */
.snippet {
  margin: 12px 0;
  background: var(--grey1);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

/* A form with its fields in one row, and its button at the end of the row. */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px;
  margin-top: 16px;
}

.inline-form label,
.field-row label,
.row-form label {
  display: grid;
  gap: 6px;
  color: var(--grey5);
  font-size: 15px;
}

.inline-form input[type='number'] {
  width: 9em;
}

.inline-form input[type='text'] {
  width: 18em;
  max-width: 100%;
}

.inline-form + .muted {
  margin-top: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 10em 1fr;
  gap: 16px;
}

.stack label .muted,
.stack label {
  font-size: 15px;
}

.form-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

a.quiet-button {
  text-decoration: none;
}

.button-small {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 15px;
}

.add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

/* Name and value pairs, for example the addresses of a quiz. */
.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 20px;
  margin: 12px 0 0;
}

.facts dt {
  color: var(--grey5);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.quiz-table .status {
  font-weight: 400;
}

/* Rows of logos and questions. */
.rows {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grey2);
}

.row-number {
  flex: none;
  width: 1.6em;
  color: var(--grey5);
  font-variant-numeric: tabular-nums;
}

.row-main {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.row-main .muted {
  font-size: 15px;
}

.row-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.logo-row {
  flex-wrap: wrap;
}

.row-form {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 12px;
  min-width: 0;
}

.row-form .row-title {
  flex-basis: 100%;
}

.row-form select,
.row-form input[type='text'] {
  width: auto;
  max-width: 11em;
  padding: 8px 10px;
}

/* The logos are light, so their small picture has a dark surface. */
.thumb {
  display: grid;
  flex: none;
  width: 96px;
  height: 64px;
  padding: 10px;
  place-items: center;
  border-radius: 6px;
  background: var(--black);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.move-form {
  display: flex;
  flex: none;
  gap: 4px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--grey3);
  border-radius: 6px;
  background: var(--white);
  color: var(--black);
  font: inherit;
  cursor: pointer;
}

.icon-button:disabled {
  color: var(--grey3);
  cursor: default;
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .row {
    flex-wrap: wrap;
  }
}

.moderation {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.moderation li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--grey2);
}

.moderation p {
  padding: 10px 0;
  overflow-wrap: anywhere;
}

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