:root {
  color-scheme: dark;
  --ink: #071312;
  --panel: #0c201d;
  --panel-2: #102a25;
  --line: #365b49;
  --paper: #eff7dc;
  --muted: #9eb8a4;
  --moss: #78c76e;
  --lime: #d8ee7b;
  --fire: #ff8358;
  --water: #67c8ed;
  --light: #f8dc77;
  --danger: #ee6157;
  --shadow: #020807;
  --pixel: 2px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #030908;
}

body {
  display: grid;
  place-items: center;
  color: var(--paper);
  font-family: "Microsoft YaHei", "Noto Sans SC", "PingFang SC", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

body.codex-open {
  touch-action: auto;
}

body.facility-open {
  touch-action: auto;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

kbd {
  display: inline-grid;
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  border: 1px solid #5c7866;
  border-bottom-width: 2px;
  background: #142a25;
  color: #c9ddc9;
  font: 700 10px/1 "Microsoft YaHei", sans-serif;
}

#app {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(89, 145, 106, 0.08) 50%, transparent 50.2%) 0 0 / 32px 32px,
    #030908;
}

#stage {
  position: relative;
  width: min(calc(100vw - 24px), calc((100vh - 24px) * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #3f6651;
  background: var(--ink);
  box-shadow: 0 24px 80px #000, 0 0 0 4px #081713;
  image-rendering: pixelated;
  isolation: isolate;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.is-hidden {
  display: none !important;
}

.screen,
.overlay,
.hud,
.toast-stack,
.room-banner,
.touch-controls {
  position: absolute;
  inset: 0;
}

.screen {
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 3.6% 5%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(4, 15, 13, 0.14), rgba(4, 15, 13, 0.84)),
    radial-gradient(circle at 75% 34%, rgba(187, 225, 86, 0.16), transparent 34%),
    #0b211b;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.4;
  background:
    linear-gradient(120deg, transparent 42%, rgba(87, 151, 92, 0.18) 43% 45%, transparent 46%),
    repeating-linear-gradient(90deg, rgba(229, 249, 196, 0.03) 0 1px, transparent 1px 38px);
}

.forest-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tree {
  position: absolute;
  bottom: 0;
  width: 9%;
  height: 58%;
  background: #081611;
  clip-path: polygon(30% 100%, 40% 31%, 24% 31%, 48% 0, 61% 26%, 53% 26%, 70% 100%);
  opacity: 0.9;
}

.tree::after {
  content: "";
  position: absolute;
  left: -45%;
  top: 20%;
  width: 220%;
  height: 32%;
  background: #0b1e18;
  clip-path: polygon(0 40%, 40% 0, 100% 44%, 73% 50%, 90% 100%, 37% 60%, 18% 100%, 22% 46%);
}

.t1 { left: -2%; transform: scale(1.4); }
.t2 { right: 7%; height: 45%; transform: scale(0.9); }
.t3 { right: -4%; height: 67%; transform: scale(1.2); }

.mushroom {
  position: absolute;
  width: 12px;
  height: 18px;
  border-radius: 9px 9px 2px 2px;
  background: #9ed565;
  box-shadow: inset 0 -5px 0 #587b3c;
}

.mushroom::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 4px;
  height: 10px;
  background: #cfdd9f;
}

.m1 { left: 13%; bottom: 10%; transform: scale(1.7); }
.m2 { right: 19%; bottom: 8%; transform: scale(1.1); }

.firefly {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e4f58c;
  box-shadow: 0 0 12px 4px rgba(228, 245, 140, 0.4);
  animation: drift 3.4s ease-in-out infinite alternate;
}

.f1 { left: 22%; top: 22%; }
.f2 { left: 68%; top: 18%; animation-delay: -1s; }
.f3 { left: 83%; top: 42%; animation-delay: -2s; }

@keyframes drift {
  to { transform: translate(18px, -12px); opacity: 0.35; }
}

.brand {
  position: relative;
  z-index: 2;
  text-align: center;
  text-shadow: 0 4px 0 #06100d;
}

.eyebrow {
  margin: 0 0 5px;
  color: #b6d18f;
  font-size: clamp(8px, 1vw, 12px);
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand h1 {
  margin: 0;
  color: #f2edce;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
  font-size: clamp(36px, 6.3vw, 78px);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0.04em;
}

.chapter {
  display: inline-block;
  margin: 10px 0 0;
  padding: 4px 14px;
  border-top: 1px solid #547247;
  border-bottom: 1px solid #547247;
  color: #cfdbb0;
  font-size: clamp(9px, 1.15vw, 14px);
  letter-spacing: 0.16em;
}

.roster {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(7px, 1.2vw, 15px);
  width: min(78%, 820px);
  margin: 2.2% auto 1.3%;
}

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 42% 1fr;
  min-width: 0;
  height: clamp(82px, 12vw, 148px);
  padding: clamp(5px, 0.8vw, 10px);
  border: 1px solid #58745e;
  background: rgba(9, 31, 25, 0.92);
  box-shadow: inset 0 0 0 3px #071411, 0 7px 0 #030b09;
  cursor: default;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-top: 2px solid var(--element-color);
  pointer-events: none;
  opacity: 0.8;
}

.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid #263f34;
  background: #0a1815;
}

.hero-card-copy {
  min-width: 0;
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-card .element {
  align-self: flex-start;
  padding: 2px 5px;
  background: var(--element-color);
  color: #07100d;
  font-size: clamp(8px, 0.9vw, 11px);
  font-weight: 900;
}

.hero-card h3 {
  margin: 5px 0 1px;
  color: #f3f1d6;
  font-size: clamp(12px, 1.4vw, 18px);
  line-height: 1;
}

.hero-card p {
  margin: 0;
  overflow: hidden;
  color: #9fbca6;
  font-size: clamp(8px, 0.9vw, 11px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-card small {
  margin-top: auto;
  color: #6f8c79;
  font-size: clamp(7px, 0.8vw, 10px);
}

.hero-order {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 3;
  padding: 2px 5px;
  border: 1px solid #71866c;
  background: rgba(5, 17, 14, 0.86);
  color: #dce8bd;
  font-size: clamp(7px, 0.8vw, 10px);
  font-weight: 800;
  pointer-events: none;
}

.start-panel {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(78%, 820px);
  margin: 0 auto;
  padding: clamp(10px, 1.3vw, 18px);
  border-top: 1px solid #47634e;
  border-bottom: 1px solid #283e32;
  background: rgba(4, 15, 12, 0.58);
}

.mission-copy {
  min-width: 0;
}

.mission-tag {
  margin-right: 8px;
  color: var(--lime);
  font-size: clamp(8px, 1vw, 11px);
  font-weight: 800;
}

.mission-copy strong {
  font-size: clamp(11px, 1.35vw, 17px);
}

.mission-copy p {
  margin: 5px 0 0;
  color: #94ad98;
  font-size: clamp(8px, 1vw, 12px);
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid #e7f2b0;
  background: var(--lime);
  color: #0a1b12;
  box-shadow: 0 5px 0 #73923e, inset 0 -2px 0 rgba(70, 94, 36, 0.25);
  font-size: clamp(10px, 1.2vw, 15px);
  font-weight: 900;
  white-space: nowrap;
}

.primary-button:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #73923e;
}

.primary-button kbd {
  border-color: #879d4e;
  background: #e4ef9b;
  color: #344316;
}

.secondary-button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid #56745e;
  background: #10241f;
  box-shadow: 0 4px 0 #07110f;
  font-weight: 800;
}

.secondary-button:hover {
  background: #18322a;
}

.text-button {
  padding: 10px;
  background: transparent;
  color: #8fa796;
  font-size: 12px;
}

.start-footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 16px;
  margin-top: auto;
  padding-top: 10px;
  color: #8aa090;
  font-size: clamp(7px, 0.8vw, 10px);
}

.start-footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hud {
  z-index: 20;
  pointer-events: none;
}

.hud button {
  pointer-events: auto;
}

.hud-top-left,
.hud-top-right,
.quest-panel,
.boss-health,
.energy-panel,
.hud-bottom,
.portal-prompt {
  position: absolute;
}

.hud-top-left {
  left: 2%;
  top: 3.2%;
}

.map-button {
  display: block;
  padding: 4px;
  border: 1px solid #6e8b72;
  background: rgba(5, 17, 14, 0.92);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

#minimap {
  display: block;
  width: clamp(100px, 13vw, 156px);
  height: auto;
  image-rendering: pixelated;
}

.map-button span {
  display: flex;
  justify-content: space-between;
  padding: 3px 2px 0;
  color: #c8dbc9;
  font-size: clamp(7px, 0.8vw, 10px);
  font-weight: 800;
}

.map-button kbd {
  height: 14px;
  min-width: 14px;
  font-size: 8px;
}

.quest-panel {
  left: 50%;
  top: 3.2%;
  width: min(34%, 360px);
  padding: 7px 10px 8px;
  transform: translateX(-50%);
  border-top: 1px solid #7b9b7a;
  border-bottom: 1px solid rgba(105, 137, 106, 0.4);
  background: rgba(5, 18, 14, 0.82);
  text-align: center;
}

.task-label {
  margin-right: 8px;
  color: var(--lime);
  font-size: clamp(7px, 0.75vw, 10px);
}

.quest-panel strong {
  font-size: clamp(8px, 0.95vw, 12px);
}

.quest-track,
.boss-track,
.energy-track,
.portal-track,
.hp-track {
  overflow: hidden;
  background: #030c0a;
  box-shadow: inset 0 1px 2px #000;
}

.quest-track {
  height: 3px;
  margin-top: 7px;
}

.quest-track i,
.boss-track i,
.energy-track i,
.portal-track i,
.hp-track i {
  display: block;
  width: 0;
  height: 100%;
  transition: width 120ms linear;
}

.quest-track i {
  background: var(--lime);
}

.hud-top-right {
  right: 2%;
  top: 3.2%;
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.currency {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #536b58;
  background: rgba(5, 18, 14, 0.85);
}

.currency span {
  color: #8fa594;
  font-size: clamp(7px, 0.8vw, 10px);
}

.currency strong {
  color: #f0d978;
  font-size: clamp(10px, 1.2vw, 15px);
}

.icon-button {
  width: clamp(30px, 3.6vw, 44px);
  border: 1px solid #627c67;
  background: #0b1e19;
  cursor: pointer;
}

.pause-icon,
.pause-icon::after {
  display: inline-block;
  width: 4px;
  height: 14px;
  background: #dce9d5;
}

.pause-icon {
  box-shadow: 8px 0 0 #dce9d5;
  transform: translateX(-4px);
}

.boss-health {
  left: 50%;
  top: 13%;
  width: min(58%, 580px);
  transform: translateX(-50%);
}

.boss-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
  text-shadow: 0 2px #000;
}

.boss-title span {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(12px, 1.7vw, 22px);
  font-weight: 900;
}

.boss-title b {
  color: #cab996;
  font-size: clamp(7px, 0.8vw, 10px);
}

.boss-track {
  height: 7px;
  border: 1px solid #493d30;
}

.boss-track i {
  background: #d66751;
}

.energy-panel {
  left: 50%;
  bottom: 18.8%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
  width: min(31%, 330px);
  padding: 5px 8px;
  transform: translateX(-50%);
  border: 1px solid #62735b;
  background: rgba(4, 15, 12, 0.88);
}

.energy-panel span,
.energy-panel strong {
  font-size: clamp(7px, 0.75vw, 10px);
}

.energy-panel span { color: #9fb4a1; }
.energy-panel strong { color: var(--lime); }

.energy-track {
  height: 5px;
}

.energy-track i {
  background: var(--lime);
  box-shadow: 0 0 8px rgba(216, 238, 123, 0.55);
}

.hud-bottom {
  left: 2%;
  right: 2%;
  bottom: 2.7%;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(160px, 1fr);
  align-items: end;
  gap: 2%;
}

.active-hero {
  display: flex;
  align-items: end;
  min-width: 0;
}

.portrait-wrap {
  position: relative;
  flex: 0 0 auto;
  width: clamp(43px, 5.4vw, 68px);
  height: clamp(43px, 5.4vw, 68px);
  border: 2px solid #d9e5cc;
  background: #07110f;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.42);
}

.portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.element-badge {
  position: absolute;
  right: -8px;
  top: -8px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid #f4f4d4;
  background: var(--element-color, var(--moss));
  color: #07100d;
  font-size: 10px;
  font-weight: 900;
}

.hero-readout {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 8px;
  padding: 6px 8px;
  border-top: 1px solid #667d67;
  border-bottom: 1px solid #354a3b;
  background: rgba(5, 18, 14, 0.88);
}

.hero-name-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.hero-name-row strong {
  overflow: hidden;
  font-size: clamp(10px, 1.3vw, 16px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-name-row span {
  overflow: hidden;
  color: #91a898;
  font-size: clamp(7px, 0.8vw, 10px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-track {
  height: 6px;
  margin-top: 6px;
  border: 1px solid #26382d;
}

.hp-track i {
  background: #71c96c;
}

.hp-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: #a9bcae;
  font-size: clamp(7px, 0.75vw, 10px);
}

.jump-ready {
  color: var(--lime);
}

.skill-bar {
  display: flex;
  gap: clamp(4px, 0.65vw, 8px);
}

.skill-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: clamp(44px, 5.8vw, 72px);
  height: clamp(48px, 6.2vw, 78px);
  padding: 3px;
  border: 1px solid #65816b;
  background: #0b211b;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 2px #07130f;
  cursor: pointer;
}

.skill-button:hover {
  border-color: #b5ce99;
  background: #122e25;
}

.skill-button .skill-glyph {
  position: relative;
  z-index: 2;
  display: grid;
  width: clamp(20px, 2.6vw, 32px);
  height: clamp(20px, 2.6vw, 32px);
  margin-bottom: 3px;
  place-items: center;
  border: 1px solid #9bb286;
  background: #173a2e;
  color: #e9efc7;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(11px, 1.45vw, 18px);
  font-weight: 900;
}

.skill-button b {
  position: relative;
  z-index: 2;
  width: 100%;
  overflow: hidden;
  font-size: clamp(6px, 0.7vw, 9px);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-button small {
  position: absolute;
  right: 3px;
  top: 2px;
  z-index: 3;
  color: #7f9b85;
  font-size: clamp(6px, 0.65vw, 8px);
  font-weight: 900;
}

.skill-button.attack .skill-glyph {
  border-color: #e8dfa1;
  background: #695e2b;
  color: #fff4b1;
}

.skill-button.ultimate {
  border-color: #b8ca69;
  background: #293719;
}

.skill-button.ultimate .skill-glyph {
  border-color: #f4ed9b;
  background: #889d38;
  color: #12200a;
}

.skill-button.is-cooling {
  filter: saturate(0.45);
}

.cooldown-mask {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 0;
  background: rgba(2, 7, 6, 0.78);
}

.skill-button em {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: clamp(10px, 1.2vw, 15px);
  font-style: normal;
  font-weight: 900;
  text-shadow: 0 2px #000;
}

.party-hud {
  position: absolute;
  right: 2%;
  bottom: 2.7%;
  display: flex;
  justify-content: flex-end;
  gap: clamp(3px, 0.55vw, 7px);
}

.party-slot {
  position: relative;
  width: clamp(31px, 4.2vw, 53px);
  height: clamp(39px, 5.2vw, 64px);
  padding: 2px;
  border: 1px solid #5a715e;
  background: rgba(5, 16, 13, 0.9);
  cursor: pointer;
}

.party-slot img {
  display: block;
  width: 100%;
  height: 72%;
  object-fit: cover;
  image-rendering: pixelated;
  filter: saturate(0.65);
}

.party-slot span {
  display: block;
  overflow: hidden;
  color: #b7c9b7;
  font-size: clamp(6px, 0.65vw, 8px);
  line-height: 1.4;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-slot b {
  position: absolute;
  left: 2px;
  top: 1px;
  z-index: 2;
  color: #f4f0d4;
  font-size: clamp(6px, 0.65vw, 8px);
  text-shadow: 0 1px 2px #000;
}

.party-energy {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  display: block;
  height: 3px;
  overflow: hidden;
  background: #1b3024;
}

.party-energy em {
  display: block;
  width: 0;
  height: 100%;
  background: var(--element-color, var(--lime));
  transition: width 120ms linear;
}

.party-slot.is-active {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(216, 238, 123, 0.2);
}

.party-slot.is-ready {
  border-color: #e8ef9e;
  box-shadow: 0 0 0 2px rgba(216, 238, 123, 0.34), 0 0 12px rgba(216, 238, 123, 0.38);
}

.party-slot.is-dead {
  filter: grayscale(1);
  opacity: 0.42;
}

.party-slot.is-dead::after {
  content: "阵亡";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(26, 7, 7, 0.62);
  color: #f3b1a7;
  font-size: clamp(7px, 0.8vw, 10px);
  font-weight: 900;
}

.portal-prompt {
  left: 50%;
  bottom: 23%;
  width: min(30%, 300px);
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 1px solid #87b4a8;
  background: rgba(5, 18, 14, 0.9);
  text-align: center;
}

.portal-prompt span {
  display: block;
  margin-bottom: 5px;
  font-size: clamp(8px, 0.9vw, 11px);
}

.portal-track {
  height: 5px;
}

.portal-track i {
  background: #96e0c6;
}

.toast-stack {
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 11%;
  pointer-events: none;
}

.toast {
  margin-bottom: 5px;
  padding: 5px 11px;
  border-left: 2px solid var(--toast-color, var(--lime));
  background: rgba(4, 15, 12, 0.9);
  color: #edf0da;
  font-size: clamp(8px, 1vw, 12px);
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
  animation: toast-in 180ms ease-out, toast-out 240ms ease-in 1.55s forwards;
}

@keyframes toast-in {
  from { transform: translateY(-8px); opacity: 0; }
}

@keyframes toast-out {
  to { transform: translateY(-6px); opacity: 0; }
}

.room-banner {
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
  background: rgba(1, 7, 5, 0);
  text-shadow: 0 4px 0 #000;
  animation: room-in 3.2s ease forwards;
}

.room-banner span {
  color: #b7cf9c;
  font-size: clamp(8px, 1vw, 12px);
  letter-spacing: 0.24em;
}

.room-banner strong {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(24px, 4vw, 50px);
}

@keyframes room-in {
  0% { opacity: 0; transform: translateY(8px); }
  15%, 65% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

.overlay {
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 4% 7%;
  border: 0;
  background: rgba(3, 12, 10, 0.95);
  box-shadow: inset 0 0 0 1px #3e5e4c;
}

.overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.overlay h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(26px, 4.5vw, 56px);
  line-height: 1;
}

.close-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #59715f;
  background: #10251f;
  cursor: pointer;
  font-size: 24px;
}

.map-tabs {
  display: flex;
  gap: 5px;
  margin: 1.8% 0 1%;
}

.map-tab {
  padding: 7px 24px;
  border: 0;
  border-bottom: 2px solid #30463a;
  background: transparent;
  color: #789080;
  cursor: pointer;
  font-size: clamp(9px, 1.1vw, 14px);
  font-weight: 800;
}

.map-tab.is-active {
  border-color: var(--lime);
  color: var(--paper);
}

#mapCanvas {
  width: 100%;
  min-height: 0;
  flex: 1;
  object-fit: contain;
  border-top: 1px solid #2e493b;
  border-bottom: 1px solid #2e493b;
  image-rendering: pixelated;
}

.map-caption {
  margin: 9px 0 0;
  color: #8da495;
  font-size: clamp(8px, 0.9vw, 11px);
}

.overlay.compact {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(3, 12, 10, 0.9);
}

.overlay.compact > p:not(.eyebrow) {
  color: #a0b2a3;
  font-size: clamp(9px, 1.05vw, 13px);
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(80%, 330px);
  margin-top: 18px;
}

.pause-actions button {
  width: 100%;
}

.result-overlay {
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(204, 219, 107, 0.16), transparent 32%),
    rgba(3, 12, 10, 0.97);
}

.result-mark {
  position: absolute;
  right: 7%;
  top: 7%;
  display: grid;
  width: clamp(54px, 7vw, 84px);
  height: clamp(54px, 7vw, 84px);
  place-items: center;
  border: 2px solid #d55747;
  color: #e17a62;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(18px, 2.6vw, 32px);
  font-weight: 900;
  transform: rotate(-8deg);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(82%, 560px);
  margin: 18px 0 12px;
  border-top: 1px solid #405b49;
  border-bottom: 1px solid #405b49;
}

.result-stats div {
  padding: 9px 14px;
  border-right: 1px solid #2b4134;
}

.result-stats div:last-child {
  border: 0;
}

.result-stats span {
  display: block;
  color: #8da498;
  font-size: clamp(7px, 0.85vw, 11px);
}

.result-stats strong {
  color: #ecf1d1;
  font-size: clamp(12px, 1.6vw, 20px);
}

.reward-line {
  display: flex;
  align-items: center;
  width: min(70%, 420px);
  margin-bottom: 16px;
  padding: 6px 10px;
  border: 1px solid #765347;
  background: #241713;
  text-align: left;
}

.reward-line img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  image-rendering: pixelated;
}

.reward-line div {
  flex: 1;
  padding-left: 9px;
}

.reward-line span,
.reward-line strong {
  display: block;
}

.reward-line span {
  color: #a6887a;
  font-size: 8px;
}

.reward-line strong {
  color: #f2d2b4;
  font-size: clamp(10px, 1.2vw, 15px);
}

.reward-line > b {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #f3aa8d;
  color: #fa8b6d;
}

.touch-controls {
  z-index: 30;
  pointer-events: none;
}

.touch-controls button {
  pointer-events: auto;
  touch-action: none;
  background: rgba(7, 24, 19, 0.72);
  border: 1px solid rgba(174, 207, 161, 0.55);
  color: #eef2d1;
  font-weight: 900;
  -webkit-tap-highlight-color: transparent;
}

.touch-move {
  position: absolute;
  left: 3%;
  bottom: 4%;
  display: flex;
  gap: 12px;
}

.touch-move button {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 28px;
}

.touch-actions {
  position: absolute;
  right: 3%;
  bottom: 4%;
  display: grid;
  grid-template-columns: repeat(3, 46px);
  gap: 7px;
}

.touch-actions button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 11px;
}

.touch-actions .touch-attack {
  width: 58px;
  height: 58px;
  margin-top: -12px;
  background: rgba(109, 98, 39, 0.8);
  font-size: 15px;
}

.touch-actions .touch-jump {
  background: rgba(34, 77, 66, 0.8);
}

.touch-controls button:active,
.touch-controls button.is-held {
  background: rgba(191, 219, 104, 0.85);
  color: #0a1b12;
  transform: translateY(2px);
}

.touch-controls button.is-cooling {
  filter: saturate(0.35);
  opacity: 0.82;
}

.touch-controls button.is-ready {
  border-color: #eff4b0;
  background: rgba(155, 174, 57, 0.9);
  box-shadow: 0 0 0 2px rgba(239, 244, 176, 0.22), 0 0 14px rgba(216, 238, 123, 0.42);
  color: #101b08;
}

.rotate-hint {
  position: absolute;
  left: 50%;
  top: 8px;
  z-index: 80;
  display: none;
  padding: 4px 10px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #b6c5aa;
  font-size: 9px;
  pointer-events: none;
}

@media (pointer: coarse), (max-width: 760px) {
  #app {
    padding: 0;
  }

  #stage {
    width: min(100vw, calc(100dvh * 16 / 9));
    max-height: 100dvh;
    border: 0;
    box-shadow: none;
  }

  .start-footer {
    display: none;
  }

  .screen {
    padding: 4% 3%;
  }

  .roster {
    width: 94%;
    gap: 4px;
  }

  .hero-card {
    height: 112px;
    grid-template-columns: 1fr;
    padding: 3px;
  }

  .hero-card img {
    height: 65px;
  }

  .hero-card-copy {
    padding: 3px 2px;
  }

  .hero-card p,
  .hero-card small {
    display: none;
  }

  .hero-card .element {
    position: absolute;
    left: 5px;
    top: 5px;
  }

  .hero-card h3 {
    margin: 2px 0 0;
    font-size: 10px;
    text-align: center;
  }

  .start-panel {
    width: 94%;
    gap: 6px;
    padding: 7px;
  }

  .mission-copy p {
    display: none;
  }

  .primary-button {
    min-height: 36px;
    padding: 0 12px;
  }

  .hud-bottom {
    bottom: 14%;
    grid-template-columns: minmax(0, 1fr);
  }

  .active-hero {
    max-width: 62%;
    opacity: 0.88;
  }

  .party-hud {
    right: 1.5%;
    top: 17%;
    bottom: auto;
    gap: 3px;
  }

  .party-slot {
    width: 34px;
    height: 42px;
  }

  .skill-bar {
    display: none;
  }

  .energy-panel {
    bottom: 27%;
  }

  .touch-controls:not(.is-hidden) {
    display: block;
  }

  .portrait-wrap {
    width: 35px;
    height: 35px;
    border-width: 1px;
  }

  .hero-readout {
    padding: 3px 5px;
  }

  .hp-meta {
    display: none;
  }

  .hud-top-left {
    left: 1.5%;
  }

  .hud-top-right {
    right: 1.5%;
  }

  #minimap {
    width: 92px;
  }

  .quest-panel {
    width: 42%;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  #stage {
    width: 100vw;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .rotate-hint {
    display: block;
  }

  .screen {
    justify-content: center;
  }

  .brand h1 {
    font-size: 44px;
  }

  .roster {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 26px;
  }

  .hero-card {
    height: 116px;
  }

  .start-panel {
    margin-top: 18px;
  }

  .skill-button {
    width: 42px;
    height: 45px;
  }
}

@media (max-height: 560px) {
  .brand h1 { font-size: 38px; }
  .chapter { margin-top: 5px; }
  .roster { margin-top: 1%; }
  .hero-card { height: 82px; }
  .start-panel { padding: 7px 12px; }
  .start-footer { padding-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Mistveil city hub */
.city-screen {
  display: block;
  padding: 0;
  background: #09151d;
}

.city-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 46% 43%, transparent 26%, rgba(2, 8, 11, 0.34) 67%, rgba(2, 7, 9, 0.7) 100%),
    linear-gradient(180deg, rgba(4, 12, 19, 0.52), transparent 24%, transparent 68%, rgba(3, 9, 11, 0.82));
}

.city-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.15;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(189, 214, 201, 0.09) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(4, 12, 13, 0.11) 0 1px, transparent 1px 38px);
}

.city-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.city-screen > .forest-frame,
.city-screen > .brand {
  display: none;
}

.city-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.city-fog {
  position: absolute;
  left: -25%;
  width: 150%;
  height: 9%;
  opacity: 0.14;
  background:
    linear-gradient(90deg, transparent, rgba(172, 203, 192, 0.46) 16%, transparent 31%, rgba(172, 203, 192, 0.28) 53%, transparent 71%),
    linear-gradient(90deg, transparent, rgba(172, 203, 192, 0.24) 38%, transparent 76%);
  animation: city-fog-drift 24s linear infinite alternate;
}

.city-fog.fog-a {
  top: 51%;
}

.city-fog.fog-b {
  top: 67%;
  height: 12%;
  opacity: 0.09;
  animation-duration: 31s;
  animation-direction: alternate-reverse;
}

.city-ember {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #f0a45c;
  box-shadow: 0 0 7px rgba(240, 164, 92, 0.7);
  opacity: 0;
  animation: city-ember-rise 7s linear infinite;
}

.ember-a {
  left: 12%;
  top: 58%;
}

.ember-b {
  left: 17%;
  top: 48%;
  animation-delay: -2.2s;
  animation-duration: 8.4s;
}

.ember-c {
  left: 21%;
  top: 62%;
  animation-delay: -4.8s;
  animation-duration: 6.3s;
}

@keyframes city-fog-drift {
  from { transform: translateX(-4%); }
  to { transform: translateX(9%); }
}

@keyframes city-ember-rise {
  0% { opacity: 0; transform: translate(0, 15px); }
  16% { opacity: 0.75; }
  72% { opacity: 0.3; }
  100% { opacity: 0; transform: translate(18px, -92px); }
}

.city-header {
  position: absolute;
  left: 4.6%;
  right: 4%;
  top: 4.3%;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}

.city-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.city-seal {
  display: grid;
  width: 47px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #b49a62;
  background:
    linear-gradient(135deg, rgba(187, 155, 92, 0.18), transparent 50%),
    #0b1c1d;
  box-shadow:
    inset 0 0 0 4px #132b2a,
    inset 0 0 0 5px rgba(207, 183, 119, 0.33),
    4px 4px 0 rgba(0, 0, 0, 0.38);
  color: #ead99e;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 27px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 0 #16221e;
}

.city-kicker {
  margin: 0 0 3px;
  color: #d4bc76;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
}

.city-brand h1 {
  margin: 0;
  color: #f1e7c3;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 0.92;
  text-shadow:
    3px 3px 0 #0b1b1b,
    0 0 16px rgba(238, 220, 165, 0.12);
}

.city-subtitle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 7px 0 0;
  color: #89a89f;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.city-subtitle span {
  padding: 2px 5px;
  border-left: 1px solid #5f7b69;
  color: #b7d09a;
  letter-spacing: 0.05em;
}

.city-status {
  display: flex;
  align-items: stretch;
  gap: 7px;
  font-size: 9px;
  font-weight: 800;
}

.city-cycle,
.city-wallet {
  border: 1px solid rgba(122, 145, 127, 0.72);
  background: linear-gradient(180deg, rgba(12, 28, 28, 0.92), rgba(7, 19, 20, 0.86));
  box-shadow:
    inset 0 0 0 2px rgba(5, 15, 16, 0.75),
    3px 3px 0 rgba(0, 0, 0, 0.34);
}

.city-cycle {
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #b0c4b5;
}

.city-wallet {
  display: flex;
  min-width: 102px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
}

.city-wallet span {
  color: #899f91;
  font-size: 8px;
}

.city-wallet strong {
  color: #f1d77c;
  font-size: 15px;
  letter-spacing: 0.03em;
}

.district-sign {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 154px;
  padding: 6px 9px 7px;
  border: 1px solid rgba(122, 133, 105, 0.65);
  border-left: 3px solid #b89c5d;
  background: linear-gradient(90deg, rgba(9, 23, 22, 0.9), rgba(8, 20, 20, 0.64));
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.district-sign > b {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #846d46;
  background: #172a25;
  color: #e3c979;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 15px;
}

.district-sign div {
  min-width: 0;
}

.district-sign strong,
.district-sign span {
  display: block;
}

.district-sign strong {
  color: #dacb9d;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 12px;
  line-height: 1.1;
}

.district-sign span {
  margin-top: 3px;
  color: #759087;
  font-size: 7px;
}

.forge-sign {
  left: 2.8%;
  top: 47%;
}

.shop-sign {
  right: 4.4%;
  top: 13.5%;
}

.city-waypoint {
  position: absolute;
  left: 34%;
  top: 55%;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #9eb5a9;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 10px;
  text-shadow: 0 2px 0 #061112;
  pointer-events: none;
}

.city-waypoint::before,
.city-waypoint i {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #839d87);
}

.city-waypoint i {
  background: linear-gradient(90deg, #839d87, transparent);
}

.roster-heading {
  position: absolute;
  left: 4.6%;
  bottom: calc(7.4% + 112px);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 9px;
  pointer-events: auto;
}

.roster-heading span {
  color: #e4d39c;
  font-size: 11px;
  font-weight: 900;
}

.roster-heading strong {
  color: #839b91;
  font-size: 8px;
  font-weight: 700;
}

.roster-heading i {
  display: block;
  width: 62px;
  height: 1px;
  background: linear-gradient(90deg, #6f8069, transparent);
}

.codex-open-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 8px;
  border: 1px solid #9c8e5d;
  background: linear-gradient(180deg, #27362d, #121f1c);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.48);
  color: #eadca8;
  cursor: pointer;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.codex-open-button:hover {
  border-color: #e0d18e;
  background: linear-gradient(180deg, #34473a, #172824);
}

.codex-open-button b {
  display: inline-grid;
  min-width: 26px;
  height: 16px;
  padding: 0 3px;
  place-items: center;
  background: #d8ee7b;
  color: #162014;
  font-size: 8px;
}

.codex-overlay {
  min-height: 0;
  padding: 2.2% 3.2% 2.6%;
  overflow: hidden;
  background:
    linear-gradient(125deg, rgba(41, 72, 51, 0.14), transparent 32%),
    repeating-linear-gradient(0deg, rgba(149, 183, 135, 0.025) 0 1px, transparent 1px 5px),
    #071411;
  box-shadow:
    inset 0 0 0 1px #47624f,
    inset 0 0 70px rgba(0, 0, 0, 0.64);
}

.codex-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(143, 178, 137, 0.07) 50%, transparent 50.2%) 0 0 / 32px 32px,
    linear-gradient(180deg, transparent 49.8%, rgba(143, 178, 137, 0.04) 50%, transparent 50.2%) 0 0 / 32px 32px;
}

.codex-overlay > * {
  position: relative;
  z-index: 1;
}

.codex-head {
  flex: 0 0 auto;
  align-items: center;
  padding: 0 2px 7px;
  border-bottom: 1px solid rgba(96, 129, 96, 0.55);
}

.codex-head .eyebrow {
  margin: 0 0 2px;
  color: #91aa7a;
  font-size: clamp(6px, 0.7vw, 9px);
  letter-spacing: 0.2em;
}

.codex-head h2 {
  font-size: clamp(23px, 3.2vw, 42px);
  letter-spacing: 0.05em;
  text-shadow: 0 3px 0 #020806;
}

.codex-subtitle {
  margin: 4px 0 0;
  color: #90a896;
  font-size: clamp(7px, 0.82vw, 11px);
}

.codex-head .close-button {
  flex: 0 0 auto;
  width: clamp(27px, 2.6vw, 36px);
  height: clamp(27px, 2.6vw, 36px);
  border-color: #6d7a55;
  background: #14251d;
}

.codex-toolbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(155px, 220px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 7px 0 8px;
  padding: 6px 8px;
  border-top: 1px solid rgba(120, 154, 112, 0.34);
  border-bottom: 1px solid rgba(120, 154, 112, 0.34);
  background: rgba(10, 27, 23, 0.88);
}

.codex-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  height: 25px;
  border: 1px solid #4c6957;
  background: #071512;
}

.codex-search span {
  padding: 0 7px;
  border-right: 1px solid #314a3d;
  color: #b5c69d;
  font-size: 7px;
  font-weight: 900;
}

.codex-search input {
  min-width: 0;
  height: 23px;
  padding: 0 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #e8f1d7;
  font: 700 9px/1 "Microsoft YaHei", sans-serif;
  user-select: text;
  -webkit-user-select: text;
}

.codex-search input::placeholder {
  color: #647c6d;
}

.codex-search:focus-within {
  border-color: #cfdf8b;
  box-shadow: inset 0 0 0 1px rgba(207, 223, 139, 0.16);
}

.codex-filters {
  display: flex;
  min-width: 0;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #61795d #0a1713;
  scrollbar-width: thin;
  touch-action: pan-x;
}

.codex-filter {
  flex: 0 0 auto;
  min-width: 27px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #3b5145;
  background: #0d201b;
  color: #91a68f;
  cursor: pointer;
  font-size: 7px;
  font-weight: 900;
}

.codex-filter:hover {
  border-color: #899d73;
  color: #e3ebc9;
}

.codex-filter.is-active {
  border-color: var(--filter-color, #d8ee7b);
  background: #263526;
  box-shadow: inset 0 -2px 0 var(--filter-color, #d8ee7b);
  color: #f1f5de;
}

.codex-result-count {
  min-width: 43px;
  color: #c7d394;
  font-size: 8px;
  text-align: right;
  white-space: nowrap;
}

.codex-browser {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1.72fr) minmax(270px, 0.78fr);
  gap: 9px;
  min-height: 0;
}

.codex-list-panel,
.codex-detail {
  min-height: 0;
  border: 1px solid #3b5a48;
  background:
    linear-gradient(145deg, rgba(23, 45, 37, 0.78), rgba(7, 19, 17, 0.92)),
    #091713;
  box-shadow:
    inset 0 0 0 2px rgba(2, 9, 7, 0.6),
    0 4px 0 rgba(0, 0, 0, 0.28);
}

.codex-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.codex-list-head {
  display: flex;
  flex: 0 0 25px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  border-bottom: 1px solid #345143;
  background: #10261f;
}

.codex-list-head span {
  color: #e2d49f;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.codex-list-head small {
  overflow: hidden;
  color: #738b7b;
  font-size: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-grid {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  grid-auto-rows: 70px;
  align-content: start;
  gap: 6px;
  min-height: 0;
  padding: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #647f62 #071310;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.codex-grid::-webkit-scrollbar,
.codex-detail::-webkit-scrollbar,
.codex-filters::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.codex-grid::-webkit-scrollbar-track,
.codex-detail::-webkit-scrollbar-track,
.codex-filters::-webkit-scrollbar-track {
  background: #071310;
}

.codex-grid::-webkit-scrollbar-thumb,
.codex-detail::-webkit-scrollbar-thumb,
.codex-filters::-webkit-scrollbar-thumb {
  border: 1px solid #1a3027;
  background: #647f62;
}

.codex-hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  height: 70px;
  padding: 6px 5px;
  overflow: hidden;
  border: 1px solid #354c40;
  border-left: 2px solid var(--element-color);
  background:
    linear-gradient(110deg, rgba(33, 54, 44, 0.8), rgba(9, 24, 21, 0.95)),
    #0b1d19;
  box-shadow: inset 0 0 0 1px rgba(2, 9, 7, 0.45);
  color: #e9f0dc;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 100ms ease,
    background 100ms ease,
    transform 100ms ease;
}

.codex-hero-card:hover,
.codex-hero-card:focus-visible {
  border-top-color: var(--element-color);
  border-right-color: var(--element-color);
  border-bottom-color: var(--element-color);
  background:
    linear-gradient(110deg, rgba(49, 73, 53, 0.92), rgba(12, 30, 24, 0.98)),
    #10271f;
}

.codex-hero-card.is-selected {
  border-top-color: var(--element-color);
  border-right-color: var(--element-color);
  border-bottom-color: var(--element-color);
  box-shadow:
    inset 0 0 0 1px rgba(235, 245, 207, 0.13),
    inset 0 -20px 30px rgba(0, 0, 0, 0.18),
    0 0 10px rgba(178, 214, 132, 0.12);
}

.codex-hero-card.is-leader::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 8px;
  height: 8px;
  background: var(--element-color);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.codex-slot {
  position: absolute;
  right: 3px;
  top: 3px;
  z-index: 2;
  max-width: 45px;
  padding: 1px 3px;
  overflow: hidden;
  border: 1px solid #45594a;
  background: #0a1713;
  color: #74887a;
  font-size: 5px;
  font-weight: 900;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-hero-card.is-party .codex-slot {
  border-color: #9ba66b;
  background: #d7e589;
  color: #162013;
}

.codex-mini-portrait {
  display: grid;
  width: 46px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #435b48;
  background:
    linear-gradient(180deg, rgba(145, 177, 121, 0.12), transparent),
    #081511;
}

.codex-mini-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.codex-card-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-self: stretch;
  justify-content: center;
  padding-top: 7px;
}

.codex-card-copy > small,
.codex-card-copy > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-card-copy > small {
  color: #819782;
  font-size: 6px;
  line-height: 1.3;
}

.codex-card-copy > strong {
  margin-top: 1px;
  color: #f0f2df;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 11px;
  line-height: 1.25;
}

.codex-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 6px;
  white-space: nowrap;
}

.codex-card-meta i {
  padding: 1px 3px;
  background: var(--element-color);
  color: #101711;
  font-style: normal;
  font-weight: 900;
}

.codex-card-meta b {
  overflow: hidden;
  color: #a6b7a2;
  font-weight: 700;
  text-overflow: ellipsis;
}

.codex-detail {
  position: relative;
  padding: 12px 13px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #647f62 #071310;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.codex-detail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--element-color, #d8ee7b);
  box-shadow: 0 0 13px var(--element-color, #d8ee7b);
  opacity: 0.85;
}

.codex-detail-head {
  display: grid;
  grid-template-columns: clamp(56px, 6vw, 76px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.codex-detail-portrait {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--element-color);
  background: var(--element-color);
  box-shadow: inset 0 0 0 3px #07130f;
}

.codex-detail-portrait img {
  display: block;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0a1813;
}

.codex-detail-portrait b {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  background: var(--element-color);
  color: #101611;
  font-size: 8px;
  line-height: 1;
}

.codex-detail-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.codex-detail-title > small {
  overflow: hidden;
  color: #a4b691;
  font-size: 7px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-detail-title > strong {
  margin: 2px 0 4px;
  overflow: hidden;
  color: #f4f2d9;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(18px, 2.4vw, 29px);
  line-height: 1.1;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 #020806;
  white-space: nowrap;
}

.codex-detail-title > span {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.codex-detail-title i {
  padding: 1px 4px;
  border: 1px solid #425a48;
  background: rgba(8, 21, 17, 0.8);
  color: #acc0a4;
  font-size: 6px;
  font-style: normal;
  font-weight: 800;
}

.codex-detail-title i:first-child {
  border-color: var(--element-color);
  color: var(--element-color);
}

.codex-detail-lore {
  margin: 9px 0 8px;
  padding: 7px 0;
  border-top: 1px solid #304b3d;
  border-bottom: 1px solid #304b3d;
  color: #c0ccb8;
  font-size: clamp(7px, 0.78vw, 10px);
  line-height: 1.65;
}

.codex-detail-gear {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 8px;
  padding-bottom: 8px;
}

.codex-detail-gear > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding-left: 6px;
  border-left: 1px solid #405747;
}

.codex-detail-gear small {
  color: #718678;
  font-size: 6px;
}

.codex-detail-gear strong {
  overflow: hidden;
  color: #d7dfc5;
  font-size: 7px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-detail-gear .codex-red-weapon {
  grid-column: 1 / -1;
  border-left-color: #b36c55;
}

.codex-detail-gear .codex-red-weapon strong {
  color: #f0a078;
}

.codex-detail-skills {
  border-top: 1px solid #3f5a49;
}

.codex-detail-skill {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(65, 91, 72, 0.62);
}

.codex-detail-skill > i {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--element-color);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), transparent 45%),
    color-mix(in srgb, var(--element-color) 17%, #0a1713);
  box-shadow:
    inset 0 0 0 2px #08130f,
    0 0 8px color-mix(in srgb, var(--element-color) 24%, transparent);
  color: var(--element-color);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 15px;
  font-style: normal;
  font-weight: 900;
}

.codex-detail-skill > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.codex-detail-skill small {
  color: #758b7a;
  font-size: 6px;
}

.codex-detail-skill b {
  overflow: hidden;
  color: #e3ead7;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-detail-skill > em {
  max-width: 54px;
  overflow: hidden;
  color: #aebc9f;
  font-size: 6px;
  font-style: normal;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-detail-skill.is-ultimate > i {
  border-color: #e4cf7a;
  color: #f5df84;
  box-shadow:
    inset 0 0 0 2px #08130f,
    0 0 10px rgba(228, 207, 122, 0.24);
}

.codex-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 8px 0;
  border-top: 1px solid #3f5a49;
  border-bottom: 1px solid #3f5a49;
}

.codex-detail-stats span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 2px;
  border-right: 1px solid #30493c;
}

.codex-detail-stats span:last-child {
  border-right: 0;
}

.codex-detail-stats small {
  color: #718678;
  font-size: 5px;
}

.codex-detail-stats b {
  color: #e4e9cf;
  font-size: 9px;
}

.codex-leader-button {
  width: 100%;
  min-height: 29px;
  border: 1px solid #a9b16d;
  background: linear-gradient(180deg, #445431, #26351f);
  box-shadow: inset 0 0 0 1px #111b0e;
  color: #eef3bd;
  cursor: pointer;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.codex-leader-button:hover:not(:disabled) {
  border-color: #e6eb9a;
  background: linear-gradient(180deg, #586b3d, #314428);
}

.codex-leader-button:disabled {
  border-color: #4a5740;
  background: #202a20;
  color: #78856e;
  cursor: default;
}

.codex-detail.is-empty {
  display: grid;
  place-items: center;
}

.codex-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #708574;
  text-align: center;
}

.codex-detail-empty span {
  font-size: 7px;
  letter-spacing: 0.18em;
}

.codex-detail-empty strong {
  color: #cbd5bf;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 16px;
}

.codex-detail-empty p {
  margin: 0;
  font-size: 7px;
}

@media (max-width: 900px), (max-height: 520px), (pointer: coarse) {
  .codex-overlay {
    padding: 6px 8px 8px;
  }

  .codex-head {
    padding-bottom: 4px;
  }

  .codex-head .eyebrow {
    margin-bottom: 1px;
    font-size: 5px;
  }

  .codex-head h2 {
    font-size: 20px;
  }

  .codex-subtitle {
    margin-top: 2px;
    font-size: 6px;
  }

  .codex-head .close-button {
    width: 25px;
    height: 25px;
    font-size: 18px;
  }

  .codex-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
    margin: 4px 0 5px;
    padding: 4px 5px;
  }

  .codex-search {
    height: 23px;
  }

  .codex-search input {
    height: 21px;
    font-size: 7px;
  }

  .codex-search span {
    padding: 0 5px;
    font-size: 6px;
  }

  .codex-filters {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .codex-filter {
    min-width: 25px;
    height: 19px;
    padding: 0 6px;
    font-size: 6px;
  }

  .codex-result-count {
    min-width: 38px;
    font-size: 6px;
  }

  .codex-browser {
    grid-template-columns: minmax(0, 1.46fr) minmax(205px, 0.84fr);
    gap: 5px;
  }

  .codex-list-head {
    flex-basis: 21px;
    padding: 0 5px;
  }

  .codex-list-head span {
    font-size: 6px;
  }

  .codex-list-head small {
    font-size: 5px;
  }

  .codex-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    grid-auto-rows: 62px;
    gap: 4px;
    padding: 4px;
  }

  .codex-hero-card {
    grid-template-columns: 39px minmax(0, 1fr);
    gap: 4px;
    height: 62px;
    padding: 4px 3px;
  }

  .codex-mini-portrait {
    width: 39px;
    height: 42px;
  }

  .codex-slot {
    right: 2px;
    top: 2px;
    max-width: 36px;
    padding: 0 2px;
    font-size: 5px;
  }

  .codex-card-copy {
    padding-top: 7px;
  }

  .codex-card-copy > small {
    font-size: 5px;
  }

  .codex-card-copy > strong {
    font-size: 9px;
  }

  .codex-card-meta {
    gap: 2px;
    margin-top: 2px;
    font-size: 5px;
  }

  .codex-card-meta i {
    padding: 0 2px;
  }

  .codex-detail {
    padding: 8px;
  }

  .codex-detail-head {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 7px;
  }

  .codex-detail-title > small {
    font-size: 5px;
  }

  .codex-detail-title > strong {
    margin: 1px 0 3px;
    font-size: 18px;
  }

  .codex-detail-title i {
    padding: 0 3px;
    font-size: 5px;
  }

  .codex-detail-lore {
    margin: 6px 0;
    padding: 5px 0;
    font-size: 7px;
    line-height: 1.55;
  }

  .codex-detail-gear {
    gap: 4px 6px;
    padding-bottom: 5px;
  }

  .codex-detail-gear small,
  .codex-detail-gear strong {
    font-size: 6px;
  }

  .codex-detail-skill {
    grid-template-columns: 25px minmax(0, 1fr) auto;
    gap: 5px;
    min-height: 32px;
    padding: 3px 0;
  }

  .codex-detail-skill > i {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .codex-detail-skill small,
  .codex-detail-skill > em {
    font-size: 5px;
  }

  .codex-detail-skill b {
    font-size: 7px;
  }

  .codex-detail-stats {
    margin: 5px 0;
  }

  .codex-detail-stats span {
    padding: 3px 1px;
  }

  .codex-detail-stats b {
    font-size: 7px;
  }

  .codex-leader-button {
    min-height: 25px;
    font-size: 7px;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  .codex-head .eyebrow,
  .codex-subtitle {
    display: none;
  }

  .codex-head h2 {
    font-size: 17px;
  }

  .codex-browser {
    grid-template-columns: minmax(0, 1fr) minmax(175px, 0.7fr);
  }
}

.city-screen > .roster {
  position: absolute;
  left: 4.6%;
  bottom: 5.5%;
  z-index: 8;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  width: 58.5%;
  max-width: 780px;
  margin: 0;
}

.city-screen .hero-card {
  grid-template-columns: 40% minmax(0, 1fr);
  height: 104px;
  min-width: 0;
  padding: 7px;
  overflow: hidden;
  border: 1px solid rgba(124, 145, 125, 0.7);
  border-radius: 0;
  background:
    linear-gradient(105deg, rgba(21, 41, 35, 0.95), rgba(9, 24, 23, 0.93)),
    #0a1918;
  box-shadow:
    inset 0 0 0 2px rgba(4, 13, 13, 0.82),
    0 6px 0 rgba(2, 8, 9, 0.46);
  text-align: left;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.city-screen .hero-card::after {
  inset: 2px;
  border-top: 2px solid var(--element-color);
}

.city-screen .hero-card::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  z-index: 4;
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-bottom: 7px solid var(--lime);
  border-left: 6px solid transparent;
  opacity: 0;
  transform: translateX(-50%);
}

.city-screen .hero-card:hover {
  z-index: 2;
  border-color: #b5c4a0;
  background:
    linear-gradient(105deg, rgba(29, 54, 44, 0.98), rgba(10, 27, 25, 0.96)),
    #0a1918;
  transform: translateY(-3px);
}

.city-screen .hero-card.is-leader {
  border-color: rgba(220, 226, 148, 0.95);
  box-shadow:
    inset 0 0 0 2px rgba(4, 13, 13, 0.82),
    0 0 0 1px rgba(216, 238, 123, 0.22),
    0 6px 0 rgba(2, 8, 9, 0.5),
    0 0 18px rgba(194, 211, 99, 0.12);
}

.city-screen .hero-card.is-leader::before {
  opacity: 1;
}

.city-screen .hero-card img {
  width: 100%;
  height: 88px;
  border: 1px solid #31453b;
  background:
    linear-gradient(135deg, rgba(98, 130, 101, 0.08), transparent 55%),
    #0b1715;
  object-fit: cover;
}

.city-screen .hero-card-copy {
  justify-content: center;
  padding-left: 8px;
}

.city-screen .hero-card .element {
  padding: 2px 5px;
  font-size: 8px;
}

.city-screen .hero-card h3 {
  margin: 5px 0 2px;
  color: #f2ecd3;
  font-size: 15px;
  line-height: 1;
}

.city-screen .hero-card p {
  color: #9db3a6;
  font-size: 8px;
}

.city-screen .hero-card small {
  color: #6f8a7f;
  font-size: 7px;
}

.city-screen .hero-order {
  right: 6px;
  top: 6px;
  border-color: #67796b;
  background: rgba(5, 16, 16, 0.9);
  font-size: 7px;
}

.city-screen > .start-panel {
  position: absolute;
  right: 4.5%;
  top: 20%;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(31%, 420px);
  margin: 0;
  padding: 16px 17px 17px;
  border: 1px solid rgba(170, 145, 91, 0.78);
  border-radius: 0;
  background:
    linear-gradient(145deg, rgba(23, 37, 31, 0.97), rgba(8, 20, 20, 0.95) 64%),
    #0b1918;
  box-shadow:
    inset 0 0 0 2px rgba(4, 12, 12, 0.9),
    inset 0 0 0 3px rgba(133, 119, 79, 0.18),
    7px 7px 0 rgba(0, 0, 0, 0.36);
}

.city-screen > .start-panel::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  width: 31%;
  height: 2px;
  background: #d0b96f;
}

.city-screen > .start-panel::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 24%;
  height: 2px;
  background: #557260;
}

.level-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 2px 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(110, 129, 108, 0.35);
}

.level-choice {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 34px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 5px 6px 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(102, 122, 103, 0.52);
  border-radius: 0;
  background: rgba(5, 15, 14, 0.62);
  color: #82958b;
  text-align: left;
}

.level-choice::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--level-color, #c9b76c);
  opacity: 0.55;
}

.level-choice small {
  width: 100%;
  overflow: hidden;
  color: #6f8379;
  font-size: 6px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-choice strong {
  width: 100%;
  overflow: hidden;
  color: #bdc8b8;
  font-size: 8px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-choice:hover,
.level-choice:focus-visible {
  border-color: color-mix(in srgb, var(--level-color, #c9b76c) 62%, #65776b);
  background: rgba(19, 35, 30, 0.9);
}

.level-choice.is-active {
  border-color: color-mix(in srgb, var(--level-color, #c9b76c) 74%, #d7d1a0);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--level-color, #c9b76c) 18%, transparent), transparent 78%),
    rgba(18, 34, 29, 0.96);
  box-shadow: inset 0 0 0 1px rgba(5, 13, 12, 0.82);
}

.level-choice.is-cleared::after {
  content: "已通关";
  position: absolute;
  top: 3px;
  right: 4px;
  padding: 1px 2px;
  background: rgba(8, 18, 15, 0.78);
  color: color-mix(in srgb, var(--level-color, #c9b76c) 72%, #d9e4c8);
  font-size: 5px;
  line-height: 1;
}

.level-choice.is-cleared strong {
  padding-right: 20px;
}

.level-choice.is-active::before {
  width: 4px;
  opacity: 1;
}

.level-choice.is-active small {
  color: color-mix(in srgb, var(--level-color, #c9b76c) 72%, #c9d2bd);
}

.level-choice.is-active strong {
  color: #f0ead1;
}

.level-choice[data-level="spore-valley"] {
  --level-color: #c9d777;
}

.level-choice[data-level="cinder-mine"] {
  --level-color: #ef8a52;
}

.level-choice[data-level="moon-lake"] {
  --level-color: #84dced;
}

.city-screen .mission-copy {
  padding: 0 2px;
}

.city-screen .mission-tag {
  display: block;
  margin: 0 0 7px;
  color: #d7bd72;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.city-screen .mission-copy strong {
  display: block;
  color: #f1e8cb;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 21px;
  line-height: 1.12;
}

.city-screen .mission-copy p {
  margin: 8px 0 0;
  color: #98ada2;
  font-size: 9px;
  line-height: 1.7;
}

.mission-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid rgba(110, 129, 108, 0.42);
  color: #b9c8ae;
  font-size: 8px;
}

.mission-rewards b {
  color: inherit;
  font: inherit;
  font-weight: 900;
}

.mission-rewards span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mission-rewards i {
  display: inline-grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 1px solid #887447;
  background: #2e2a1d;
  color: #e0c467;
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
}

.mission-rewards span:last-child i {
  border-color: #a05e50;
  background: #3a1d1b;
  color: #ff977a;
}

.city-screen .start-panel .primary-button {
  width: 100%;
  min-height: 44px;
  justify-content: space-between;
  margin-top: 15px;
  padding: 0 13px;
  border-color: #e6e0a9;
  background:
    linear-gradient(180deg, #dfe391, #c5ce6e),
    #d5da82;
  box-shadow:
    0 5px 0 #677a3b,
    inset 0 -2px 0 rgba(77, 94, 37, 0.24);
  color: #142014;
  font-size: 10px;
}

.city-screen .start-panel .primary-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.city-screen .start-panel .primary-button kbd {
  border-color: #8d955b;
  background: #eceaa9;
  color: #3a4421;
}

.city-screen > .start-footer {
  position: absolute;
  left: 4.6%;
  right: 4.5%;
  bottom: 1.1%;
  z-index: 8;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  padding: 3px 0 0;
  color: #789088;
  font-size: 7px;
}

.city-screen > .start-footer span:first-child {
  margin-right: auto;
  color: #7f9389;
}

.city-screen > .start-footer b {
  margin-right: 7px;
  color: #cdbb81;
}

.city-screen .start-footer kbd {
  height: 14px;
  min-width: 15px;
  border-color: #556e60;
  background: rgba(7, 19, 18, 0.82);
  color: #aab9ac;
  font-size: 7px;
}

@media (max-width: 760px) {
  .city-screen {
    padding: 0;
  }

  .city-header {
    left: 3%;
    right: 3%;
    top: 3.5%;
    gap: 8px;
  }

  .city-brand {
    gap: 6px;
  }

  .city-seal {
    width: 30px;
    height: 32px;
    box-shadow:
      inset 0 0 0 2px #132b2a,
      inset 0 0 0 3px rgba(207, 183, 119, 0.33),
      2px 2px 0 rgba(0, 0, 0, 0.38);
    font-size: 17px;
  }

  .city-kicker {
    margin-bottom: 1px;
    font-size: 6px;
  }

  .city-brand h1 {
    font-size: 24px;
    letter-spacing: 0.06em;
  }

  .city-subtitle {
    gap: 4px;
    margin-top: 2px;
    font-size: 5px;
  }

  .city-subtitle span {
    padding: 1px 3px;
  }

  .city-status {
    gap: 3px;
    font-size: 6px;
  }

  .city-cycle {
    display: none;
  }

  .city-wallet {
    min-width: 69px;
    gap: 5px;
    padding: 3px 5px;
  }

  .city-wallet span {
    font-size: 5px;
  }

  .city-wallet strong {
    font-size: 10px;
  }

  .district-sign,
  .city-waypoint {
    display: none;
  }

  .city-screen > .start-panel {
    right: 3%;
    top: 12%;
    width: 40%;
    max-width: none;
    padding: 7px;
    box-shadow:
      inset 0 0 0 1px rgba(4, 12, 12, 0.9),
      3px 3px 0 rgba(0, 0, 0, 0.34);
  }

  .city-screen .mission-tag {
    margin-bottom: 3px;
    font-size: 6px;
  }

  .level-selector {
    gap: 3px;
    margin: 0 0 6px;
    padding-bottom: 5px;
  }

  .level-choice {
    min-height: 23px;
    justify-content: center;
    padding: 3px 4px 3px 6px;
  }

  .level-choice small {
    display: none;
  }

  .level-choice strong {
    font-size: 7px;
    text-align: center;
  }

  .city-screen .mission-copy strong {
    font-size: 12px;
  }

  .city-screen .mission-copy p,
  .mission-rewards {
    display: none;
  }

  .city-screen .start-panel .primary-button {
    min-height: 28px;
    margin-top: 7px;
    padding: 0 7px;
    box-shadow:
      0 3px 0 #677a3b,
      inset 0 -1px 0 rgba(77, 94, 37, 0.24);
    font-size: 7px;
  }

  .city-screen .start-panel .primary-button kbd {
    min-width: 26px;
    height: 14px;
    font-size: 6px;
  }

  .roster-heading {
    left: 3%;
    bottom: calc(6.5% + 69px);
    gap: 5px;
    font-size: 6px;
  }

  .roster-heading span {
    font-size: 8px;
  }

  .roster-heading strong,
  .roster-heading i {
    display: none;
  }

  .city-screen > .roster {
    left: 3%;
    bottom: 6%;
    gap: 3px;
    width: 94%;
    max-width: none;
  }

  .city-screen .hero-card {
    grid-template-columns: 38% minmax(0, 1fr);
    height: 64px;
    padding: 3px;
    box-shadow: 0 3px 0 rgba(2, 8, 9, 0.46);
  }

  .city-screen .hero-card img {
    height: 56px;
  }

  .city-screen .hero-card-copy {
    padding-left: 4px;
  }

  .city-screen .hero-card .element {
    padding: 1px 3px;
    font-size: 5px;
  }

  .city-screen .hero-card h3 {
    margin: 2px 0 0;
    font-size: 9px;
    text-align: left;
  }

  .city-screen .hero-card p,
  .city-screen .hero-card small {
    display: none;
  }

  .city-screen .hero-order {
    right: 2px;
    top: 2px;
    padding: 1px 2px;
    font-size: 5px;
  }

  .city-screen > .start-footer {
    display: none;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  .city-header {
    top: 3%;
  }

  .city-seal {
    width: 23px;
    height: 24px;
    font-size: 13px;
  }

  .city-kicker,
  .city-subtitle {
    display: none;
  }

  .city-brand h1 {
    font-size: 18px;
  }

  .city-screen > .start-panel {
    top: 19%;
    width: 47%;
    padding: 5px;
  }

  .level-choice {
    min-height: 20px;
  }

  .level-choice strong {
    font-size: 6px;
  }

  .city-screen .mission-tag {
    display: none;
  }

  .city-screen .mission-copy strong {
    font-size: 9px;
  }

  .city-screen .start-panel .primary-button {
    min-height: 22px;
    margin-top: 4px;
    font-size: 6px;
  }

  .roster-heading {
    display: none;
  }

  .city-screen > .roster {
    bottom: 4%;
    width: 82%;
  }

  .city-screen .hero-card {
    grid-template-columns: 34% minmax(0, 1fr);
    height: 43px;
    padding: 2px;
  }

  .city-screen .hero-card img {
    height: 38px;
  }

  .city-screen .hero-card .element {
    display: none;
  }

  .city-screen .hero-card h3 {
    font-size: 7px;
  }

  .city-screen .hero-order {
    display: none;
  }
}

@media (max-height: 560px) and (min-width: 761px) {
  .city-header {
    top: 3%;
  }

  .city-seal {
    width: 36px;
    height: 38px;
    font-size: 21px;
  }

  .city-brand h1 {
    font-size: 31px;
  }

  .city-screen > .start-panel {
    top: 15%;
    padding: 10px 12px 11px;
  }

  .city-screen .mission-copy strong {
    font-size: 16px;
  }

  .city-screen .mission-copy p {
    margin-top: 4px;
    line-height: 1.45;
  }

  .mission-rewards {
    margin-top: 6px;
    padding-top: 5px;
  }

  .city-screen .start-panel .primary-button {
    min-height: 34px;
    margin-top: 8px;
  }

  .roster-heading {
    bottom: calc(6.5% + 86px);
  }

  .city-screen > .roster {
    bottom: 5%;
  }

  .city-screen .hero-card {
    height: 78px;
    padding: 5px;
  }

  .city-screen .hero-card img {
    height: 66px;
  }

  .city-screen .hero-card h3 {
    font-size: 12px;
  }

  .city-screen > .start-footer {
    bottom: 0.7%;
  }
}

/* Interactive city facilities */
.district-sign,
.city-waypoint {
  border: 0;
  color: inherit;
  font: inherit;
  pointer-events: auto;
  cursor: pointer;
  text-align: left;
}

.district-sign {
  transition:
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.district-sign:hover,
.district-sign:focus-visible {
  border-color: #d6bd78;
  background: linear-gradient(90deg, rgba(18, 38, 34, 0.97), rgba(10, 26, 24, 0.9));
  box-shadow:
    4px 4px 0 rgba(0, 0, 0, 0.34),
    0 0 18px rgba(227, 194, 105, 0.1);
  transform: translateY(-2px);
}

.notice-sign {
  left: 25.5%;
  top: 31.5%;
  border-left-color: #78a999;
}

.notice-sign > b {
  border-color: #567f70;
  color: #b9d8c8;
}

.city-waypoint {
  padding: 4px 7px;
  background: rgba(5, 16, 17, 0.52);
  transition:
    background 120ms ease,
    color 120ms ease,
    transform 120ms ease;
}

.city-waypoint:hover,
.city-waypoint:focus-visible {
  background: rgba(13, 31, 29, 0.88);
  color: #dce7c7;
  transform: translateY(-1px);
}

.city-facility-rail {
  position: absolute;
  left: 4.6%;
  top: 15.5%;
  z-index: 9;
  display: grid;
  width: 176px;
  gap: 4px;
}

.city-facility-rail > p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 2px;
  padding: 0 2px 5px;
  border-bottom: 1px solid rgba(151, 168, 132, 0.42);
}

.city-facility-rail > p span {
  color: #ddcd94;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.city-facility-rail > p small {
  color: #657d75;
  font-size: 5px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.city-facility-entry {
  --facility-accent: #b8c47f;
  position: relative;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) 7px;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 4px 6px 4px 5px;
  overflow: hidden;
  border: 1px solid rgba(105, 128, 112, 0.6);
  border-left: 2px solid var(--facility-accent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--facility-accent) 10%, transparent), transparent 72%),
    rgba(7, 20, 19, 0.85);
  box-shadow:
    inset 0 0 0 1px rgba(4, 13, 13, 0.72),
    3px 3px 0 rgba(0, 0, 0, 0.26);
  color: #a8b9a8;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
}

.city-facility-entry[data-facility="forge"] {
  --facility-accent: #e6a05e;
}

.city-facility-entry[data-facility="shop"] {
  --facility-accent: #78b8c5;
}

.city-facility-entry[data-facility="quests"] {
  --facility-accent: #c9bd75;
}

.city-facility-entry[data-facility="heroes"] {
  --facility-accent: #8ccc8a;
}

.city-facility-entry:hover,
.city-facility-entry:focus-visible {
  border-color: color-mix(in srgb, var(--facility-accent) 64%, #778c7a);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--facility-accent) 18%, transparent), transparent 78%),
    rgba(14, 32, 28, 0.96);
  transform: translateX(2px);
}

.city-facility-entry i {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--facility-accent) 68%, #4d6154);
  background: rgba(11, 26, 23, 0.94);
  color: var(--facility-accent);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
  font-style: normal;
  font-weight: 900;
}

.city-facility-entry > span {
  min-width: 0;
}

.city-facility-entry strong,
.city-facility-entry small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-facility-entry strong {
  color: #ded7b4;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 10px;
  line-height: 1.05;
}

.city-facility-entry small {
  margin-top: 3px;
  color: #697f77;
  font-size: 6px;
}

.city-facility-entry > b {
  color: var(--facility-accent);
  font-size: 13px;
  font-weight: 400;
  opacity: 0.72;
}

.city-facility-overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: flex-end;
  padding: 4.2% 4.5% 4.8%;
}

.city-facility-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 8, 9, 0.34), rgba(2, 8, 9, 0.78)),
    rgba(2, 8, 9, 0.34);
  backdrop-filter: blur(1px);
}

.city-facility-panel {
  --facility-accent: #e6a05e;
  position: relative;
  display: flex;
  width: min(48%, 610px);
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(183, 157, 98, 0.82);
  background:
    linear-gradient(133deg, color-mix(in srgb, var(--facility-accent) 8%, transparent), transparent 33%),
    repeating-linear-gradient(0deg, rgba(153, 177, 145, 0.018) 0 1px, transparent 1px 5px),
    rgba(7, 20, 18, 0.985);
  box-shadow:
    inset 0 0 0 2px rgba(3, 11, 11, 0.88),
    inset 0 0 0 3px color-mix(in srgb, var(--facility-accent) 14%, transparent),
    9px 9px 0 rgba(0, 0, 0, 0.4),
    0 0 50px rgba(0, 0, 0, 0.42);
  animation: city-facility-in 160ms steps(3, end) both;
}

.city-facility-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 34%;
  height: 2px;
  background: var(--facility-accent);
}

@keyframes city-facility-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.city-facility-head {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto 30px;
  align-items: center;
  gap: 11px;
  padding: 17px 17px 13px;
  border-bottom: 1px solid rgba(117, 137, 113, 0.42);
}

.city-facility-seal {
  display: grid;
  width: 48px;
  height: 50px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--facility-accent) 76%, #937f50);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--facility-accent) 16%, transparent), transparent 58%),
    #10231f;
  box-shadow:
    inset 0 0 0 3px #0a1816,
    inset 0 0 0 4px color-mix(in srgb, var(--facility-accent) 22%, transparent);
  color: var(--facility-accent);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 25px;
  font-weight: 900;
}

.city-facility-title {
  min-width: 0;
}

.city-facility-title p {
  margin: 0 0 3px;
  color: color-mix(in srgb, var(--facility-accent) 76%, #c8d0b5);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.city-facility-title h2 {
  margin: 0;
  color: #f0e9cc;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 27px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.city-facility-title > span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #859b90;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-facility-head-wallet {
  display: flex;
  min-width: 70px;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-left: 9px;
  border-left: 1px solid rgba(112, 136, 119, 0.38);
}

.city-facility-head-wallet small {
  color: #778d82;
  font-size: 6px;
}

.city-facility-head-wallet strong {
  color: #f0d87c;
  font-size: 15px;
}

.city-facility-close {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid #566d5d;
  background: #11251f;
  color: #aabcaa;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.city-facility-close:hover {
  border-color: var(--facility-accent);
  color: #f1e9c9;
}

.city-facility-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 8px 17px 0;
}

.city-facility-tab {
  position: relative;
  min-width: 0;
  min-height: 29px;
  padding: 4px 5px;
  overflow: hidden;
  border: 0;
  border-bottom: 2px solid #31483d;
  background: rgba(4, 14, 13, 0.4);
  color: #778d82;
  cursor: pointer;
  font-size: 8px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-facility-tab:hover {
  background: rgba(24, 46, 38, 0.62);
  color: #c3cfba;
}

.city-facility-tab.is-active {
  border-bottom-color: var(--facility-accent);
  background: color-mix(in srgb, var(--facility-accent) 9%, transparent);
  color: #ece4c5;
}

.city-facility-content {
  min-height: 0;
  flex: 1;
  padding: 13px 17px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: color-mix(in srgb, var(--facility-accent) 52%, #394b40) #071310;
  scrollbar-width: thin;
}

.city-facility-content::-webkit-scrollbar {
  width: 5px;
}

.city-facility-content::-webkit-scrollbar-track {
  background: #071310;
}

.city-facility-content::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--facility-accent) 52%, #394b40);
}

.facility-lead-copy {
  margin: 0 0 11px;
  color: #93a89d;
  font-size: 8px;
  line-height: 1.7;
}

.facility-section {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(105, 129, 111, 0.34);
}

.facility-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.facility-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.facility-section-head strong {
  color: #d9d2af;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 12px;
}

.facility-section-head span,
.facility-section-head small {
  color: #70887d;
  font-size: 6px;
}

.facility-hero-feature {
  position: relative;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border: 1px solid rgba(137, 119, 75, 0.56);
  background:
    linear-gradient(90deg, rgba(164, 106, 59, 0.11), transparent 72%),
    rgba(13, 28, 24, 0.86);
}

.facility-hero-feature > img {
  width: 78px;
  height: 78px;
  border: 1px solid #555541;
  background: #071310;
  object-fit: cover;
  image-rendering: pixelated;
}

.facility-hero-copy {
  min-width: 0;
}

.facility-hero-copy small,
.facility-hero-copy strong,
.facility-hero-copy span {
  display: block;
}

.facility-hero-copy small {
  color: #b99b65;
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.facility-hero-copy strong {
  margin-top: 3px;
  color: #f1e8cc;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 19px;
  line-height: 1;
}

.facility-hero-copy span {
  margin-top: 5px;
  color: #96aa9c;
  font-size: 7px;
}

.facility-red-mark {
  display: grid;
  width: 34px;
  height: 38px;
  place-items: center;
  border: 1px solid #f18a67;
  background: rgba(83, 29, 23, 0.74);
  color: #ff9b76;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 2px 0 #2b0f0b;
}

.facility-weapon-band {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  padding: 8px 9px;
  border-left: 2px solid #d76c50;
  background: rgba(34, 21, 18, 0.76);
}

.facility-weapon-rune {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #8c5747;
  color: #f2a076;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 19px;
}

.facility-weapon-band div {
  min-width: 0;
}

.facility-weapon-band small,
.facility-weapon-band strong,
.facility-weapon-band span {
  display: block;
}

.facility-weapon-band small {
  color: #9e776a;
  font-size: 6px;
}

.facility-weapon-band strong {
  margin-top: 2px;
  color: #f2d8bc;
  font-size: 11px;
}

.facility-weapon-band span {
  margin-top: 3px;
  color: #8d776e;
  font-size: 6px;
}

.facility-weapon-band > em {
  color: #f18667;
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
}

.facility-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.facility-rule {
  padding: 7px 8px;
  border: 1px solid rgba(101, 123, 108, 0.4);
  background: rgba(5, 16, 14, 0.52);
}

.facility-rule b {
  display: block;
  color: #d4cdaa;
  font-size: 8px;
}

.facility-rule span {
  display: block;
  margin-top: 3px;
  color: #72897e;
  font-size: 6px;
  line-height: 1.5;
}

.facility-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.facility-action-button,
.facility-secondary-button {
  min-height: 30px;
  padding: 0 11px;
  cursor: pointer;
  font-size: 8px;
  font-weight: 900;
}

.facility-action-button {
  border: 1px solid color-mix(in srgb, var(--facility-accent) 69%, #dfe4bb);
  background: color-mix(in srgb, var(--facility-accent) 72%, #d8dfad);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--facility-accent) 38%, #1d2b23);
  color: #101a13;
}

.facility-secondary-button {
  border: 1px solid #526b5d;
  background: #10231e;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
  color: #c4d0bb;
}

.facility-action-button:hover,
.facility-secondary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.rarity-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.rarity-step {
  --rarity-color: #d6dbd1;
  min-width: 0;
  padding: 7px 4px 6px;
  border: 1px solid color-mix(in srgb, var(--rarity-color) 34%, #35453b);
  border-top: 2px solid var(--rarity-color);
  background: color-mix(in srgb, var(--rarity-color) 7%, rgba(5, 16, 14, 0.75));
  text-align: center;
}

.rarity-step strong,
.rarity-step span {
  display: block;
}

.rarity-step strong {
  color: var(--rarity-color);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 13px;
}

.rarity-step span {
  margin-top: 2px;
  overflow: hidden;
  color: #788d81;
  font-size: 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gear-list {
  display: grid;
  gap: 5px;
}

.gear-row {
  --gear-color: #d6dbd1;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 5px 7px;
  border: 1px solid color-mix(in srgb, var(--gear-color) 24%, #35483d);
  border-left: 2px solid var(--gear-color);
  background: rgba(5, 16, 14, 0.62);
}

.gear-swatch {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--gear-color) 48%, #58685e);
  background: color-mix(in srgb, var(--gear-color) 12%, #0b1a17);
  color: var(--gear-color);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 12px;
}

.gear-copy {
  min-width: 0;
}

.gear-copy strong,
.gear-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gear-copy strong {
  color: #e6dfc1;
  font-size: 9px;
}

.gear-copy span {
  margin-top: 2px;
  color: #70877b;
  font-size: 6px;
}

.gear-price {
  color: #e3ca70;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.gear-buy {
  min-width: 46px;
  min-height: 25px;
  padding: 0 7px;
  border: 1px solid #6f8060;
  background: #1a3027;
  color: #d8dfb7;
  cursor: pointer;
  font-size: 7px;
  font-weight: 900;
}

.gear-buy:hover:not(:disabled) {
  border-color: var(--gear-color);
  background: #243b30;
}

.gear-buy:disabled {
  border-color: #37483e;
  background: #0d1b17;
  color: #5e7267;
  cursor: default;
}

.facility-mission-list {
  display: grid;
  gap: 6px;
}

.facility-mission {
  --mission-color: #c9d777;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid rgba(95, 118, 101, 0.48);
  border-left: 2px solid var(--mission-color);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--mission-color) 9%, transparent), transparent 68%),
    rgba(5, 16, 14, 0.6);
}

.facility-mission.is-active {
  border-color: color-mix(in srgb, var(--mission-color) 55%, #637361);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--mission-color) 15%, transparent), transparent 72%),
    rgba(9, 23, 19, 0.86);
}

.facility-mission-copy {
  min-width: 0;
}

.facility-mission-copy small,
.facility-mission-copy strong,
.facility-mission-copy p {
  display: block;
}

.facility-mission-copy small {
  color: color-mix(in srgb, var(--mission-color) 78%, #9eab9b);
  font-size: 6px;
}

.facility-mission-copy strong {
  margin-top: 3px;
  color: #e9e2c5;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 13px;
}

.facility-mission-copy p {
  margin: 3px 0 0;
  color: #71887d;
  font-size: 6px;
  line-height: 1.5;
}

.facility-mission-meta {
  display: flex;
  min-width: 78px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
}

.facility-mission-meta > span {
  color: #a99567;
  font-size: 6px;
}

.facility-mission-meta button {
  min-width: 66px;
  min-height: 24px;
  border: 1px solid #627760;
  background: #172b23;
  color: #d3dab6;
  cursor: pointer;
  font-size: 7px;
  font-weight: 900;
}

.facility-mission-meta button:hover:not(:disabled) {
  border-color: var(--mission-color);
  background: #20372b;
}

.facility-mission-meta button:disabled {
  border-color: color-mix(in srgb, var(--mission-color) 38%, #465a4d);
  background: color-mix(in srgb, var(--mission-color) 8%, #101f1a);
  color: color-mix(in srgb, var(--mission-color) 66%, #849387);
  cursor: default;
}

.facility-party-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.facility-party-card {
  --party-color: #b8c47f;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  min-width: 0;
  padding: 5px;
  overflow: hidden;
  border: 1px solid rgba(97, 122, 104, 0.58);
  border-top: 2px solid var(--party-color);
  background: rgba(5, 16, 14, 0.62);
  color: #d6ddbf;
  cursor: pointer;
  text-align: left;
}

.facility-party-card:hover,
.facility-party-card.is-leader {
  border-color: color-mix(in srgb, var(--party-color) 65%, #768576);
  background: color-mix(in srgb, var(--party-color) 8%, rgba(9, 24, 20, 0.9));
}

.facility-party-card.is-leader {
  cursor: default;
}

.facility-party-card img {
  width: 48px;
  height: 48px;
  border: 1px solid #435648;
  background: #071310;
  object-fit: cover;
  image-rendering: pixelated;
}

.facility-party-copy {
  min-width: 0;
  padding: 3px 0 0 7px;
}

.facility-party-copy small,
.facility-party-copy strong,
.facility-party-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-party-copy small {
  color: var(--party-color);
  font-size: 6px;
}

.facility-party-copy strong {
  margin-top: 2px;
  color: #e4ddc0;
  font-size: 10px;
}

.facility-party-copy span {
  margin-top: 3px;
  color: #6f857a;
  font-size: 6px;
}

.facility-summary-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  padding: 7px 9px;
  border-top: 1px solid rgba(107, 129, 111, 0.36);
  border-bottom: 1px solid rgba(107, 129, 111, 0.24);
  color: #7c9186;
  font-size: 6px;
}

.facility-summary-bar b {
  color: #d8cc9a;
  font-size: 7px;
}

@media (max-width: 760px) {
  .city-facility-rail {
    left: 3%;
    top: 13%;
    width: 35%;
    gap: 2px;
  }

  .city-facility-rail > p {
    margin-bottom: 0;
    padding: 0 1px 2px;
  }

  .city-facility-rail > p span {
    font-size: 7px;
  }

  .city-facility-rail > p small {
    display: none;
  }

  .city-facility-entry {
    grid-template-columns: 20px minmax(0, 1fr) 5px;
    gap: 4px;
    min-height: 28px;
    padding: 2px 4px 2px 3px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.26);
  }

  .city-facility-entry i {
    width: 19px;
    height: 19px;
    font-size: 10px;
  }

  .city-facility-entry strong {
    font-size: 7px;
  }

  .city-facility-entry small {
    margin-top: 1px;
    font-size: 5px;
  }

  .city-facility-entry > b {
    font-size: 9px;
  }

  .city-facility-overlay {
    padding: 3%;
  }

  .city-facility-panel {
    width: min(79%, 550px);
  }

  .city-facility-head {
    grid-template-columns: 31px minmax(0, 1fr) auto 25px;
    gap: 6px;
    padding: 8px 9px 7px;
  }

  .city-facility-seal {
    width: 30px;
    height: 31px;
    box-shadow:
      inset 0 0 0 2px #0a1816,
      inset 0 0 0 3px color-mix(in srgb, var(--facility-accent) 22%, transparent);
    font-size: 15px;
  }

  .city-facility-title p {
    margin-bottom: 1px;
    font-size: 4px;
  }

  .city-facility-title h2 {
    font-size: 16px;
  }

  .city-facility-title > span {
    margin-top: 2px;
    font-size: 5px;
  }

  .city-facility-head-wallet {
    min-width: 47px;
    gap: 1px;
    padding-left: 5px;
  }

  .city-facility-head-wallet small {
    font-size: 4px;
  }

  .city-facility-head-wallet strong {
    font-size: 9px;
  }

  .city-facility-close {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .city-facility-tabs {
    gap: 2px;
    padding: 5px 9px 0;
  }

  .city-facility-tab {
    min-height: 22px;
    padding: 2px 3px;
    font-size: 6px;
  }

  .city-facility-content {
    padding: 7px 9px 9px;
  }

  .facility-lead-copy {
    margin-bottom: 7px;
    font-size: 6px;
    line-height: 1.55;
  }

  .facility-section {
    margin-top: 7px;
    padding-top: 6px;
  }

  .facility-section-head {
    margin-bottom: 5px;
  }

  .facility-section-head strong {
    font-size: 9px;
  }

  .facility-section-head span,
  .facility-section-head small {
    font-size: 5px;
  }

  .facility-hero-feature {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 5px;
  }

  .facility-hero-feature > img {
    width: 48px;
    height: 48px;
  }

  .facility-hero-copy small {
    font-size: 4px;
  }

  .facility-hero-copy strong {
    font-size: 13px;
  }

  .facility-hero-copy span {
    margin-top: 2px;
    font-size: 5px;
  }

  .facility-red-mark {
    width: 24px;
    height: 27px;
    font-size: 13px;
  }

  .facility-weapon-band {
    grid-template-columns: 29px minmax(0, 1fr) auto;
    gap: 6px;
    margin-top: 4px;
    padding: 5px;
  }

  .facility-weapon-rune {
    width: 27px;
    height: 27px;
    font-size: 13px;
  }

  .facility-weapon-band small,
  .facility-weapon-band span {
    font-size: 4px;
  }

  .facility-weapon-band strong {
    font-size: 8px;
  }

  .facility-weapon-band > em {
    font-size: 5px;
  }

  .facility-rule {
    padding: 4px 5px;
  }

  .facility-rule b {
    font-size: 6px;
  }

  .facility-rule span {
    margin-top: 2px;
    font-size: 5px;
  }

  .facility-actions {
    gap: 4px;
    margin-top: 7px;
  }

  .facility-action-button,
  .facility-secondary-button {
    min-height: 23px;
    padding: 0 7px;
    font-size: 6px;
  }

  .rarity-step {
    padding: 4px 2px;
  }

  .rarity-step strong {
    font-size: 9px;
  }

  .rarity-step span {
    font-size: 4px;
  }

  .gear-row {
    grid-template-columns: 23px minmax(0, 1fr) auto auto;
    gap: 5px;
    min-height: 32px;
    padding: 3px 4px;
  }

  .gear-swatch {
    width: 21px;
    height: 21px;
    font-size: 9px;
  }

  .gear-copy strong {
    font-size: 7px;
  }

  .gear-copy span {
    font-size: 4px;
  }

  .gear-price {
    font-size: 6px;
  }

  .gear-buy {
    min-width: 36px;
    min-height: 20px;
    padding: 0 4px;
    font-size: 5px;
  }

  .facility-mission {
    gap: 6px;
    padding: 5px 6px;
  }

  .facility-mission-copy small {
    font-size: 4px;
  }

  .facility-mission-copy strong {
    font-size: 10px;
  }

  .facility-mission-copy p {
    font-size: 5px;
  }

  .facility-mission-meta {
    min-width: 58px;
    gap: 3px;
  }

  .facility-mission-meta > span {
    font-size: 4px;
  }

  .facility-mission-meta button {
    min-width: 52px;
    min-height: 19px;
    font-size: 5px;
  }

  .facility-party-grid {
    gap: 4px;
  }

  .facility-party-card {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 3px;
  }

  .facility-party-card img {
    width: 34px;
    height: 34px;
  }

  .facility-party-copy {
    padding: 1px 0 0 4px;
  }

  .facility-party-copy small {
    font-size: 4px;
  }

  .facility-party-copy strong {
    font-size: 7px;
  }

  .facility-party-copy span {
    font-size: 4px;
  }

  .facility-summary-bar {
    margin-top: 6px;
    padding: 5px 6px;
    font-size: 5px;
  }

  .facility-summary-bar b {
    font-size: 5px;
  }
}

@media (max-height: 560px) and (min-width: 761px) {
  .city-facility-rail {
    top: 13.5%;
    width: 164px;
  }

  .city-facility-entry {
    min-height: 30px;
  }

  .city-facility-overlay {
    padding-top: 3%;
    padding-bottom: 3%;
  }

  .city-facility-head {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .city-facility-title h2 {
    font-size: 22px;
  }
}
