/* One stylesheet for three pages.
 *
 * The game used to paint its HUD on the canvas, so the only CSS in the app was
 * a landing page and a table. Now that the HUD is DOM, the same tokens dress
 * all of it, and they are written down once here rather than three times in
 * three <style> blocks that drifted.
 *
 * Everything in the HUD is sized in `em` off one custom property the loop sets
 * from the canvas's own upscale, so the overlay grows and shrinks with the
 * picture and there is exactly one number to change.
 */

:root {
  color-scheme: dark;
  --ink: #14161a;
  --panel: #1d2026;
  --plate: rgba(16, 18, 22, 0.82);
  --text: #e8e6e1;
  --dim: #9aa0a8;
  --edge: #3d444f;
  --focus: #6f7d92;
  --bad: #d98b7a;
  --good: #8fbf8a;
  --flag: #d9c27a;
  --gold: #e7b93c;
  --hp: #d8443a;
  --hp-back: #3a1f1e;
  --hurt: #ff6a5a;
  --hud-font: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

[hidden] { display: none !important; }
a { color: var(--text); }

/* Said, but not shown. Everything the canvas could only draw is also here. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

button {
  padding: 0.55rem 1.1rem;
  font: inherit;
  color: var(--ink);
  background: var(--text);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }

input[type="email"], textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 4px;
}

/* --- the game ------------------------------------------------------------ */

body.game { height: 100%; overflow: hidden; }

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
}

/* Shrink-wraps the canvas, so the HUD inside it is clipped to the picture
   without anybody measuring anything. */
.viewport { position: relative; }

.screen {
  /* The backing store is a 2x supersample of the logical view, so this governs
     only the final upscale to CSS pixels. */
  image-rendering: auto;
  display: block;
}
.screen:focus { outline: none; }

.hud {
  position: absolute;
  inset: 0;
  font-size: var(--hud-font);
  line-height: 1.25;
  /* The picture is underneath. Only the chat line takes a pointer. */
  pointer-events: none;
  user-select: none;
}

.hud-panel {
  background: var(--plate);
  border: 1px solid var(--edge);
}

.hud-vitals {
  position: absolute;
  top: 0.6em;
  left: 0.6em;
  width: 13em;
  padding: 0.45em 0.6em 0.5em;
}

.hud-who { display: flex; align-items: baseline; gap: 0.5em; }
.hud-name { font-size: 1em; }
.hud-slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; color: var(--dim); }

.hud-bar {
  height: 0.7em;
  margin-top: 0.45em;
  background: var(--hp-back);
  overflow: hidden;
}
.hud-bar-fill { height: 100%; background: var(--hp); }

.hud-numbers {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25em;
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
}
.hud-gold { color: var(--gold); }

/* Sat over open grass with no panel behind it, so it carries its own shadow.
   Everything else up here has a plate to sit on. */
.hud-online {
  position: absolute;
  top: 0.45em;
  right: 0.6em;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}

.hud-prompt {
  position: absolute;
  top: 0.6em;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 1.2em);
  padding: 0.35em 1em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tone-plain { color: var(--text); }
.tone-dim { color: var(--dim); }
.tone-warn { color: var(--hurt); }
.tone-gold { color: var(--gold); }

.hud-chat {
  position: absolute;
  left: 0.6em;
  bottom: 0.6em;
  width: min(24em, calc(100% - 1.2em));
  padding: 0.4em 0.6em 0.45em;
}

.hud-log {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* Four rows, always. A panel that changes height when somebody speaks is a
     panel you read twice. */
  min-height: 4.8em;
  list-style: none;
}
.hud-line { display: flex; gap: 0.4em; overflow-wrap: anywhere; }
.hud-system { color: var(--dim); }
/* The slug is the speaker: everybody is called "player". */
.hud-from { flex: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; color: var(--gold); }

.hud-hint { margin-top: 0.35em; font-size: 0.85em; color: var(--dim); }

.hud-compose { margin-top: 0.35em; pointer-events: auto; }
.hud-field {
  display: block;
  width: 100%;
  padding: 0.15em 0.35em;
  font: inherit;
  color: var(--text);
  background: var(--edge);
  border: 0;
  border-radius: 2px;
}

/* --- the maintenance lock ------------------------------------------------ */

.hud-maintenance {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1em;
  background: rgba(0, 0, 0, 0.55);
  /* Over everything and taking the pointer, so nothing under it is pressed. */
  pointer-events: auto;
}
.hud-maintenance-text {
  max-width: 24em;
  padding: 0.8em 1.2em;
  text-align: center;
}

/* --- touch ---------------------------------------------------------------- */

/* A finger on the picture is a game input, never a scroll, a zoom or a
   text selection. */
.stage { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; }

/* The bottom corners belong to the thumbs, so the chat log moves up under the
   population count. */
.hud.touch .hud-chat {
  top: 2em;
  right: 0.6em;
  bottom: auto;
  left: auto;
  width: min(16em, 38%);
}

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

/* Sized in CSS pixels rather than em: a thumb does not shrink with the
   picture. */
.hud-pad {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: clamp(96px, 30vh, 150px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(16, 18, 22, 0.45);
  border: 1px solid var(--edge);
  pointer-events: auto;
  touch-action: none;
}
.hud-pad-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 9px solid transparent;
}
.hud-pad-arrow.up { top: 8%; left: 50%; transform: translateX(-50%); border-bottom-color: var(--dim); border-top-width: 0; }
.hud-pad-arrow.down { bottom: 8%; left: 50%; transform: translateX(-50%); border-top-color: var(--dim); border-bottom-width: 0; }
.hud-pad-arrow.left { left: 8%; top: 50%; transform: translateY(-50%); border-right-color: var(--dim); border-left-width: 0; }
.hud-pad-arrow.right { right: 8%; top: 50%; transform: translateY(-50%); border-left-color: var(--dim); border-right-width: 0; }

.hud-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}
.hud-button {
  width: clamp(48px, 14vh, 64px);
  aspect-ratio: 1;
  padding: 0;
  font-size: 13px;
  color: var(--text);
  background: rgba(16, 18, 22, 0.7);
  border: 1px solid var(--edge);
  border-radius: 50%;
  touch-action: manipulation;
}
.hud-attack { width: clamp(64px, 20vh, 84px); border-color: var(--hurt); }
.hud-buy { color: var(--gold); border-color: var(--gold); }

.hud-entering {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
}

/* --- the landing page ---------------------------------------------------- */

/* The name of the game and a field. That is deliberately the whole of it. */
.landing {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.landing-inner { width: min(24rem, 100%); text-align: center; }
.landing h1 { font-size: clamp(1.75rem, 6vw, 2.75rem); font-weight: 600; letter-spacing: 0.01em; }
.tagline { margin: 0.5rem 0 1.75rem; color: var(--dim); font-size: 0.9375rem; }
.signin { display: flex; gap: 0.5rem; }
.signin input { flex: 1; min-width: 0; padding: 0.6rem 0.75rem; }
.signin button { padding: 0.6rem 1rem; }

/* The invisible gate's mount point. It stays in the layout on purpose — a
   display:none container stops Turnstile running — but an Invisible sitekey
   draws nothing into it, so it is an empty flex box of zero height and the page
   is still a heading, a field and a button. No margin: an empty element must
   not push the note down. */
.captcha { display: flex; justify-content: center; }
.landing-note { min-height: 1.4em; margin-top: 0.9rem; color: var(--dim); font-size: 0.875rem; }

/* --- documents ----------------------------------------------------------- */

main { width: min(74rem, 100%); margin: 0 auto; padding: 3rem 1.5rem 5rem; }
main.landing { width: auto; margin: 0; padding: 1.5rem; }
body.narrow main { width: min(42rem, 100%); }
h1 { font-size: clamp(1.5rem, 5vw, 2.25rem); font-weight: 600; }
h2 { margin-bottom: 0.75rem; font-size: 1rem; font-weight: 600; color: var(--dim); }
h2:focus { outline: none; }
h2:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lede { margin-top: 0.75rem; max-width: 42rem; color: var(--dim); }
section { margin-top: 2.5rem; }
.back { display: inline-block; margin-top: 2.5rem; font-size: 0.875rem; color: var(--dim); }
noscript { display: block; margin-top: 2rem; color: var(--dim); }

/* --- the feedback box ---------------------------------------------------- */

.compose { max-width: 42rem; }
.compose textarea {
  display: block;
  width: 100%;
  min-height: 10rem;
  padding: 0.75rem;
  line-height: 1.5;
  resize: vertical;
}
.compose select { padding: 0.55rem 0.6rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }
.row .spacer { flex: 1; }
.count { font-size: 0.875rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.count.over { color: var(--bad); }
.note { min-height: 1.4em; margin-top: 0.75rem; font-size: 0.875rem; color: var(--dim); }
.note .bad { color: var(--bad); }
.quota { margin-top: 0.25rem; font-size: 0.875rem; color: var(--dim); }

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

.scroller { overflow-x: auto; border: 1px solid var(--edge); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
thead th {
  position: sticky;
  top: 0;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dim);
  background: var(--panel);
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
tbody td { padding: 0.7rem 0.75rem; vertical-align: top; border-top: 1px solid var(--edge); }
tbody tr.mine { background: #191d24; }
td.when, td.who { white-space: nowrap; color: var(--dim); font-size: 0.8125rem; }
td.who { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
td.body { min-width: 18rem; }
td.notes { min-width: 9rem; color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; }

/* A real button, so the six-line clamp opens from the keyboard as well as from
   a click, and says which state it is in while it does. */
.body-text {
  display: block;
  width: 100%;
  padding: 0;
  font: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.body-text.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  white-space: nowrap;
  border: 1px solid var(--edge);
  border-radius: 999px;
  color: var(--dim);
}
.tag.implemented { color: var(--good); border-color: var(--good); }
.tag.ignored { color: var(--dim); }
.tag.flagged { color: var(--flag); border-color: var(--flag); }
.none { color: #5d646e; }

.pager { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; }
.pager button { padding: 0.4rem 0.8rem; }
.page-label { font-size: 0.875rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.empty { color: var(--dim); }
