:root {
  color-scheme: dark;
  --bg: #010a03;
  --panel: #031207;
  --fg: #39ff6a;
  --bright: #b6ffc9;
  --dim: #1f8a3e;
  --faint: #0d3b1a;
  --glow: 0 0 6px rgba(57, 255, 106, 0.55);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 var(--mono);
  text-shadow: var(--glow);
}
/* Faint scanlines over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.18) 2px 3px);
}
a, button.link { color: var(--fg); }
button.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  text-shadow: inherit;
  cursor: pointer;
}
button.link:hover, a:hover { color: var(--bright); }
:focus-visible { outline: 1px dashed var(--bright); outline-offset: 2px; }
.dim { color: var(--dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* Emoji, tinted to the phosphor. */
.glyph { filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(5) brightness(1.05); text-shadow: none; }

.sitenav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--faint);
  min-height: 100vh;
}
.sitenav a {
  display: block;
  padding: 0.35rem 0.5rem;
  text-decoration: none;
  letter-spacing: 0.08em;
}
.sitenav a[aria-current="page"] { background: var(--fg); color: var(--bg); text-shadow: none; }

.shell { display: flex; flex-direction: column; min-width: 0; padding: 0 1.25rem 1.25rem; }
.bar {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.9rem 0 0.6rem;
  border-bottom: 1px solid var(--faint);
}
.bar h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.3em; }
.bar .rank { margin-left: auto; }
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 30vw, 360px);
  gap: 1.25rem;
  padding-top: 1rem;
}

.term {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
  border: 1px solid var(--dim);
  background: var(--panel);
  padding: 0.9rem 1rem;
  cursor: text;
}
.hive { display: flex; gap: 0.9rem; justify-content: center; font-size: 1.6rem; letter-spacing: 0.05em; padding-bottom: 0.6rem; border-bottom: 1px dashed var(--faint); }
.hive .center { background: var(--fg); color: var(--bg); text-shadow: none; padding: 0 0.35rem; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; flex: 1; padding-top: 0.6rem; min-height: 0; }
.col { min-width: 0; border-right: 1px dashed var(--faint); padding-right: 0.5rem; }
.col:last-child { border-right: 0; }
.col h2 { margin: 0 0 0.4rem; font-size: 1.5rem; text-align: center; font-weight: normal; }
.col ol { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; }
.col li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col li button { all: unset; cursor: pointer; }
.col li.new { animation: blink 0.9s steps(2) 2; }
.col li.pangram::after { content: " *"; color: var(--bright); }
.status { min-height: 1.45em; margin: 0.6rem 0 0.2rem; color: var(--bright); }
.status.err { color: var(--dim); }
.ticker {
  --seg-on: #39ff6a;
  --seg-off: #0a2412;
  display: block;
  width: 100%;
  height: 6rem; /* set from the width by ticker.js: five rows of square-ish cells */
  margin: 0.15rem 0 0.45rem;
  background: #000;
  border: 1px solid var(--faint);
}
.prompt { display: flex; align-items: baseline; gap: 0.5ch; font-size: 1.25rem; position: relative; }
.prompt .ps { color: var(--dim); }
#typed { text-transform: uppercase; letter-spacing: 0.08em; }
#typed .bad { color: var(--dim); }
.cursor { animation: blink 1.06s steps(2) infinite; }
.kbd { position: absolute; inset: 0; opacity: 0; font-size: 16px; }
@keyframes blink { 50% { opacity: 0; } }
.keys { display: none; flex-wrap: wrap; gap: 0.4rem; justify-content: center; padding-top: 0.75rem; }
.keys button {
  font: inherit;
  font-size: 1.15rem;
  min-width: 2.6rem;
  min-height: 2.6rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--dim);
  text-shadow: inherit;
  text-transform: uppercase;
}
.keys button.center { background: var(--fg); color: var(--bg); text-shadow: none; }

.side { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.scene { width: 100%; aspect-ratio: 1; display: block; border: 1px solid var(--dim); background: #000; }
.caption { margin: -0.4rem 0 0; min-height: 1.45em; font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; }
.caption.event { color: var(--bright); }
.caption.idle { color: var(--dim); }
.meters { display: grid; gap: 0.45rem; }
.meter { display: grid; grid-template-columns: 1.6rem 1fr 3.2rem; align-items: center; gap: 0.5rem; }
/* The lane is the full width; the track's length is the category's available
   points, on a scale where the biggest category fills the lane. */
.lane { display: block; min-width: 0; }
.track { display: block; width: 100%; min-width: 0.6rem; height: 0.9rem; border: 1px solid var(--dim); padding: 1px; transition: width 0.4s; }
.fill { display: block; height: 100%; width: 0; background: var(--fg); box-shadow: var(--glow); transition: width 0.4s steps(12); }
.n { text-align: right; }
.board h2 { margin: 0 0 0.4rem; font-size: 1rem; font-weight: normal; letter-spacing: 0.15em; }
.name-form { display: flex; gap: 0.5ch; align-items: baseline; margin-bottom: 0.4rem; }
.name-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--dim);
  text-shadow: inherit;
}
.board-list { margin: 0; padding: 0; list-style: none; font-size: 0.92rem; }
.board-list li { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 0.5ch; }
.board-list li.you { color: var(--bright); }
.board-list li.empty { display: block; }
.board-list .tally { color: var(--dim); }

.help {
  max-width: 34rem;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--fg);
  font: inherit;
  text-shadow: inherit;
}
.help::backdrop { background: rgba(0, 0, 0, 0.7); }
.help h2 { margin-top: 0; font-size: 1.1rem; letter-spacing: 0.2em; }

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .sitenav { flex-direction: row; min-height: 0; border-right: 0; border-bottom: 1px solid var(--faint); padding: 0.5rem 1rem; }
  .shell { padding: 0 0.75rem 1rem; }
  .grid { grid-template-columns: 1fr; }
  .side { order: -1; display: grid; grid-template-columns: 9rem 1fr; align-items: start; }
  .side .board { grid-column: 1 / -1; }
  .side .caption { grid-column: 1 / -1; margin: 0; }
  .term { min-height: 0; }
  .keys { display: flex; }
  .col ol { max-height: 32vh; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor, .col li.new { animation: none; }
  .fill { transition: none; }
}
