:root {
  --ink: #241910;
  --paper: #f4ead6;
  --gold: #f0c14a;
  --blue: #2f74c4;
  --red: #d24b43;
  --line: rgba(244, 234, 214, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--paper);
  background: #14110e;
  user-select: none;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

#stage { position: fixed; inset: 0; z-index: 1; }
#stage canvas { display: block; width: 100%; height: 100%; }
#fx { position: fixed; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }

.hud { z-index: 4; }
.top {
  position: fixed;
  left: 12px; right: 12px; top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand h1 {
  margin: 0;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 28px;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,.55);
}
.brand p { margin: 0; font-size: 13px; opacity: .9; text-shadow: 0 1px 4px #000; }
.seal {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: #b4332a;
  border: 2px solid #f0d2cc;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 24px;
  transform: rotate(-8deg);
}
.top-mid, .gold-tools, .controls, .row, .view-row, .mode-row, .map-row, .dock-row, .cmd {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.top button, .gold-tools button, .controls button, .row button, .team, .ghost, .cat, #btn-sound {
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(20,16,12,.72);
  color: var(--paper);
  border-radius: 999px;
  padding: 6px 12px;
}
.top button.on, .team.on, #btn-inf.on, .ghost.on, .cat.on {
  background: var(--gold);
  color: #2a1c08;
  border-color: #8a6414;
  font-weight: 700;
}
#cmd-blue.on { background: var(--blue); color: white; border-color: transparent; }
#cmd-red.on { background: var(--red); color: white; border-color: transparent; }
.map-pick { font-size: 14px; background: rgba(20,16,12,.72); padding: 4px 10px; border-radius: 999px; }
.map-pick select, .gold-tools input {
  background: transparent; color: var(--paper); border: none; font-size: 14px; outline: none;
}
.gold-tools input { width: 84px; }

.goldbar {
  position: fixed;
  left: 16px; right: 16px; top: 62px;
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 220px);
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  z-index: 4;
}
.gold {
  width: min(220px, 100%);
  background: rgba(244, 234, 214, .96);
  color: var(--ink);
  border-radius: 14px;
  padding: 8px 14px;
  border: 1px solid rgba(90, 62, 36, .18);
  box-shadow: 0 8px 18px rgba(0,0,0,.16);
}
.gold.blue { justify-self: start; }
.gold.red { justify-self: end; text-align: right; }
.gold span, .gold small { display: block; font-size: 12px; opacity: .75; }
.gold strong { font-size: 26px; line-height: 1.1; }
.gold.blue strong { color: var(--blue); }
.gold.red strong { color: var(--red); }
.gold-tools {
  justify-content: center;
  background: rgba(20,16,12,.55);
  padding: 6px;
  border-radius: 12px;
}
.gold-tools label { color: var(--paper); font-size: 14px; }

.mini {
  position: fixed;
  top: 168px; right: 16px;
  border: 2px solid #e6d2a2;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
.fight-clean .gold span,
.fight-clean .gold small,
.fight-clean #cats,
.fight-clean #roster,
.fight-clean #pick-hint,
.fight-clean #cmd-row,
.fight-clean .keys,
.fight-clean #btn-del,
.fight-clean #btn-start,
.fight-clean #btn-deploy-done { display: none !important; }
.fight-clean .gold {
  background: none;
  box-shadow: none;
  border: none;
}
.fight-clean .gold strong {
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 28px;
  text-shadow: 0 2px 8px rgba(0,0,0,.45);
}
.fight-clean .goldbar {
  right: 16px;
  grid-template-columns: 1fr 1fr;
}
.fight-clean #topbar { display: none !important; }
.match-clock {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 26px;
  letter-spacing: .08em;
  color: #f4ead6;
  text-shadow: 0 2px 8px rgba(0,0,0,.55);
}
.speed5-bar {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 16px;
  background: rgba(42, 18, 14, 0.88);
  color: #f4ead6;
  border: 1px solid rgba(196, 74, 58, 0.75);
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 22px;
  letter-spacing: .08em;
}
.speed5-bar button {
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 18px;
  color: #f4ead6;
  background: rgba(160, 42, 32, 0.9);
  border: 1px solid rgba(244, 214, 180, 0.45);
  padding: 2px 12px;
  cursor: pointer;
}
body.hand-mode #cats,
body.hand-mode #roster,
body.hand-mode #dock-toggle,
body.hand-mode #cmd-row,
body.hand-mode #pick-hint,
body.hand-mode .keys,
body.hand-mode #goldbar,
body.hand-mode #btn-start,
body.hand-mode #btn-deploy-done,
body.hand-mode #btn-del,
body.hand-mode #btn-clear { display: none !important; }
body.build-mode #cats { display: none !important; }
.fight-clean .dock {
  background: transparent;
  border: none;
  box-shadow: none;
}
.fight-clean .mini {
  top: 168px;
  right: 16px;
  border: none;
  box-shadow: none;
}
.count-ink {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.count-ink b {
  font-family: "STXingkai", "华文行楷", "KaiTi", "STKaiti", serif;
  font-size: min(46vw, 340px);
  font-weight: 400;
  line-height: 1;
  color: #1a120e;
  text-shadow: 0 0 18px rgba(255,255,255,.9), 0 0 2px #1a120e, 0 16px 28px rgba(40,24,12,.28);
}
.count-ink.word b { font-size: min(22vw, 180px); letter-spacing: .12em; }
.count-ink.pop b { animation: inkCount .95s cubic-bezier(.16, .84, .28, 1); }
#hand-clock {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  font-family: "STXingkai", "华文行楷", "KaiTi", "STKaiti", serif;
  font-size: 138px;
  line-height: 1;
  color: #1a120e;
  text-shadow: 0 2px 0 #fff6e4, 0 8px 18px rgba(255,255,255,.75);
  pointer-events: none;
}
#hand-clock b {
  display: block;
  font-weight: 400;
  transform: scale(1);
  transform-origin: center center;
}
#hand-clock.tick b { animation: handTick .52s ease-in-out; }
@keyframes handTick {
  0% { transform: scale(1); }
  42% { transform: scale(0.2); }
  100% { transform: scale(1); }
}
#hand-clock.hidden { display: none; }
#hand-clock.center {
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 240px;
}
#hand-end {
  position: fixed;
  top: 11%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
#hand-end b {
  font-family: "STXingkai", "华文行楷", "KaiTi", "STKaiti", serif;
  font-size: 108px;
  font-weight: 400;
  line-height: 1;
  color: #1a120e;
  text-shadow: 0 2px 0 #fff6e4, 0 8px 18px rgba(255,255,255,.75);
  pointer-events: none;
  white-space: nowrap;
}
#hand-end.hidden { display: none; }
#hand-skip {
  font-family: "STXingkai", "华文行楷", "KaiTi", "STKaiti", serif;
  font-size: 46px;
  line-height: 1;
  color: #1a120e;
  background: none;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  text-shadow: 0 1px 0 #fff6e4, 0 4px 10px rgba(255,255,255,.7);
}
#hand-skip:hover { color: #fff; }
#hand-tap {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
#hand-tap.hidden { display: none; }
#hand-mult {
  position: relative;
  top: -64px;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 48px;
  line-height: 1;
  color: #1a120e;
  text-shadow: 0 1px 0 #fff6e4, 0 2px 8px rgba(255,255,255,.8);
  transform-origin: center bottom;
}
#hand-dot {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  border: 4px solid #3a2a1c;
  --heat: 0;
  --spin: 0deg;
  --scale: 1;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.9), rgba(255,255,255,0) 46%),
    conic-gradient(from 0deg,
      #ffe7a3,
      hsl(calc(36 + var(--heat) * 50), calc(78% + var(--heat) * 18%), 58%) calc(22% + var(--heat) * 10%),
      hsl(calc(8 + var(--heat) * 24), calc(72% + var(--heat) * 22%), calc(52% - var(--heat) * 8%)) calc(48% + var(--heat) * 8%),
      hsl(calc(200 + var(--heat) * 70), calc(46% + var(--heat) * 40%), calc(58% - var(--heat) * 6%)) calc(74% + var(--heat) * 6%),
      #ffe7a3);
  box-shadow: 0 10px 22px rgba(40, 24, 12, calc(0.22 + var(--heat) * 0.28));
  transform: rotate(var(--spin)) scale(var(--scale));
  transform-origin: center center;
}
@keyframes inkCount {
  0% { opacity: 0; transform: scale(1.18); }
  16% { opacity: 1; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}
#mini { display: block; cursor: pointer; }

.dock {
  position: fixed;
  left: 10px; right: 10px; bottom: 8px;
  background: rgba(16, 13, 10, .78);
  border: 1px solid rgba(230, 210, 162, .35);
  border-radius: 14px;
  padding: 8px 10px 8px;
  max-width: calc(100% - 20px);
  transition: transform .48s cubic-bezier(.22, .72, .2, 1);
}
.dock.shut {
  transform: translateY(calc(100% - 36px));
  overflow: hidden;
}
.dock.shut > :not(.dock-arrow) {
  visibility: hidden;
}
.dock-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 28px;
  margin: -2px auto 6px;
  border: none;
  border-radius: 999px;
  background: #f4ead6;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
.dock-arrow i {
  width: 10px;
  height: 10px;
  border-right: 3px solid #241910;
  border-bottom: 3px solid #241910;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .35s ease;
}
.dock.shut .dock-arrow i { transform: rotate(225deg) translateY(-2px); }
#pick-hint { margin: 0; font-size: 13px; opacity: .92; }
#cats { display: flex; gap: 6px; margin: 6px 0; }
.cat small { display: block; font-weight: 400; opacity: .8; font-size: 11px; }
#roster {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.role {
  flex: 0 0 104px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(244, 234, 214, .95);
  color: var(--ink);
  border-radius: 10px;
  padding: 4px 4px 6px;
  text-align: center;
}
.role canvas { width: 100%; height: 58px; display: block; background: #efe2c4; border-radius: 6px; }
.role b { display: block; font-size: 13px; }
.role em, .role small { display: block; font-style: normal; font-size: 11px; opacity: .72; }
.role.sel {
  outline: 3px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(240, 193, 74, .55);
}
.role.poor { opacity: .45; }
.controls { margin-top: 6px; }
#btn-start:not(:disabled), #btn-deploy-done {
  background: #f0c14a;
  color: #2a1c08;
  border-color: #8a6414;
  font-weight: 700;
}
.deploy-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: max-content;
  text-align: center;
  padding: 8px 18px;
  border-radius: 14px;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.15;
  color: #fff;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
}
.deploy-banner.blue { background: #1d5fa8; border: 3px solid #d7ecff; }
.deploy-banner.red { background: #b4332a; border: 3px solid #ffd0c8; }
#btn-del.on { background: #d24b43; color: #fff; border-color: transparent; font-weight: 700; }

.modal {
  position: fixed;
  z-index: 6;
  left: 50%; top: 48%;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100% - 28px));
  max-height: calc(100% - 120px);
  overflow: auto;
  background: rgba(244, 234, 214, .95);
  color: var(--ink);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
}
.modal h2 { margin: 0 0 6px; font-family: "KaiTi", "STKaiti", serif; font-size: 32px; }
.lead { margin: 0 0 12px; line-height: 1.55; }
.choice {
  flex: 1;
  text-align: left;
  border-radius: 12px;
  border: 1px solid #3a2a1c;
  background: #fffaf0;
  color: var(--ink);
  padding: 10px 12px;
}
.choice b { display: block; font-size: 20px; font-family: "KaiTi", "STKaiti", serif; }
.choice span { display: block; font-size: 13px; line-height: 1.4; }
.choice.on { outline: 3px solid #b4332a; }
#level-grid { display: block; margin-bottom: 12px; }
#level-grid .endless-open { width: 100%; margin: 0 0 14px; }
.boss-shelf {
  margin: 0 0 14px;
  padding: 8px 8px 10px;
  background: rgba(244, 234, 214, .97);
  border-radius: 12px;
}
.boss-shelf h3 { margin: 0 0 8px; }
#levels { width: min(1080px, calc(100% - 24px)); }
.boss-after { margin: 0 0 14px; }
.boss-after .lv { width: 100%; text-align: left; }
.chapter h3 {
  margin: 0 0 8px;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 22px;
  color: #8a2a22;
}
.lv.boss b { color: #9a1c14; }
.lv.smallboss b { color: #8a5a12; }
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.lv-cell { min-width: 0; display: flex; }
.lv-cell .lv { flex: 1 1 0; width: 0; min-width: 0; box-sizing: border-box; }
.lv {
  text-align: left;
  border-radius: 12px;
  border: 1px solid #3a2a1c;
  background: #fffaf0;
  color: var(--ink);
  padding: 8px 10px 9px;
  min-height: 78px;
}
.lv b { display: block; font-size: 12px; opacity: .7; }
.lv span { font-family: "KaiTi", "STKaiti", serif; font-size: 20px; line-height: 1.2; }
.lv small { display: block; margin-top: 4px; font-size: 12px; opacity: .75; }
.lv.locked { opacity: .38; }
.lv.done { background: #e5f0dc; }
.lv.now {
  background: #fff3cc;
  border-color: #b4332a;
  box-shadow: 0 0 0 3px rgba(180, 51, 42, .28);
}
.map-row { margin: 10px 0; align-items: center; }
#pick.side-panel, #map-list.side-panel, #td-pick.side-panel {
  left: 16px;
  top: 78px;
  transform: none;
  width: 280px;
  max-height: calc(100% - 96px);
  padding: 14px 12px 12px;
}
#td-pick.side-panel {
  left: auto;
  right: 16px;
}
#td-pick .mode-row { flex-direction: column; align-items: stretch; }
#td-pick .choice, #td-pick .map-chip, #td-pick .pick-foot button {
  width: 100%;
  flex: none;
}
#td-pick .map-chip.on,
#map-list .map-chip.on {
  outline: 3px solid #b4332a;
  background: #ffe08a;
  color: #241910;
}
#td-pick .map-chip,
#map-list .map-chip {
  color: #241910;
  background: #fffaf0;
  font-weight: 700;
  font-size: 18px;
}
.td-label { display: block; margin: 10px 0 6px; font-size: 14px; }
#pick .mode-row { flex-direction: column; align-items: stretch; }
#pick .choice, #map-list .map-chip, #pick .pick-foot button, #map-list .pick-foot button {
  width: 100%;
  flex: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
#map-now { color: #241910; font-weight: 700; font-size: 16px; opacity: 1; }
#pick .pick-foot, #map-list .pick-foot { flex-direction: column; align-items: stretch; margin-top: 8px; }
.map-col { display: flex; flex-direction: column; gap: 8px; }
#pick .choice:hover, #map-list .map-chip:hover,
#pick .pick-foot button:hover, #map-list .pick-foot button:hover {
  transform: scale(1.03);
  box-shadow: 0 0 0 3px #7a1410;
}
#btn-gate-exit { margin-left: auto; }
.pick-foot { margin-top: 12px; }
.map-chip {
  border-radius: 999px;
  border: 1px solid #3a2a1c;
  background: #fffaf0;
  color: var(--ink);
  padding: 6px 12px;
}
.map-chip.on { background: #1d3e66; color: #f4ead6; }
#result { text-align: center; }
#result h2 { font-size: 42px; color: #b4332a; }
.toast {
  position: fixed;
  z-index: 8;
  left: 50%; top: 118px;
  transform: translateX(-50%);
  background: rgba(20,16,12,.88);
  color: var(--paper);
  padding: 8px 16px;
  border-radius: 999px;
  pointer-events: none;
}
.row button, #levels button, #result button, .choice, .map-chip, .lv, #btn-enter, #btn-gate-exit { cursor: pointer; }

#gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: auto;
  overflow: hidden;
}
#gate.hidden { display: none !important; }
.sensor-head, .jamb, .track, .leaf { pointer-events: none; }
.sensor-head {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 64px;
  z-index: 6;
  background: linear-gradient(#4a525b, #23282e 55%, #15191d);
  box-shadow: 0 8px 18px rgba(0,0,0,.28);
}
.sensor {
  position: absolute;
  left: 50%; top: 18px;
  width: 72px; height: 26px;
  transform: translateX(-50%);
  border-radius: 20px;
  background: #0c0e11;
  box-shadow: inset 0 0 0 2px #6d757e, 0 0 0 4px #2a3036;
}
.sensor:after {
  content: "";
  position: absolute;
  left: 12px; top: 8px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ff4a3a;
  box-shadow: 0 0 10px #ff4a3a;
}
.jamb {
  position: absolute;
  top: 0; bottom: 0;
  width: 22px;
  z-index: 5;
  background: linear-gradient(90deg, #d5dde4, #8e979f 40%, #5c656d);
}
.jamb.left { left: 0; }
.jamb.right { right: 0; background: linear-gradient(90deg, #5c656d, #8e979f 60%, #d5dde4); }
.track {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 16px;
  z-index: 5;
  background: linear-gradient(#9aa3ab, #5d666e);
}
#gate { --pry: 0%; }
.leaf {
  position: absolute;
  top: 64px;
  bottom: 16px;
  width: 25%;
  z-index: 1;
  box-sizing: border-box;
  border: 12px solid #8d97a0;
  border-left-color: #f2f5f7;
  border-right-color: #5e686f;
  background-color: transparent;
  background-image:
    linear-gradient(118deg, rgba(255,255,255,.5) 0 7%, rgba(255,255,255,0) 16%),
    linear-gradient(180deg, rgba(198,220,228,.38), rgba(150,186,198,.16) 46%, rgba(176,204,214,.28));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
  will-change: transform;
}
.leaf:before {
  content: "";
  position: absolute;
  left: 18px; right: 18px; top: 18px; bottom: 18px;
  border: 2px solid rgba(255,255,255,.85);
  background:
    linear-gradient(#fff, #fff) 8px 8px / 22px 3px no-repeat,
    linear-gradient(#fff, #fff) 8px 8px / 3px 22px no-repeat,
    linear-gradient(#fff, #fff) right 8px top 8px / 22px 3px no-repeat,
    linear-gradient(#fff, #fff) right 8px top 8px / 3px 22px no-repeat,
    linear-gradient(#fff, #fff) 8px bottom 8px / 22px 3px no-repeat,
    linear-gradient(#fff, #fff) 8px bottom 8px / 3px 22px no-repeat,
    linear-gradient(#fff, #fff) right 8px bottom 8px / 22px 3px no-repeat,
    linear-gradient(#fff, #fff) right 8px bottom 8px / 3px 22px no-repeat;
  pointer-events: none;
}
.l-out { left: 0; }
.l-in { left: 25%; }
.r-in { left: 50%; }
.r-out { left: 75%; }
.l-in:after, .r-in:after {
  content: "";
  position: absolute;
  top: 42%;
  width: 8px;
  height: 16%;
  border-radius: 6px;
  background: linear-gradient(#f7fafc, #9aa3ab);
  box-shadow: 0 0 0 3px rgba(90, 98, 106, .35);
}
.l-in:after { right: 22px; }
.r-in:after { left: 22px; }
.gate-ui {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding-bottom: 4vh;
}
.ink {
  width: max-content;
  max-width: 92vw;
  margin: 0 auto;
  background: none;
  box-shadow: none;
  padding: 0;
  transition: transform .2s ease;
}
.ink .row {
  display: flex;
  flex-wrap: nowrap;
  width: auto;
  justify-content: center;
}
.r1 { gap: .08em; }
.r2, .r3 { gap: .16em; margin-top: .02em; }
.ink b {
  font-family: "STXingkai", "华文行楷", "KaiTi", "STKaiti", serif;
  font-weight: 400;
  line-height: .92;
  color: #1a120e;
  text-shadow: 0 0 1px #1a120e, 0 10px 18px rgba(40, 24, 12, .18);
  opacity: 0;
  transform: translateY(22px) scale(.9);
}
.r1 b { font-size: clamp(96px, 16vw, 210px); }
.r2 b { font-size: clamp(68px, 11vw, 142px); }
.r3 b { font-size: clamp(56px, 8.6vw, 112px); }
#btn-enter {
  pointer-events: none;
  margin-top: 8vh;
  border: none;
  background: transparent;
  color: #1a120e;
  font-family: "STXingkai", "华文行楷", "KaiTi", "STKaiti", serif;
  font-size: clamp(44px, 6.2vw, 92px);
  letter-spacing: .18em;
  padding: 0 8px 8px;
  background: transparent;
  border-radius: 0;
  opacity: 0;
  transform: translateY(16px);
  text-shadow: 0 0 1px #1a120e;
  box-shadow: none;
  transition: transform .2s ease, color .2s ease, text-shadow .2s ease;
}
#gate.show-title .ink b,
#gate.show-title #btn-enter {
  animation: charPop .55s cubic-bezier(.16, .84, .28, 1) forwards;
}
#gate.show-title .r1 b:nth-child(1) { animation-delay: .02s; }
#gate.show-title .r1 b:nth-child(2) { animation-delay: .1s; }
#gate.show-title .r2 b:nth-child(1) { animation-delay: .2s; }
#gate.show-title .r2 b:nth-child(2) { animation-delay: .28s; }
#gate.show-title .r2 b:nth-child(3) { animation-delay: .36s; }
#gate.show-title .r3 b:nth-child(1) { animation-delay: .46s; }
#gate.show-title .r3 b:nth-child(2) { animation-delay: .54s; }
#gate.show-title .r3 b:nth-child(3) { animation-delay: .62s; }
#gate.show-title #btn-enter { animation-delay: .78s; }
@keyframes charPop {
  to { opacity: 1; transform: none; }
}
#gate.slam .sensor-head { animation: headIn 1.7s cubic-bezier(.22, .72, .2, 1) both; }
#gate.slam .track { animation: trackIn 1.7s cubic-bezier(.22, .72, .2, 1) both; }
@keyframes headIn { from { transform: translateY(-120%); } to { transform: none; } }
@keyframes trackIn { from { transform: translateY(160%); } to { transform: none; } }
#gate.slam .l-out { animation: shutSide 1.7s cubic-bezier(.22, .72, .2, 1) both; }
#gate.slam .r-out { animation: shutSide 1.7s cubic-bezier(.22, .72, .2, 1) both; }
#gate.slam .l-in { animation: shutInner 1.7s cubic-bezier(.22, .72, .2, 1) both; }
#gate.slam .r-in { animation: shutInner 1.7s cubic-bezier(.22, .72, .2, 1) both; }
#gate.slam .l-out, #gate.slam .l-in { --dir: -1; }
#gate.slam .r-out, #gate.slam .r-in { --dir: 1; }
@keyframes shutSide {
  from { transform: translate3d(calc(var(--dir) * 108%), 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}
@keyframes shutInner {
  from { transform: translate3d(calc(var(--dir) * 216%), 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}
.ink { pointer-events: auto; }
#gate.show-title .ink:hover { transform: scale(1.08); }
#gate.show-title .ink:hover b {
  color: #fff;
  text-shadow: 0 0 8px #fff, 0 0 16px rgba(255,255,255,.9);
}
#gate.enter-on #btn-enter {
  pointer-events: auto;
  animation: none;
  opacity: 1;
  transform: none;
}
#gate.enter-on #btn-enter:hover {
  transform: scale(1.1);
  color: #fff;
  background: transparent;
  text-shadow: 0 0 8px #fff, 0 0 18px rgba(255,255,255,.95);
  box-shadow: none;
}
#btn-settings-gate {
  position: absolute;
  top: 14px;
  right: 28px;
  z-index: 25;
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,.45);
  background: rgba(20,16,12,.72);
  color: #f4ead6;
  border-radius: 999px;
  padding: 6px 16px;
  transition: transform .16s ease, filter .16s ease;
}
#btn-settings-gate:hover { transform: scale(1.08); filter: brightness(1.2); }
#gate.open #btn-settings-gate { opacity: 0; pointer-events: none; }
.ink-lace {
  position: absolute;
  left: 50%;
  top: 61%;
  width: 320px;
  height: 22px;
  z-index: 21;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(#fff, #fff) center / 210px 3px no-repeat,
    radial-gradient(circle, #fff 0 5px, transparent 6px) 18px center / 14px 14px no-repeat,
    radial-gradient(circle, #fff 0 5px, transparent 6px) right 18px center / 14px 14px no-repeat,
    linear-gradient(45deg, transparent 42%, #fff 43% 57%, transparent 58%) center / 16px 16px no-repeat;
  filter: drop-shadow(0 0 8px rgba(255,255,255,.9));
}
#gate.show-line .ink-lace { animation: lineIn .65s ease forwards; }
@keyframes lineIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
#gate.ready .l-out, #gate.ready .l-in { --dir: -1; }
#gate.ready .r-out, #gate.ready .r-in { --dir: 1; }
#gate.ready .l-out, #gate.ready .r-out,
#gate.ready .l-in, #gate.ready .r-in {
  transform: translate3d(calc(var(--dir) * var(--pry)), 0, 0);
  transition: transform .55s cubic-bezier(.22, .8, .3, 1);
}
#gate.ready.prying .leaf { transition: none; }
#gate.open { z-index: 5; pointer-events: none; }
#gate.open .l-out { animation: openSide 2.25s cubic-bezier(.42, 0, .18, 1) forwards; }
#gate.open .r-out { animation: openSide 2.25s cubic-bezier(.42, 0, .18, 1) forwards; }
#gate.open .l-in { animation: openInner 2.25s cubic-bezier(.42, 0, .18, 1) forwards; }
#gate.open .r-in { animation: openInner 2.25s cubic-bezier(.42, 0, .18, 1) forwards; }
#gate.open .l-out, #gate.open .l-in { --dir: -1; }
#gate.open .r-out, #gate.open .r-in { --dir: 1; }
@keyframes openSide {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(var(--dir) * 108%), 0, 0); }
}
@keyframes openInner {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(var(--dir) * 216%), 0, 0); }
}
#gate.open .sensor-head,
#gate.open .jamb,
#gate.open .track,
#gate.open .gate-ui {
  animation: frameFade 1.15s ease forwards;
}
#gate.open.show-line .ink-lace {
  animation: frameFade 1.15s ease forwards;
}
@keyframes frameFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
#guide.modal {
  z-index: 40;
  width: min(720px, calc(100% - 36px));
  max-height: none;
  overflow: visible;
  padding: 0 0 12px;
  background: transparent;
  box-shadow: none;
}
#guide .roll {
  height: 16px;
  margin: 0 6px;
  border-radius: 10px;
  background: linear-gradient(#c4a07a, #6b4228 42%, #3d2616 50%, #a67c52);
  box-shadow: 0 2px 0 rgba(255,255,255,.25) inset;
}
#guide .sheet {
  height: 0;
  overflow: hidden;
  margin: 0 22px;
  background: #f6efe2;
  color: #241910;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
}
#guide .sheet h2 { margin: 16px 22px 8px; }
#guide-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 22px 16px;
  line-height: 1.7;
}
#guide.unfurl .sheet { animation: unroll 2.25s cubic-bezier(.22, .72, .2, 1) forwards; }
#guide.open .sheet { height: 460px; }
#guide.closing .sheet { animation: reroll .42s ease forwards; }
#guide.opening .sheet { animation: unroll .5s ease forwards; }
@keyframes unroll { from { height: 0; } to { height: 460px; } }
@keyframes reroll { from { height: 460px; } to { height: 0; } }
#guide .guide-progress {
  height: 8px;
  margin: 10px 22px 0;
  background: rgba(255,255,255,.35);
  border-radius: 99px;
  overflow: hidden;
}
#guide-bar {
  display: block;
  height: 100%;
  width: 20%;
  background: #f4ead6;
  border-radius: 99px;
}
#guide-body h3 { margin: 0 0 8px; font-family: "KaiTi", "STKaiti", serif; font-size: 26px; }
#guide-body p { margin: 0 0 10px; }
#guide-body ul { margin: 0 0 10px; padding-left: 1.2em; }
.guide-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 8px 0 12px; color: #f4ead6; }
.guide-nav button {
  width: 54px; height: 42px;
  border-radius: 12px;
  border: 1px solid #3a2a1c;
  background: #fffaf0;
  color: #241910;
  font-size: 26px;
}
.guide-nav button:disabled { opacity: .35; }
#guide-page { font-family: "KaiTi", "STKaiti", serif; font-size: 22px; text-shadow: 0 1px 4px #000; }
#settings {
  z-index: 40;
  width: min(760px, calc(100% - 28px));
  background: #f6efe2;
}
#settings .gold-tools label { color: #241910; }
.set-block {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 250, 240, .72);
  border: 1px solid rgba(58, 42, 28, .12);
}
.set-block > b { display: block; margin-bottom: 8px; font-size: 16px; }
#settings button,
#settings .map-pick,
#settings .gold-tools label {
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
#settings button:hover,
#settings .map-pick:hover,
#settings .gold-tools label:hover {
  transform: scale(1.08);
  filter: brightness(1.18);
}
#settings .map-pick {
  background: #fffaf0;
  color: #241910;
  border: 1px solid #3a2a1c;
  border-radius: 999px;
  padding: 6px 14px;
}
#settings .map-pick select,
#settings .map-pick option,
#settings .gold-tools input {
  color: #241910;
  background: #fffaf0;
  border: none;
  font-size: 16px;
  font-weight: 700;
}
#settings .gold-tools {
  background: transparent;
  padding: 0;
  justify-content: flex-start;
}
#btn-set-blue { background: #2f74c4; color: #fff; border-color: transparent; }
#btn-set-red { background: #d24b43; color: #fff; border-color: transparent; }
#gold-open {
  z-index: 45;
  width: min(1040px, calc(100% - 24px));
  background: #f6efe2;
  padding: 28px 32px 26px;
}
#gold-open h2 { font-size: 46px; margin-bottom: 14px; }
#gold-open .set-block { padding: 18px 20px; }
#gold-open .set-block > b { font-size: 22px; }
#gold-open .gold-tools { gap: 14px; background: transparent; padding: 0; justify-content: flex-start; }
#gold-open .gold-tools label { color: #241910; font-size: 22px; }
#gold-open button,
#gold-open .gold-tools label {
  font-size: 22px;
  padding: 12px 18px;
}
#gold-open .gold-tools input {
  width: 140px;
  font-size: 24px;
  color: #241910;
  font-weight: 700;
}
#gold-open #btn-open-blue { background: #2f74c4; color: #fff; border-color: transparent; }
#gold-open #btn-open-red { background: #d24b43; color: #fff; border-color: transparent; }
#gold-open button.on { box-shadow: 0 0 0 3px #8a6414; }
#gold-open #btn-gold-open-ok { font-size: 26px; padding: 12px 32px; background: #fffaf0; color: #241910; border: 1px solid #3a2a1c; }

@media (max-width: 900px) {
  .goldbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); top: 58px; }
  .gold { width: 100%; }
  .chapter-grid { grid-template-columns: 1fr 1fr; }
  .r1 b { font-size: 64px; }
  .r2 b { font-size: 46px; }
  .r3 b { font-size: 36px; }
  #btn-enter { font-size: 36px; }
  .mini { display: none; }
  .brand h1 { font-size: 22px; }
}
