/* The Line Test — "split screen". The whole screen is the line: every question fills the phone
   with its group's two colours, one above your line and one below. Around it, a calm cool-grey
   page with heavy grotesque headlines and black pill buttons, so the colour belongs to the questions. */

/* Variable, with optical sizes: big headlines get the narrower, livelier display cut. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-latin-opsz-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  /* Keep in sync with src/shared/palette.ts */
  --paper: #f2f2f5;
  --paper-deep: #e6e6ec;
  --surface: #ffffff;
  --ink: #14141a;
  --muted: #55555f;
  --rule: #d9d9e0;
  --red: #d21f3c;
  --blue: #2b3ff0;
  /* The Time group's colours, for the logo and the start screen's demo line. */
  --demo-a: #2b3ff0;
  --demo-b: #ffd6c2;

  --font-display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: clamp(2.5rem, 11vw, 4.25rem);
  --step-5: clamp(4.5rem, 22vw, 8rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  --radius-sm: 10px;
  --radius-md: 24px;
  --radius-pill: 999px;
  --rule-heavy: 2px solid var(--ink);
  --rule-light: 1px solid var(--rule);
  --shadow-lift: 0 10px 28px -14px rgb(20 20 26 / 0.35);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 120ms;
  --medium: 240ms;

  --z-play: 20;
  --z-overlay: 30;

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
body.is-playing {
  overflow: hidden;
}
.is-playing .masthead,
.is-playing .colophon {
  display: none;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

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

[tabindex="-1"]:focus {
  outline: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--space-4);
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 10;
}
.skip:focus {
  top: var(--space-4);
}

/* Masthead and colophon ---------------------------------------------------- */

.masthead,
.colophon,
.page {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding-inline: var(--space-4);
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: var(--space-4) var(--space-2);
}
.masthead__name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font: 800 1.25rem / 1 var(--font-display);
  letter-spacing: -0.03em;
  text-decoration: none;
}
/* The logo: a line drawn through a two-colour square. */
.masthead__name::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(var(--demo-a) 0 55%, var(--ink) 55% calc(55% + 3px), var(--demo-b) calc(55% + 3px));
}
.masthead__issue {
  color: var(--muted);
  font-size: var(--step--1);
}

.page {
  flex: 1;
}

.colophon {
  padding-block: var(--space-6) var(--space-8);
  color: var(--muted);
  font-size: var(--step--1);
}
.colophon p {
  margin: 0 0 var(--space-1);
}

/* Type ----------------------------------------------------------------------- */

.screen {
  padding-block: var(--space-6) var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.display--number {
  font-size: var(--step-5);
  line-height: 0.85;
  color: var(--red);
}

.lede {
  margin: 0;
  font-size: var(--step-1);
  line-height: 1.45;
  text-wrap: pretty;
}

.fineprint {
  margin: 0;
  font-size: var(--step--1);
  color: var(--muted);
}

h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.loading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-3);
  color: var(--muted);
}

/* Panels: white cards that hold one job each ------------------------------------- */

.panel {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.panel p {
  margin: 0;
}
.panel--challenge {
  background: var(--ink);
  color: #fff;
}
.panel--challenge .fineprint,
.panel--challenge .field__help,
.panel--challenge .share__url {
  color: #c9c9d2;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Buttons: pills ---------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: var(--space-3) var(--space-6);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  font: 600 var(--step-0) / 1.2 var(--font-text);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
  touch-action: manipulation;
}
.button:active:not(:disabled) {
  transform: scale(0.97);
}
.button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.button--primary {
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.button--primary:hover:not(:disabled) {
  background: #000;
}
.button--secondary {
  background: transparent;
  color: var(--ink);
}
.button--secondary:hover:not(:disabled) {
  background: var(--paper-deep);
}
.button--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.button--big {
  min-height: 60px;
  font-size: var(--step-1);
  padding-inline: var(--space-8);
  align-self: flex-start;
}
/* On dark panels and the milestone card. */
.button--on-dark {
  background: transparent;
  border-color: #fff;
  color: #fff;
}
.panel--challenge .button--primary,
.play--milestone .button--primary {
  background: #fff;
  border-color: #fff;
  color: var(--ink);
}
.panel--challenge .button--primary:hover:not(:disabled),
.play--milestone .button--primary:hover:not(:disabled) {
  background: var(--paper-deep);
  border-color: var(--paper-deep);
}
.button--on-dark:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.12);
}
.panel--challenge .button--secondary {
  border-color: #fff;
  color: #fff;
}
.panel--challenge .button--secondary:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.12);
}
.panel--challenge .button--ghost {
  color: #fff;
}

/* Forms ------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}
.field label {
  font-weight: 600;
}
.field input,
.field textarea {
  min-height: 52px;
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: var(--step-1) var(--font-text);
}
.field input:focus,
.field textarea:focus {
  border-color: var(--ink);
}
.field textarea {
  resize: vertical;
  line-height: 1.35;
}
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--red);
}
.field__help {
  margin: 0;
  font-size: var(--step--1);
  color: var(--muted);
}
.field__error {
  margin: 0;
  color: var(--red);
  font-weight: 600;
  font-size: var(--step--1);
  min-height: 1.3em;
}
.panel--challenge .field__error {
  color: #ff9aab;
}
.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
}
/* Beside the field on wide screens, the button lines up with the input; stacked, it sits under it. */
@media (min-width: 30rem) {
  .field-row .button {
    margin-top: 1.6rem;
  }
}
.check {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--step--1);
}
.check input {
  width: 24px;
  height: 24px;
  margin: 0;
  flex: none;
  accent-color: var(--ink);
}

/* Start screen: the demo line --------------------------------------------------- */

/* A still from the question screen, bobbing gently, so the idea reads before the first tap. */
.demo-line {
  position: relative;
  height: 210px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--demo-b);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}
.demo-line__a {
  position: absolute;
  inset: 0 0 auto;
  height: 56%;
  background: var(--demo-a);
  animation: demo-bob 3.2s var(--ease) infinite alternate;
}
.demo-line__edge {
  position: absolute;
  left: 0;
  right: 0;
  top: 56%;
  height: 0;
  animation: demo-edge 3.2s var(--ease) infinite alternate;
}
.demo-line__edge::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1.5px;
  height: 3px;
  background: var(--ink);
}
.demo-line__tag {
  position: absolute;
  left: var(--space-4);
  top: 0;
  transform: translateY(-50%);
  height: 40px;
  padding: 0 var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-pill);
  background: #fff;
  font: 800 1.05rem var(--font-display);
  white-space: nowrap;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.22);
}
.demo-line__tag::before {
  content: "";
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}
.demo-line__side {
  position: absolute;
  right: var(--space-4);
  font: 600 0.72rem var(--font-text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.demo-line__side--a {
  bottom: 14px;
  color: #fff;
}
.demo-line__side--b {
  top: 14px;
}
.demo-line__q {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  right: var(--space-4);
  margin: 0;
  color: #fff;
  font: 800 1.4rem / 1 var(--font-display);
  letter-spacing: -0.02em;
}
@keyframes demo-bob {
  from {
    height: 50%;
  }
  to {
    height: 70%;
  }
}
@keyframes demo-edge {
  from {
    top: 50%;
  }
  to {
    top: 70%;
  }
}

/* The question screen: the whole screen is the line ---------------------------------- */

.play {
  --a: var(--demo-a);
  --b: var(--demo-b);
  --on-a: #fff;
  --on-b: var(--ink);
  position: fixed;
  inset: 0;
  z-index: var(--z-play);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: var(--b);
  color: var(--on-b);
  animation: play-in var(--medium) var(--ease) both;
}
/* Movement only, no fade: the text is at full contrast from the first frame. */
@keyframes play-in {
  from {
    transform: translateY(24px);
  }
}
.play-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
}
.play__head {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: calc(env(safe-area-inset-top, 0px) + var(--space-3)) max(20px, env(safe-area-inset-right, 0px))
    var(--space-4) max(20px, env(safe-area-inset-left, 0px));
  background: var(--a);
  color: var(--on-a);
}
.play__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 40px;
}
.play__group {
  margin: 0;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.play__group span:not(:empty)::before {
  content: "·";
  margin-inline: var(--space-2);
}
.play__controls {
  display: flex;
  gap: var(--space-2);
  flex: none;
}
.play__control {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--on-a);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--on-a);
  font: 600 0.875rem var(--font-text);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.play__control--strong {
  background: var(--on-a);
  color: var(--a);
}
.play :focus-visible {
  outline-color: currentColor;
}
.play__field:focus-visible {
  outline-color: var(--on-b);
}
.play__q {
  margin: 0;
  font: 800 clamp(1.6rem, 7.2vw, 2.25rem) / 1.02 var(--font-display);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.play__field {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline-offset: -6px;
}
.play.is-locked .play__field {
  cursor: default;
}
.play__fill {
  position: absolute;
  inset: 0 0 auto;
  height: 0;
  background: var(--a);
  transition: height var(--fast) var(--ease);
}
.play__rows {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}
.play__row {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-inline: max(20px, env(safe-area-inset-left, 0px)) max(20px, env(safe-area-inset-right, 0px));
  color: var(--on-b);
  transition: color var(--fast) var(--ease);
}
.play__row.is-a {
  color: var(--on-a);
}
.play__label {
  position: relative;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}
.play--pick .play__row {
  justify-content: flex-end;
  font: 600 0.8125rem var(--font-text);
}
.play--pick .play__row.is-mine .play__label {
  font: 800 1.05rem var(--font-display);
}
.play--pick .play__row.is-minor:not(.is-mine) .play__label {
  visibility: hidden;
}
.play--pick .play__row.is-minor:not(.is-mine)::after {
  content: "";
  position: absolute;
  right: max(28px, env(safe-area-inset-right, 0px));
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.play--split .play__row {
  font: 700 clamp(1rem, 4.4vw, 1.2rem) / 1.1 var(--font-display);
  letter-spacing: -0.01em;
}
.play--split .play__label {
  white-space: normal;
}
.play__pct {
  margin-left: auto;
  font: 600 0.8125rem var(--font-text);
  font-variant-numeric: tabular-nums;
}
.play--pick .play__pct {
  display: none;
}
/* The crowd, drawn the moment the line locks: how many chose each value, or the share who put
   each thing on the first side. */
.play__meter {
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: calc(var(--w, 0) * 62%);
  border-radius: 0 6px 6px 0;
  background: rgb(20 20 26 / 0.12);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 520ms var(--ease);
}
.play__row.is-a .play__meter {
  background: rgb(0 0 0 / 0.28);
}
.play--split .play__meter {
  width: calc(var(--w, 0) * 100%);
  top: 12%;
  bottom: 12%;
}
.play.is-revealed .play__meter {
  transform: scaleX(1);
}

.play__edge {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  z-index: 2;
  display: none;
  pointer-events: none;
  transition: top var(--fast) var(--ease);
}
.play.is-dragging .play__edge,
.play.is-dragging .play__fill {
  transition-duration: 40ms;
}
.play.is-placed .play__edge {
  display: block;
}
.play__edge::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1.5px;
  height: 3px;
  background: var(--on-b);
}
.play__tag {
  position: absolute;
  left: max(20px, env(safe-area-inset-left, 0px));
  top: 0;
  transform: translateY(-50%);
  max-width: calc(100% - 8rem);
  height: 42px;
  padding: 0 var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--ink);
  font: 800 1.05rem var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.24);
}
.play__tag::before {
  content: "";
  flex: none;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}
.play--split .play__tag {
  left: auto;
  right: max(20px, env(safe-area-inset-right, 0px));
  max-width: calc(100% - 40px);
  font-size: 0.95rem;
}
.play__edge[data-edge="top"] .play__tag {
  transform: translateY(6px);
}
.play__edge[data-edge="bottom"] .play__tag {
  transform: translateY(calc(-100% - 6px));
}
.play__side {
  position: absolute;
  left: max(20px, env(safe-area-inset-left, 0px));
  font: 600 0.72rem var(--font-text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.play--split .play__side {
  left: auto;
  right: max(20px, env(safe-area-inset-right, 0px));
}
.play__side--a {
  bottom: 30px;
  color: var(--on-a);
}
.play__side--b {
  top: 30px;
  color: var(--on-b);
}
.play__edge[data-edge="top"] .play__side,
.play__edge[data-edge="bottom"] .play__side {
  display: none;
}
.play__hint {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-4);
  text-align: center;
  font: 800 1.25rem / 1.1 var(--font-display);
  pointer-events: none;
}
/* A short line sliding up and down: drag me. */
.play__hint::before {
  content: "";
  width: 56px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  animation: hint-drag 1.4s var(--ease) infinite alternate;
}
@keyframes hint-drag {
  from {
    transform: translateY(-14px);
  }
  to {
    transform: translateY(14px);
  }
}
.play.is-placed .play__hint {
  display: none;
}
/* With labels on the right, the hint sits left of centre so it never covers them. */
.play--pick .play__hint {
  padding-right: 6rem;
}
/* With things listed on the left, it sits on the right. */
.play--split .play__hint {
  align-items: flex-end;
  text-align: right;
  padding-left: 50%;
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  font-size: 1rem;
}

.play__foot {
  flex: none;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  padding: var(--space-4) max(20px, env(safe-area-inset-right, 0px))
    calc(env(safe-area-inset-bottom, 0px) + var(--space-4)) max(20px, env(safe-area-inset-left, 0px));
  background: var(--b);
  box-shadow: 0 -1px 0 rgb(20 20 26 / 0.12);
}
.play__verdict {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.play__verdict p {
  margin: 0;
}
.play__headline {
  font: 800 1.4rem / 1.05 var(--font-display);
  letter-spacing: -0.02em;
}
.play.is-hot .play__headline {
  padding: 4px 12px 6px;
  margin-bottom: var(--space-1);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  transform: rotate(-2deg);
  animation: hot-pop 420ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
@keyframes hot-pop {
  from {
    transform: rotate(-2deg) scale(0.6);
  }
}
.play__detail,
.play__note,
.play__peek {
  font-size: 0.8125rem;
  line-height: 1.35;
}
.play__verdict .play__peek {
  margin-top: var(--space-1);
  font-weight: 600;
}
.play__go {
  flex: none;
  min-height: 58px;
  padding: 0 var(--space-6);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: #fff;
  font: 800 1.1rem var(--font-display);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--fast) var(--ease);
}
.play__go:active:not(:disabled) {
  transform: scale(0.95);
}
.play__go:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Milestone: a pause every few lines, with the compare link. */
.play--milestone {
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-8) max(24px, env(safe-area-inset-right, 0px)) var(--space-8)
    max(24px, env(safe-area-inset-left, 0px));
  background: var(--ink);
  color: #fff;
}
.play--milestone .kicker {
  color: #c9c9d2;
}
.milestone__big {
  margin: 0;
  font: 800 clamp(3rem, 15vw, 5rem) / 0.9 var(--font-display);
  letter-spacing: -0.04em;
}
.milestone__text {
  margin: 0;
  max-width: 30ch;
  font-size: var(--step-1);
}
.milestone__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Charts ---------------------------------------------------------------------------- */

.chart {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.chart figcaption {
  font-size: var(--step--1);
  color: var(--muted);
}
.chart svg {
  width: 100%;
  height: auto;
}
.chart .col {
  fill: var(--ink);
  opacity: 0.8;
}
.chart .col--mine {
  fill: var(--red);
  opacity: 1;
}
.chart .axis {
  fill: var(--muted);
  font: 9px var(--font-text);
}

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.bars__row {
  display: grid;
  grid-template-columns: 6.5rem 1fr 2.75rem;
  align-items: center;
  gap: var(--space-3);
  font-variant-numeric: tabular-nums;
}
.bars__track {
  height: 1.25rem;
}
.bars__fill {
  display: block;
  height: 100%;
  background: var(--ink);
  opacity: 0.8;
}
.bars__value {
  text-align: right;
}
.bars__row.is-mine {
  color: var(--red);
  font-weight: 600;
}
.bars__row.is-mine .bars__fill {
  background: var(--red);
  opacity: 1;
}
.bars__you {
  grid-column: 2;
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: calc(var(--space-2) * -1);
}

.chart__scale {
  position: relative;
  height: 1.25rem;
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chart__scale span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}
.chart__scale span:first-child {
  left: 0 !important;
  transform: none;
}
.chart__scale span:last-child {
  left: auto !important;
  right: 0;
  transform: none;
}

/* Every value named under its own column, read bottom to top like a printed chart's axis. */
.chart__labels {
  display: grid;
  align-items: start;
  font-size: var(--step--1);
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chart__labels--dense {
  font-size: 0.6875rem;
}
.chart__labels span {
  justify-self: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}
.chart__labels--across span {
  writing-mode: horizontal-tb;
  transform: none;
}
.chart__labels .is-mine {
  color: var(--red);
  font-weight: 600;
}

/* Results ------------------------------------------------------------------------------ */

.take {
  --a: var(--demo-a);
  --b: var(--demo-b);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
}
.take__top {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4) var(--space-4);
  background: var(--a);
  color: #fff;
}
.take__bottom {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--b);
  color: var(--ink);
  border-top: 3px solid var(--ink);
}
.take .kicker {
  color: inherit;
}
.take__q {
  margin: 0;
  font: 700 var(--step-1) / 1.25 var(--font-display);
  text-wrap: balance;
}
.take__you {
  margin: 0;
  font: 800 var(--step-4) / 0.95 var(--font-display);
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
.take__typical {
  margin: 0;
  font-weight: 600;
}
.take .lede {
  font-size: var(--step-0);
}

.progress-note {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  border-top: var(--rule-light);
  padding-top: var(--space-4);
}
.progress-note .button {
  padding-inline: 0;
}

.suggest__options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
}
.suggest__options legend {
  padding: 0;
  margin-bottom: var(--space-1);
  font-weight: 600;
}
.suggest__add {
  align-self: flex-start;
  padding-inline: 0;
}
.comments {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.comments__toggle {
  align-self: flex-start;
  padding-inline: 0;
}
.comments__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.comments__body[hidden],
.comment__content[hidden],
.comments__sort[hidden] {
  display: none;
}
.comments__sort {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.comments__sort-option {
  white-space: nowrap;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 var(--step--1) var(--font-text);
  cursor: pointer;
}
.comments__sort-option[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.comments__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Thread line: each level of replies hangs off a thin rule, like a forum. */
.comments__replies:not(:empty) {
  margin-top: var(--space-2);
  padding-left: var(--space-3);
  border-left: 2px solid var(--rule);
}
.comments__replies--flat:not(:empty) {
  padding-left: 0;
  border-left: 0;
}
.comment {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.comment__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0;
  font-size: var(--step--1);
  color: var(--muted);
}
.comment__collapse {
  width: 28px;
  height: 28px;
  border: var(--rule-light);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 var(--step--1) / 1 var(--font-text);
  cursor: pointer;
}
.comment__collapse:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.comment__name {
  font-weight: 600;
  color: var(--ink);
}
.comment__you {
  padding: 0 var(--space-2);
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
}
.comment__answer::before,
.comment__time::before {
  content: "·";
  margin-right: var(--space-2);
}
.comment__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-left: calc(28px + var(--space-2));
}
.comment__body {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.comment__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.comment__votes {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.comment__score {
  min-width: 2ch;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.comment__score[data-sign="up"] {
  color: var(--red);
}
.vote,
.comment__action {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: 600 var(--step--1) var(--font-text);
  cursor: pointer;
}
.comment__action {
  padding: 0 var(--space-2);
}
.vote:hover,
.comment__action:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}
.vote--up[aria-pressed="true"] {
  color: var(--red);
}
.vote--down[aria-pressed="true"] {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.08);
}
.comment-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.comment-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.groups-line {
  margin: 0;
  font-size: var(--step--1);
  color: var(--muted);
}

/* Group picker on the start screen: pills like the sort buttons, ink when picked. */
.groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.groups legend {
  padding: 0;
  margin-bottom: var(--space-3);
  font-weight: 600;
}
.groups__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.groups__status {
  margin: 0;
}
.group-chip {
  position: relative;
  cursor: pointer;
}
.group-chip span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 var(--step--1) var(--font-text);
  transition: background var(--fast) var(--ease);
}
.group-chip small {
  font-weight: 400;
  font-size: 0.75rem;
}
.group-chip input:checked + span {
  border-color: var(--chip, var(--ink));
  background: var(--chip, var(--ink));
  color: #fff;
}
.group-chip input:indeterminate + span {
  border-color: var(--ink);
  color: var(--ink);
}
.group-chip input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.answer__count {
  color: var(--muted);
}
.everyone {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-block: var(--space-8) var(--space-12);
  scroll-margin-top: var(--space-4);
}
.everyone + .panel {
  margin-bottom: var(--space-12);
}

.actions--single {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.answer {
  --a: var(--ink);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.answer > .kicker {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--a);
  color: #fff;
  letter-spacing: 0.1em;
}
.answer__q {
  margin: 0;
  font: 800 1.35rem / 1.1 var(--font-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.answer__mine {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-6);
  font-variant-numeric: tabular-nums;
}
.answer__you {
  color: var(--red);
  font-weight: 600;
}
.answer__typical {
  color: var(--muted);
}
.answer__standing {
  margin: 0;
}

/* Head to head ------------------------------------------------------------------------ */

.duel__headline {
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-weight: 400;
}
.duel__headline .display--number {
  color: var(--ink);
}
.duel__insync {
  font: 800 var(--step-3) / 1 var(--font-display);
  letter-spacing: -0.02em;
}
.duel__names {
  margin: 0;
  font-size: var(--step-1);
}
.tone--you {
  color: var(--red);
}
.tone--them {
  color: var(--blue);
}
.duel__names .tone--you,
.duel__names .tone--them {
  font-weight: 600;
}

.duel-strip {
  margin: 0;
  padding-block: 2.5rem 2.5rem;
}
.duel-strip__track {
  position: relative;
  height: 4rem;
  border-bottom: var(--rule-heavy);
}
.duel-strip__marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  margin-left: -2px;
}
.duel-strip__marker--you {
  background: var(--red);
  color: var(--red);
}
.duel-strip__marker--them {
  background: var(--blue);
  color: var(--blue);
}
.duel-strip__tag {
  position: absolute;
  white-space: nowrap;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
.duel-strip__marker--top .duel-strip__tag {
  bottom: 100%;
  margin-bottom: var(--space-1);
}
.duel-strip__marker--bottom .duel-strip__tag {
  top: 100%;
  margin-top: var(--space-2);
}
/* Labels centre on their line, and hug the inside near either end of the strip. */
.duel-strip__marker--center .duel-strip__tag {
  left: 50%;
  transform: translateX(-50%);
}
.duel-strip__marker--start .duel-strip__tag {
  left: 0;
}
.duel-strip__marker--end .duel-strip__tag {
  right: 0;
}

.compare-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.compare-list__item {
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.compare-list__q {
  margin: 0;
}
.compare-list__answers {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  font-variant-numeric: tabular-nums;
}
.compare-list__agree {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Share ---------------------------------------------------------------------------------- */

.share {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.share > .button--primary {
  min-height: 56px;
  font-size: var(--step-1);
}
.share__more {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.share__more .button {
  flex: 1 1 8rem;
  padding-inline: var(--space-3);
}
.share__url {
  margin: 0;
  font-size: var(--step--1);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.share__status {
  margin: 0;
  min-height: 1.5em;
  font-weight: 600;
}

.image-dialog {
  border: 0;
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  padding: var(--space-4);
  max-width: min(24rem, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.image-dialog::backdrop {
  background: rgb(20 20 26 / 0.7);
}
.image-dialog__img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.inbox__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.inbox__list a {
  display: block;
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: 700 var(--step-1) var(--font-display);
  text-decoration: none;
}

/* Static pages ----------------------------------------------------------------------------- */

.prose {
  padding-block: var(--space-8) var(--space-12);
  max-width: 36rem;
}
.prose h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0 0 var(--space-6);
}
.prose h2 {
  margin: var(--space-8) 0 var(--space-2);
}

/* Plain versions of the pages, shown until the app starts (and to crawlers without JavaScript). */
.seo h2 {
  margin: var(--space-8) 0 var(--space-3);
  font-family: var(--font-display);
  font-weight: 800;
}
.seo table {
  width: 100%;
  max-width: 28rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.seo th,
.seo td {
  padding: var(--space-1) 0;
  border-bottom: var(--rule-light);
  text-align: left;
}
.seo th:last-child,
.seo td:last-child {
  text-align: right;
}
.seo ul {
  padding-left: 1.2em;
}
.seo li + li {
  margin-top: var(--space-2);
}
.seo__comments {
  list-style: none;
  padding: 0;
}
.seo__comments p {
  margin: 0;
}

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

/* Comments and Share sit side by side under each chart; their panels open below, full width. */
.answer__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-6);
}
.answer__tools > .comments,
.answer__tools > .question-share {
  display: contents;
}
.answer__tools .comments__toggle {
  order: 0;
}
.question-share__toggle {
  order: 1;
  padding-inline: 0;
}
.answer__tools .comments__body {
  order: 2;
  flex: 1 1 100%;
}
.question-share__panel {
  order: 3;
  flex: 1 1 100%;
}
.question-share__panel[hidden] {
  display: none;
}

/* Answering straight from the list. */
.answer-here {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.answer-here > .button {
  align-self: flex-start;
}

/* Start screen: the start button stays in reach while the groups scroll past. */
.intro > .button--big {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--space-4));
  z-index: 5;
  align-self: stretch;
  box-shadow: 0 12px 30px -10px rgb(20 20 26 / 0.55);
}
@media (min-width: 40rem) {
  .intro > .button--big {
    align-self: flex-start;
  }
}
