:root {
  /* The board page's pub chalkboard (darts-play's style.css): slate and chalk, with the board's
     own colours as meanings. */
  --slate: #1f2a26;
  --slate-raised: #28352f;
  --slate-line: #3a4a43;
  --chalk: #ece8dc;
  --chalk-dim: #9aa59f;
  --board-red: #c8322f;
  --board-green: #2f8f5b;
  --sisal: #e3d3a8;
  --board-black: #1b1b1b;
  --wire: #b8bcc0;
  --chalk-yellow: #e8c65a;
  --red-tint: rgba(200, 50, 47, 0.18);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, sans-serif;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--slate); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--slate);
  color: var(--chalk);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.4;
}
h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 0.75rem; letter-spacing: 0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.75rem; }
p { margin: 0 0 1rem; }
a { color: var(--chalk); text-decoration-color: var(--chalk-dim); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--chalk); }
:focus-visible { outline: 3px solid var(--chalk-yellow); outline-offset: 2px; }

/* ---- header ---- */

header.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.5rem 16px;
  border-bottom: 1px solid var(--slate-line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
}
/* A dartboard seen from afar: the bull, the green ring, black and sisal, the black rim. */
.mark {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: radial-gradient(circle,
    var(--board-red) 0 14%, var(--board-green) 14% 28%, var(--board-black) 28% 46%,
    var(--sisal) 46% 64%, var(--board-red) 64% 74%, var(--board-black) 74% 100%);
  box-shadow: 0 0 0 1px var(--wire);
}
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; margin-left: auto; }
nav form { margin: 0; }
nav a, button.nav {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  color: var(--chalk-dim);
  background: none;
  font-weight: 600;
  text-decoration: none;
}
nav a:hover, button.nav:hover { color: var(--chalk); background: var(--slate-raised); }

/* ---- the cards and their forms ---- */

main { max-width: 60rem; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.card {
  max-width: 30rem;
  margin: 0 auto;
  padding: 1.25rem;
  background: var(--slate-raised);
  border-radius: var(--radius);
}
.card.wide { max-width: 44rem; }
/* A column of cards, each as wide as the column. */
.cards { display: grid; gap: 1rem; max-width: 30rem; margin: 0 auto; }
.cards > .card { width: 100%; max-width: none; margin: 0; }
.card.danger { border: 1px solid var(--board-red); }
.intro, .aside, .hint { color: var(--chalk-dim); }
.aside { margin: 1rem 0 0; }

form.stack { display: grid; gap: 1rem; margin: 0; }
label.field { display: grid; gap: 0.35rem; }
.label { font-weight: 600; }
.hint { font-size: 0.875rem; }
input, select {
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.75rem;
  /* 16 px at least, or phones zoom into the field. */
  font: inherit;
  font-size: 1rem;
  color: var(--chalk);
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: 8px;
}
input:focus, select:focus { border-color: var(--chalk-dim); }
button {
  min-height: 3rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 800;
  color: var(--slate);
  background: var(--chalk);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease-out, background-color 0.15s;
}
button:active { transform: scale(0.97); }
form.stack button { width: 100%; margin-top: 0.25rem; }
button.secondary { color: var(--chalk); background: var(--slate-line); font-weight: 600; }
button.danger { color: var(--chalk); background: var(--board-red); }
button.nav { min-height: 2.75rem; border: 0; cursor: pointer; }

.links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem; margin: 1rem 0 0; color: var(--chalk-dim); }
.links a { display: inline-block; padding: 0.6rem 0; }
.links + .links { margin-top: 0; }

/* ---- messages and facts ---- */

.notice, .error {
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  border-radius: var(--radius);
  background: var(--slate);
  border-left: 4px solid var(--board-green);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.notice.warn { border-left-color: var(--chalk-yellow); }
.error { border-left-color: var(--board-red); background: var(--red-tint); }
.status { display: flex; align-items: baseline; gap: 0.5rem; }
.status .dot { flex: none; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--chalk-yellow); }
.status.ok .dot { background: var(--board-green); }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0 0 1rem; }
dl.facts dt { color: var(--chalk-dim); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.status.off .dot { background: var(--chalk-dim); }
[hidden] { display: none !important; }

/* ---- my boards ---- */

ul.boards { list-style: none; display: grid; gap: 1rem; margin: 0; padding: 0; }
li.board {
  padding: 1rem;
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius);
}
.board-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; }
.board-head h2 { margin: 0 0 0.5rem; overflow-wrap: anywhere; }
.board-head .status { margin: 0 0 0.5rem; font-weight: 600; }
/* One short fact: its label beside it, at any width. */
li.board dl.facts { grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin-bottom: 0.75rem; }
li.board dl.facts dd { margin-bottom: 0; }
.actions { margin: 0 0 0.5rem; }
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  min-width: 8rem;
  padding: 0.6rem 1.25rem;
  font-weight: 800;
  color: var(--slate);
  background: var(--chalk);
  border-radius: 8px;
  text-decoration: none;
}
a.button:active { transform: scale(0.97); }
a.button.secondary { color: var(--chalk); background: var(--slate-line); }
li.board details { border-top: 1px solid var(--slate-line); }
li.board summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.75rem;
  color: var(--chalk-dim);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
li.board summary::-webkit-details-marker,
details.local-network summary::-webkit-details-marker { display: none; }
/* A chevron that turns down when open, on the board cards and on the local network's fold. */
li.board summary::after,
details.local-network summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.25rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
li.board details[open] summary::after,
details.local-network[open] summary::after { transform: rotate(45deg); }
li.board summary:hover, li.board details[open] summary { color: var(--chalk); }
li.board details > :last-child { margin-bottom: 0.75rem; }
form.add { margin: 1.25rem 0 0; }
form.add button { width: 100%; }
.code-link { margin: 0.75rem 0 0; }
.code-link a.button { width: 100%; }
/* "Play" beside a board: a one-tap form, or the way to its session. */
li.board .actions form { margin: 0; }

/* ---- the start page and "Play" ---- */

.start-actions { display: grid; gap: 0.75rem; margin: 0 0 0.5rem; }
.start-actions a.button, .start-actions button { width: 100%; }
.start-actions form { margin: 0; }
.start-links span { color: var(--chalk-dim); }
/* Where to play: each own board one wide button, a board in a session shown, not to choose. */
ul.choices { list-style: none; display: grid; gap: 0.75rem; margin: 0 0 1rem; padding: 0; }
li.choice form { margin: 0; }
li.choice button { width: 100%; overflow-wrap: anywhere; }
li.choice button:disabled {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  cursor: not-allowed;
  opacity: 0.6;
}
li.choice .busy { color: var(--chalk-dim); font-weight: 600; }
/* The same code on "My boards", folded away under the list. */
details.local-network { margin: 1.25rem 0 0; border-top: 1px solid var(--slate-line); }
details.local-network summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.75rem;
  color: var(--chalk-dim);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
details.local-network summary:hover, details.local-network[open] summary { color: var(--chalk); }
details.local-network .pairing { padding-top: 0.5rem; }

/* ---- add a board ---- */

.pairing { text-align: center; }
.pairing .instruction { font-size: 1.15rem; font-weight: 700; }
/* As large as the phone allows, white with its quiet zone, so that a camera a hand's width away
   reads it. */
.qr {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto 1rem;
  background: #fff;
  border-radius: 8px;
}
.qr svg { display: block; width: 100%; height: auto; }
.pairing .code { margin-bottom: 0.75rem; }
.pairing code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  overflow-wrap: anywhere;
}
.pairing .status { justify-content: center; }
.status.waiting .dot { animation: waiting 1.2s ease-in-out infinite; }
@keyframes waiting { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  .status.waiting .dot { animation: none; }
}
.pairing .links { justify-content: center; }
/* The install line for a board not set up yet, to copy: one tap selects all of it. */
.pairing .install {
  margin: 1.5rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--slate-line);
}
.pairing .install p { color: var(--chalk-dim); margin-bottom: 0.5rem; }
.pairing .install pre {
  margin: 0;
  padding: 0.75rem 1rem;
  text-align: left;
  background: var(--board-black);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius);
  overflow-x: auto;
}
.pairing .install code {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  overflow-wrap: normal;
  user-select: all;
}

/* ---- show my code ---- */

.show-code #code-expired a.button { margin-bottom: 0.5rem; }
/* What the phone asks after a code: each question with "Yes" and "No". */
ul.questions { list-style: none; display: grid; gap: 0.75rem; margin: 0 0 1.25rem; padding: 0; }
li.question {
  padding: 1rem;
  background: var(--slate);
  border: 1px solid var(--chalk-yellow);
  border-radius: var(--radius);
}
li.question .text { font-size: 1.15rem; font-weight: 800; margin: 0 0 0.75rem; overflow-wrap: anywhere; }
li.question .number { font-weight: 700; margin: 0 0 0.5rem; }
li.question .warning { color: var(--chalk-yellow); font-size: 0.875rem; margin: 0 0 0.75rem; }
li.question .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
li.question .actions button { flex: 1 1 8rem; }

/* ---- the history ---- */

/* Each ended match a card of its facts, the newest first, as "My boards" lists its boards. */
ol.matches { list-style: none; display: grid; gap: 0.75rem; margin: 0; padding: 0; }
li.match {
  padding: 1rem;
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius);
}
li.match dl.facts { margin: 0; }

/* ---- the board page ---- */

.board-view .board-head h1 { margin: 0 0 0.5rem; overflow-wrap: anywhere; }
.board-view .board-head .status { margin: 0 0 0.5rem; font-weight: 600; }
.board-view h2 { margin-top: 0.5rem; }
/* Whether the board is free, or in whose session. */
.board-view .in-session {
  margin: 0 0 1.25rem;
  padding: 0.5rem 1rem;
  font-size: 1.15rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius);
}
.board-view .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.25rem; }
/* The board's displays, for the owner: each with its mode, and the device the page is on marked. */
ul.displays { list-style: none; display: grid; gap: 0.5rem; margin: 0 0 1.25rem; padding: 0; }
li.display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius);
}
li.display .about { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
li.display .name { font-weight: 800; }
li.display .mode { color: var(--chalk-dim); }
li.display .here { color: var(--chalk-yellow); font-weight: 600; }
li.display form { margin: 0; }
/* On a display: "Manage", and the way to the other mode, a link or a one-tap form. */
.board-view .actions form { margin: 0; }

/* ---- the owner's proof and the management ---- */

.proof .instruction { font-size: 1.15rem; font-weight: 700; }
/* The number that names the display's request on the owner's phone. */
.proof .number { display: flex; align-items: baseline; gap: 0.75rem; }
.proof .number code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--chalk-yellow);
}
.proof #proof-live, .proof #proof-expired { margin-bottom: 1.25rem; }
.manage h2 { margin-top: 1.5rem; }
.manage form.stack { margin-bottom: 1rem; }
.manage .window { margin: 0 0 1rem; }
.manage form.close { margin: 1.25rem 0 0; }
.manage form.close button { width: 100%; }
/* The setup link to the board's own page, one for each of its addresses: long, so it wraps
   anywhere, and touch-sized. */
ul.setup-links { list-style: none; display: grid; gap: 0.5rem; margin: 0.75rem 0 0; padding: 0; }
ul.setup-links a {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-left: 4px solid var(--board-green);
  border-radius: var(--radius);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
/* A switch: a checkbox with its words beside it, touch-sized. */
label.check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  font-weight: 600;
  cursor: pointer;
}
label.check input {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--board-green);
}

/* ---- my invitations ---- */

.invitations h2 { margin: 1.5rem 0 0.75rem; }
.invitations .count { font-weight: 600; }
/* The link just made, to copy: once, as only its hash is kept. */
.made { margin: 0 0 1.25rem; }
.made input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9rem; }
.made button { width: 100%; margin-top: 0.75rem; }
.made .aside { margin-top: 0.5rem; }
ul.invitations { list-style: none; display: grid; gap: 0.75rem; margin: 1.5rem 0 0; padding: 0; }
li.invitation {
  padding: 0.75rem 1rem;
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius);
}
li.invitation p { margin: 0; }
li.invitation .status { flex-wrap: wrap; font-weight: 600; }
li.invitation .status .hint { margin-left: auto; font-weight: 400; color: var(--chalk-dim); }
li.invitation .aside { margin-top: 0.25rem; overflow-wrap: anywhere; }
li.invitation form { margin: 0.75rem 0 0; }
li.invitation form button { width: 100%; }

/* ---- the admin's accounts ---- */

/* Each account a card of its facts, with "Give invitations" below them. */
ul.accounts { list-style: none; display: grid; gap: 0.75rem; margin: 1rem 0 0; padding: 0; }
li.account {
  padding: 0.75rem 1rem;
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius);
}
.account-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin: 0 0 0.5rem; }
.admin .name { font-weight: 800; overflow-wrap: anywhere; }
li.account dl.facts { margin: 0; }
form.give { display: flex; gap: 0.5rem; margin: 0.75rem 0 0; }
form.give input { flex: 0 0 5.5rem; }
form.give button { flex: 1 1 auto; }
/* The tree: each account under the one who invited it, indented along a line. */
ul.tree, ul.tree ul { list-style: none; margin: 0; padding: 0; }
ul.tree { margin-top: 1rem; }
ul.tree ul { margin-left: 0.6rem; padding-left: 1rem; border-left: 1px solid var(--slate-line); }
li.node { padding: 0.4rem 0; }
li.node p { margin: 0; }
.node-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.75rem; }
.node-head .email { color: var(--chalk-dim); overflow-wrap: anywhere; }
.node-facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1rem; font-size: 0.875rem; }
li.node.deleted > .node-head .name { color: var(--chalk-dim); font-style: italic; }

/* ---- use as a display ---- */

/* On a display of a board: whose it is, the way to its view, and the way to another board. */
.display-of .notice { text-align: left; }
.display-of .actions a.button { width: 100%; }
.display-of form.another { margin: 1.25rem 0 0; }
.display-of form.another button { width: 100%; }
/* The code typed on a phone, in the display's letters. */
input.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 30rem) {
  main { padding-top: 1rem; }
  .card { padding: 1rem; }
  dl.facts { grid-template-columns: 1fr; gap: 0.1rem; }
  dl.facts dd { margin-bottom: 0.5rem; }
}
