:root {
  --paper: #f6f1e5;
  --ink: #25302f;
  --orange: #ed5a28;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: ui-rounded, "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #d7d0bf;
}
.shell {
  height: 100%;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) 40px;
  gap: 8px;
  padding: 10px 18px;
  background: radial-gradient(circle at 50% 15%, #f0ece2, #d0c8b7);
}
header,
footer {
  width: min(1180px, 100%);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header small {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.19em;
  color: #8a7462;
}
h1 {
  margin: 2px 0 0;
  font-size: 30px;
  letter-spacing: -0.055em;
  transform: skew(-5deg);
}
.stats {
  display: flex;
  gap: 7px;
}
.stats span {
  min-width: 82px;
  padding: 7px 10px;
  background: #eee7d8;
  border: 1px solid rgba(39, 49, 47, 0.14);
  box-shadow: 0 3px rgba(58, 48, 34, 0.08);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.stats b {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  letter-spacing: 0;
}
.paper {
  position: relative;
  width: min(1180px, 100%);
  height: 100%;
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(51, 50, 43, 0.16);
  border-radius: 8px;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(91, 148, 173, 0.16) 1px, transparent 1px),
    linear-gradient(
      90deg,
      transparent 72px,
      rgba(214, 82, 82, 0.2) 73px,
      transparent 74px
    );
  background-size:
    100% 34px,
    100% 100%;
  box-shadow: 0 18px 50px rgba(64, 55, 38, 0.2);
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.intro {
  position: absolute;
  left: 17px;
  bottom: 15px;
  padding: 9px 12px;
  background: rgba(255, 253, 246, 0.93);
  border-left: 4px solid var(--orange);
  transition: 0.25s;
  pointer-events: none;
}
.intro.hidden {
  opacity: 0;
}
.intro b,
.intro span {
  display: block;
}
.intro b {
  font-size: 11px;
  letter-spacing: 0.1em;
}
.intro span {
  margin-top: 3px;
  font-size: 11px;
  color: #68726f;
}
.powerbar {
  position: absolute;
  top: 13px;
  left: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 70%;
  pointer-events: none;
}
.power {
  padding: 6px 9px;
  border-radius: 3px;
  background: #26302f;
  color: white;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 3px 3px 0 rgba(237, 90, 40, 0.7);
}
.power.shield {
  background: #238f9d;
}
.top-actions {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 4;
  display: flex;
  gap: 6px;
}
.top-actions button,
.top-actions a {
  border: 0;
  background: rgba(37, 48, 47, 0.9);
  color: #fff;
  padding: 7px 9px;
  font: 900 8px inherit;
  letter-spacing: 0.09em;
  text-decoration: none;
  cursor: pointer;
}
.challenges {
  position: absolute;
  z-index: 9;
  right: 14px;
  top: 48px;
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 64px);
  overflow: auto;
  display: none;
  padding: 18px;
  background: rgba(250, 247, 237, 0.97);
  border: 1px solid #bcb3a2;
  box-shadow: 8px 8px 0 rgba(37, 48, 47, 0.18);
}
.challenges.show { display: block; }
.challenges > button { float: right; border: 0; background: none; font-size: 24px; cursor: pointer; }
.challenges small { font-weight: 900; letter-spacing: 0.14em; color: #a84825; }
.challenges h2 { margin: 2px 0 12px; }
.challenge { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 9px 0; border-top: 1px solid #ddd4c4; font-size: 11px; }
.challenge b { letter-spacing: 0.03em; }
.challenge span { font-weight: 900; }
.challenge i { grid-column: 1/-1; height: 4px; background: #ddd5c7; }
.challenge i::after { content: ""; display: block; width: var(--p); height: 100%; background: #ed5a28; }
.challenge.done span { color: #198b55; }
.challenges p { font-size: 10px; color: #6b746f; }
.pause,
.game-over {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  text-align: center;
  background: rgba(246, 241, 229, 0.9);
  backdrop-filter: blur(3px);
  z-index: 5;
}
.pause.show,
.game-over.show {
  display: grid;
}
.pause b {
  font-size: 44px;
}
.pause span {
  font-weight: 800;
}
.game-over small {
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #ad4b27;
}
.game-over h2 {
  margin: 3px;
  font-size: 46px;
  letter-spacing: -0.05em;
}
.game-over p {
  margin: 6px 0 18px;
}
.game-over button {
  justify-self: center;
  border: 0;
  background: #25302f;
  color: white;
  padding: 13px 20px;
  font: 900 13px inherit;
  letter-spacing: 0.1em;
  box-shadow: 5px 5px 0 var(--orange);
  cursor: pointer;
}
.mobile-controls {
  display: none;
  position: absolute;
  bottom: 12px;
  right: 12px;
  gap: 8px;
}
.mobile-controls button {
  width: 58px;
  height: 48px;
  border: 0;
  border-radius: 7px;
  background: rgba(37, 48, 47, 0.86);
  color: #fff;
  font-size: 25px;
  touch-action: none;
}
footer {
  font-size: 10px;
  font-weight: 800;
  color: #68726f;
}
footer b {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 23px;
  padding: 0 5px;
  background: #f5f0e4;
  border: 1px solid #aaa392;
  border-radius: 4px;
  color: #26302f;
}
footer strong {
  color: #d34d20;
  letter-spacing: 0.11em;
}
@media (max-width: 760px) {
  .shell {
    padding: 5px;
    grid-template-rows: 55px minmax(0, 1fr) 28px;
  }
  .stats span:nth-child(3),
  .stats span:nth-child(4) {
    display: none;
  }
  .stats span {
    min-width: 64px;
    padding: 5px 7px;
  }
  h1 {
    font-size: 20px;
  }
  header small {
    font-size: 7px;
  }
  .mobile-controls {
    display: flex;
  }
  .intro {
    bottom: 70px;
    max-width: 250px;
  }
  .intro span {
    font-size: 9px;
  }
  footer span:nth-child(3) {
    display: none;
  }
}
