:root {
  color-scheme: dark;
  --ink: #e7e1cc;
  --gold: #d8b578;
  --line: #454b43;
  --muted: #a6afa2;
  --panel: #222a27;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 4%, #303931, #191f1d 69%, #171c1b);
  font:
    14px "Yu Gothic UI",
    "Meiryo",
    sans-serif;
  color: var(--ink);
  min-height: 100vh;
}
main {
  width: min(1150px, 96vw, max(580px, calc((100svh - 250px) * 1.86)));
  margin: auto;
  padding: 12px 0;
}
header,
.bar,
.status,
.rosterhead {
  display: flex;
  align-items: center;
}
header {
  gap: 15px;
  margin-bottom: 10px;
}
.crest {
  height: 44px;
  width: 38px;
  display: grid;
  place-items: center;
  background: #b99a62;
  color: #29332c;
  clip-path: polygon(0 0, 100% 0, 94% 65%, 50% 100%, 6% 65%);
  font:
    30px Georgia,
    serif;
}
.heading {
  flex: 1;
}
.eyebrow,
small {
  color: var(--gold);
  font:
    10px Georgia,
    serif;
  letter-spacing: 0.16em;
}
.eyebrow b {
  font-weight: 400;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font:
    600 clamp(17px, 2vw, 29px) / 1.25 "Yu Mincho",
    "MS PMincho",
    serif;
  letter-spacing: 0.06em;
}
h1 span {
  color: var(--gold);
  margin-left: 3px;
}
.clock,
.wave {
  border-left: 1px solid var(--line);
  padding: 0 8px 0 18px;
}
.clock small,
.wave small {
  display: block;
  color: var(--muted);
  font: 10px sans-serif;
}
.clock strong,
.wave strong {
  font:
    22px Georgia,
    serif;
  font-variant-numeric: tabular-nums;
}
.board {
  border: 1px solid #756e54;
  box-shadow: 0 14px 45px #10141166;
  background: #1e2522;
}
.bar,
.status {
  justify-content: space-between;
  gap: 10px;
  padding: 5px 12px;
  font-size: 12px;
}
.bar {
  background: #2a322b;
  min-height: 28px;
}
.village {
  display: flex;
  align-items: center;
  gap: 7px;
}
.village > i {
  background: var(--gold);
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
}
.village b {
  font: 12px monospace;
}
.life {
  display: block;
  width: 64px;
  height: 4px;
  background: #454d40;
}
.life i {
  display: block;
  height: 100%;
  background: #c9b783;
}
#waveHint {
  color: #e1c593;
}
#field {
  position: relative;
  aspect-ratio: 480/258;
  overflow: hidden;
  background: #687650;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
}
#labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.site {
  position: absolute;
  transform: translateX(-50%);
  background: #233029ee;
  border: 1px solid #94a38099;
  color: #f4ebce;
  border-radius: 2px;
  text-align: center;
  padding: 1px 5px 2px;
  white-space: nowrap;
  font-size: clamp(10px, 1.05vw, 13px);
  font-weight: bold;
  text-shadow: 0 1px #151e18;
}
.site em {
  font-style: normal;
  color: #e4ca90;
  margin-left: 5px;
}
.site .hp {
  display: block;
  height: 2px;
  background: #4f5848;
  margin-top: 1px;
}
.site .hp i {
  display: block;
  height: 100%;
  background: #c7bc86;
}
.site.ruined {
  border-color: #df8e71;
}
.status {
  color: var(--muted);
  font-size: 11px;
  min-height: 25px;
}
.status span:last-child {
  font-variant-numeric: tabular-nums;
  color: #d2bc91;
  white-space: nowrap;
}
.rosterhead {
  justify-content: space-between;
  margin: 9px 0 6px;
}
.rosterhead h2 {
  font:
    600 15px "Yu Mincho",
    serif;
  letter-spacing: 0.08em;
}
.rosterhead span {
  font-size: 11px;
  color: var(--muted);
}
#heroes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: linear-gradient(105deg, #303931, #242c28);
  border: 1px solid #414c41;
  border-left: 3px solid var(--accent);
  min-width: 0;
}
.card canvas {
  width: 30px;
  height: 40px;
  flex: none;
}
.card b {
  font-size: 14px;
}
.card .sub,
.card .gear {
  font-size: 11px;
  color: #b3baa9;
  white-space: nowrap;
}
.card .gear {
  color: #dfceb0;
}
.card .mini {
  height: 2px;
  background: #485144;
  margin-top: 3px;
}
.card .mini i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.card .info {
  flex: 1;
  min-width: 0;
}
#dialog {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #19221f66;
}
#dialog[hidden],
[hidden] {
  display: none !important;
}
article {
  width: min(350px, 80%);
  background: #222b26f7;
  border: 1px solid #bcaa80;
  text-align: center;
  padding: 20px 24px;
  box-shadow: 0 12px 35px #18221aa6;
}
article h2 {
  font:
    600 24px "Yu Mincho",
    serif;
  color: #f5e7c6;
  margin: 5px 0 10px;
}
article p {
  font-size: 13px;
  line-height: 1.75;
  color: #d6d8c9;
  white-space: pre-line;
}
#actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
}
button {
  font-size: 14px;
  font-family: inherit;
  padding: 8px 15px;
  border: 1px solid #baab83;
  background: #dfc697;
  color: #292c25;
  cursor: pointer;
  font-weight: bold;
}
button + button {
  color: var(--ink);
  background: transparent;
  border-color: #6b7363;
}
button:hover {
  filter: brightness(1.15);
}
button:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}
#bootError {
  padding: 20px;
  color: #ffc8a2;
}
@media (max-width: 800px) {
  main {
    width: 98vw;
  }
  header {
    gap: 7px;
  }
  .card {
    gap: 4px;
    padding: 4px;
  }
  .card canvas {
    width: 20px;
    height: 30px;
  }
  .card .sub {
    font-size: 10px;
  }
  .rosterhead {
    margin-top: 6px;
  }
}
