:root {
  color-scheme: light dark;
  --fg: #1a1a1a;
  --muted: #6a6a6a;
  --bg: #fafafa;
  --link: #2952a3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #eaeaea;
    --muted: #8a8a8a;
    --bg: #121212;
    --link: #8bb4ff;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2rem 1.5rem min(12vw + 9rem, 45vh);
}

main {
  max-width: 32rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.tag {
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.now {
  margin: 0;
  font-size: 0.95rem;
  text-wrap: balance;
}

.links {
  display: flex;
  gap: 1.25rem;
  margin: 2rem 0 0;
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
}

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

.word {
  white-space: nowrap;
}

.piece {
  display: inline-block;
  line-height: 1;
  white-space: pre;
}

a .piece {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.toy {
  --paper: #ffffff;
  --line: #8a8a8a;
}

@media (prefers-color-scheme: dark) {
  .toy {
    --paper: #1c1c1c;
    --line: #9a9a9a;
  }
}

.band {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  stroke: var(--line);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-dasharray: 2 4;
}

.paper-ball {
  position: fixed;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 200ms;
}

.paper-ball.is-aiming {
  cursor: grabbing;
}

.paper-ball.is-away {
  opacity: 0;
}

.paper-ball-drawing {
  width: var(--size);
  height: var(--size);
  overflow: visible;
  stroke: var(--line);
  stroke-width: 1.1;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke 150ms;
}

.paper-ball-drawing .paper {
  fill: var(--paper);
}

.paper-ball-drawing .crease {
  fill: none;
  stroke-width: 0.6;
  opacity: 0.75;
}

.paper-ball:hover .paper-ball-drawing {
  stroke: var(--fg);
}

@media (prefers-reduced-motion: no-preference) {
  .paper-ball:hover:not(.is-aiming) .paper-ball-drawing {
    animation: rustle 520ms ease-out;
  }
}

@keyframes rustle {
  25% {
    transform: rotate(-9deg) scale(1.04);
  }
  55% {
    transform: rotate(6deg);
  }
  80% {
    transform: rotate(-2deg);
  }
}

.basket {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms;
}

.basket.is-shown {
  opacity: 1;
}

.basket svg {
  display: block;
  overflow: visible;
  fill: none;
  stroke: var(--line);
  stroke-linejoin: round;
  stroke-linecap: round;
}

.basket .bin-body {
  fill: var(--bg);
  fill-opacity: 0.72;
  stroke: none;
}

.basket .bin-mesh {
  stroke-width: 0.6;
  opacity: 0.5;
}

.basket .bin-foot {
  stroke-width: 1;
}

.basket .bin-edge {
  stroke-width: 1.25;
}

.basket .bin-rim {
  fill: var(--bg);
  stroke-width: 1.25;
}

.sign-in {
  position: fixed;
  font-size: 0.8rem;
  color: var(--muted);
  animation: appear 900ms ease-out;
}

@keyframes appear {
  from {
    opacity: 0;
  }
}

.agents-start,
.board button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.agents-start:hover,
.board button:hover {
  color: var(--fg);
}

.agents-start {
  position: fixed;
  font-size: 0.8rem;
}

.agents-start.is-invited {
  color: var(--fg);
}

.agents-start:focus-visible,
.board button:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 4px;
  border-radius: 2px;
}

.agents-start:disabled {
  color: var(--muted);
  cursor: default;
}

.agents-start.is-running {
  visibility: hidden;
}

.board {
  position: fixed;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.45;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 3rem);
  mask-image: linear-gradient(to bottom, transparent, #000 3rem);
}

.board[data-placement="below"] {
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 1.25rem);
  mask-image: linear-gradient(to bottom, transparent, #000 1.25rem);
}

.board[hidden],
.board-post[hidden] {
  display: none;
}

.board-notes {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.board-notes::-webkit-scrollbar {
  display: none;
}

.board-notes > :first-child {
  margin-top: auto;
}

.board-notes li,
.board-pending,
.board-post {
  margin: 0 0 0.3rem;
  overflow-wrap: anywhere;
}

.board-author,
.board-closing,
.board-pending {
  flex: none;
  color: var(--muted);
}

.board-end {
  flex: none;
}

.board[data-placement="below"] .board-end {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
}

.board-stop {
  font-size: 0.7rem;
}

.board[data-placement="beside"] .board-stop {
  margin: 0.5rem 0 0;
}

.board-stop[hidden] {
  display: none;
}

.board-pending:empty {
  display: none;
}

.board-post {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.board-input {
  flex: 1;
  min-width: 0;
  padding: 0 0 0.1rem;
  border: 0;
  border-bottom: 1px solid var(--muted);
  border-radius: 0;
  background: none;
  font: inherit;
  color: var(--fg);
  outline: none;
}

@media (pointer: coarse) {
  .board-input {
    font-size: 16px;
  }
}

.board-input:focus {
  border-bottom-color: var(--fg);
}

.board-input::placeholder {
  color: var(--muted);
}

.board-foot {
  margin: 0.2rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .basket,
  .paper-ball {
    transition: none;
  }

  .sign-in {
    animation: none;
  }
}
