:root {
  --paper: #ede6d6;
  --ink: #15110d;
  --ink-soft: #3f362e;
  --accent: #b0291e;
  --guess: #5a4c3f;
  --glow: 0 0 18px var(--paper), 0 0 6px var(--paper), 0 0 2px var(--paper);

  /* Interface sizes follow the window so a large monitor doesn't get laptop-sized labels. */
  --ui: clamp(11px, 0.62vw, 16px);
  --tick: clamp(12px, 0.78vw, 19px);
  --edge: clamp(24px, 2vw, 52px);

  /* Set from script: the drag zone's top and height, and the timeline's offset inside it. */
  --zone-top: 32vh;
  --zone-height: 36vh;
  --line-y: 50%;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: 'Inter Tight', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.label {
  font-size: var(--ui);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* Timeline ------------------------------------------------------------------------------------- */

.timeline {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--zone-top);
  height: var(--zone-height);
  overflow: hidden;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 1.2s ease;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
}

.timeline.is-visible {
  opacity: 1;
}

.timeline-track {
  display: flex;
  height: 100%;
  will-change: transform;
}

.timeline-spacer {
  flex: 0 0 50vw;
}

.century {
  --halo: 0 0 0 1.5px var(--paper), 0 0 10px 2px color-mix(in srgb, var(--paper) 80%, transparent);
  position: relative;
  flex-shrink: 0;
  height: 100%;
  font-size: var(--tick);
}

.century::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: var(--line-y);
  height: 0.18em;
  transform: translateY(-50%);
  background: var(--ink);
  box-shadow: var(--halo);
}

/* Short mark every decade, labelled mark every 50 years, taller mark every century. */
.tick {
  position: absolute;
  top: var(--line-y);
  z-index: 1;
  width: 0;
  pointer-events: none;
}

.tick::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0.15em;
  height: 0.9em;
  transform: translate(-50%, -50%);
  background: var(--ink);
  box-shadow: var(--halo);
}

.tick span {
  position: absolute;
  top: 1.5em;
  left: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--ink);
  letter-spacing: 0.12em;
  text-shadow:
    1.5px 0 0 var(--paper), -1.5px 0 0 var(--paper),
    0 1.5px 0 var(--paper), 0 -1.5px 0 var(--paper),
    0 0 8px var(--paper);
}

.tick--half::before {
  height: 1.55em;
}

.tick--century::before {
  width: 0.22em;
  height: 2.3em;
}

.tick--century span {
  top: 1.55em;
  font-size: 1.25em;
}

/* The tutorial's pulsing mark at the practice answer. */
.timeline-target {
  position: absolute;
  top: var(--line-y);
  z-index: 2;
  width: 0;
  pointer-events: none;
}

.timeline-target::before,
.timeline-target::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* A thick ring that breathes, with a thinner ripple spreading out from it. */
.timeline-target::after {
  width: 10.5em;
  height: 10.5em;
  border: 0.8em solid color-mix(in srgb, var(--accent) 80%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--paper) 70%, transparent), inset 0 0 0 2px color-mix(in srgb, var(--paper) 70%, transparent);
  animation: target-breathe 1.6s ease-in-out infinite;
}

.timeline-target::before {
  width: 10.5em;
  height: 10.5em;
  border: 3px solid var(--accent);
  animation: target-ripple 1.6s ease-out infinite;
}

@keyframes target-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(0.88); }
  50% { transform: translate(-50%, -50%) scale(1.04); }
}

@keyframes target-ripple {
  from { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
  to { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

.needle {
  --ring: 0 0 0 2px color-mix(in srgb, var(--paper) 70%, transparent);
  position: fixed;
  left: 50%;
  top: 50%;
  width: 3px;
  height: calc(var(--tick) * 6);
  margin: calc(var(--tick) * -3.9) 0 0 -1.5px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: var(--ring);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.needle::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -10px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: var(--ring);
}

.needle.is-visible {
  opacity: 1;
}

/* Heads-up display -------------------------------------------------------------------------- */

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.hud .label {
  text-shadow: var(--glow);
}

.corner {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
}

.corner--top-left {
  top: var(--edge);
  left: var(--edge);
  gap: calc(var(--ui) * 1.1);
}

.corner--top-right {
  top: var(--edge);
  right: var(--edge);
  height: calc(var(--ui) * 2.9); /* the logo's height, so both top corners centre on one line */
}

.corner--bottom-left {
  bottom: var(--edge);
  left: var(--edge);
  color: var(--ink-soft);
}

.corner--bottom-right {
  bottom: var(--edge);
  right: var(--edge);
}

.corner--top-left .label,
.corner--top-right .label {
  font-size: calc(var(--ui) * 1.4);
  letter-spacing: 0.16em;
}

.logo {
  width: calc(var(--ui) * 2.9);
  height: calc(var(--ui) * 2.9);
}

.event {
  position: absolute;
  left: 50%;
  top: 9vh;
  width: min(56vw, 900px);
  max-width: calc(100vw - 48px);
  transform: translateX(-50%);
  text-align: center;
}

.event .label {
  color: var(--ink-soft);
}

.event .label.is-error {
  color: var(--accent);
}

.event h1 {
  margin: 14px 0 8px;
  font-size: clamp(28px, 2.4vw, 48px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-shadow: var(--glow);
}

.picker {
  position: absolute;
  left: 50%;
  bottom: 6vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  text-align: center;
}

.picker-label {
  margin-bottom: 12px;
}

.year {
  border-bottom: 1.5px solid transparent;
  font-size: clamp(56px, 5.4vw, 108px);
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 0.9;
  letter-spacing: -0.045em;
  text-shadow: var(--glow);
  cursor: text;
  pointer-events: auto;
  transition: border-color 0.3s;
}

.year:hover,
.year:focus-visible {
  border-bottom-color: rgba(21, 17, 13, 0.35);
  outline: none;
}

.year small {
  margin-left: 0.2em;
  font-size: 0.28em;
  letter-spacing: 0.12em;
  vertical-align: 0.9em;
}

.year-input {
  display: block;
  width: 5.2ch;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 600 clamp(50px, 5vw, 100px) / 0.95 'Inter Tight', system-ui, sans-serif;
  letter-spacing: -0.045em;
  text-align: center;
  text-shadow: var(--glow);
  outline: none;
  pointer-events: auto;
}

.year-input::placeholder {
  color: rgba(21, 17, 13, 0.3);
}

.year-input.is-invalid {
  animation: shake 0.35s;
}

@keyframes shake {
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

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

.button {
  margin-top: calc(var(--ui) * 2);
  padding: 1.45em 3.1em;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: var(--ui);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.35s ease, color 0.35s ease;
}

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

.button--solid {
  background: var(--ink);
  color: var(--paper);
}

.button--solid:hover {
  border-color: var(--ink-soft);
  background: var(--ink-soft);
}

.button:focus-visible,
.sound:focus-visible,
.tip-skip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

#lock {
  transition-delay: 0.25s;
}

.sound {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  pointer-events: auto;
}

.sound-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.sound-bars i {
  width: 2px;
  height: 3px;
  background: currentColor;
}

.sound.is-on .sound-bars i {
  animation: equalizer 1s ease-in-out infinite;
}

.sound.is-on .sound-bars i:nth-child(2) { animation-delay: 0.2s; }
.sound.is-on .sound-bars i:nth-child(3) { animation-delay: 0.4s; }
.sound.is-on .sound-bars i:nth-child(4) { animation-delay: 0.1s; }

@keyframes equalizer {
  0%, 100% { height: 3px; }
  50% { height: 12px; }
}

/* Entrance animations ----------------------------------------------------------------------- */

.line {
  display: block;
  overflow: hidden;
}

.line > span {
  display: block;
  transform: translateY(105%);
  transition: transform 1.1s cubic-bezier(0.19, 1, 0.22, 1);
}

.is-in .line > span {
  transform: none;
}

.fade {
  opacity: 0;
  transition: opacity 1s ease;
}

.is-in .fade {
  opacity: 1;
}

/* Reveal: dimmed painting, the timeline redrawn to fit guess and answer, and an arc between them. */

.dim {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

body.is-dimmed .dim {
  opacity: 1;
}

/* The final screen only dims a little, so the painting still shows behind the timeline. */
body.is-summary .dim {
  opacity: 0.7;
}

/* Nothing plays on the results screen, so the sound toggle goes. */
body.is-results .corner--bottom-right {
  display: none;
}

body.is-dimmed .corner,
body.is-dimmed .sound {
  color: #f3ebdd;
  transition: color 0.4s;
}

body.is-dimmed .hud .label {
  text-shadow: none;
}

body.is-dimmed .event,
body.is-dimmed .picker,
body.is-dimmed .corner--bottom-left,
body.is-dimmed .needle {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.is-dimmed .timeline {
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.reveal {
  --ink: #f3ebdd;
  --guess: #cfc3ae;
  --accent: #e8705f;
  position: fixed;
  inset: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 8px rgba(0, 0, 0, 0.5));
}

.reveal svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.reveal-ticks line {
  stroke: var(--ink);
}

.reveal-ticks text {
  fill: var(--ink);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-anchor: middle;
}

.reveal-arc {
  fill: none;
  stroke: var(--ink);
  stroke-width: calc(var(--tick) * 0.16);
  stroke-linecap: round;
}

.reveal-head {
  fill: var(--ink);
}

.marker {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.marker text {
  font-size: var(--tick);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-anchor: middle;
  text-transform: uppercase;
}

.marker .marker-year {
  font-size: calc(var(--tick) * 1.7);
  letter-spacing: -0.01em;
  text-transform: none;
}

.marker--guess circle,
.marker--guess text {
  fill: var(--guess);
}

.marker--answer path,
.marker--answer text {
  fill: var(--accent);
}

.marker--answer .blot {
  transform: scale(0);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.callout text {
  fill: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}

.callout-backing {
  fill: rgba(15, 12, 9, 0.92);
}

.callout .callout-title {
  font-size: calc(var(--tick) * 1.15);
  font-weight: 600;
}

.callout .callout-detail {
  fill: var(--accent);
  font-size: var(--tick);
  font-weight: 600;
}

/* Results: each answer on the bottom timeline is a button that opens its round. */
.timeline-mark {
  cursor: pointer;
  pointer-events: auto;
  outline: none;
}

.timeline-mark-hit {
  fill: transparent;
}

.timeline-mark .timeline-mark-year {
  letter-spacing: 0.06em;
  text-transform: none;
}

.timeline-mark-leader {
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.7;
}

.timeline-mark:hover .timeline-mark-year,
.timeline-mark:focus-visible .timeline-mark-year {
  fill: var(--ink);
}

.timeline-mark:focus-visible .timeline-mark-hit {
  stroke: var(--ink);
  stroke-width: 2;
}

.callout-leader {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.callout-leader.is-shown {
  opacity: 0.7;
}

.reveal-distance {
  fill: var(--ink);
  font-size: calc(var(--tick) * 1.9);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-anchor: middle;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.marker.is-shown,
.reveal-distance.is-shown {
  opacity: 1;
}

.marker--answer.is-shown .blot {
  transform: scale(1);
}

/* Cards (round summary and daily results) --------------------------------------------------- */

.card {
  position: fixed;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.4vh, 16px);
  max-height: calc(100vh - 2 * var(--edge) - 60px);
  overflow: auto;
  padding: clamp(22px, 2.6vh, 36px) clamp(22px, 2vw, 36px);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

.card.is-open {
  opacity: 1;
  pointer-events: auto;
}

.card .label {
  color: var(--ink-soft);
}

.card h2 {
  margin: 0;
  font-size: clamp(21px, 1.5vw, 28px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.card p {
  margin: 0;
  font-size: clamp(14px, 0.86vw, 17px);
  line-height: 1.6;
}

.summary {
  z-index: 6; /* above the results card, which it opens over on phones */
  right: var(--edge);
  top: 50%;
  width: min(460px, 32vw);
  transform: translate(40px, -50%);
}

.summary.is-open {
  transform: translate(0, -50%);
}

.card-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.card-close:hover {
  background: rgba(21, 17, 13, 0.08);
  color: var(--ink);
}

.card-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* Leave room for the close button beside the round label. */
.summary:has(.card-close:not([hidden])) .summary-head {
  padding-right: 8px;
}

.summary.summary--top {
  left: 50%;
  right: auto;
  top: 6vh;
  bottom: auto;
  width: min(460px, calc(100vw - 32px));
  transform: translate(-50%, -12px);
}

.summary.summary--top.is-open {
  transform: translate(-50%, 0);
}

.summary--top .summary-body {
  display: none;
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.score-badge {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 92px;
  padding: 10px 16px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
}

.card .score-badge .label {
  font-size: calc(var(--ui) * 0.9);
  color: rgba(237, 230, 214, 0.7);
}

.score-badge b {
  font-size: clamp(28px, 2.1vw, 38px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.summary-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1px solid rgba(21, 17, 13, 0.2);
}

.summary-distance {
  color: var(--accent);
  font-size: clamp(13px, 0.8vw, 15px);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.summary-when {
  color: var(--ink-soft);
  font-size: clamp(13px, 0.82vw, 16px);
  font-weight: 500;
}

.summary-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card .summary-outro {
  font-size: clamp(16px, 1.05vw, 20px);
  font-weight: 500;
  line-height: 1.5;
}

/* The results: a paper panel with the score, then the day's rounds on a vertical timeline, newest
   first. Wider screens also get every answer on a horizontal timeline along the bottom (drawn by
   reveal.js), so the column stops above it and scrolls if the window is short. */
.results {
  left: 50%;
  top: calc(var(--edge) + 52px);
  bottom: 140px;
  width: min(560px, calc(100vw - 32px));
  max-height: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  align-items: stretch;
  text-align: left;
  scrollbar-width: none;
  /* A soft fade at the foot shows when there is more to scroll to. */
  padding-bottom: 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  transform: translate(-50%, -12px);
}

.results::-webkit-scrollbar {
  display: none;
}

.results.is-open {
  transform: translate(-50%, 0);
}

.results-main {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px 12px;
  padding: 22px 26px 18px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.results-main > :not(.results-total, .results-side) {
  grid-column: 1 / -1;
}

.card .results-total {
  margin: 0;
  font-size: clamp(54px, 4.2vw, 64px);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.045em;
}

.results-total small {
  margin-left: 0.15em;
  color: var(--ink-soft);
  font-size: 0.3em;
  letter-spacing: 0;
}

.card .results-side {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
}

.results-side b {
  color: var(--accent);
}

/* How everyone scored today: a curve with this player's total marked on it. */
.distribution {
  width: 100%;
  margin: -4px 0 0;
}

.distribution-chart {
  display: block;
  width: 100%;
  height: 76px;
  overflow: visible;
}

.distribution-area {
  fill: var(--ink);
  opacity: 0.07;
}

.distribution-curve {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.distribution-base {
  stroke: var(--ink-soft);
  stroke-opacity: 0.35;
}

.distribution-axis {
  fill: var(--ink-soft);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.distribution-you {
  stroke: var(--accent);
  stroke-width: 1.5;
}

.distribution-you-dot {
  fill: var(--accent);
}

.distribution-you-label {
  fill: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.results-actions .button {
  width: 100%;
  margin: 2px 0 4px;
}

/* Desktop always shows all five rounds: when the column would scroll, main.js steps it down to a
   compact layout, then a tight one. */
.results.is-compact .results-main {
  gap: 8px 12px;
  padding: 16px 22px 14px;
}

.results.is-compact .results-total {
  font-size: 50px;
}

.results.is-compact .distribution-chart {
  height: 62px;
}

.results.is-compact .round-node {
  margin-bottom: 7px;
}

.results.is-compact .round-row {
  padding: 7px 14px;
}

.results.is-tight {
  top: calc(var(--edge) + 44px);
  bottom: 124px;
}

.results.is-tight .distribution-chart {
  height: 52px;
}

.results.is-tight .results-actions {
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.results.is-tight .results-actions .button {
  flex: 1;
  margin: 0;
  padding-block: 1.1em;
}

.results.is-tight .results-rounds {
  padding-top: 20px;
}

.results.is-tight .round-node {
  margin-bottom: 5px;
}

.results.is-tight .round-row {
  padding: 6px 14px;
}

.results.is-tight .round-row-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.results.is-tight .round-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results.is-tight .round-row-detail {
  flex-shrink: 0;
  margin: 0;
}

.results-rounds {
  --line-x: 67px;
  position: relative;
  display: block;
  margin: 10px 0 0;
  padding: 24px 0 0 calc(var(--line-x) + 15px);
  color: #f3ebdd;
  list-style: none;
}

/* The line, and "Now" at its top. */
.results-rounds::before {
  content: '';
  position: absolute;
  left: var(--line-x);
  top: 22px;
  bottom: 28px;
  width: 2px;
  background: currentColor;
  opacity: 0.55;
}

.results-rounds::after {
  content: 'Now';
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--line-x) - 11px);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: right;
  text-transform: uppercase;
  opacity: 0.7;
}

.round-node {
  position: relative;
  margin-bottom: 10px;
}

/* The answer's mark on the line. */
.round-node::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: #e8705f;
  box-shadow: 0 0 0 3px rgba(10, 8, 6, 0.8);
}

.round-node-year {
  position: absolute;
  left: calc(-1 * var(--line-x) - 15px);
  top: 50%;
  width: calc(var(--line-x) - 11px);
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
}

.round-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid rgba(243, 235, 221, 0.12);
  border-radius: 10px;
  background: rgba(15, 12, 9, 0.78);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.round-row::after {
  content: '›';
  font-size: 22px;
  line-height: 1;
  opacity: 0.6;
}

.round-row:active {
  background: rgba(15, 12, 9, 0.95);
}

.round-row:focus-visible {
  outline: 2px solid #e8705f;
  outline-offset: 2px;
}

.round-row-text {
  flex: 1;
  min-width: 0;
}

.round-row-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.round-row-detail {
  display: block;
  margin-top: 3px;
  color: #e8705f;
  font-size: 13px;
  font-weight: 500;
}

.round-row-score {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.share-fallback {
  width: 100%;
  min-height: 7em;
  padding: 10px;
  border: 1px solid rgba(21, 17, 13, 0.25);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  resize: none;
}

/* Tutorial ---------------------------------------------------------------------------------- */

.tip {
  position: fixed;
  left: 50%;
  top: calc(50% - var(--tick) * 6.6); /* clear of the tutorial's target ring on the line */
  z-index: 6;
  width: min(440px, calc(100vw - 32px));
  padding: 16px 22px 12px;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% + 10px));
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.tip.is-shown {
  opacity: 1;
  transform: translate(-50%, -100%);
}

.tip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: var(--paper);
  transform: rotate(45deg);
}

.tip .label {
  color: var(--ink-soft);
}

.tip p {
  margin: 6px 0;
  font-size: clamp(15px, 1vw, 19px);
  font-weight: 500;
  line-height: 1.4;
}

.tip-skip {
  padding: 6px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: calc(var(--ui) * 0.85);
  cursor: pointer;
  pointer-events: auto;
}

.tip:not(.is-shown) .tip-skip {
  visibility: hidden;
  pointer-events: none;
}

.tip-skip:hover {
  color: var(--ink);
}

/* Drag cursor ------------------------------------------------------------------------------- */

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    width 0.35s cubic-bezier(0.19, 1, 0.22, 1),
    height 0.35s cubic-bezier(0.19, 1, 0.22, 1),
    margin 0.35s cubic-bezier(0.19, 1, 0.22, 1),
    background 0.35s;
}

.cursor span {
  font-size: calc(var(--ui) * 0.82);
  opacity: 0;
  transition: opacity 0.2s;
}

.cursor.is-visible {
  opacity: 1;
}

.cursor.is-grabbing {
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  background: rgba(237, 230, 214, 0.35);
}

.cursor.is-grabbing span {
  opacity: 1;
}

@media (pointer: fine) {
  .timeline {
    cursor: none;
  }
}

@media (pointer: coarse) {
  .cursor {
    display: none;
  }
}

/* Small screens ----------------------------------------------------------------------------- */

/* Tablets and phones: the round summary becomes a sheet along the bottom, under the timeline, which
   the reveal raises to 26% of the height (NARROW_LINE in reveal.js). */
@media (max-width: 900px) {
  .summary {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    max-height: calc(74dvh - 130px);
    padding-bottom: calc(clamp(22px, 2.6vh, 36px) + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .summary.is-open {
    transform: none;
  }

  /* The summary scrolls inside the sheet, so the button sits on a strip pinned to the bottom. */
  .summary:has(#next-row:not([hidden])) {
    padding-bottom: 0;
  }

  .summary #next-row {
    position: sticky;
    bottom: 0;
    margin: -10px calc(-1 * clamp(22px, 2vw, 36px)) 0;
    padding: 0 clamp(22px, 2vw, 36px) calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, transparent, var(--paper) 22px);
  }

  /* The practice round keeps its card at the top, above its single marker. */
  .summary.summary--top {
    max-height: none;
    padding-bottom: clamp(22px, 2.6vh, 36px);
    border-radius: 6px;
  }
}

@media (max-width: 760px) {
  .corner--top-left,
  .corner--top-right {
    top: calc(16px + env(safe-area-inset-top));
  }

  .corner--top-left { left: 16px; }
  .corner--top-right { right: 16px; }
  .corner--bottom-right { right: 16px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .corner--bottom-left { display: none; }

  .corner--top-left .label,
  .corner--top-right .label {
    font-size: 13px;
    letter-spacing: 0.14em;
  }

  .logo {
    width: 28px;
    height: 28px;
  }

  .corner--top-right {
    height: 28px;
  }

  .wide-only {
    display: none;
  }

  .event {
    top: calc(12dvh + env(safe-area-inset-top));
    width: calc(100vw - 40px);
  }

  .event h1 {
    margin-top: 12px;
    font-size: clamp(26px, 7.6vw, 34px);
  }

  .picker {
    bottom: calc(7dvh + env(safe-area-inset-bottom));
  }

  .year {
    font-size: clamp(56px, 17vw, 72px);
  }

  .year-input {
    font-size: clamp(50px, 15vw, 64px);
  }

  .button {
    font-size: 12px;
    touch-action: manipulation;
  }

  /* A compact tip pinned under the headline, so it never covers the question. The headline already
     says "Practice round", so the tip's own heading goes. */
  .tip {
    top: calc(var(--headline-bottom, 30vh) + 12px);
    width: calc(100vw - 48px);
    padding: 10px 16px 4px;
    transform: translate(-50%, -6px);
  }

  .tip.is-shown {
    transform: translate(-50%, 0);
  }

  .tip #tip-heading {
    display: none;
  }

  .tip p {
    margin: 0 0 2px;
    font-size: 14px;
    line-height: 1.35;
  }

  .tip-skip {
    font-size: 10px;
  }

  .card h2 {
    font-size: 21px;
  }

  .card p {
    font-size: 15px;
    line-height: 1.55;
  }

  /* A handle, so the sheet reads as something that came up from below. */
  .summary:not(.summary--top)::before {
    content: '';
    align-self: center;
    flex-shrink: 0;
    width: 36px;
    height: 4px;
    margin: -8px 0 2px;
    border-radius: 2px;
    background: rgba(21, 17, 13, 0.18);
  }
}

/* Phones: the column spans the screen and scrolls under the top bar; there is no bottom timeline. */
@media (max-width: 600px) {
  .results {
    left: 0;
    right: 0;
    top: calc(60px + env(safe-area-inset-top));
    bottom: 0;
    width: auto;
    padding: 0 16px calc(24px + env(safe-area-inset-bottom));
    transform: translateY(-12px);
  }

  .results.is-open {
    transform: none;
  }

  .results-main {
    padding: 20px;
  }
}

/* Phones shouldn't bounce or zoom the page; everything that moves is inside it. */
@media (pointer: coarse) {
  html,
  body {
    overscroll-behavior: none;
  }
}

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

  .line > span {
    transform: none;
  }
}
