:root {
  color-scheme: dark;
  --night: #17282e;
  --paper: #faeed4;
  --brass: #edbb74;
  --rust: #a64d35;
  --ink: #2c3233;
  --serif: 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'SimSun', Georgia, serif;
  --sans: 'PingFang SC', 'Noto Sans CJK SC', 'Microsoft YaHei', Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--paper);
  font-family: var(--sans);
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
button {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible {
  outline: 3px solid #ffcf7c;
  outline-offset: 4px;
}
button:active {
  filter: brightness(1.15);
}
button:disabled {
  cursor: wait;
}
#stage {
  --t: max(var(--safe-t), var(--host-top, 0px));
  --r: var(--safe-r);
  --b: var(--safe-b);
  --l: var(--safe-l);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  background: #30474c;
}
#field,
.cover,
.overlay,
#game-ui {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#field {
  display: block;
  outline: none;
}
.cover {
  overflow: hidden;
  background: #20333a url('assets/keyart.webp') center center/cover no-repeat;
}
.cover-ink {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(12, 26, 32, 0.72), rgba(12, 26, 32, 0.37) 36%, rgba(12, 26, 32, 0.01) 65%),
    linear-gradient(0deg, rgba(10, 22, 32, 0.38), transparent 21%);
}
.edition {
  position: absolute;
  left: calc(6.3% + var(--l));
  top: calc(7.5% + var(--t));
  display: flex;
  gap: 13px;
  align-items: center;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.24em;
  font-weight: bold;
  color: #f1d5ab;
  text-shadow: 0 1px 3px #233238;
}

.postmark {
  width: 40px;
  height: 38px;
  display: block;
  position: relative;
  border: 1px solid #e5c598;
  border-radius: 50%;
  transform: rotate(-12deg);
}
.postmark:before,
.postmark:after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 8px;
  height: 15px;
  border: 1px solid #e8cda4;
  transform: skew(-10deg);
}
.postmark:after {
  top: 8px;
  left: 11px;
  right: 11px;
  height: 10px;
  transform: rotate(45deg) skew(-9deg);
  border-top: 0;
  border-left: 0;
}
.postmark i {
  position: absolute;
  left: 29px;
  top: 22px;
  width: 17px;
  height: 1px;
  background: #e8cda4;
}
.postmark i:nth-child(2) {
  top: 25px;
}
.postmark i:nth-child(3) {
  top: 28px;
}
.cover-copy {
  position: absolute;
  left: calc(6.3% + var(--l));
  width: 55%;
  top: 49%;
  transform: translateY(-39%);
  text-shadow: 0 2px 12px #1a292e;
}
.wordmark {
  margin: 0 0 0.12em;
  color: #f4cca0;
  font:
    italic bold clamp(22px, 3vw, 54px) / 1 Georgia,
    'Times New Roman',
    serif;
  letter-spacing: 0.035em;
}
h1 {
  margin: 0 0 0.14em -0.065em;
  font: 900 clamp(54px, 8.1vw, 147px) / 1.15 var(--serif);
  letter-spacing: 0.015em;
  color: #fcf2d9;
  text-shadow:
    0 2px 0 #514e41,
    0 4px 16px #1a292e;
}
.chapter {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--serif);
  font-size: clamp(15px, 1.6vw, 27px);
  letter-spacing: 0.14em;
}
.chapter i {
  width: 36px;
  height: 1px;
  background: var(--brass);
}
.chapter span {
  color: #e9bd8d;
  font-size: 0.7em;
  letter-spacing: 0.2em;
}
.chapter b {
  font-weight: 600;
}
.premise {
  margin: 17px 0 0;
  color: #f0e5cf;
  font-size: clamp(13px, 1.13vw, 19px);
  line-height: 1.65;
  letter-spacing: 0.035em;
}
.cover-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.cover-actions {
  margin-top: clamp(20px, 4.5vmin, 55px);
}
.ticket {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 47px;
  padding: 0 19px;
  color: #243137;
  background: #efd3a2;
  border: 1px solid #f7deb3;
  box-shadow:
    inset 0 0 0 3px #efd3a2,
    inset 0 0 0 4px #b18c5d,
    0 3px 12px #16252c44;
  font-weight: 750;
  letter-spacing: 0.12em;
}
.ticket b {
  font-size: 1.3em;
  font-weight: 400;
  line-height: 1;
}
.ticket:hover {
  background: #f8e2bb;
}
.text-button {
  background: transparent;
  color: inherit;
  font-size: 14px;
  letter-spacing: 0.08em;
  min-height: 44px;
  padding: 0 6px;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-color: #b39974;
}
.sound-button,
.pause-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1d3035e8;
  border: 1px solid #c7ac7d8a;
  color: #f6e2bf;
  min-width: 45px;
  min-height: 45px;
}
.sound-button {
  position: absolute;
  right: calc(3.3% + var(--r));
  top: calc(5% + var(--t));
  gap: 8px;
  padding: 0 12px;
  font-size: 12px;
  letter-spacing: 0.1em;
}
.sound-bars {
  display: inline-flex;
  height: 13px;
  align-items: center;
  gap: 2px;
}
.sound-bars b {
  background: currentColor;
  width: 2px;
  height: 6px;
}
.sound-bars b:nth-child(2) {
  height: 13px;
}
.sound-bars b:nth-child(3) {
  height: 9px;
}
.sound-button[aria-pressed='false'] .sound-bars {
  opacity: 0.5;
  transform: scaleY(0.38);
}
#game-ui {
  pointer-events: none;
}
.hud {
  position: absolute;
  top: calc(13px + var(--t));
  left: calc(16px + var(--l));
  right: calc(16px + var(--r));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.vitals,
.location,
.boss-title {
  display: flex;
  align-items: center;
}
.vitals {
  height: 42px;
  padding: 4px 13px 4px 7px;
  gap: 8px;
  background: #1d3036f5;
  border: 1px solid #b89364;
  box-shadow: 0 2px 5px #25343b45;
  color: #efcf9b;
}
.hud-emblem {
  height: 28px;
  width: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #cba472;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #29383b;
}
.hud-emblem i,
.seal-score i {
  display: inline-block;
  position: relative;
  width: 15px;
  height: 10px;
  border: 1px solid #e6cb99;
  overflow: hidden;
  transform: rotate(-10deg);
}
.hud-emblem i:after,
.seal-score i:after {
  content: '';
  position: absolute;
  width: 10px;
  height: 9px;
  left: 1px;
  top: -6px;
  border: 1px solid #e6cb99;
  transform: rotate(45deg);
}
.health {
  height: 13px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.health i {
  width: 11px;
  height: 9px;
  transform: skewX(-20deg);
  background: #ffcc83;
  box-shadow: inset 0 -2px #d29354;
}
.health i.empty {
  background: #39484a;
  box-shadow: inset 0 0 0 1px #786f61;
}
.dash-line {
  height: 2px;
  background: #657374;
  margin-top: 3px;
  overflow: hidden;
}
.dash-line i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left;
  background: #98ddd2;
}
.seal-score {
  margin-left: 3px;
  padding-left: 10px;
  border-left: 1px solid #777465;
  display: flex;
  align-items: center;
  gap: 6px;
}
.seal-score b {
  font:
    600 12px Georgia,
    serif;
  letter-spacing: 0.06em;
}
.location {
  gap: 10px;
}
#region {
  font: 600 14px var(--serif);
  letter-spacing: 0.12em;
  color: #fff0d7;
  padding: 5px 10px;
  background: #24383cea;
  border-bottom: 1px solid #c2ab7b;
}
.pause-button {
  pointer-events: auto;
  gap: 4px;
  background: #23373bec;
}
.pause-button i {
  height: 13px;
  width: 3px;
  background: #f3e2bd;
}
#boss-hud {
  position: absolute;
  left: 50%;
  top: calc(12px + var(--t));
  transform: translateX(-50%);
  width: clamp(170px, 30%, 470px);
  padding: 6px 10px 8px;
  background: #233138f5;
  color: #f2ddba;
  border: 1px solid #a88a64;
}
.boss-title {
  justify-content: space-between;
  margin-bottom: 5px;
  font-family: var(--serif);
  letter-spacing: 0.08em;
  font-size: 15px;
}
.boss-title span {
  color: #e7bc84;
  font: 12px var(--sans);
  letter-spacing: 0;
}
.boss-track {
  height: 5px;
  overflow: hidden;
  background: #4d4240;
}
.boss-track i {
  display: block;
  height: 100%;
  background: #ea9166;
  transform-origin: left;
}
#route-hint,
#announcement {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #fff0cd;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px #223438;
  white-space: nowrap;
  max-width: 92%;
  text-align: center;
}
#route-hint {
  bottom: calc(10.5% + var(--b));
  padding: 5px 13px;
  background: #24363de8;
  border-left: 1px solid #d8b17a;
  font-size: clamp(12px, 1.1vw, 17px);
}
#announcement {
  top: calc(16% + var(--t));
  font: 600 clamp(15px, 2vw, 28px) var(--serif);
  background: #253839eb;
  border-top: 1px solid #b5976b;
  border-bottom: 1px solid #b5976b;
  padding: 7px 18px;
}
.keyboard-keys {
  position: absolute;
  bottom: calc(10px + var(--b));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 13px;
  align-items: center;
  background: #1b3037e6;
  color: #e4dcc9;
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
}
kbd {
  display: inline-block;
  border: 1px solid #8e917e;
  border-radius: 2px;
  padding: 0 4px;
  font: inherit;
  line-height: 1.4;
}
.keyboard-keys kbd + kbd {
  margin-left: 2px;
}
.touch-controls {
  display: none;
}
.touch .touch-controls {
  display: block;
}
.touch .keyboard-keys {
  display: none;
}
.move-pad,
.action-pad {
  position: absolute;
  bottom: calc(10px + var(--b));
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.move-pad {
  left: calc(17px + var(--l));
}
.action-pad {
  right: calc(17px + var(--r));
}
.touch-controls button {
  pointer-events: auto;
  display: grid;
  place-items: center;
  height: clamp(45px, 6.3vmax, 70px);
  width: clamp(45px, 6.3vmax, 70px);
  border-radius: 50%;
  background: #193139cf;
  border: 1.5px solid #e2c59a;
  color: #fff0d2;
  box-shadow: inset 0 0 0 3px #25424a85;
  font: bold 20px var(--serif);
}
.move-pad button {
  font-size: 16px;
  border-radius: 9px;
}
.action-pad button[data-action='attack'] {
  background: #99492ee8;
  width: clamp(49px, 7.1vmax, 78px);
  height: clamp(49px, 7.1vmax, 78px);
}
.touch-controls button.held {
  background: #e0b078;
  color: #243238;
  box-shadow: 0 0 0 3px #f6e0ba80;
}
.overlay {
  display: grid;
  place-items: center;
  overflow: auto;
  background: #102229b8;
  padding: calc(8px + var(--t)) calc(14px + var(--r)) calc(8px + var(--b)) calc(14px + var(--l));
}
.paper-panel {
  position: relative;
  overflow: auto;
  max-height: 100%;
  width: min(90%, 500px);
  padding: clamp(17px, 3.6vmin, 37px) clamp(24px, 4.7vmin, 46px);
  color: var(--ink);
  background: linear-gradient(112deg, #f7e9c9, #e2d0a8);
  border: 1px solid #c6a573;
  box-shadow:
    0 12px 55px #15252d80,
    inset 0 0 0 5px #efdfbc,
    inset 0 0 0 6px #aa936b;
}
.panel-stamp {
  position: absolute;
  right: 23px;
  top: 21px;
  width: 39px;
  height: 39px;
  opacity: 0.55;
  transform: rotate(-18deg);
  border: 3px double #9d543c;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.panel-stamp i {
  width: 19px;
  height: 12px;
  border: 1px solid #985138;
  background: linear-gradient(32deg, transparent 47%, #985138 48%, #985138 51%, transparent 52%);
}
.paper-panel h2 {
  font: 800 clamp(29px, 4.6vmin, 48px) / 1.13 var(--serif);
  margin: 0 35px 12px 0;
}
.paper-panel p#panel-copy {
  font-size: 14px;
  line-height: 1.7;
  margin: 0 0 14px;
}
#controls-table {
  margin: 0 0 12px;
  padding-top: 3px;
  border-top: 1px solid #ac9979;
  font-size: 13px;
}
#controls-table div {
  padding: 5px 0;
  display: flex;
  border-bottom: 1px solid #bead8c;
}
#controls-table dt {
  font-weight: 700;
  min-width: 58px;
}
#controls-table dd {
  margin: 0;
}
#controls-table kbd {
  border-color: #a49272;
  min-width: 19px;
  text-align: center;
}
.panel-actions {
  gap: 9px;
}
.panel-actions .ticket {
  background: #2a454c;
  border-color: #346069;
  color: #fff1d5;
  box-shadow:
    inset 0 0 0 3px #2a454c,
    inset 0 0 0 4px #79908a;
  min-height: 44px;
  gap: 14px;
}
#summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 10px 0 19px;
  padding: 10px 0;
  border-block: 1px solid #b5a07d;
  font-size: 12px;
}
#summary b {
  font:
    700 18px Georgia,
    serif;
  margin-right: 4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
@media (orientation: portrait) {
  #stage {
    width: 100vh;
    height: 100vw;
    transform-origin: 0 0;
    transform: translateX(100vw) rotate(90deg);
    --l: max(var(--safe-t), var(--host-top, 0px));
    --r: var(--safe-b);
    --t: var(--safe-r);
    --b: var(--safe-l);
  }
  .wordmark {
    font-size: 4.3vh;
  }
  h1 {
    font-size: 9.6vh;
  }
  .chapter {
    font-size: 2.5vh;
  }
  .premise {
    font-size: 1.7vh;
  }
}
@media (max-height: 500px), (orientation: portrait) and (max-width: 500px) {
  .edition {
    top: calc(5% + var(--t));
    font-size: 11px;
    gap: 10px;
  }
  .postmark {
    transform: scale(0.8) rotate(-12deg);
    transform-origin: left;
  }
  .cover-copy {
    top: 45%;
    transform: translateY(-32%);
  }
  .cover-actions {
    margin-top: 13px;
  }
  .premise {
    margin-top: 8px;
  }
  .hud {
    top: calc(7px + var(--t));
    left: calc(10px + var(--l));
    right: calc(10px + var(--r));
  }
  .vitals {
    height: 38px;
  }
  .sound-button {
    top: calc(4% + var(--t));
  }
  .paper-panel {
    padding: 16px 24px;
  }
  .paper-panel h2 {
    margin-bottom: 6px;
  }
  .paper-panel p#panel-copy {
    margin-bottom: 7px;
  }
  .touch #route-hint {
    bottom: calc(19% + var(--b));
  }
  #boss-hud {
    top: calc(7px + var(--t));
  }
  .boss-title {
    font-size: 13px;
  }
}
@media (max-height: 340px), (orientation: portrait) and (max-width: 340px) {
  .cover-copy {
    top: 37%;
    transform: translateY(-20%);
  }
  h1 {
    font-size: 51px;
  }
  .wordmark {
    font-size: 22px;
  }
  .cover-actions {
    margin-top: 7px;
  }
  .paper-panel {
    padding: 12px 23px;
  }
  .paper-panel h2 {
    font-size: 26px;
  }
  .paper-panel p#panel-copy,
  #controls-table {
    font-size: 12px;
  }
  #controls-table div {
    padding: 3px 0;
  }
  .keyboard-keys {
    bottom: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

.pad-only,
.touch .keys-only {
  display: none;
}
.touch .pad-only {
  display: inline;
}
/* Keep old WebViews usable when safe-area functions and fluid type are unavailable. */
#field,
.cover,
.overlay,
#game-ui {
  top: 0;
  left: 0;
}
.overlay {
  align-items: center;
  justify-items: center;
}
@supports not (width: clamp(1px, 2vw, 3px)) {
  #stage {
    --t: var(--host-top, 0px);
    --l: 0px;
    --r: 0px;
    --b: 0px;
  }
  .cover-ink {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .cover-copy .wordmark {
    font:
      italic bold 26px Georgia,
      serif;
  }
  h1 {
    font: 900 9vw/1.15 var(--serif);
  }
  .chapter {
    font-size: 17px;
  }
  .premise {
    font-size: 14px;
  }
  .cover-actions {
    margin-top: 18px;
  }
  .paper-panel {
    width: 460px;
    max-width: 90%;
    padding: 18px 26px;
  }
  .paper-panel h2 {
    font-size: 32px;
  }
  .touch-controls button {
    height: 48px;
    width: 48px;
  }
  .action-pad button[data-action='attack'] {
    height: 53px;
    width: 53px;
  }
  .touch-controls button + button,
  .panel-actions button + button,
  .cover-actions button + button {
    margin-left: 8px;
  }
  #boss-hud {
    width: 28%;
  }
  .health i + i {
    margin-left: 4px;
  }
  #route-hint {
    font-size: 12px;
  }
  #announcement {
    font-size: 16px;
  }
}
@media (orientation: portrait) {
  @supports not (width: clamp(1px, 2vw, 3px)) {
    #stage {
      --l: var(--host-top, 0px);
      --t: 0px;
    }
    h1 {
      font-size: 9vh;
    }
  }
}
