:root {
  color-scheme: dark;
  --paper: #fff5dc;
  --gold: #dabb81;
  --ink: #131813;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #1d2423;
  color: var(--paper);
  overflow: hidden;
}
canvas,
.shade,
.vignette,
#damage,
#hud {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
canvas {
  display: block;
  touch-action: none;
  outline: 0;
}
.shade,
.vignette,
#damage,
#hud {
  pointer-events: none;
}
.shade {
  background: linear-gradient(
    90deg,
    rgba(11, 16, 15, 0.92),
    rgba(11, 16, 15, 0.78) 20%,
    rgba(11, 16, 15, 0.28) 46%,
    transparent 68%
  );
  transition: opacity 0.4s;
}
.vignette {
  background: radial-gradient(
    ellipse at 52% 48%,
    transparent 42%,
    rgba(8, 11, 10, 0.38) 100%
  );
}
body:not([data-mode="lobby"]) .shade {
  opacity: 0;
}
#damage {
  box-shadow: inset 0 0 14vmax #c83b18;
  opacity: 0;
}
header {
  position: fixed;
  z-index: 3;
  left: max(4.4vw, 18px);
  right: max(4.4vw, 18px);
  top: max(4.5vh, env(safe-area-inset-top), 16px);
  display: flex;
  align-items: center;
  gap: 20px;
}
header a,
button {
  color: inherit;
  text-decoration: none;
  font: inherit;
}
button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #fbe7a7;
  outline-offset: 5px;
}
button:hover,
header a:hover {
  color: white;
}
header a {
  font:
    27px/1 Georgia,
    serif;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
header a span,
header button {
  font: 12px/1.3 system-ui;
  letter-spacing: 0.09em;
  text-shadow: 0 1px 5px black;
}
header button {
  padding: 8px 0;
}
#lobby {
  position: fixed;
  left: 7.6vw;
  top: 50%;
  transform: translateY(-42%);
  max-width: 88vw;
}
.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 11px/1.4 system-ui;
  letter-spacing: 0.32em;
  color: var(--gold);
}
.rule i {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 1px;
  background: currentColor;
}
.rule i:after {
  content: "";
  position: absolute;
  right: 0;
  top: -2px;
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: currentColor;
}
h1 {
  font:
    normal clamp(64px, 8.3vw, 146px)/1.03 Didot,
    "Bodoni MT",
    Baskerville,
    Georgia,
    serif;
  letter-spacing: -0.064em;
  margin: 16px 0 0;
}
.cn {
  font:
    500 clamp(18px, 1.65vw, 26px)/1.3 "Songti SC",
    "STSong",
    serif;
  color: #eddbba;
  margin: 9px 0 0;
  letter-spacing: 0.35em;
}
.lead,
#dialogCopy {
  font-size: 14px;
  line-height: 1.95;
  letter-spacing: 0.035em;
  color: #ede6d8;
}
.lead {
  margin: 30px 0 23px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 19px;
}
.actions button,
dialog button {
  font-size: 13px;
  letter-spacing: 0.07em;
}
.primary {
  background: #dfc797;
  color: #27291f;
  font-weight: 650;
  border: 1px solid #e6cc9d;
  padding: 13px 23px;
}
.primary:hover {
  background: #f5dfb5;
  color: #181916;
}
.primary:disabled {
  opacity: 0.65;
  cursor: progress;
}
[hidden] {
  display: none !important;
}
#hud {
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 5px #000;
}
.task,
.vital,
.cell {
  position: absolute;
}
.task {
  top: 11vh;
  left: 4.4vw;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.task b {
  color: #efcb8a;
  letter-spacing: 0.15em;
}
.vital,
.cell {
  bottom: 5.5vh;
}
.vital {
  left: 4.4vw;
}
.cell {
  right: 4.4vw;
}
.vital small,
.cell small {
  display: block;
  font: 11px system-ui;
  letter-spacing: 0.22em;
}
.cell b,
.vital b {
  font:
    34px/1.1 Georgia,
    serif;
}
.cell span {
  font: 12px monospace;
  color: #e6d4af;
}
#reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border: 1px solid #fff3d9;
  border-radius: 50%;
  box-shadow: 0 0 3px #000;
  transform: translate(-50%, -50%);
}
#reticle.hit {
  width: 13px;
  height: 13px;
  border-radius: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  border-color: #ffd386;
}
#feedback {
  position: absolute;
  white-space: pre-line;
  text-align: center;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  font-size: 13px;
  line-height: 1.65;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  background: #131712a3;
  max-width: 80vw;
  width: max-content;
}
#feedback:empty {
  display: none;
}
dialog {
  background: #202923f5;
  color: var(--paper);
  border: 1px solid #aa957644;
  padding: clamp(23px, 4vw, 46px);
  width: min(410px, 90vw);
  box-shadow: 0 18px 80px #0008;
}
dialog::backdrop {
  background: #0b100d94;
  backdrop-filter: blur(4px);
}
dialog h2 {
  font:
    30px/1.4 "Songti SC",
    Georgia,
    serif;
  margin: 17px 0 8px;
}
#dialogCopy {
  white-space: pre-line;
  margin: 0 0 22px;
}
#again {
  margin-left: 10px;
}
#touch {
  display: none;
}
body.touch #touch {
  display: block;
}
#touch > * {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  border: 1px solid #e5d9b180;
  background: #10191355;
  color: #fff3d4;
  border-radius: 50%;
}
#stick {
  bottom: 9%;
  left: 6%;
  width: 88px;
  height: 88px;
}
#stick i {
  position: absolute;
  top: 28px;
  left: 28px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f4e4bb66;
}
#trigger {
  right: 5%;
  bottom: 11%;
  width: 67px;
  height: 67px;
}
#load {
  right: calc(5% + 78px);
  bottom: 9%;
  width: 49px;
  height: 49px;
}
@media (max-width: 650px) and (orientation: portrait) {
  #lobby {
    top: auto;
    bottom: 8%;
    transform: none;
    left: 7%;
  }
  .shade {
    background: linear-gradient(
      0deg,
      #111813 4%,
      #111813e8 22%,
      #151a1655 54%,
      transparent 75%
    );
  }
  .lead {
    margin: 17px 0;
  }
  .vital,
  .cell {
    bottom: 2%;
  }
  .task {
    top: 9%;
  }
  #feedback {
    bottom: 27%;
  }
}
@media (max-height: 450px) {
  #lobby {
    transform: translateY(-36%);
  }
  h1 {
    font-size: 60px;
    margin-top: 5px;
  }
  .lead {
    margin: 9px 0;
  }
  .cn {
    margin-top: 0;
  }
  .primary {
    padding: 9px 16px;
  }
  .vital,
  .cell {
    bottom: 2%;
  }
  .task {
    top: 18%;
  }
  dialog {
    padding: 17px 26px;
  }
  dialog h2 {
    margin: 8px 0;
  }
  .vital b,
  .cell b {
    font-size: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
