@font-face {
  font-family: Jua;
  src: url("./jua.woff2") format("woff2");
  font-display: swap;
}
:root {
  --paper: #fff8ec;
  --ink: #503c30;
  --edge: #624b39;
  --mint: #bde8d3;
  --lav: #d4c3f8;
  --butter: #ffe7a1;
  --peach: #ffc9d6;
  --shadow: 0 4px 0 #765b4933;
  font-family:
    system-ui,
    -apple-system,
    "Malgun Gothic",
    sans-serif;
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
}
[hidden] {
  display: none !important;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: default;
}
button:focus-visible {
  outline: 4px solid #167f73;
  outline-offset: 2px;
}
h1,
h2,
b,
legend,
.paint,
.map-label,
.bubble,
.versus,
.nameplate,
.eyebrow,
.tools,
.ward,
.score,
#wallet,
#tip,
#receipt,
.folio {
  font-family: Jua, system-ui, sans-serif;
  font-weight: 400;
}
#title {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 22px max(16px, env(safe-area-inset-left));
  background-color: var(--paper);
  background-image: radial-gradient(#cbb79670 0.8px, transparent 0.9px);
  background-size: 14px 14px;
}
.cover-inner {
  width: min(945px, 100%);
}
.cover-head {
  text-align: center;
}
.map-label,
.folio {
  font-size: 15px;
  display: table;
  margin: 0 auto 10px;
  padding: 5px 14px;
  background: var(--butter);
  border: 2px solid var(--edge);
  border-radius: 10px;
  box-shadow: 0 3px 0 #654c3922;
  transform: rotate(-2deg);
}
h1 {
  margin: 0;
  font-size: clamp(62px, 7.5vw, 106px);
  letter-spacing: -0.055em;
  line-height: 1.1;
  color: var(--mint);
  -webkit-text-stroke: 2px var(--edge);
  paint-order: stroke fill;
  text-shadow: 0 4px var(--edge);
}
h1 span {
  color: var(--lav);
}
.cover-head > p:last-child {
  font-weight: 700;
  margin: 9px 0 15px;
  font-size: clamp(14px, 1.6vw, 20px);
  word-break: keep-all;
}
.match {
  height: clamp(210px, 35vh, 340px);
  position: relative;
  border: 2.5px solid var(--edge);
  border-radius: 60% 55% 24px 24px / 13% 12% 24px 24px;
  background: #e1eecc url("./courtyard.webp") center 43% / cover;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2%;
  padding: 0 4% 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.team {
  position: relative;
  width: 40%;
  height: 84%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.team > div {
  width: 100%;
  height: 80%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.team img {
  width: 55%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(1px 4px 0 #604a342b);
}
.team img + img {
  margin-left: -9%;
}
.team img:first-child {
  height: 85%;
}
.foes img:first-child {
  height: 58%;
  width: 38%;
}
.foes img:last-child {
  width: 69%;
}
.bubble {
  position: relative;
  white-space: nowrap;
  background: white;
  border: 2px solid var(--edge);
  border-radius: 15px;
  padding: 5px 12px;
  margin: 0 0 7px;
  font-size: clamp(13px, 1.8vw, 20px);
  box-shadow: 0 2px 0 #70584733;
}
.allies .bubble {
  background: #e8fbef;
  transform: rotate(-3deg);
}
.foes .bubble {
  background: #ffe5ee;
  transform: rotate(3deg);
}
.versus {
  align-self: center;
  background: #ec92ae;
  color: white;
  font-size: clamp(20px, 3vw, 38px);
  border: 2.5px solid var(--edge);
  border-radius: 50%;
  padding: 5px 8px;
  transform: rotate(-7deg);
  box-shadow: 0 3px var(--edge);
}
.enlist {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 26px;
  margin-top: 24px;
}
.enlist fieldset,
.camp-paper,
.paper {
  background: #fffdf8;
  border: 2px solid var(--edge);
  border-radius: 23px;
  box-shadow: var(--shadow);
}
fieldset {
  margin: 0;
  min-width: 0;
  padding: 10px 15px 14px;
}
legend {
  border: 2px solid var(--edge);
  padding: 3px 13px;
  background: var(--butter);
  border-radius: 14px;
  font-size: 18px;
}
.choices,
.market {
  display: flex;
  gap: 9px;
}
.choices button,
.market button,
.tools button,
#home {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  background: #fffdf8;
  border: 2px solid var(--edge);
  border-radius: 14px;
  min-height: 44px;
  box-shadow: 0 2px 0 #5b46363d;
}
.choices button {
  width: 50%;
  position: relative;
  padding: 5px 12px;
}
.choices button[aria-pressed="true"] {
  background: var(--butter);
}
.choices button[aria-pressed="true"]:after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-weight: 900;
}
.choices img {
  height: clamp(44px, 7vh, 67px);
  width: 58px;
  object-fit: contain;
}
.choices span,
.market span {
  display: grid;
  text-align: left;
}
.choices b,
.market b {
  font-size: 19px;
}
.choices small,
.market small {
  font-size: 12px;
  font-weight: 700;
}
.send {
  align-self: end;
  display: grid;
  gap: 9px;
  text-align: center;
  padding-bottom: 5px;
}
.send small {
  font-size: 12px;
  font-weight: 650;
}
.paint {
  font-size: 22px;
  min-height: 51px;
  border: 2px solid var(--edge);
  border-radius: 17px;
  background: #bde8d3;
  padding: 10px 30px;
  box-shadow: 0 4px 0 var(--edge);
}
.paint:active {
  box-shadow: 0 1px var(--edge);
  transform: translateY(2px);
}
#arena {
  position: fixed;
  inset: 0;
  isolation: isolate;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
header {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
.ward,
.nameplate,
.score,
#wallet,
#tip {
  background: #fffaf0f5;
  border: 2px solid var(--edge);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.ward {
  padding: 6px 12px 10px;
}
.eyebrow {
  font-size: 14px;
}
#lamps,
.tools,
.pulses {
  display: flex;
  align-items: center;
  gap: 5px;
}
.lamp {
  width: 12px;
  height: 14px;
  border: 1.5px solid var(--edge);
  border-radius: 35%;
  background: #ffbb68;
  box-shadow:
    inset 2px 0 #ed8b63,
    inset -2px 0 #ed8b63;
}
.lamp.out {
  opacity: 0.22;
}
.tools {
  pointer-events: auto;
}
.tools button {
  padding: 0 10px;
  min-width: 44px;
  font-size: 14px;
}
.nameplate {
  position: absolute;
  top: max(13px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 15px;
  text-align: center;
  font-size: clamp(16px, 2vw, 22px);
  background: var(--lav);
}
.pulses {
  justify-content: center;
  height: 10px;
}
.pulses i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8c778f;
}
.pulses .lit {
  background: #fff3ad;
  box-shadow: 0 0 0 1px #705f46;
}
#life {
  min-width: 80px;
  height: 7px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  overflow: hidden;
  background: #fff8ec;
}
#lifeBar {
  display: block;
  height: 100%;
  background: #f68187;
}
#drum {
  position: absolute;
  background: transparent;
  border: 0;
  border-radius: 50%;
  touch-action: none;
}
#tip {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 13px;
  text-align: center;
  width: max-content;
  max-width: 74%;
  font-size: clamp(13px, 1.6vw, 18px);
  pointer-events: none;
  word-break: keep-all;
}
.score {
  position: absolute;
  right: 13px;
  bottom: 12px;
  display: grid;
  text-align: center;
  padding: 5px 10px;
}
.score strong {
  font-size: 24px;
  line-height: 1;
}
.score span {
  font-size: 12px;
}
#wallet {
  position: absolute;
  left: 13px;
  top: max(75px, calc(env(safe-area-inset-top) + 60px));
  padding: 4px 9px;
  background: var(--butter);
  font-size: 14px;
}
#dialog,
#camp {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: #47362879;
  display: grid;
  place-items: center;
  padding: 14px;
}
.camp-paper,
.paper {
  position: relative;
  padding: 22px;
  text-align: center;
  width: min(495px, 100%);
  max-height: 95dvh;
  overflow: auto;
}
.paper {
  max-width: 365px;
}
.paper h2,
.camp-paper h2 {
  font-size: clamp(28px, 5vw, 38px);
  margin: 12px 0 4px;
}
.paper p,
.camp-paper p {
  word-break: keep-all;
}
.camp-paper #forecast,
.paper #story {
  font-size: 15px;
  line-height: 1.5;
}
.market button {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  padding: 8px 3px;
}
.market span {
  text-align: center;
}
.market img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.market #buy-repair {
  background: #ffe6ae;
}
.market button:disabled {
  opacity: 0.55;
  background: #f1eddf;
}
.market #buy-totem {
  background: #ddf4e4;
}
.market #buy-bell {
  background: #eee6ff;
}
#balance {
  display: table;
  margin: 12px auto 9px;
  background: var(--butter);
  padding: 5px 12px;
  border-radius: 10px;
}
#receipt {
  font-size: 14px;
  min-height: 1.2em;
}
.paper #tally {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin: 15px;
}
.paper #tally div {
  display: grid;
}
.paper #tally strong {
  font-size: 23px;
}
#home {
  margin: 12px auto 0;
  border: none;
  box-shadow: none;
  background: transparent;
}
@media (max-width: 660px) {
  #title {
    padding: 18px 12px;
  }
  .enlist {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 15px;
  }
  .send {
    justify-self: center;
  }
  .match {
    height: clamp(166px, 26vh, 265px);
    padding-inline: 0;
    gap: 0;
  }
  .team {
    width: 43%;
    height: 88%;
  }
  .team .bubble {
    font-size: 13px;
    padding: 4px 8px;
  }
  .choices button {
    padding: 5px;
    gap: 4px;
  }
  .choices img {
    width: 41px;
  }
  .choices b {
    font-size: 17px;
  }
  .enlist fieldset {
    padding: 7px 9px 10px;
  }
  .cover-head p:last-child {
    margin: 8px 0 11px;
  }
  .nameplate {
    top: 76px;
    left: auto;
    right: 12px;
    transform: none;
  }
  .score {
    right: 7px;
    bottom: 8px;
  }
  .camp-paper,
  .paper {
    padding: 19px 12px;
  }
  .market b {
    font-size: 16px;
  }
  .market small {
    font-size: 11px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  #title {
    padding: 10px 16px;
  }
  h1 {
    font-size: 47px;
  }
  .cover-head .map-label {
    display: none;
  }
  .cover-head > p:last-child {
    margin: 2px;
  }
  .match {
    height: 124px;
  }
  .enlist {
    margin-top: 6px;
    gap: 15px;
  }
  .choices img {
    height: 35px;
  }
  .camp-paper {
    padding: 9px 15px;
  }
  .camp-paper h2 {
    font-size: 26px;
    margin: 4px;
  }
  .camp-paper .map-label,
  .camp-paper #forecast,
  .camp-paper #balance,
  .camp-paper #receipt {
    margin: 4px auto;
  }
  .market button {
    flex-direction: row;
  }
  .market img {
    width: 35px;
    height: 35px;
  }
  .nameplate {
    top: 6px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  #tip {
    bottom: 4px;
  }
  .tools button {
    min-height: 44px;
  }
}
