@font-face {
  font-family: Jua;
  src: url(./jua.woff2) format("woff2");
  font-display: swap;
}
:root {
  --ink: #503d33;
  --paper: #fff8e8;
  --red: #a0463e;
  --line: #685044;
  --mint: #c6e3c1;
  --body: system-ui, -apple-system, sans-serif;
  --title: Jua, var(--body);
  color: var(--ink);
  font-family: var(--body);
  background-color: #f6edda;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background-image: radial-gradient(#9a7d4f25 0.8px, transparent 0.9px);
  background-size: 9px 9px;
}
button {
  font-family: var(--title);
  font-size: 17px;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid #ca7836;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.65;
}
button:active {
  translate: 0 2px;
}
[hidden] {
  display: none !important;
}
#cover {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 56px);
}
.postcard {
  position: relative;
  max-width: 1120px;
  width: 100%;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 7px;
  box-shadow: 5px 7px 0 #69523d30;
  padding: clamp(14px, 3.1vw, 41px);
  border-top: 0;
  overflow: hidden;
}
.postcard:before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 9px;
  background: repeating-linear-gradient(
    130deg,
    #8aacae 0 18px,
    #fffae8 18px 33px,
    #c07767 33px 51px,
    #fffae8 51px 67px
  );
  border-bottom: 1px solid #977b65;
}
.posthead,
.postfoot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 16px var(--title);
  color: #72594d;
  gap: 10px;
}
.posthead {
  border-bottom: 1px solid #b8a68f;
  padding: 5px 0 10px;
}
.posthead [lang] {
  font:
    700 11px Georgia,
    serif;
  letter-spacing: 0.18em;
}
.postfoot {
  border-top: 1px dashed #ad9784;
  margin-top: 18px;
  padding-top: 13px;
  font-size: 14px;
}
.spread {
  display: grid;
  grid-template-columns: 1fr 1.06fr;
  align-items: center;
  gap: 4%;
  padding: 18px 3%;
}
.dispatch,
.label {
  font: 15px var(--title);
  color: var(--red);
}
.dispatch {
  display: inline-block;
  border-bottom: 2px solid var(--red);
  padding: 3px 1px 5px;
}
.intro h1 {
  font: clamp(68px, 7.6vw, 110px)/0.95 var(--title);
  margin: 19px 0 15px;
  letter-spacing: -0.065em;
  color: #344940;
}
.intro h1 span {
  color: #b45d43;
}
.intro p {
  font-weight: 620;
  font-size: clamp(15px, 1.6vw, 21px);
  line-height: 1.55;
  word-break: keep-all;
  margin: 10px 0 18px;
}
.action {
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: #f1c66d;
  padding: 10px 26px;
  min-height: 48px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 21px;
}
.picture {
  position: relative;
  transform: rotate(2deg);
  aspect-ratio: 1.04;
  padding: 12px;
  background: #ecdfc1;
  outline: 1px dashed #aa9276;
  outline-offset: -5px;
  box-shadow: 3px 5px 0 #816b513e;
}
.print {
  position: relative;
  isolation: isolate;
  height: 100%;
  background:
    linear-gradient(0deg, #18304155, transparent 40%),
    url(./village.webp) center/cover;
  border: 1.5px solid var(--line);
  overflow: hidden;
}
.hero {
  position: absolute;
  left: 20%;
  top: 17%;
  width: 60%;
  height: 62%;
  object-fit: contain;
  filter: drop-shadow(4px 7px 2px #26382b75);
  animation: float 4s ease-in-out infinite;
}
.postmark {
  position: absolute;
  right: -4%;
  bottom: 6%;
  transform: rotate(-13deg);
  background: #ffedcdec;
  border: 4px double #964e3f;
  border-radius: 50%;
  width: 78px;
  height: 78px;
  display: grid;
  align-content: center;
  text-align: center;
  line-height: 1.05;
  font: 20px var(--title);
  color: #884738;
}
.postmark small {
  font-size: 13px;
}
@keyframes float {
  50% {
    transform: translate(3px, -7px) rotate(-2deg);
  }
}
#game {
  max-width: 1180px;
  margin: auto;
  min-height: 100svh;
  padding: 0 max(14px, env(safe-area-inset-right)) 12px
    max(14px, env(safe-area-inset-left));
}
header,
.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
header {
  min-height: 54px;
  border-bottom: 1px solid #b09b80;
}
header strong {
  font: 26px var(--title);
  color: #384c43;
}
header button,
.back {
  min-height: 44px;
  min-width: 44px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
}
header div {
  display: flex;
  gap: 6px;
}
.desk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vw, 40px);
  padding: 8px 0;
}
.field {
  width: min(100%, calc((100svh - 118px)), calc(100% - 238px), 740px);
}
.status {
  font: 15px var(--title);
  min-height: 34px;
  margin: 0 3px 5px;
}
.status strong {
  font-weight: 400;
  font-size: 17px;
}
.map {
  position: relative;
  isolation: isolate;
  border: 3px solid var(--line);
  border-radius: 17px;
  overflow: hidden;
  background: #304e50;
  box-shadow: 0 4px 0 #978569;
  width: 100%;
  aspect-ratio: 1;
}
.map canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}
#boss {
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 2%;
  transform: translateX(-50%);
  border: 2px solid #705967;
  border-radius: 13px;
  background: #f4e5f3e8;
  padding: 3px 13px;
  text-align: center;
  font: 14px var(--title);
}
#boss b {
  font-weight: 400;
}
#boss i {
  display: block;
  overflow: hidden;
  border-radius: 6px;
  height: 5px;
  background: #ccbdc4;
}
#boss em {
  display: block;
  height: 100%;
  background: #8d5a93;
  transition: width 0.32s;
}
.ticket {
  position: relative;
  width: 218px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 4px 4px 12px 12px;
  box-shadow: 2px 4px 0 #9b856735;
  padding: 15px;
}
.tickethead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed #b69d81;
  margin-bottom: 17px;
  padding-bottom: 8px;
  font: 20px var(--title);
}
.tickethead img {
  width: 30px;
}
.label {
  display: block;
}
.ticket > strong {
  font: 30px var(--title);
}
.ticket p,
.sheet p {
  line-height: 1.55;
  font-size: 15px;
  font-weight: 600;
  word-break: keep-all;
}
.ledger {
  border-top: 1px dashed #c7b59c;
  padding-top: 10px;
}
#stamps {
  display: flex;
  gap: 6px;
  margin: 7px 0 12px;
}
#stamps i {
  width: 22px;
  height: 22px;
  font: 14px var(--title);
  display: grid;
  place-content: center;
  border: 1.5px dashed #b49b80;
  border-radius: 50%;
  color: #93795d;
}
#stamps i.done {
  background: #d3e5be;
  border: 2px solid #597760;
  color: #425d45;
  transform: rotate(-8deg);
}
#keyHelp {
  display: block;
  font-size: 12px;
  line-height: 1.6;
  color: #766453;
}
#overlay {
  position: fixed;
  inset: 0;
  background: #172c32ad;
  display: grid;
  place-items: center;
  padding: 14px;
  z-index: 3;
}
.sheet {
  width: min(455px, 100%);
  max-height: 95dvh;
  overflow: auto;
  text-align: center;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  padding: 19px;
  box-shadow: 4px 7px 0 #2d383561;
}
.sheet > img {
  width: 86px;
  height: 80px;
  object-fit: contain;
}
.sheet h2 {
  font: 34px var(--title);
  margin: 6px 0;
}
.sheet p {
  margin: 9px 0 16px;
}
#choices {
  display: flex;
  gap: 6px;
}
#choices button {
  flex: 1;
  min-height: 68px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #cce4c7;
}
#choices button:nth-child(2) {
  background: #d8d5ec;
}
#choices button:nth-child(3) {
  background: #f6df9f;
}
#choices small {
  display: block;
  font: 12px var(--body);
  margin-top: 4px;
}
.back {
  display: block;
  border: 0;
  background: transparent;
  margin: 5px auto 0;
}
@media (orientation: portrait) {
  #cover {
    padding: 16px;
  }
  .postcard {
    max-width: 600px;
    padding: 18px;
  }
  .spread {
    display: flex;
    flex-direction: column-reverse;
    gap: 13px;
    padding: 18px 0 0;
  }
  .picture {
    width: min(87%, 39svh);
    aspect-ratio: 1.16;
  }
  .intro {
    text-align: center;
  }
  .intro h1 br {
    display: none;
  }
  .intro h1 {
    font-size: clamp(44px, 9vw, 73px);
    margin: 12px 0 5px;
  }
  .intro p {
    margin: 8px 0 12px;
    font-size: 16px;
  }
  .postmark {
    width: 62px;
    height: 62px;
    font-size: 16px;
  }
  .postfoot {
    font-size: 12px;
  }
  .desk {
    flex-direction: column;
    gap: 13px;
    padding-top: 4px;
  }
  .field,
  .ticket {
    width: min(100%, calc(100svh - 201px), 730px);
  }
  header {
    min-height: 50px;
  }
  .ticket {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 16px;
    padding: 10px 14px;
  }
  .tickethead,
  #keyHelp {
    display: none;
  }
  .ticket > .label {
    grid-column: 1;
    grid-row: 1;
    font-size: 13px;
  }
  .ticket > strong {
    grid-column: 1;
    grid-row: 2;
    font-size: 23px;
  }
  .ticket p {
    grid-column: 2;
    grid-row: 1/3;
    margin: 0;
    font-size: 14px;
  }
  .ledger {
    grid-column: 1/-1;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 7px;
    padding-top: 5px;
  }
  .ledger .label {
    font-size: 12px;
  }
  #stamps {
    margin: 0;
  }
  #stamps i {
    width: 17px;
    height: 17px;
    font-size: 11px;
  }
}
@media (orientation: landscape) and (max-height: 570px) {
  #cover {
    padding: 12px;
  }
  .postcard {
    max-width: 750px;
    padding: 12px 19px;
  }
  .spread {
    padding: 3px 10px;
  }
  .picture {
    width: min(95%, 62svh);
    justify-self: center;
  }
  .intro h1 {
    font-size: 48px;
    margin: 6px 0;
  }
  .intro p {
    font-size: 13px;
    margin: 4px 0 9px;
  }
  .postfoot {
    margin-top: 7px;
    padding-top: 5px;
  }
  .posthead {
    font-size: 12px;
  }
  .postmark {
    width: 52px;
    height: 52px;
    font-size: 13px;
  }
  .action {
    font-size: 17px;
    min-height: 44px;
  }
  .desk {
    padding-top: 1px;
  }
  header {
    min-height: 46px;
  }
  .field {
    width: min(calc(100svh - 85px), calc(100% - 200px));
  }
  .status {
    min-height: 24px;
    margin-bottom: 1px;
  }
  .ticket {
    width: 185px;
    padding: 10px;
  }
  .tickethead,
  #keyHelp {
    display: none;
  }
  .sheet > img {
    width: 60px;
    height: 55px;
  }
  .sheet {
    padding: 8px 13px;
  }
  .sheet p {
    margin: 5px 0;
  }
  .sheet h2 {
    font-size: 27px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero {
    animation: none;
  }
}
