@font-face {
  font-family: Brush;
  src: url(assets/brush.woff2) format("woff2");
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #0d111b;
  --panel: #151c29;
  --rule: #31394a;
  --muted: #99a4b6;
  --cream: #f5eddd;
  --red: #dc5141;
  --mono: "Courier New", monospace;
  --brush: Brush, "STKaiti", "KaiTi", "楷体", serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--cream);
  background: radial-gradient(ellipse at 50% 45%, #17202d 0, transparent 72%), var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  min-height: 100vh;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible {
  outline: 3px solid #ffd395;
  outline-offset: 3px;
}
button {
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
button,
input {
  -webkit-tap-highlight-color: transparent;
}
[hidden] {
  display: none !important;
}
.mast {
  height: 78px;
  background: #0d111bf5;
  border-bottom: 1px solid #2c3342;
}
.mast-inner,
.shell {
  width: min(1344px, 91.5%);
  margin: auto;
}
.mast-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 48px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
}
.brand img {
  width: 39px;
  height: 39px;
  image-rendering: pixelated;
}
.brand b {
  display: block;
  font: 30px/0.96 var(--brush);
  letter-spacing: 3px;
  color: #f6ecdb;
}
.brand small {
  display: block;
  font: 9px var(--mono);
  letter-spacing: 1.45px;
  color: #aaa295;
  margin-top: 7px;
}
.mast nav {
  align-self: stretch;
  display: flex;
  gap: 31px;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 1px;
}
.nav-item.current {
  color: #f48069;
}
.nav-item.current:after {
  content: "";
  position: absolute;
  bottom: -1px;
  height: 3px;
  background: var(--red);
  left: 0;
  right: 0;
}
.nav-item:hover,
.icon-button:hover {
  color: var(--cream);
}
.ico {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.tools {
  display: flex;
  gap: 10px;
  margin-left: auto;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid #394152;
  background: #151b27;
  border-radius: 4px;
  color: #bec7d5;
}
.shell {
  padding: 28px 0 18px;
}
.chapter {
  position: relative;
  height: clamp(365px, 31.7vw, 468px);
  border: 1px solid #475365;
  background: #15263b;
  isolation: isolate;
  overflow: hidden;
  box-shadow: 0 10px 40px #04060b33;
}
.scene,
.wash,
#weather {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.scene {
  background-size: cover;
  background-position: center 54%;
  image-rendering: pixelated;
}
.scene-0 {
  background-image: url(assets/shrine.webp);
}
.scene-1 {
  background-image: url(assets/forest.webp);
}
.scene-2 {
  background-image: url(assets/crossing.webp);
}
.wash {
  background:
    linear-gradient(90deg, #080e19e8 0%, #0a1120a6 26%, #0b112114 57%, transparent 85%),
    linear-gradient(0deg, #080e19a6, transparent 21%);
}
.scene-content {
  position: absolute;
  inset: 0 auto 0 4.55%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 61%;
  pointer-events: none;
}
.scene-content button {
  pointer-events: auto;
}
.chapter-label,
.scene-meta,
.chapter-switch,
.section-head,
.key-group,
.auto-note,
.control-title,
.control-strip,
.start,
.hero-title,
.hero-data,
.hero-type,
.scene-meta > span {
  display: flex;
  align-items: center;
}
.chapter-label {
  gap: 12px;
  color: #d9b29b;
  font: bold 12px var(--mono);
  letter-spacing: 2px;
}
.red-label {
  font:
    700 13px/1.5 "Microsoft YaHei",
    sans-serif;
  padding: 2px 9px;
  background: #b64231;
  color: #fff0d8;
  letter-spacing: 2px;
}
.small-line {
  width: 23px;
  height: 1px;
  background: #a67a62;
}
.scene h1,
h1 {
  font: normal clamp(54px, 5.7vw, 91px)/1.15 var(--brush);
  margin: 14px 0 12px;
  letter-spacing: 1px;
  color: #fff4dc;
  text-shadow: 3px 4px 0 #0c101b80;
}
.scene-copy {
  font-size: clamp(14px, 1.16vw, 18px);
  line-height: 1.78;
  color: #d4d8dc;
  letter-spacing: 1px;
  margin: 0;
}
.scene-meta {
  gap: 13px;
  color: #b4c0d0;
  font-size: 13px;
  margin: 15px 0 23px;
}
.scene-meta > span {
  gap: 6px;
}
.scene-meta .ico {
  width: 15px;
  height: 15px;
  color: #d0bfa4;
}
.scene-meta i {
  height: 12px;
  border-left: 1px solid #667182;
}
.start {
  border: 1px solid #f1886d;
  border-bottom: 3px solid #842f29;
  outline: 1px solid #842f29;
  outline-offset: 1px;
  border-radius: 2px;
  background: #cc4939;
  box-shadow:
    inset 0 1px #ec7861,
    0 4px 8px #0004;
  padding: 12px 20px;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  transition:
    background 0.18s,
    transform 0.18s;
}
.start:hover {
  background: #e25944;
  transform: translateY(-1px);
}
.start .ico {
  width: 22px;
  height: 22px;
}
.start kbd {
  margin-left: 9px;
  border: 1px solid #f3af9777;
  background: #8e302833;
  color: #ffe0c7;
  font: 11px var(--mono);
  padding: 3px 6px;
  letter-spacing: 1px;
}
.corner {
  position: absolute;
  width: 17px;
  height: 17px;
  z-index: 2;
  pointer-events: none;
  border-color: #c8c2aa;
  border-style: solid;
  border-width: 0;
}
.tl {
  top: 5px;
  left: 5px;
  border-width: 2px 0 0 2px;
}
.tr {
  top: 5px;
  right: 5px;
  border-width: 2px 2px 0 0;
}
.bl {
  bottom: 5px;
  left: 5px;
  border-width: 0 0 2px 2px;
}
.br {
  bottom: 5px;
  right: 5px;
  border-width: 0 2px 2px 0;
}
.chapter-switch {
  position: absolute;
  right: 23px;
  bottom: 18px;
  gap: 13px;
  color: #e2e2df;
  font-size: 12px;
  letter-spacing: 2px;
  text-shadow: 0 1px 4px black;
}
#chapter-tabs {
  display: flex;
  gap: 5px;
}
.chapter-tab {
  font: bold 12px var(--mono);
  border: 1px solid #91a0ad75;
  background: #101825cd;
  color: #c0c9d5;
  padding: 6px 8px;
}
.chapter-tab.active {
  color: #ffe4d3;
  border-color: #dc7861;
  background: #913b2eeb;
}
.section-head {
  gap: 14px;
  margin: 26px 0 16px;
}
.section-head h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 22px;
  letter-spacing: 2px;
}
.red-diamond {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--red);
  transform: rotate(45deg);
  box-shadow: inset 0 0 0 2px #c04437;
}
.section-head > span {
  font: 11px var(--mono);
  color: #8f9aaf;
  letter-spacing: 2px;
}
.rule {
  height: 1px;
  background: var(--rule);
  flex: 1;
}
.section-head small {
  color: #8e98a8;
  font-size: 12px;
  letter-spacing: 1px;
}
.hero-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}
.hero-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  text-align: left;
  background: #151c29;
  border: 1px solid #333d4e;
  border-radius: 3px;
  overflow: hidden;
  min-height: 120px;
  padding: 0;
  transition:
    border-color 0.16s,
    background 0.16s;
}
.hero-card:hover {
  border-color: #8997ad;
  background: #1c2534;
}
.hero-card.selected {
  border-color: #d05a48;
  background: linear-gradient(110deg, #322225, #241d24);
  box-shadow: inset 0 0 0 1px #bb4f3f38;
}
.hero-card.selected:after {
  content: "✓";
  background: #c95240;
  color: #fff3de;
  position: absolute;
  right: 0;
  top: 0;
  font-size: 11px;
  width: 26px;
  height: 22px;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  text-align: right;
  padding-right: 3px;
}
.hero-portrait {
  width: 35%;
  max-width: 145px;
  align-self: stretch;
  object-fit: cover;
  object-position: center 32%;
  image-rendering: pixelated;
  mask-image: linear-gradient(90deg, #000 80%, transparent);
}
.hero-data {
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px 12px 9px;
}
.epithet {
  font-size: 12px;
  color: #c4aa8c;
  letter-spacing: 2px;
}
.hero-title {
  gap: 8px;
}
.hero-title b {
  font-family: var(--brush);
  font-size: 32px;
  line-height: 1.04;
  font-weight: 400;
  letter-spacing: 2px;
}
.hero-type {
  color: #acb6c6;
  font-size: 12px;
  gap: 6px;
  margin-top: 4px;
}
.hero-type .ico {
  width: 14px;
  height: 14px;
}
.control-strip {
  margin-top: 23px;
  padding: 17px 21px;
  border: 1px solid #2b3443;
  border-radius: 3px;
  background: #121824;
  gap: 28px;
  color: #9eaabd;
  font-size: 13px;
}
.control-title {
  color: #c6ced9;
  gap: 9px;
  padding-right: 23px;
  border-right: 1px solid #343e4e;
}
.control-title .ico {
  width: 20px;
  height: 20px;
}
.key-group {
  gap: 4px;
}
.key-group span {
  margin-left: 5px;
}
kbd {
  font: 11px/1.1 var(--mono);
  color: #c1cbd7;
  border: 1px solid #465062;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 3px 5px;
  background: #202735;
  letter-spacing: 0.4px;
}
.auto-note {
  margin-left: auto;
  gap: 8px;
  font-size: 12px;
}
.auto-note i {
  width: 5px;
  height: 5px;
  background: #9bafaa;
}
dialog {
  max-width: min(630px, 94vw);
  width: 580px;
  max-height: 90dvh;
  overflow: auto;
  color: var(--cream);
  background: #151c28;
  border: 1px solid #495365;
  border-top: 3px solid #bf5142;
  padding: 0;
  box-shadow: 0 24px 100px #020305b3;
  border-radius: 4px;
}
dialog::backdrop {
  background: #050914d9;
  backdrop-filter: blur(4px);
}
#story-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #0c1421;
  overflow: hidden;
}
#story-dialog[open] {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#story-dialog::backdrop {
  background: #0c1421;
}
.story-stage {
  flex: 1;
  min-height: 0;
}
#story-landscape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 64% center;
  image-rendering: pixelated;
}
.story-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, #09111bbd, transparent 43%, #08122430 68%, #060d19e6),
    linear-gradient(100deg, #08101e73, transparent 60%);
}
.story-heading {
  position: relative;
  z-index: 1;
  padding: clamp(22px, 5vh, 58px) 0 0 max(5vw, env(safe-area-inset-left));
  max-width: min(600px, 76vw);
  text-shadow: 0 2px 5px #050b14;
}
.story-heading small {
  color: #f3c790;
  font-size: 0.875rem;
  letter-spacing: 0.12em;
}
.story-heading h2 {
  margin: 0.25em 0;
  font:
    600 clamp(2rem, 5vw, 4rem)/1.1 "STKaiti",
    "KaiTi",
    serif;
  color: #fff1d7;
  letter-spacing: 0.1em;
}
#story-action {
  margin: 0;
  font-size: clamp(0.95rem, 1.3vw, 1.12rem);
  color: #e3e6e9;
  line-height: 1.8;
}
#story-skip {
  position: absolute;
  z-index: 2;
  top: max(18px, env(safe-area-inset-top));
  right: max(4vw, env(safe-area-inset-right));
  min-height: 40px;
  background: #111924d9;
  color: #d1d8df;
}
.story-script {
  position: relative;
  width: min(1100px, 91vw);
  margin: 0 auto max(4vh, env(safe-area-inset-bottom));
  border: 1px solid #988465;
  border-top: 2px solid #d9a965;
  border-radius: 3px;
  background: linear-gradient(110deg, #202b39f5, #0d1724f7 66%);
  box-shadow: 0 10px 40px #040a14b0;
  padding: clamp(12px, 2vw, 24px);
  isolation: isolate;
}
.story-speech {
  display: grid;
  grid-template-columns: clamp(92px, 10vw, 142px) 1fr;
  align-items: center;
  gap: clamp(14px, 2.2vw, 32px);
}
#story-portrait {
  width: 100%;
  aspect-ratio: 1;
  image-rendering: pixelated;
  object-fit: cover;
  border: 1px solid #a88a62;
  box-shadow: 0 0 0 3px #0a1421;
  background: #142132;
}
#story-speaker {
  color: #f4c587;
  font:
    700 clamp(1.09rem, 2vw, 1.55rem)/1.4 "STKaiti",
    "KaiTi",
    serif;
  letter-spacing: 0.08em;
}
#story-line {
  margin: 0.35em 0 0;
  color: #f6ebda;
  font-size: clamp(1.06rem, 1.55vw, 1.38rem);
  line-height: 1.7;
}
.story-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.story-actions button {
  min-height: 42px;
  min-width: 100px;
}
.story-pref {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 15px;
  cursor: pointer;
}
.story-pref input {
  width: 1rem;
  height: 1rem;
  accent-color: #cc6950;
}
.modal-body .story-ending {
  margin: 13px 0;
  padding: 6px 14px;
  border-left: 2px solid #b67c59;
  color: #eddfcb;
}
#fight-path {
  display: block;
  color: #edc48f;
  font-size: 12px;
  margin-top: 4px;
}
@media (max-width: 600px) {
  .story-heading {
    padding-top: max(48px, env(safe-area-inset-top));
    max-width: 87vw;
  }
  #story-skip {
    top: max(8px, env(safe-area-inset-top));
    padding: 5px 10px;
    min-height: 32px;
  }
  .story-script {
    width: 94vw;
    margin-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .story-speech {
    grid-template-columns: clamp(64px, 19vw, 92px) 1fr;
    gap: 12px;
    align-items: start;
  }
  #story-line {
    font-size: 1.03rem;
  }
}
@media (max-height: 490px) {
  .story-heading {
    padding-top: 10px;
    max-width: 80vw;
  }
  .story-heading h2 {
    font-size: 1.6rem;
  }
  #story-action {
    font-size: 0.9rem;
    line-height: 1.5;
  }
  .story-script {
    min-height: 0;
    max-height: 57dvh;
    overflow: auto;
    padding: 10px 14px;
    margin-bottom: 6px;
  }
  .story-speech {
    grid-template-columns: 60px 1fr;
    gap: 12px;
  }
  #story-speaker,
  #story-line {
    font-size: 1rem;
  }
  .story-actions button {
    min-height: 32px;
    padding-block: 5px;
  }
}
#dialog-inner {
  padding: 26px;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dialog-head h2 {
  font-size: 26px;
  margin: 4px 0;
  letter-spacing: 2px;
}
.modal-eyebrow {
  color: #e6876b;
  font: 12px var(--mono);
  letter-spacing: 2px;
}
.modal-body {
  line-height: 1.7;
  color: #c4cfda;
  margin-top: 18px;
}
.modal-body p {
  margin: 8px 0;
}
.bio,
.record {
  padding: 15px 0;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 14px;
}
.bio img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid #465064;
}
.bio b,
.record b {
  color: #f2e1c7;
}
.bio p,
.record small {
  font-size: 14px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.button,
.choice {
  background: #202a38;
  border: 1px solid #414c5d;
  padding: 10px 15px;
  border-radius: 3px;
}
.button.primary {
  background: #b54535;
  border-color: #cf6651;
  color: #fff2df;
}
.button:hover,
.choice:hover {
  filter: brightness(1.18);
}
.choice {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 9px 0;
}
.choice b {
  color: #ffe4ae;
}
.choice span {
  font-size: 14px;
  color: #b5c3d0;
}
.choice.training-choice {
  display: grid;
  gap: 6px;
  border-left: 3px solid #cfa267;
}
.training-choice small {
  color: #c4cdda;
}
#fresh-training {
  border-left-color: #647289;
}
.modal-body .training-line {
  color: #edc891;
}
.choice kbd {
  margin-left: auto;
}
button.art-choice {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 14px 48px 14px 18px;
  border-left: 3px solid #987b56;
}
button.art-choice:hover,
button.art-choice:focus-visible {
  border-left-color: #f5bd82;
  background: #283244;
}
button.art-choice b {
  font-size: 1.12rem;
}
button.art-choice[aria-pressed="true"] {
  border-color: #efbc80;
  background: #3c312a;
}
.upgrade-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.upgrade-footer span {
  color: #edd1a7;
  font-size: 0.92rem;
}
.upgrade-footer .button {
  min-height: 44px;
  flex-shrink: 0;
}
.upgrade-footer .button:disabled {
  opacity: 0.48;
}
button.art-choice span {
  font-size: 0.94rem;
  line-height: 1.6;
}
button.art-choice small {
  color: #d6b78d;
  font-size: 0.8rem;
}
button.art-choice kbd {
  position: absolute;
  top: 14px;
  right: 12px;
}
.record {
  justify-content: space-between;
}
.records-summary,
.result-stats {
  display: flex;
  justify-content: space-around;
  padding: 15px 0;
  background: #101722;
  margin: 13px 0;
}
.records-summary b,
.result-stats b {
  display: block;
  font: bold 23px var(--mono);
  color: #edba7c;
}
.records-summary small,
.result-stats small {
  font-size: 12px;
}
.help-row {
  padding: 8px 0;
  border-bottom: 1px solid #303847;
}
.help-row b {
  color: #eadac3;
  margin-right: 12px;
}
.modal-body .hint {
  font-size: 13px;
  color: #a4afbd;
}
#battle {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: #141e2a;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
#arena {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}
.combat-top,
.combat-bottom {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}
.combat-top {
  top: max(14px, env(safe-area-inset-top));
}
.health-panel,
.wave-panel,
.combat-right,
.skill-buttons button {
  background: #0b1423e8;
  border: 1px solid #69788880;
  border-radius: 3px;
  padding: 9px 12px;
}
.health-panel {
  display: flex;
  gap: 10px;
  align-items: center;
  width: clamp(165px, 23vw, 270px);
}
.health-panel img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  image-rendering: pixelated;
}
.health-panel > div {
  flex: 1;
}
.health-panel strong {
  font-size: 14px;
}
.health-panel span {
  font: 11px var(--mono);
  float: right;
  color: #b8c7d4;
  margin-top: 4px;
}
.bar {
  height: 7px;
  background: #38404b;
  margin: 4px 0;
  overflow: hidden;
}
.bar i {
  display: block;
  background: #d36757;
  height: 100%;
}
.bar.exp {
  height: 4px;
}
.bar.exp i {
  background: #6dbdb1;
}
.wave-panel {
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  min-width: 160px;
}
.wave-panel b,
.wave-panel span {
  display: block;
}
.wave-panel span {
  margin-top: 3px;
  font-size: 12px;
  color: #b6c6d4;
}
.combat-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 16px var(--mono);
  padding: 5px 6px 5px 12px;
}
.combat-top button,
.combat-bottom button {
  pointer-events: auto;
}
.combat-bottom {
  bottom: max(20px, env(safe-area-inset-bottom));
  align-items: flex-end;
}
.skill-buttons {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.skill-buttons button {
  min-width: 85px;
  color: #f3d2a3;
}
.skill-buttons button:disabled {
  color: #a1aab7;
}
.skill-buttons button.ready {
  border-color: #f1b66b;
  background: #713c27;
}
.skill-buttons kbd {
  margin-left: 4px;
}
#stick {
  width: 100px;
  height: 100px;
  background: #18212b77;
  border: 2px solid #cad5dd66;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
#stick i {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #bfcbd77a;
  pointer-events: none;
}
#banner {
  position: absolute;
  top: 23%;
  width: 100%;
  text-align: center;
  pointer-events: none;
  font: clamp(28px, 4vw, 60px) var(--brush);
  text-shadow: 2px 3px 1px #112;
  color: #fff1d7;
  opacity: 0;
  transition: opacity 0.25s;
}
#banner.show {
  opacity: 1;
}
#combo {
  position: absolute;
  right: 4%;
  top: 21%;
  color: #ffca82;
  text-shadow: 2px 2px #542a24;
  font: bold 22px var(--mono);
}
#tech-btn {
  min-width: 125px;
  border-color: #a4885b;
}
#tech-btn.follow,
#tech-btn.counter-ready {
  background: #7c492a;
  color: #fff2c7;
  border-color: #ffe296;
  box-shadow: 0 0 12px #edb65380;
}
#rescue-hud {
  position: absolute;
  left: 50%;
  top: 91px;
  transform: translateX(-50%);
  max-width: 94%;
  padding: 6px 12px;
  background: #101d25ed;
  border: 1px solid #947952;
  pointer-events: none;
  border-radius: 3px;
  white-space: nowrap;
  font-size: 13px;
}
#rescue-hud strong {
  color: #f1c98c;
  margin-right: 10px;
}
#lock-progress {
  background: #84caae;
}
@media (max-width: 700px) {
  #rescue-hud {
    top: 84px;
  }
  .combat-bottom .skill-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(58px, 1fr));
    width: min(49vw, 198px);
    gap: 5px;
  }
  .skill-buttons #tech-btn {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
  }
  .combat-bottom .skill-buttons button {
    min-width: 0;
    padding: 5px 7px;
  }
}
#boss-bar {
  position: absolute;
  top: 94px;
  left: 50%;
  transform: translateX(-50%);
  width: min(380px, 65%);
  text-align: center;
  font-size: 13px;
  color: #ffe4c6;
  text-shadow: 1px 1px #000;
}
#boss-bar .bar {
  border: 1px solid #a28170;
  height: 9px;
}
#boss-bar i {
  background: #c64d45;
}
@media (min-width: 1600px) {
  .shell {
    padding-top: 38px;
  }
  .hero-card {
    min-height: 150px;
  }
  .section-head {
    margin-top: 32px;
  }
  .control-strip {
    margin-top: 30px;
  }
}
@media (max-width: 950px) {
  .mast-inner,
  .shell {
    width: 94%;
  }
  .mast-inner {
    gap: 28px;
  }
  .hero-list {
    gap: 9px;
  }
  .hero-data {
    padding-left: 5px;
  }
  .hero-title b {
    font-size: 27px;
  }
  .control-strip {
    gap: 16px;
  }
  .chapter {
    height: 360px;
  }
  .hero-card {
    min-height: 108px;
  }
  .hero-type {
    font-size: 11px;
  }
  .scene-content {
    left: 5%;
  }
}
@media (max-width: 700px) {
  .mast {
    height: 62px;
  }
  .mast-inner {
    gap: 12px;
  }
  .brand img {
    width: 29px;
    height: 29px;
  }
  .brand {
    gap: 7px;
  }
  .brand b {
    font-size: 23px;
    letter-spacing: 1px;
  }
  .brand small {
    font-size: 7px;
    margin-top: 5px;
    letter-spacing: 0.8px;
  }
  .mast nav {
    gap: 9px;
    margin-left: auto;
  }
  .nav-item {
    font-size: 13px;
    letter-spacing: 0;
    gap: 0;
  }
  .nav-item .ico {
    display: none;
  }
  .tools {
    gap: 5px;
    margin: 0;
  }
  .tools .icon-button {
    width: 30px;
    height: 30px;
  }
  .tools .ico {
    width: 15px;
  }
  .shell {
    padding-top: 14px;
  }
  .chapter {
    height: 355px;
  }
  .scene {
    background-position: 62% center;
  }
  .scene-content {
    width: 86%;
    justify-content: flex-start;
    top: 33px;
  }
  .wash {
    background:
      linear-gradient(90deg, #091222da, #0b122369 50%, #11182700),
      linear-gradient(0deg, #080d19c9, transparent 25%);
  }
  h1 {
    font-size: 54px;
  }
  .scene-copy {
    font-size: 14px;
  }
  .scene-meta {
    margin: 12px 0 19px;
    font-size: 12px;
  }
  .start {
    font-size: 16px;
    padding: 9px 14px;
    gap: 8px;
  }
  .start kbd {
    display: none;
  }
  .chapter-switch {
    right: 13px;
    bottom: 10px;
    font-size: 11px;
    gap: 7px;
  }
  .chapter-tab {
    padding: 5px 7px;
  }
  .section-head {
    gap: 9px;
    margin: 19px 0 12px;
  }
  .section-head h2 {
    font-size: 19px;
    gap: 8px;
  }
  .section-head > span {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .section-head small {
    display: none;
  }
  .hero-list {
    gap: 7px;
  }
  .hero-card {
    flex-direction: column;
    align-items: center;
    min-height: 0;
  }
  .hero-portrait {
    width: 100%;
    max-width: none;
    height: clamp(65px, 20vw, 125px);
    object-position: 50% 30%;
    mask-image: linear-gradient(#000 75%, transparent);
  }
  .hero-data {
    width: 100%;
    padding: 4px 5px 12px;
    align-items: center;
    gap: 4px;
  }
  .epithet {
    font-size: 11px;
  }
  .hero-title b {
    font-size: 26px;
  }
  .hero-type {
    font-size: 10px;
    gap: 3px;
    margin: 0;
  }
  .hero-type .ico {
    width: 11px;
  }
  .control-strip {
    margin-top: 14px;
    padding: 12px 10px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .control-title {
    padding-right: 8px;
  }
  .key-group {
    gap: 2px;
  }
  .auto-note {
    font-size: 11px;
  }
  .combat-top {
    left: 7px;
    right: 7px;
    top: 8px;
  }
  .health-panel {
    width: 43%;
    max-width: 190px;
    padding: 6px;
    gap: 6px;
  }
  .health-panel img {
    width: 32px;
    height: 36px;
  }
  .health-panel span {
    font-size: 9px;
  }
  .health-panel strong {
    font-size: 12px;
  }
  .wave-panel {
    transform: none;
    position: static;
    min-width: 0;
    padding: 6px;
    font-size: 12px;
  }
  .wave-panel span {
    font-size: 10px;
  }
  .combat-right {
    padding: 3px;
    gap: 3px;
    font-size: 11px;
  }
  .combat-right .icon-button {
    width: 28px;
    height: 29px;
  }
  .combat-right > span {
    display: none;
  }
  #dialog-inner {
    padding: 19px;
  }
  .choice {
    gap: 9px;
  }
  .choice span {
    font-size: 12px;
  }
  .skill-buttons {
    gap: 5px;
  }
  .skill-buttons button {
    min-width: 65px;
  }
  .skill-buttons kbd {
    display: none;
  }
  #boss-bar {
    top: 65px;
  }
}
@media (pointer: coarse) {
  #stick {
    display: flex;
  }
  .skill-buttons button {
    min-height: 52px;
  }
  .control-strip .key-group {
    display: none;
  }
  .control-title:after {
    content: "拖动摇杆移动 · 点按施放技能";
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    margin-left: 3px;
  }
  .control-title {
    border: none;
    padding: 0;
  }
  .auto-note {
    margin-left: auto;
  }
  .control-strip {
    gap: 6px;
  }
  .start kbd {
    display: none;
  }
}
@media (max-width: 420px) {
  .mast nav {
    gap: 4px;
  }
  .nav-item {
    padding: 0 3px;
  }
  .tools {
    gap: 3px;
  }
  .brand small {
    letter-spacing: 0.4px;
  }
  .mast-inner {
    gap: 7px;
  }
  .hero-type {
    letter-spacing: -0.3px;
  }
  .control-title {
    font-size: 12px;
  }
  .control-title:after {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.scene-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
#difficulty {
  border: 1px solid #bd9871;
  background: #171c23d9;
  color: #f0d8ae;
  font-size: 14px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 3px;
}
#difficulty:hover {
  background: #3d352c;
}
.difficulty-presets {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}
.difficulty-presets legend {
  margin-bottom: 8px;
  color: #ddc9a7;
}
.difficulty-presets > div {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.difficulty-presets button {
  padding: 8px 3px;
  font-size: 14px;
  min-height: 44px;
}
.difficulty-presets button[aria-pressed="true"] {
  color: #ffdf9f;
  background: #43352d;
  border-color: #deae74;
}
.difficulty-tuning {
  border-block: 1px solid var(--rule);
  padding: 8px 0;
}
.difficulty-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 4px 0;
}
.difficulty-row output {
  color: #f5d7a0;
  font-variant-numeric: tabular-nums;
}
.difficulty-row input {
  grid-column: 1 / -1;
  width: 100%;
  height: 25px;
  margin: 0;
  accent-color: #e6af73;
  cursor: pointer;
}
.difficulty-preview {
  color: #efcf9b;
}
@media (max-width: 480px) {
  .difficulty-presets > div {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (pointer: coarse) and (orientation: portrait) {
  .control-title:after {
    content: "可转横屏 · 左手摇杆，右手出招";
  }
}
@media (pointer: coarse) and (orientation: landscape) {
  :root {
    --play-left: max(16px, calc(env(safe-area-inset-left) + 8px));
    --play-right: max(16px, calc(env(safe-area-inset-right) + 8px));
    --play-top: max(8px, calc(env(safe-area-inset-top) + 4px));
    --play-bottom: max(12px, calc(env(safe-area-inset-bottom) + 5px));
  }
  .combat-top,
  .combat-bottom {
    left: var(--play-left);
    right: var(--play-right);
  }
  .combat-top {
    top: var(--play-top);
    display: grid;
    grid-template-columns: auto auto;
    row-gap: 3px;
  }
  .health-panel,
  .wave-panel,
  .combat-right {
    background: #0b1423d9;
  }
  .health-panel {
    grid-area: 1 / 1;
    width: clamp(162px, 22vw, 220px);
    max-width: none;
    padding: 4px 7px;
    gap: 7px;
  }
  .health-panel img {
    width: 32px;
    height: 34px;
  }
  .health-panel > div {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0 3px;
  }
  .health-panel strong {
    font-size: 14px;
  }
  .health-panel span {
    font-size: 11px;
    justify-self: end;
    margin: 0;
  }
  .health-panel .bar,
  #fight-path {
    grid-column: 1 / -1;
  }
  .health-panel .bar {
    margin: 3px 0;
    height: 5px;
  }
  .health-panel .exp {
    height: 3px;
  }
  .wave-panel {
    grid-area: 2 / 1;
    position: static;
    transform: none;
    justify-self: start;
    min-width: 0;
    padding: 3px 7px;
    text-align: left;
  }
  .wave-panel b {
    display: none;
  }
  .wave-panel span {
    margin: 0;
    font-size: 12px;
  }
  .combat-right {
    grid-area: 1 / 2;
    align-self: start;
    justify-self: end;
    padding: 0 0 0 8px;
    gap: 6px;
  }
  .combat-right > span {
    display: inline;
    font-size: 13px;
  }
  .combat-right .icon-button {
    width: 44px;
    height: 44px;
  }
  #boss-bar,
  #rescue-hud {
    top: calc(var(--play-top) + 50px);
    left: auto;
    right: var(--play-right);
    transform: none;
    width: min(200px, 31vw);
    padding: 4px 7px;
    background: #101b28d9;
    border: 1px solid #826e56;
    border-radius: 3px;
    text-align: left;
    font-size: 12px;
  }
  #rescue-hud strong,
  #cart-state {
    display: block;
  }
  #banner {
    top: 24%;
    font-size: clamp(20px, 3vw, 34px);
  }
  #combo {
    top: auto;
    right: var(--play-right);
    bottom: calc(var(--play-bottom) + 105px);
    font-size: 17px;
  }
  .combat-bottom {
    bottom: var(--play-bottom);
  }
  #stick {
    width: clamp(82px, 23dvh, 104px);
    height: auto;
    aspect-ratio: 1;
  }
  #stick i {
    width: 38%;
    height: auto;
    aspect-ratio: 1;
  }
  .combat-bottom .skill-buttons {
    display: grid;
    grid-template-areas: "ult tech" "dash tech";
    grid-template-columns: minmax(78px, auto) clamp(84px, 12vw, 112px);
    grid-template-rows: repeat(2, 44px);
    width: auto;
    align-items: stretch;
    gap: 5px 8px;
  }
  .combat-bottom .skill-buttons button {
    min-width: 0;
    min-height: 44px;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
    touch-action: manipulation;
  }
  .skill-buttons #dash-btn {
    grid-area: dash;
  }
  .skill-buttons #ult-btn {
    grid-area: ult;
  }
  .skill-buttons #tech-btn {
    grid-area: tech;
    align-self: center;
    min-width: 0;
    width: 100%;
    min-height: 72px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    border-width: 2px;
    border-radius: 16px;
  }
  .skill-buttons kbd,
  .art-choice kbd {
    display: none;
  }
  #dialog {
    max-width: calc(100vw - 2 * max(var(--play-left), var(--play-right)));
    max-height: calc(100dvh - 2 * max(var(--play-top), var(--play-bottom)));
  }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  .mast {
    height: 48px;
  }
  .shell {
    padding-top: 8px;
  }
  .chapter {
    height: clamp(226px, calc(100dvh - 64px), 300px);
  }
  .scene-content {
    top: 0;
    justify-content: center;
  }
  .scene-content h1 {
    font-size: clamp(40px, 5vw, 56px);
    margin: 6px 0;
  }
  .scene-meta {
    margin: 8px 0 12px;
  }
  .story-heading {
    padding: var(--play-top) 0 0 var(--play-left);
    max-width: 75vw;
  }
  #story-skip {
    top: var(--play-top);
    right: var(--play-right);
    min-height: 44px;
  }
  .story-script {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: auto;
    margin: 0 var(--play-right) var(--play-bottom) var(--play-left);
    padding: 8px 12px;
  }
  .story-speech {
    grid-template-columns: clamp(52px, 16dvh, 72px) minmax(0, 1fr);
  }
  #story-line {
    line-height: 1.45;
  }
  .story-actions {
    margin: 0;
  }
  .story-actions button {
    min-height: 44px;
    min-width: 82px;
  }
  #dialog-inner {
    padding: 12px 16px;
  }
  .modal-body {
    margin-top: 8px;
  }
  #dialog[data-view="upgrade"] {
    width: 820px;
  }
  #dialog[data-view="upgrade"] #dialog-inner {
    max-height: calc(100dvh - 2 * max(var(--play-top), var(--play-bottom)) - 4px);
    display: flex;
    flex-direction: column;
  }
  #dialog[data-view="upgrade"] .modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .upgrade-cards {
    display: grid;
    overflow-y: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .upgrade-cards .art-choice {
    margin: 0;
    padding: 8px 10px;
    align-content: start;
    gap: 4px;
  }
  .upgrade-cards .art-choice span {
    font-size: 14px;
    line-height: 1.5;
  }
  .upgrade-footer {
    flex-shrink: 0;
    margin-top: 8px;
    padding-top: 8px;
  }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 360px) {
  #dialog[data-view="upgrade"] .modal-eyebrow,
  #dialog[data-view="upgrade"] .modal-body > p {
    display: none;
  }
}
#lan-link {
  width: 100%;
  padding: 10px;
  font: 14px monospace;
}
.lan-download {
  display: inline-block;
  margin: 8px 0;
  color: #fff2df;
  text-decoration: none;
}
.guest-page {
  background: #101824;
  color: #f4e4c8;
}
#seat-lobby {
  width: min(480px, 92vw);
  margin: 8vh auto;
  padding: 24px;
  border: 1px solid #756447;
  background: #17212e;
}
#seat-lobby h1 {
  font-size: 42px;
}
#seat-lobby label {
  display: grid;
  gap: 4px;
  margin: 14px 0;
}
#seat-lobby select {
  font: inherit;
  padding: 9px;
  color: #f4e4c8;
  background: #253141;
}
.guest-page #arena {
  object-fit: contain;
}
.guest-hud,
.guest-objective {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  background: #121b28db;
  padding: 7px 10px;
  border: 1px solid #8a785c;
  font-size: 13px;
}
.guest-hud {
  left: max(8px, env(safe-area-inset-left));
}
.guest-hud b {
  margin-right: 8px;
  color: #ffda86;
}
.guest-objective {
  right: max(8px, env(safe-area-inset-right));
}
#guest-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #08101fc9;
}
#guest-overlay article {
  width: min(88%, 560px);
  background: #172333;
  border: 1px solid #b49359;
  padding: 18px;
}
#guest-overlay small {
  color: #eed09a;
}
#guest-overlay[hidden] {
  display: none;
}

#team-learn {
  position: absolute;
  z-index: 8;
  right: max(12px, env(safe-area-inset-right));
  top: max(76px, 16%);
  width: max-content;
  max-width: min(355px, calc(100vw - 24px));
  color: #f5e8cd;
}
#learn-open {
  background: #463621;
  border: 1px solid #e4bf77;
  color: #ffe2a4;
}
#learn-choices {
  padding: 12px;
  border: 1px solid #b99a60;
  background: #142028f5;
  box-shadow: 0 6px 20px #0008;
  max-height: 65dvh;
  overflow: auto;
  overscroll-behavior: contain;
}
#learn-list {
  display: grid;
  gap: 5px;
  margin: 8px 0;
}
#learn-list button {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 7px 10px;
  background: #243039;
  color: #fff1d1;
  border: 1px solid #69716a;
  cursor: pointer;
}
#learn-list span {
  font-size: 14px;
  color: #d9ded7;
}
#learn-list [aria-pressed="true"] {
  border-color: #f2cb7d;
  background: #493e2d;
}
#mate-hp {
  display: block;
  color: #f4d39b;
  font-size: 13px;
}
#team-wait {
  position: absolute;
  top: 37%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  max-width: 90%;
  width: max-content;
  border: 1px solid #a88f61;
  background: #17232deb;
  padding: 6px 14px;
  color: #fbe4b9;
  text-align: center;
  pointer-events: none;
}
@media (max-height: 500px) and (orientation: landscape) {
  #team-learn {
    top: 10px;
    right: 70px;
  }
  #learn-choices {
    max-height: 85dvh;
  }
}
#guest-detail {
  white-space: pre-line;
}

#leave-empty-room {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
}

.room-page,
#seat-lobby.room-page {
  width: min(760px, calc(100% - 28px));
  box-sizing: border-box;
  margin: clamp(16px, 5vh, 64px) auto;
  padding: clamp(18px, 4vw, 38px);
  border: 1px solid #726443;
  background: linear-gradient(145deg, #1c2b39, #111a25 72%);
  box-shadow: 0 14px 48px #05091052;
  color: #f1e8d6;
}
.room-heading,
.room-actions,
.room-invite > div,
#room-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.room-heading small,
.room-seat small,
.room-invite small {
  color: #cbb48a;
}
.room-heading h1,
#seat-lobby .room-heading h1 {
  margin: 4px 0;
  font-size: clamp(28px, 5vw, 42px);
}
.room-count {
  white-space: nowrap;
  border: 1px solid #716348;
  padding: 5px 10px;
  color: #f3d99d;
}
.room-mission {
  margin: 6px 0 20px;
  color: #dbdccc;
}
.room-roster,
.room-loadout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.room-seat {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 96px;
  padding: 12px;
  border: 1px solid #526774;
  background: #192735;
}
.room-seat.empty {
  border-style: dashed;
  background: transparent;
}
.room-seat.prepared {
  border-color: #85b699;
}
.room-avatar {
  display: grid;
  place-items: center;
  width: 60px;
  height: 70px;
  flex-shrink: 0;
  background: #101924;
  color: #716b5d;
  font-size: 25px;
}
.room-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}
.room-seat h2 {
  font-size: 20px;
  margin: 3px 0;
}
.room-seat p {
  font-size: 14px;
  margin: 0;
  color: #c1d4db;
}
.room-seat.prepared p {
  color: #b4e7bc;
}
.room-status {
  border-left: 3px solid #caab72;
  padding: 7px 10px;
  margin: 16px 0;
  color: #f4e3c3;
}
.room-invite,
.room-loadout {
  border-top: 1px solid #52606a;
  padding-top: 16px;
}
.room-invite label,
#join-room label {
  display: block;
  margin-bottom: 6px;
}
.room-invite small {
  display: block;
  margin: 6px 0;
}
#lan-link,
#invite-input {
  width: 100%;
  min-width: 0;
  border: 1px solid #68727b;
  background: #101924;
  color: #eee8d4;
  padding: 10px;
  font: inherit;
}
.room-invite button {
  flex-shrink: 0;
}
.room-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}
#room-summary {
  margin: 10px 0;
  background: #1e3038;
  padding: 10px 16px;
  border-left: 3px solid #ddbc80;
}
#room-summary span {
  display: block;
  color: #e5d2af;
  font-size: 14px;
}
#room-summary button {
  flex-shrink: 0;
}
#join-room {
  margin-bottom: 16px;
}
#join-error:empty {
  display: none;
}
#join-room .button {
  margin-top: 10px;
}
@media (max-width: 560px) {
  .room-seat {
    gap: 6px;
    padding: 10px;
    flex-direction: column;
    align-items: flex-start;
  }
  .room-avatar {
    width: 44px;
    height: 50px;
  }
  .room-roster,
  .room-loadout {
    gap: 8px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .room-page,
  #seat-lobby.room-page {
    margin: 8px auto;
    padding: 14px 20px;
  }
  .room-seat {
    min-height: 62px;
    padding: 6px 10px;
  }
  .room-avatar {
    height: 43px;
    width: 40px;
  }
  .room-mission,
  .room-status,
  .room-actions {
    margin: 6px 0;
  }
}

#stone-btn {
  touch-action: none;
  user-select: none;
  border-color: #8d9b97;
}
@media (max-width: 700px) {
  .combat-bottom .skill-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "tech dash" "stone ult";
  }
  .skill-buttons #tech-btn {
    grid-area: tech;
  }
  .skill-buttons #dash-btn {
    grid-area: dash;
  }
  .skill-buttons #ult-btn {
    grid-area: ult;
  }
  .skill-buttons #stone-btn {
    grid-area: stone;
  }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  .combat-bottom .skill-buttons {
    grid-template-areas: "tech dash" "stone ult";
    grid-template-columns: repeat(2, minmax(90px, auto));
  }
  .combat-bottom .skill-buttons #tech-btn {
    grid-area: tech;
    min-height: 44px;
    border-radius: 6px;
  }
  .skill-buttons #stone-btn {
    grid-area: stone;
  }
}

.scene-3 { background-image:url(assets/tavern.webp); }
.art-picture { display:block; background-image:url(assets/martial.webp); background-size:400% 200%; background-repeat:no-repeat; aspect-ratio:3/2; }
.upgrade-cards,#learn-list {display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:10px;align-items:stretch}
.upgrade-cards .art-choice,#learn-list button {display:flex;flex-direction:column;align-items:stretch;gap:5px;margin:0;padding:0 0 10px;overflow:hidden;border:1px solid #6a6353;border-radius:5px;text-align:left;}
.upgrade-cards .art-picture,#learn-list .art-picture {width:100%;flex:none;border-bottom:1px solid #857044}
.upgrade-cards .art-choice :is(b,span,small),#learn-list :is(b,span) {margin:0 9px}
.upgrade-cards .art-choice[aria-pressed="true"],#learn-list button[aria-pressed="true"] {border-color:#f7ce86;box-shadow:inset 0 0 0 1px #e3b96c}
.upgrade-cards .art-choice kbd {top:5px;right:5px;background:#171e29e8;color:#ffedcd}
#team-learn:has(#learn-choices:not([hidden])) {width:min(630px,calc(100vw - 24px));max-width:none}
.field-tools {display:flex;gap:5px;align-items:center;pointer-events:auto;margin-top:3px}
.field-tools button {border:1px solid #756346;border-radius:3px;background:#16212ac9;color:#f4d89f;padding:3px 6px;font:inherit;font-size:12px;cursor:pointer}
.pocket {background:#17212b;color:#f7ead0;border:1px solid #a48a60;border-radius:6px;width:min(450px,90vw);max-height:83dvh;overflow:auto;padding:18px;box-sizing:border-box}
.pocket::backdrop {background:#091018a6}
.pocket header {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.pocket h2 {font-family:var(--brush,serif);font-size:26px;margin:0}
.mix-line {display:grid;grid-template-columns:5em minmax(70px,1fr) 3.3em;align-items:center;gap:10px;margin:17px 0}
.mix-line input {accent-color:#deb472;width:100%;min-width:0}
.mix-line output {text-align:right;font-variant-numeric:tabular-nums}
#book-list article {display:grid;grid-template-columns:68px 1fr;column-gap:12px;align-items:center;margin:8px 0;padding-bottom:8px;border-bottom:1px solid #635640}
#book-list .art-picture {grid-row:span 2;width:68px}
#book-list span {color:#d8d1c0;font-size:14px}
@media(max-width:620px) and (orientation:portrait){
  .upgrade-cards,#learn-list {grid-auto-columns:minmax(145px,55%);overflow-x:auto;scroll-snap-type:x proximity;padding-bottom:6px}
  .upgrade-cards .art-choice,#learn-list button{scroll-snap-align:start}
}
@media (max-height:560px) and (orientation:landscape){
  .upgrade-cards .art-picture,#learn-list .art-picture{align-self:center;width:min(100%,105px)}
  .upgrade-cards .art-choice,#learn-list button{gap:2px;padding-bottom:4px}
  .field-tools{gap:4px}.field-tools button{font-size:11px;padding:2px 5px}
}

.field-tools{grid-column:1 / -1;min-width:0}
#book-open {min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#field-audio {flex:none}
@media(max-width:500px),(max-height:560px){#book-open{max-width:115px}}

.school-picture {background-image:url(assets/schools.webp);background-size:300% 200%}
@media (max-height:560px) and (orientation:landscape){
  .upgrade-cards .art-choice,#learn-list button{display:grid;grid-template-columns:clamp(48px,7vw,80px) 1fr;grid-template-rows:min-content 1fr;align-content:start;column-gap:3px;padding:5px}
  .upgrade-cards .art-picture,#learn-list .art-picture{grid-row:1/span 3;align-self:start;width:100%}
  .upgrade-cards .art-choice :is(b,span,small),#learn-list :is(b,span){margin:0 3px}
  .upgrade-cards .art-choice kbd{display:none}
}

#tech-btn.follow {
  position:relative; isolation:isolate; background:#194534; border-color:#9df4bb; color:#edffe9;
  box-shadow:0 0 0 2px #17342a,0 0 12px #72d4a166;
}
#tech-btn.follow::after {
  content:"";position:absolute;inset:-3px;border-radius:inherit;pointer-events:none;padding:3px;
  background:conic-gradient(#d0ffbd var(--follow-left),#375646 0);
  mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask-composite:exclude;
}
.stone-return {
  position:fixed;left:0;top:0;width:10px;height:8px;z-index:9;pointer-events:none;
  border:2px solid #eaffe0;background:#75ae96;border-radius:60% 35% 50% 30%;box-shadow:-3px 0 7px #affac4;
}

.skill-buttons {position:relative}
#counter-call {
  position:absolute;right:0;bottom:calc(100% + 7px);width:max-content;max-width:78vw;
  border:1px solid #a4d4a3;border-left:4px solid #bafaac;border-radius:3px;
  padding:5px 10px;background:#102d24f2;color:#e2f6db;font:600 14px/1.3 sans-serif;
  text-shadow:0 1px #101a17;pointer-events:none;
}
#counter-call[hidden] {display:none}

.turn-phone, .skill-buttons .act-icon { display:none }
.skill-buttons .act-detail { margin-inline-start:3px; font:inherit; font-variant-numeric:tabular-nums }
.skill-buttons .act-detail:empty { display:none }
@media (pointer:coarse) and (orientation:portrait) {
  .turn-phone { display:inline-flex; align-items:center }
}
@media (pointer:coarse) {
  .combat-bottom {align-items:flex-end;pointer-events:none}
  .combat-bottom #stick,.combat-bottom .skill-buttons button {
    touch-action:none; -webkit-tap-highlight-color:transparent; user-select:none;
  }
  .combat-bottom .skill-buttons {
    display:block;position:relative;flex:none;width:195px;max-width:none;height:146px;pointer-events:none;
    margin:0 2px 0 auto;
  }
  .combat-bottom .skill-buttons button:is(#dash-btn,#tech-btn,#ult-btn,#stone-btn) {
    --accent:#e2cb9e;
    position:absolute; min-width:0;min-height:0; margin:0;padding:0;box-sizing:border-box;
    display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;
    border:1.5px solid var(--accent);border-radius:50%;
    color:#fff4d9;background:radial-gradient(circle at 38% 25%,#354551ef,#152431ee 78%);
    box-shadow:inset 0 0 0 3px #10202bb8,inset 0 0 0 4px #e6d3b137,0 2px 6px #08131aae;
    font:600 13px/1.05 sans-serif;pointer-events:auto;
  }
  .combat-bottom .skill-buttons #dash-btn {right:3px;bottom:1px;width:76px;height:76px;--accent:#b9dfee}
  .combat-bottom .skill-buttons #tech-btn {right:88px;bottom:14px;width:65px;height:65px;--accent:#f2c984}
  .combat-bottom .skill-buttons #ult-btn {right:30px;bottom:86px;width:59px;height:59px;--accent:#e7986e}
  .combat-bottom .skill-buttons #stone-btn {right:146px;bottom:85px;width:48px;height:48px;--accent:#9bc8b8}
  .combat-bottom .skill-buttons button:disabled {opacity:.75}
  .combat-bottom .skill-buttons #tech-btn:is(.counter-ready,.follow) {color:#e3ffdd;background:#23523a;border-color:#c9ffb8}
  .combat-bottom .skill-buttons #ult-btn.ready {color:#fff0c2;background:radial-gradient(at 40% 20%,#ad5636,#602f27);box-shadow:inset 0 0 0 3px #e9b45a50,0 0 9px #e99d3d70}
  .combat-bottom .skill-buttons button:active:enabled {filter:brightness(1.3)}
  .combat-bottom .skill-buttons .act-icon {display:block;width:22px;height:22px;margin:0 0 1px;color:var(--accent);pointer-events:none}
  .combat-bottom .skill-buttons #dash-btn .act-icon {width:29px;height:29px}
  .combat-bottom .skill-buttons #stone-btn .act-icon {width:15px;height:15px}
  .combat-bottom .skill-buttons .act-name {font-size:0;pointer-events:none}
  .combat-bottom .skill-buttons .act-name::before {content:attr(data-short);font:600 13px/1.05 sans-serif}
  .combat-bottom .skill-buttons #dash-btn .act-name::before {font-size:15px}
  .combat-bottom .skill-buttons .act-detail {margin:1px 0 0;font:600 11px/1 sans-serif;pointer-events:none}
  .combat-bottom .skill-buttons #stone-btn .act-name::before {font-size:11px}
  .combat-bottom .skill-buttons kbd {display:none}
  #counter-call {bottom:calc(100% + 3px)}
}
