/*
 * The site's one stylesheet. The legal pages' colours are custom properties
 * here, defined for dark (the fleet's default) and redefined for a light
 * preference. The GAME's colours are not here: they are the one palette in
 * client/palette.ts, published on the page as `--lk-*` custom properties when
 * the game mounts, and this file only uses them by name.
 *
 * Nothing in this file moves or fades: the game shows motion only where it
 * carries game information (01-first-release.md section 3), so there are no
 * transitions or animations to turn off for reduced motion.
 */
:root {
  color-scheme: dark light;
  --ground: #101418;
  --text: #e8ecef;
  --muted: #a9b3bb;
  --link: #8cc8ff;
}
@media (prefers-color-scheme: light) {
  :root {
    --ground: #f6f7f8;
    --text: #15191d;
    --muted: #4a545c;
    --link: #0b57a8;
  }
}
html {
  font-size: 100%;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 1rem/1.5 system-ui, sans-serif;
}
a {
  color: var(--link);
}
.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
.stamp,
.dated {
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem;
}
.site-footer nav a {
  margin-right: 1rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ------------------------------------------------------------------ the game
   The game page is the game: the stage fills the window at 16:9, letterboxed
   on the ground colour when the window is another shape. */
.play {
  position: fixed;
  inset: 0;
  background: var(--lk-ground, black);
}
.game {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--lk-ground, black);
  color: var(--lk-ink, white);
  font: 16px/1.35 system-ui, sans-serif;
  --lk-caption-size: 16px;
  --lk-hud-size: 20px;
  --lk-body-size: 16px;
  --lk-title-size: 28px;
}
.game.lk-large {
  --lk-caption-size: 24px;
  --lk-hud-size: 30px;
  --lk-body-size: 24px;
  --lk-title-size: 42px;
}
.lk-stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  background: var(--lk-ground, black);
  overflow: hidden;
}
.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.game-canvas:focus {
  /* The whole page is the game, so a ring around it says nothing; the game's own screens show what is selected. */
  outline: none;
}

/* The word layer: sharp text on the field. */
.lk-words {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: var(--lk-body-size);
}
.lk-words[hidden] {
  display: none;
}
.lk-score {
  position: absolute;
  top: 10px;
  left: 14px;
  line-height: 1.1;
  font-size: 14px;
  color: var(--lk-muted);
}
.lk-score[hidden] {
  display: none;
}
.lk-score-n {
  font-variant-numeric: tabular-nums;
}
.lk-score-in {
  animation: lk-score-in 600ms ease-out;
}
.lk-score-new {
  color: var(--lk-gold);
  font-weight: 700;
}
@keyframes lk-score-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lk-score-in {
    animation: none;
  }
}
.lk-flares {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lk-flare {
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid var(--lk-gold);
  transform: rotate(45deg);
}
.lk-flare.lk-full {
  background: var(--lk-gold);
}
.lk-gauge {
  position: relative;
  width: 88px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid var(--lk-gold);
  overflow: hidden;
}
.lk-gauge-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--lk-gold);
  transition: width 160ms linear;
}
.lk-gauge.lk-loss {
  border-color: var(--lk-coral);
}
.lk-gauge.lk-loss .lk-gauge-fill {
  background: var(--lk-coral);
}
.lk-gauge.lk-feed {
  animation: lk-feed 280ms ease-out;
}
@keyframes lk-feed {
  0% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lk-gauge-fill {
    transition: none;
  }
  .lk-gauge.lk-feed {
    animation: none;
  }
}
.lk-key {
  display: inline-block;
  min-width: 1.5em;
  box-sizing: border-box;
  padding: 2px 6px;
  border: 2px solid var(--lk-ink);
  border-radius: 4px;
  background: var(--lk-ground);
  color: var(--lk-ink);
  font: 700 14px/1.2 system-ui, sans-serif;
  text-align: center;
}
.lk-needs {
  position: absolute;
  top: 8px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateX(-50%);
}
.lk-need {
  position: relative;
  box-sizing: border-box;
  width: 26px;
  height: 26px;
}
.lk-need.lk-first {
  width: 38px;
  height: 38px;
}
.lk-need.lk-capsule {
  border: 2px dashed var(--lk-own);
  border-radius: 50%;
}
.lk-need.lk-moveup::before {
  content: "";
  position: absolute;
  left: 22%;
  top: 30%;
  width: 56%;
  height: 56%;
  box-sizing: border-box;
  border-left: 4px solid var(--lk-gold);
  border-top: 4px solid var(--lk-gold);
  transform: rotate(45deg) scale(0.8);
}
/* A put-out light: a grey helper ring with a coral cross. A slip: a grey tick. Each its own shape, besides colour. */
.lk-need.lk-putout {
  border: 2px solid var(--lk-muted);
  border-radius: 50%;
}
.lk-need.lk-putout::before,
.lk-need.lk-putout::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18%;
  width: 3px;
  height: 64%;
  margin-left: -1.5px;
  background: var(--lk-coral);
  transform: rotate(45deg);
}
.lk-need.lk-putout::after {
  transform: rotate(-45deg);
}
.lk-need.lk-slip::before {
  content: "";
  position: absolute;
  left: 24%;
  top: 14%;
  width: 28%;
  height: 56%;
  box-sizing: border-box;
  border-right: 4px solid var(--lk-muted);
  border-bottom: 4px solid var(--lk-muted);
  transform: rotate(40deg);
}
.lk-pointer {
  position: absolute;
  inset: 0;
}
.lk-pointer::after {
  content: "";
  position: absolute;
  right: -9px;
  top: calc(50% - 4px);
  border-left: 7px solid var(--lk-amber);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}
.lk-weapon {
  position: absolute;
  top: 8px;
  right: 14px;
  padding: 4px 10px;
  border: 2px solid var(--lk-gold);
  border-radius: 4px;
  background: var(--lk-panel);
  color: var(--lk-gold);
  font-size: var(--lk-caption-size);
}
.lk-weapon[hidden] {
  display: none;
}
.lk-sound {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--lk-panel);
  font-size: 16px;
}
.lk-sound[hidden],
.lk-caption[hidden],
.lk-needs[hidden],
.lk-arrows[hidden],
.lk-field-key[hidden],
.lk-pop[hidden] {
  display: none;
}
.lk-sound-glyph::before {
  font-weight: 700;
}
.lk-sound-glyph[data-glyph="all"]::before {
  content: "\266A ))";
}
.lk-sound-glyph[data-glyph="effects"]::before {
  content: "))";
}
.lk-sound-glyph[data-glyph="music"]::before {
  content: "\266A";
}
.lk-sound-glyph[data-glyph="off"]::before {
  content: "\00D7";
}
.lk-caption {
  position: absolute;
  max-width: 46%;
  box-sizing: border-box;
  padding: 4px 10px;
  border-left: 4px solid var(--lk-ink);
  border-radius: 4px;
  background: color-mix(in srgb, var(--lk-ground) 88%, transparent);
  color: var(--lk-ink);
  font-size: var(--lk-caption-size);
  text-align: left;
  transform: translate(-50%, -100%);
}
.lk-caption.lk-urgent {
  border-left-color: var(--lk-coral);
  border-left-width: 8px;
  font-weight: 700;
}
.lk-keys {
  position: absolute;
  inset: 0;
}
.lk-arrows,
.lk-field-key {
  position: absolute;
  transform: translate(-50%, -50%);
}
.lk-arrows {
  display: flex;
  gap: 3px;
}
.lk-pops {
  position: absolute;
  inset: 0;
}
.lk-pop {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 16px;
  font-weight: 700;
  color: var(--lk-gold);
}

/* The screens over the field: start, pause and the end panel. */
.lk-screen {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  pointer-events: auto;
  font-size: var(--lk-body-size);
}
.lk-screen[hidden] {
  display: none;
}
.lk-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7% 5% 3%;
  pointer-events: none;
}
.lk-start > * {
  pointer-events: auto;
}
.lk-start-line {
  margin: 0;
  padding: 4px 12px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--lk-ground) 80%, transparent);
  font-size: var(--lk-caption-size);
}
.lk-tiles {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 90%;
  margin-bottom: 14px;
}
.lk-tiles[hidden] {
  display: none;
}
.lk-tile {
  box-sizing: border-box;
  min-width: 48px;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--lk-muted);
  border-radius: 6px;
  background: var(--lk-panel);
  color: var(--lk-ink);
  font-size: var(--lk-caption-size);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.lk-tile-speed,
.lk-tile-largeText,
.lk-tile-sound {
  font-weight: 400;
}
.lk-tile.lk-selected {
  border-color: var(--lk-ink);
  box-shadow: 0 5px 0 var(--lk-ink);
}
.lk-tile.lk-closed {
  border-style: dashed;
  color: var(--lk-muted);
}
.lk-tiles[hidden] ~ .lk-start-sound {
  margin-top: auto;
}
.lk-start-sound {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--lk-caption-size);
}
.lk-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  margin-top: 10px;
  font-size: 14px;
}
.lk-foot-link,
.lk-link {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--lk-ink);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.lk-foot-link:focus-visible,
.lk-link:focus-visible,
.lk-button:focus-visible,
.lk-form input:focus-visible {
  outline: 3px solid var(--lk-blue);
  outline-offset: 2px;
}
.lk-pause,
.lk-end {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 4%;
  background: color-mix(in srgb, var(--lk-ground) 90%, transparent);
  overflow: auto;
}
.lk-pause h2,
.lk-headline {
  margin: 0;
  font-size: var(--lk-title-size);
}
.lk-hint,
.lk-idea,
.lk-unproven,
.lk-deed,
.lk-stamp {
  margin: 0;
  text-align: center;
}
.lk-stamp {
  color: var(--lk-muted);
  font-size: 14px;
}
.lk-end {
  gap: 8px;
}
.lk-end-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.lk-cause {
  width: 40px;
  height: 40px;
}
.lk-cause[hidden],
.lk-new-best[hidden],
.lk-reasons[hidden],
.lk-offer[hidden] {
  display: none;
}
.lk-scores {
  display: flex;
  align-items: baseline;
  gap: 24px;
}
.lk-score-box {
  margin: 0;
  font-size: calc(var(--lk-hud-size) * 1.1);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lk-new-best {
  margin: 0;
  padding: 2px 8px;
  border: 2px solid var(--lk-gold);
  border-radius: 4px;
  color: var(--lk-gold);
  font-weight: 700;
}
.lk-bars {
  display: grid;
  gap: 4px;
  width: min(100%, 560px);
}
.lk-bar {
  display: grid;
  grid-template-columns: 11em 1fr 7em;
  align-items: center;
  gap: 8px;
  font-size: var(--lk-caption-size);
}
.lk-bar-track {
  height: 14px;
  border: 2px solid var(--lk-muted);
  border-radius: 2px;
}
.lk-bar-fill {
  display: block;
  height: 100%;
  background: var(--lk-ink);
}
.lk-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.lk-reasons {
  margin: 0;
  padding-left: 1.2em;
  font-size: var(--lk-caption-size);
}
.lk-strip-box {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.lk-strip-label,
.lk-strip-copy {
  margin: 0;
  font-size: 14px;
  color: var(--lk-muted);
}
.lk-strip {
  display: flex;
  gap: 3px;
}
.lk-cell {
  display: block;
  width: 16px;
  height: 22px;
  box-sizing: border-box;
  border: 2px solid var(--lk-ink);
}
.lk-cell-full {
  background: var(--lk-ink);
}
.lk-cell-half {
  background: linear-gradient(to top, var(--lk-ink) 50%, transparent 50%);
}
.lk-end-keys {
  display: flex;
  gap: 24px;
  margin: 4px 0 0;
  font-size: var(--lk-caption-size);
}
.lk-offer {
  width: min(100%, 560px);
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

/* The account panel. */
.lk-panel {
  box-sizing: border-box;
  width: min(100%, 520px);
  padding: 16px;
  border: 2px solid var(--lk-muted);
  border-radius: 8px;
  background: var(--lk-panel);
  font-size: var(--lk-body-size);
}
.lk-panel p {
  margin: 0 0 10px;
}
.lk-form {
  display: grid;
  gap: 10px;
}
.lk-field {
  display: grid;
  gap: 6px;
}
.lk-form input {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--lk-muted);
  border-radius: 4px;
  background: var(--lk-ground);
  color: var(--lk-ink);
  font: inherit;
}
.lk-button {
  padding: 8px 16px;
  border: 2px solid var(--lk-ink);
  border-radius: 6px;
  background: var(--lk-ink);
  color: var(--lk-ground);
  font: 700 inherit/1.2 system-ui, sans-serif;
  cursor: pointer;
}
.lk-button:disabled {
  opacity: 0.5;
  cursor: default;
}
.lk-row {
  display: flex;
  gap: 18px;
  margin-top: 8px;
}
.lk-error {
  padding: 6px 10px;
  border-left: 6px solid var(--lk-coral);
  background: var(--lk-ground);
}
.lk-backup-code {
  padding: 10px;
  border: 2px dashed var(--lk-gold);
  font: 700 calc(var(--lk-body-size) * 1.4) ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-align: center;
  user-select: all;
}
.lk-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.lk-card {
  padding: 10px;
  border: 2px solid var(--lk-muted);
  border-radius: 6px;
}
.lk-card-title {
  font-weight: 700;
}
.lk-recommended {
  color: var(--lk-gold);
  font-weight: 700;
}
.lk-note {
  color: var(--lk-muted);
  font-size: 14px;
}

/* A phone-wide window: the field is letterboxed small, so the start screen's controls shrink to fit inside it. */
@media (max-width: 700px) {
  .lk-start {
    padding: 4% 3% 2%;
  }
  .lk-start-line {
    font-size: 14px;
    padding: 2px 8px;
  }
  .lk-tiles {
    gap: 4px;
    margin-bottom: 6px;
    max-width: 98%;
  }
  .lk-tile {
    min-width: 34px;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 13px;
  }
  .lk-start-sound {
    font-size: 13px;
  }
  .lk-foot {
    margin-top: 2px;
    font-size: 12px;
  }
}

/* The calm screen when the window is too small or the device has no keyboard: one still line on the field's own black. */
.lk-gate {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  box-sizing: border-box;
  background: var(--lk-ground, black);
  text-align: center;
}
.lk-gate[hidden] {
  display: none;
}
.lk-gate-words {
  margin: 0;
  font-size: 18px;
  color: var(--lk-ink);
}

/* The one full-screen button, in the field's top right corner. No key does what it does. */
.lk-fullscreen {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  padding: 0;
  border: 2px solid var(--lk-muted);
  border-radius: 4px;
  background: none;
  opacity: 0.6;
  cursor: pointer;
  pointer-events: auto;
}
.lk-fullscreen::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid var(--lk-muted);
  border-radius: 1px;
}
.lk-fullscreen:hover,
.lk-fullscreen:focus-visible {
  opacity: 1;
}
.lk-fullscreen[hidden] {
  display: none;
}
