:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  background: #171713;
  color: #f4efd8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #171713;
  background-size: 32px 32px;
}

.shell {
  width: min(100vw, 1130px);
  padding: 16px;
}

.game-panel {
  display: grid;
  gap: 10px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(6, minmax(78px, 1fr)) auto;
  gap: 8px;
  align-items: stretch;
}

.hud > div,
.hud button,
.title-strip,
.status-line,
.crew-panel,
.help-panel {
  border: 2px solid #4b4736;
  background: #242316;
  box-shadow: inset 0 0 0 2px #11100b;
}

.title-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 14px;
  align-items: center;
  min-height: 104px;
  padding: 12px 14px;
}

.title-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.title-copy h1,
.title-copy p {
  margin: 0;
}

.title-copy h1 {
  color: #f1d16a;
  font-size: 2.35rem;
  line-height: 0.98;
  text-transform: uppercase;
  text-shadow:
    3px 0 0 #7a2d22,
    0 3px 0 #11100b,
    3px 3px 0 #11100b;
}

.title-copy p {
  max-width: 520px;
  color: #ddd4a8;
  font-size: 0.9rem;
  line-height: 1.25;
}

.title-mascot {
  position: relative;
  width: 82px;
  height: 72px;
  justify-self: end;
  border: 2px solid #0c0c08;
  background: #18170f;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
  image-rendering: pixelated;
}

.title-mascot span {
  position: absolute;
  display: block;
}

.mascot-head {
  left: 20px;
  top: 14px;
  width: 42px;
  height: 44px;
  background: #5c8a4f;
  border: 2px solid #10250e;
}

.mascot-hair {
  left: 16px;
  top: 8px;
  width: 50px;
  height: 14px;
  background: #26351e;
  border: 2px solid #10250e;
}

.mascot-eye {
  top: 28px;
  width: 7px;
  height: 7px;
  background: #fff0b8;
  border: 2px solid #10250e;
}

.mascot-eye.left {
  left: 30px;
}

.mascot-eye.right {
  left: 48px;
}

.mascot-mouth {
  left: 36px;
  top: 44px;
  width: 18px;
  height: 12px;
  background: #17100f;
  border: 2px solid #10250e;
}

.mascot-poo {
  background: #5a2f16;
  border: 2px solid #2a170b;
}

.mascot-poo.one {
  left: 42px;
  top: 18px;
  width: 18px;
  height: 13px;
}

.mascot-poo.two {
  left: 36px;
  top: 26px;
  width: 14px;
  height: 12px;
}

.mascot-poo.three {
  left: 53px;
  top: 34px;
  width: 10px;
  height: 18px;
}

.mascot-pain {
  top: 9px;
  width: 14px;
  height: 4px;
  background: #d98264;
}

.mascot-pain.left {
  left: 7px;
  transform: rotate(-38deg);
}

.mascot-pain.right {
  right: 7px;
  transform: rotate(38deg);
}

.hud > div {
  display: grid;
  min-height: 54px;
  padding: 8px 10px;
}

.label {
  color: #cfc392;
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
}

.hud strong {
  align-self: end;
  color: #fff5bb;
  font-size: 1.15rem;
  line-height: 1.1;
}

.hud button {
  min-width: 92px;
  padding: 0 14px;
  color: #fff5bb;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.hud-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, auto));
  gap: 8px;
}

.hud button:hover,
.hud button:focus-visible {
  background: #35331e;
  outline: 2px solid #e1cb69;
  outline-offset: 2px;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 800px) 210px;
  gap: 12px;
  align-items: start;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 800px;
}

canvas {
  display: block;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 25 / 18;
  touch-action: none;
  cursor: crosshair;
  image-rendering: pixelated;
  border: 4px solid #0c0c08;
  background: #37591f;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
}

.focus-exit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid #4b4736;
  background: #242316;
  box-shadow: inset 0 0 0 2px #11100b;
  color: #fff5bb;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.focus-exit[hidden] {
  display: none;
}

.focus-exit:hover,
.focus-exit:focus-visible {
  background: #35331e;
  outline: 2px solid #e1cb69;
  outline-offset: 2px;
}

.crew-panel {
  display: grid;
  gap: 10px;
  min-height: 576px;
  padding: 10px;
}

.crew-title {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 2px solid #11100b;
  background: #18170f;
}

.crew-title strong {
  color: #fff5bb;
  font-size: 1.35rem;
  line-height: 1;
}

.employee-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.employee-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 9px;
  align-items: center;
  min-height: 82px;
  padding: 8px;
  border: 2px solid #11100b;
  background: #1a1a12;
  opacity: 0.78;
}

.employee-card.active {
  border-color: #e1cb69;
  background: #2d2a18;
  opacity: 1;
}

.employee-card.lost {
  filter: grayscale(1);
  opacity: 0.48;
}

.employee-copy {
  display: grid;
  gap: 2px;
}

.employee-copy strong {
  color: #fff5bb;
  font-size: 1rem;
  line-height: 1.1;
}

.employee-copy small,
.employee-copy em {
  color: #cfc392;
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1.1;
}

.employee-card.active .employee-status {
  color: #f1d16a;
  font-weight: 700;
}

.employee-card.lost .employee-status {
  color: #d98264;
}

.employee-face {
  position: relative;
  display: block;
  width: 52px;
  height: 58px;
  border: 2px solid #0c0c08;
  background: #445c34;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
  image-rendering: pixelated;
}

.employee-face span {
  position: absolute;
  display: block;
}

.employee-face .head {
  left: 12px;
  top: 13px;
  width: 28px;
  height: 28px;
  background: #d39b6a;
}

.employee-face .hair {
  left: 10px;
  top: 8px;
  width: 32px;
  height: 13px;
  background: #3a2619;
}

.employee-face .eye {
  top: 24px;
  width: 4px;
  height: 4px;
  background: #16130f;
}

.employee-face .eye.left {
  left: 19px;
}

.employee-face .eye.right {
  left: 30px;
}

.employee-face .mouth {
  left: 23px;
  top: 33px;
  width: 9px;
  height: 3px;
  background: #6f3026;
}

.employee-face .shirt {
  left: 9px;
  top: 41px;
  width: 34px;
  height: 14px;
  background: #ca2f26;
}

.employee-face.ryan .head {
  background: #c98456;
}

.employee-face.ryan .hair {
  background: #211813;
  height: 10px;
}

.employee-face.ryan .shirt {
  background: #d6b23e;
}

.employee-face.ben .head {
  background: #e0ad78;
}

.employee-face.ben .hair {
  background: #6a3b22;
}

.employee-face.ben .shirt {
  background: #486bb0;
}

.employee-face.ben .mouth {
  width: 11px;
}

.status-line {
  min-height: 38px;
  padding: 9px 12px;
  color: #f7efc6;
  font-weight: 700;
}

.help-panel {
  color: #efe7bc;
}

.help-panel summary {
  min-height: 42px;
  padding: 10px 12px;
  color: #fff5bb;
  cursor: pointer;
  font-weight: 700;
  list-style-position: inside;
}

.help-panel summary:focus-visible {
  outline: 2px solid #e1cb69;
  outline-offset: 2px;
}

.help-content {
  display: grid;
  gap: 14px;
  padding: 0 12px 14px;
}

.help-content section {
  display: grid;
  gap: 6px;
}

.help-content h2,
.help-content p {
  margin: 0;
}

.help-content h2 {
  color: #f1d16a;
  font-size: 0.88rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.help-content p,
.legend-grid {
  color: #ddd4a8;
  font-size: 0.92rem;
  line-height: 1.35;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px 14px;
}

.legend-grid span {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
}

.legend-swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid #11100b;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.legend-swatch.mower {
  background: linear-gradient(90deg, #191919 0 25%, #ca2f26 25% 74%, #d7d0bd 74%);
}

.legend-swatch.zombie {
  background: linear-gradient(#315a38 0 45%, #4a365f 45%);
}

.legend-swatch.dog {
  background: linear-gradient(90deg, #f0d49b 0 22%, #c99553 22% 82%, #2c1a10 82%);
}

.legend-swatch.poo {
  background: radial-gradient(circle at 55% 35%, #7a421f 0 22%, #4a2612 23% 70%, transparent 71%), #242316;
}

.legend-swatch.grass {
  background: repeating-linear-gradient(90deg, #3e702b 0 7px, #376827 7px 14px);
}

.legend-swatch.cut {
  background: repeating-linear-gradient(90deg, #6b8a3c 0 7px, #617f35 7px 14px);
}

.legend-swatch.muffler {
  background: linear-gradient(90deg, #b8b9a9 0 72%, #5c5e56 72%);
}

.legend-swatch.vest {
  background: linear-gradient(90deg, #f2e747 0 42%, #ff8d2a 42% 58%, #f2e747 58%);
}

.legend-swatch.golden {
  background: radial-gradient(circle, #fff0a0 0 18%, #f2d15c 19% 70%, #9a7021 71%);
}

body.focus-mode {
  overflow: hidden;
}

body.focus-mode .shell {
  display: grid;
  width: 100vw;
  height: 100vh;
  padding: 0;
  place-items: center;
}

body.focus-mode .game-panel,
body.focus-mode .play-layout {
  width: 100vw;
  height: 100vh;
}

body.focus-mode .game-panel {
  display: grid;
  gap: 0;
  place-items: center;
}

body.focus-mode .play-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  place-items: center;
}

body.focus-mode .title-strip,
body.focus-mode .hud,
body.focus-mode .crew-panel,
body.focus-mode .status-line,
body.focus-mode .help-panel {
  display: none;
}

body.focus-mode .stage {
  display: grid;
  width: 100vw;
  height: 100vh;
  max-width: none;
  background: #0c0c08;
  place-items: center;
}

body.focus-mode canvas {
  width: min(83.333vw, calc(83.333vh * 25 / 18));
  height: min(83.333vh, calc(83.333vw * 18 / 25));
  max-width: none;
  border: 0;
  box-shadow: none;
}

body.focus-mode .focus-exit {
  display: block;
}

@media (max-width: 980px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .crew-panel {
    min-height: 0;
  }

  .employee-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .employee-card {
    grid-template-columns: 52px 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 8px;
  }

  .title-strip {
    grid-template-columns: minmax(0, 1fr) 74px;
    min-height: 92px;
    padding: 10px;
  }

  .title-copy h1 {
    font-size: 1.7rem;
  }

  .title-copy p {
    font-size: 0.82rem;
  }

  .title-mascot {
    width: 68px;
    height: 62px;
    transform: scale(0.86);
    transform-origin: right center;
  }

  .hud {
    grid-template-columns: repeat(3, minmax(78px, 1fr));
  }

  .hud button {
    min-height: 54px;
  }

  .hud-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-list {
    grid-template-columns: 1fr;
  }

  .legend-grid {
    grid-template-columns: 1fr;
  }
}
