:root {
  color-scheme: dark;
  --bg: #111519;
  --panel: #1d2428;
  --panel-strong: #263036;
  --ink: #f8ecd1;
  --muted: #bfae8a;
  --gold: #e9b95f;
  --paper: #f3d88b;
  --red: #c84e42;
  --green: #74d28c;
  --jade: #55c6a5;
  --blue: #24394c;
  --line: rgba(248, 236, 209, 0.16);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 10%, rgba(200, 78, 66, 0.16), transparent 24rem),
    radial-gradient(circle at 86% 14%, rgba(85, 198, 165, 0.12), transparent 20rem),
    linear-gradient(160deg, #10151a 0%, #172028 46%, #0f1215 100%);
  color: var(--ink);
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: #29343a;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

a.settings-link {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: #29343a;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2.2rem;
  line-height: 1.08;
}

h2 {
  font-size: 1.05rem;
}

.app {
  width: min(100vw, 460px);
  min-height: 100dvh;
  height: 100dvh;
  margin: 0 auto;
  background: rgba(12, 18, 22, 0.68);
  border-inline: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.screen {
  min-height: 100dvh;
  padding: 1rem;
}

.hidden {
  display: none !important;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  background:
    linear-gradient(rgba(13, 18, 22, 0.34), rgba(13, 18, 22, 0.82)),
    url("./assets/generated/home-bg.webp") center 44% / cover no-repeat,
    #111519;
}

.loading-card {
  width: min(86vw, 360px);
  display: grid;
  gap: 0.8rem;
  padding: 1.15rem;
  border: 1px solid rgba(248, 236, 209, 0.28);
  border-radius: 8px;
  background: rgba(22, 28, 31, 0.84);
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-card h1 {
  color: #ffe8ad;
  font-size: 1.7rem;
}

.loading-card p {
  color: #e8d6a9;
}

.loading-bar {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 219, 135, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
}

.loading-bar i {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8cd66a, #f2c66d);
  transition: width 180ms ease;
}

.hero {
  min-height: 190px;
  padding: 1.3rem;
  border-radius: 0 0 18px 18px;
  background:
    linear-gradient(rgba(16, 21, 25, 0.18), rgba(16, 21, 25, 0.64)),
    repeating-linear-gradient(90deg, rgba(248, 236, 209, 0.06) 0 1px, transparent 1px 18px),
    linear-gradient(145deg, #283747, #182227 56%, #3b2122);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -28% 18%;
  height: 76px;
  background:
    linear-gradient(90deg, transparent 0 10%, #161414 10% 13%, transparent 13% 18%, #1b1615 18% 22%, transparent 22% 100%),
    linear-gradient(#1a1718, #151414);
  clip-path: polygon(0 42%, 7% 24%, 16% 40%, 23% 15%, 32% 35%, 43% 12%, 55% 40%, 69% 18%, 78% 36%, 100% 26%, 100% 100%, 0 100%);
  opacity: 0.86;
}

.moon {
  position: absolute;
  top: 26px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #f6df9f;
  box-shadow: 0 0 40px rgba(246, 223, 159, 0.52);
}

.eyebrow,
.label,
.hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.story-line {
  color: #e8d6a9;
  margin-top: 0.45rem;
}

.settings-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  min-height: 32px;
  padding: 0.32rem 0.56rem;
  border-color: rgba(248, 236, 209, 0.24);
  background: rgba(13, 18, 22, 0.58);
  color: #f7e7bc;
  font-size: 0.72rem;
  z-index: 2;
}

.panel {
  background: rgba(29, 36, 40, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
  margin-top: 0.8rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.between {
  justify-content: space-between;
}

.protagonist-panel {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
}

.taoist-portrait {
  height: 136px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(#233640, #13191d);
  border: 1px solid var(--line);
}

.taoist-portrait .hat {
  position: absolute;
  left: 28px;
  top: 12px;
  width: 44px;
  height: 30px;
  background: #262018;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.taoist-portrait .face {
  position: absolute;
  left: 31px;
  top: 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f4c98e;
  box-shadow: inset -5px -3px 0 rgba(120, 68, 38, 0.18);
}

.taoist-portrait .face::before,
.taoist-portrait .face::after {
  content: "";
  position: absolute;
  top: 15px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2b1d18;
}

.taoist-portrait .face::before {
  left: 10px;
}

.taoist-portrait .face::after {
  right: 10px;
}

.taoist-portrait .robe {
  position: absolute;
  left: 25px;
  bottom: 0;
  width: 52px;
  height: 64px;
  border-radius: 18px 18px 4px 4px;
  background: linear-gradient(90deg, #d9b15d, #7f392f 52%, #4d2228);
}

.taoist-portrait .sword {
  position: absolute;
  right: 13px;
  top: 40px;
  width: 7px;
  height: 82px;
  background: #d8a44e;
  transform: rotate(19deg);
  border-radius: 8px;
}

.hero-stats {
  min-width: 0;
}

.power,
.badge {
  color: #17130c;
  background: var(--gold);
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  white-space: nowrap;
  font-size: 0.78rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.stat-grid span,
.resource-row,
.time-strip span,
.battle-info span {
  background: rgba(248, 236, 209, 0.07);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
}

.primary-btn,
.start-btn {
  background: linear-gradient(180deg, #f3c56e, #b86b32);
  border-color: rgba(255, 219, 135, 0.6);
  color: #21150b;
}

.start-btn {
  width: 100%;
  margin-top: 0.8rem;
  font-size: 1rem;
}

.time-strip,
.battle-info,
.reward-actions,
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.resources-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.resource-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0.02rem 0.32rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 238, 178, 0.08);
}

.resource-row img {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.35));
}

.resource-row span,
.resource-row b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-row span {
  color: rgba(248, 236, 209, 0.72);
  font-size: 0.66rem;
  line-height: 1.05;
}

.resource-row b {
  color: var(--paper);
  font-size: 0.96rem;
  line-height: 1.05;
}

.resource-plus {
  grid-column: 3;
  grid-row: 1 / 3;
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #95d86d, #4f9c38);
  color: #18300d;
  font-weight: 900;
  font-size: 0.82rem;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.resource-plus:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.24);
}

.artifact-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.artifact-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.04);
}

.artifact-icon,
.weapon-cell .weapon-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #614034, #e0bb63);
  color: #20130c;
  font-weight: 900;
}

.artifact-card p {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.16rem;
}

.battle-topbar {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.7rem;
  background: #11181d;
  border-bottom: 1px solid var(--line);
  margin: -1rem -1rem 0;
}

.battle-topbar div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ghost-btn {
  background: transparent;
}

#battleCanvas {
  width: 100%;
  aspect-ratio: 720 / 520;
  display: block;
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #152027;
}

.merge-panel {
  margin-top: 0.75rem;
  padding: 0.8rem;
  background: #1b2429;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.merge-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.weapon-cell {
  aspect-ratio: 1;
  min-height: 64px;
  border: 1px solid rgba(248, 236, 209, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(248, 236, 209, 0.05), rgba(0, 0, 0, 0.12)),
    #20292f;
  display: grid;
  place-items: center;
  position: relative;
  user-select: none;
}

.weapon-cell.selected {
  outline: 3px solid var(--gold);
}

.weapon-cell.empty::after {
  content: "法器";
  color: rgba(248, 236, 209, 0.32);
  font-size: 0.8rem;
}

.weapon-cell.sealed {
  cursor: default;
  opacity: 0.5;
  filter: grayscale(0.85);
  background:
    repeating-linear-gradient(135deg, rgba(248, 236, 209, 0.08) 0 5px, transparent 5px 10px),
    #11181d;
}

.weapon-cell.sealed::after {
  content: none;
}

.weapon-cell .level {
  position: absolute;
  right: 5px;
  bottom: 5px;
  border-radius: 999px;
  padding: 0.08rem 0.32rem;
  background: #15191c;
  color: var(--paper);
  font-size: 0.72rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 1rem;
  z-index: 20;
}

.result-card {
  width: min(92vw, 430px);
  background: #20282d;
  border: 1px solid rgba(248, 236, 209, 0.22);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.result-summary,
.reward-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.result-summary div {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(248, 236, 209, 0.07);
}

.reward-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reward-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0.08rem 0.45rem;
  min-width: 0;
  padding: 0.42rem 0.5rem;
  border: 1px solid rgba(248, 236, 209, 0.12);
  border-radius: 8px;
  background: rgba(248, 236, 209, 0.07);
}

.reward-card img {
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.34));
}

.reward-card span,
.reward-card b,
.reward-card em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-card span {
  color: rgba(248, 236, 209, 0.74);
  font-size: 0.74rem;
}

.reward-card b {
  color: var(--paper);
  font-size: 0.86rem;
}

.reward-card em {
  grid-column: 2;
  color: rgba(248, 236, 209, 0.56);
  font-style: normal;
  font-size: 0.68rem;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.notice-card {
  display: grid;
  gap: 0.75rem;
}

.settings-card {
  position: relative;
  color: #513124;
  border: 24px solid transparent;
  border-image: url("./assets/generated/settings-panel-frame.webp") 108 96 122 96 fill / 24px 22px 28px 22px / 0 stretch;
  background: rgba(241, 210, 161, 0.96);
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.48);
}

.settings-card .eyebrow {
  color: #7f4b34;
  font-weight: 800;
  text-align: center;
}

.settings-card h2 {
  color: #4b271d;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 235, 190, 0.64);
}

.settings-card .notice-list {
  padding: 0.48rem 0.56rem;
  border-radius: 8px;
  background: rgba(121, 75, 48, 0.12);
  color: #5a3728;
  font-weight: 650;
}

.settings-card .hint {
  color: rgba(88, 48, 32, 0.72);
}

.notice-list {
  display: grid;
  gap: 0.52rem;
  color: #ead8a6;
  line-height: 1.55;
  font-size: 0.86rem;
}

.redeem-box {
  display: grid;
  gap: 0.45rem;
  padding: 0.62rem;
  border: 1px solid rgba(255, 219, 135, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(243, 216, 139, 0.13), rgba(104, 57, 39, 0.18)),
    rgba(12, 18, 22, 0.42);
}

.redeem-box strong {
  color: var(--paper);
  font-size: 0.92rem;
  text-align: center;
}

.redeem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 0.45rem;
}

.redeem-row input {
  min-width: 0;
  height: 42px;
  border: 1px solid rgba(248, 236, 209, 0.18);
  border-radius: 8px;
  padding: 0 0.72rem;
  background: rgba(13, 18, 22, 0.82);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0;
  outline: none;
}

.redeem-row input:focus {
  border-color: rgba(233, 185, 95, 0.68);
  box-shadow: 0 0 0 2px rgba(233, 185, 95, 0.16);
}

.redeem-row button {
  min-height: 42px;
  padding: 0.45rem 0.55rem;
  background: linear-gradient(180deg, #95d86d, #4f9c38);
  border-color: rgba(205, 255, 151, 0.56);
  color: #1a260f;
}

.settings-card .redeem-box {
  border-color: rgba(105, 58, 38, 0.24);
  background: rgba(132, 83, 48, 0.15);
}

.settings-card .redeem-box strong {
  color: #4b271d;
}

.settings-card .redeem-row input {
  background: rgba(103, 58, 43, 0.82);
  border-color: rgba(80, 36, 27, 0.42);
  color: #fff0c9;
}

.settings-card .redeem-row input::placeholder {
  color: rgba(255, 240, 201, 0.62);
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.52rem;
}

.settings-card .settings-actions button,
.settings-card .settings-actions .settings-link {
  background: linear-gradient(180deg, #8d5b42, #5d3026);
  border-color: rgba(86, 38, 28, 0.58);
  color: #fff0c9;
  box-shadow: inset 0 1px 0 rgba(255, 232, 184, 0.24);
}

.settings-card .settings-actions .primary-btn {
  background: linear-gradient(180deg, #f0c66e, #b86b32);
  border-color: rgba(119, 57, 34, 0.5);
  color: #301a0f;
}

.save-transfer {
  width: 100%;
  min-height: 96px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  background: rgba(12, 18, 22, 0.86);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

.battle-info button {
  min-width: 0;
  min-height: auto;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
}

.battle-sheet {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  max-height: calc(100dvh - 24px);
}

.sheet-list {
  display: grid;
  gap: 0.38rem;
  min-height: 0;
  overflow: hidden;
}

.sheet-list h3 {
  margin-top: 0.2rem;
  color: var(--gold);
  font-size: 0.86rem;
}

.sheet-list div {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.42rem 0.52rem;
  border-radius: 8px;
  background: rgba(248, 236, 209, 0.07);
}

.sheet-list span,
.sheet-list b {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(88vw, 360px);
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: #f3d88b;
  color: #1c140b;
  text-align: center;
  font-weight: 800;
  z-index: 30;
}

@media (max-width: 380px) {
  .screen {
    padding: 0.7rem;
  }

  .protagonist-panel {
    grid-template-columns: 82px 1fr;
  }

  .taoist-portrait {
    height: 124px;
  }

  .time-strip,
  .reward-actions,
  .shop-grid {
    grid-template-columns: 1fr;
  }

  button {
    padding-inline: 0.65rem;
  }
}

/* Generated-art skin pass */
.app {
  background:
    linear-gradient(rgba(10, 14, 17, 0.18), rgba(10, 14, 17, 0.88)),
    url("./assets/generated/home-bg.webp") center top / cover no-repeat;
}

.hero {
  min-height: 210px;
  background:
    linear-gradient(rgba(9, 12, 16, 0.12), rgba(9, 12, 16, 0.64)),
    url("./assets/generated/home-bg.webp") center 26% / cover no-repeat;
}

.hero::after,
.moon {
  display: none;
}

.panel,
.merge-panel,
.result-card,
.choice-card {
  background:
    linear-gradient(180deg, rgba(24, 31, 35, 0.94), rgba(15, 22, 26, 0.94));
  border-color: rgba(233, 185, 95, 0.24);
}

.taoist-portrait {
  height: 154px;
  background:
    radial-gradient(circle at 50% 78%, rgba(116, 210, 140, 0.2), transparent 43%),
    url("./assets/generated/taoist-hero.webp") center bottom / contain no-repeat,
    linear-gradient(#233640, #13191d);
}

.taoist-portrait > * {
  display: none;
}

.artifact-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.08));
}

.artifact-card.locked {
  filter: grayscale(0.65);
  opacity: 0.72;
}

.artifact-icon,
.weapon-cell .weapon-icon {
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--quality, #e0bb63), white 18%), transparent 62%),
    linear-gradient(145deg, #614034, var(--quality, #e0bb63));
}

.artifact-icon img,
.weapon-cell .weapon-icon img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.42));
}

.gear-row {
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
}

.gear-row img {
  grid-row: 1 / 4;
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.42));
}

.gear-row span,
.gear-row b,
.gear-row em {
  grid-column: 2;
  min-width: 0;
}

.run-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.run-bars span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 0.25rem;
}

.bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--line);
}

.bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--gold));
  transition: width 0.2s ease;
}

#battleCanvas {
  background: url("./assets/generated/battle-bg.webp") center / cover no-repeat #152027;
}

.battle-info {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.battle-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.battle-actions button {
  padding-inline: 0.55rem;
  font-size: 0.75rem;
}

.merge-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 0.42rem;
}

.weapon-cell {
  min-height: 58px;
  background:
    linear-gradient(145deg, rgba(248, 236, 209, 0.05), rgba(0, 0, 0, 0.12)),
    #20292f;
}

.weapon-cell.locked {
  opacity: 0.48;
  filter: grayscale(0.8);
}

.weapon-cell strong {
  position: absolute;
  left: 5px;
  top: 4px;
  color: var(--quality, var(--paper));
  font-size: 0.62rem;
}

.lock-mark {
  color: rgba(248, 236, 209, 0.46);
  font-size: 0.82rem;
}

.weapon-cell.locked::after {
  content: none;
}

.choice-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.choice-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 76px;
  background: linear-gradient(180deg, rgba(74, 33, 25, 0.92), rgba(42, 26, 26, 0.94));
  border-color: rgba(233, 185, 95, 0.36);
}

.choice-option span {
  color: var(--muted);
  font-size: 0.82rem;
}

.boss-intro {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: #06090d;
  display: grid;
  place-items: end center;
  overflow: hidden;
  animation: bossFade 2.3s ease both;
}

.boss-intro-art {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.65)),
    url("./assets/generated/boss-intro-qipao.webp") center / cover no-repeat;
  transform-origin: center;
  animation: bossZoom 2.3s ease both;
}

.boss-intro-copy {
  position: relative;
  width: min(92vw, 420px);
  margin: 0 0 8vh;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(233, 185, 95, 0.42);
  background: linear-gradient(180deg, rgba(28, 18, 17, 0.9), rgba(12, 13, 15, 0.92));
  box-shadow: var(--shadow);
}

.boss-intro-copy h2 {
  font-size: 1.7rem;
  color: #fff1c5;
}

.progress-block {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.42rem;
  margin-top: 0.75rem;
}

.stage-chip {
  min-height: 54px;
  padding: 0.35rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(25, 48, 43, 0.88), rgba(13, 24, 25, 0.94));
}

.stage-chip span {
  color: var(--muted);
  font-size: 0.64rem;
}

.stage-chip.cleared {
  border-color: rgba(116, 210, 140, 0.58);
}

.stage-chip.boss {
  border-color: rgba(200, 78, 66, 0.7);
}

.gear-list,
.achievement-list {
  display: grid;
  gap: 0.52rem;
  margin-top: 0.75rem;
}

.gear-row,
.achievement-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.gear-row.equipped {
  border-color: rgba(233, 185, 95, 0.32);
}

.gear-row b,
.achievement-row b {
  color: var(--paper);
}

.gear-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.76rem;
}

.achievement-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.achievement-row p {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.achievement-row.ready {
  border-color: rgba(116, 210, 140, 0.42);
}

.achievement-row.claimed {
  opacity: 0.68;
}

.story-text {
  display: grid;
  gap: 0.45rem;
  margin: 0.85rem 0 1rem;
  color: #ead8a6;
  line-height: 1.55;
}

.comic-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 0.48rem;
  height: min(92dvh, 760px);
  cursor: pointer;
}

.comic-viewport {
  min-height: 0;
  border-radius: 8px;
  border: 1px solid rgba(233, 185, 95, 0.28);
  overflow: hidden;
  background: #10171c;
}

.comic-image {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: block;
  background: rgba(8, 11, 14, 0.72);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  overflow: hidden;
  animation: comicPanelIn 0.32s ease both;
}

.comic-image.is-loading::after,
.comic-image.is-error::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: #d8c69d;
  background: rgba(8, 11, 14, 0.82);
  font-size: 0.88rem;
  text-align: center;
}

.comic-image.is-loading::after {
  content: "剧情绘卷加载中...";
}

.comic-image.is-error::after {
  content: "绘卷暂未加载，点击继续";
}

@keyframes comicPanelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.comic-dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.comic-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(248, 236, 209, 0.28);
}

.comic-dots i.active {
  background: var(--gold);
}

@keyframes bossZoom {
  from {
    transform: scale(1.08);
    filter: brightness(0.65);
  }
  42% {
    transform: scale(1);
    filter: brightness(1.1);
  }
  to {
    transform: scale(1.04);
    filter: brightness(0.9);
  }
}

@keyframes bossFade {
  from {
    opacity: 0;
  }
  16%,
  86% {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@media (max-width: 380px) {
  .stage-list {
    gap: 0.32rem;
  }

  .stage-chip {
    min-height: 48px;
  }

  .achievement-row {
    grid-template-columns: 1fr;
  }

  .protagonist-panel {
    grid-template-columns: 92px 1fr;
  }

  .merge-grid {
    gap: 0.34rem;
  }

  .weapon-cell {
    min-height: 50px;
  }
}

/* One-screen fit: no page-level or internal scrollbars. */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100dvh;
}

.app {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.screen {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: max(clamp(6px, 1.3vh, 10px), var(--safe-top)) max(clamp(6px, 1.3vh, 10px), var(--safe-right)) max(clamp(6px, 1.3vh, 10px), var(--safe-bottom)) max(clamp(6px, 1.3vh, 10px), var(--safe-left));
}

.screen-home {
  display: grid;
  grid-template-rows: clamp(72px, 11vh, 102px) minmax(0, 1fr) clamp(72px, 11vh, 92px) clamp(38px, 5.5vh, 48px) auto;
  gap: clamp(5px, 0.9vh, 8px);
}

.screen-home .hero,
.screen-home .home-tabs,
.screen-home .panel {
  margin-top: 0;
}

.screen-home .hero {
  grid-row: 1;
  min-height: 0;
  height: 100%;
  padding: 0.8rem;
  border-radius: 8px;
}

.screen-home .hero h1 {
  font-size: clamp(1.35rem, 5vw, 1.85rem);
}

.screen-home .story-line {
  font-size: 0.82rem;
}

/* Bottom nav uses a generated base image plus coordinate-mapped icon hotspots. */
.screen-home .home-tabs {
  grid-row: 5;
  width: 100%;
  aspect-ratio: 892 / 293;
  height: auto;
  padding: 0;
  gap: 0;
  align-self: end;
  position: relative;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: url("./assets/generated/bottom-nav-base.webp") center bottom / 100% auto no-repeat;
  box-shadow: none;
}

.screen-home .home-tabs::before,
.screen-home .home-tabs::after {
  content: none;
}

.screen-home .tab-btn {
  position: absolute;
  z-index: 1;
  left: var(--slot-x);
  top: var(--slot-y);
  width: var(--slot-w);
  height: var(--slot-h);
  transform: translateX(-50%);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  display: block;
  font-size: clamp(0.62rem, 2.55vw, 0.72rem);
  line-height: 1;
  color: #f8e5ba;
  text-shadow: 0 2px 0 rgba(45, 22, 15, 0.85);
  background: transparent;
  box-shadow: none;
}

.screen-home [data-tab="cultivate"] {
  --slot-x: 14.8%;
  --slot-y: 27%;
  --slot-w: 17.2%;
  --slot-h: 63%;
}

.screen-home [data-tab="artifacts"] {
  --slot-x: 30.7%;
  --slot-y: 27%;
  --slot-w: 17.2%;
  --slot-h: 63%;
}

.screen-home [data-tab="stages"] {
  --slot-x: 50%;
  --slot-y: 12%;
  --slot-w: 22%;
  --slot-h: 72%;
}

.screen-home [data-tab="gear"] {
  --slot-x: 68.8%;
  --slot-y: 27%;
  --slot-w: 17.2%;
  --slot-h: 63%;
}

.screen-home [data-tab="rewards"] {
  --slot-x: 85.2%;
  --slot-y: 27%;
  --slot-w: 17.2%;
  --slot-h: 63%;
}

.screen-home .tab-btn.active {
  color: #fff4d0;
  background: transparent;
}

.screen-home .tab-icon {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(94%, 76px);
  aspect-ratio: 1;
  height: auto;
  display: block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: saturate(0.78) brightness(0.86) drop-shadow(0 2px 1px rgba(30, 13, 10, 0.66));
  transform: translate(-50%, -50%) scale(0.98);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.screen-home [data-tab="cultivate"] .tab-icon {
  background-image: url("./assets/generated/tab-icon-cultivate.webp");
}

.screen-home [data-tab="artifacts"] .tab-icon {
  background-image: url("./assets/generated/tab-icon-artifacts.webp");
}

.screen-home [data-tab="stages"] .tab-icon {
  background-image: url("./assets/generated/tab-icon-stages.webp");
}

.screen-home [data-tab="gear"] .tab-icon {
  background-image: url("./assets/generated/tab-icon-gear.webp");
}

.screen-home [data-tab="rewards"] .tab-icon {
  background-image: url("./assets/generated/tab-icon-rewards.webp");
}

.screen-home .tab-btn.active .tab-icon {
  filter: saturate(1.18) brightness(1.18) drop-shadow(0 0 8px rgba(255, 218, 120, 0.86)) drop-shadow(0 3px 1px rgba(45, 18, 12, 0.78));
  transform: translate(-50%, -50%) scale(1.12);
}

.screen-home .tab-label {
  position: absolute;
  left: 50%;
  bottom: 2%;
  max-width: 100%;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.screen-home .tab-main {
  min-height: 0;
  margin-top: 0;
  padding-top: 0;
  border-radius: 0;
  color: #fff3c7;
  font-size: clamp(0.78rem, 3.35vw, 0.95rem);
  background: transparent;
  box-shadow: none;
}

.screen-home .tab-main .tab-icon {
  top: 47%;
  width: min(92%, 96px);
  transform: translate(-50%, -50%) scale(1);
}

.screen-home .tab-main.active {
  background: transparent;
}

.screen-home .tab-main.active .tab-icon {
  transform: translate(-50%, -50%) scale(1.1);
}

.screen-home .tab-panel {
  grid-row: 2;
  min-height: 0;
  overflow: hidden;
}

.screen-home .stage-panel {
  grid-row: 3;
  min-height: 0;
  overflow: hidden;
  padding: 0.55rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(104px, 31%, 128px);
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: 0.5rem;
  row-gap: 0.34rem;
  align-items: stretch;
}

.screen-home .stage-panel h2 {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.screen-home .stage-panel > .row {
  grid-column: 1;
  min-width: 0;
}

.screen-home .start-btn {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  margin-top: 0;
  min-height: 0;
  height: 100%;
  padding-block: 0.45rem;
  display: grid;
  place-items: center;
  line-height: 1.15;
}

.screen-home .time-strip {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  margin-top: 0;
  gap: 0.36rem;
}

.screen-home .time-strip span {
  padding: 0.32rem 0.42rem;
  font-size: 0.74rem;
}

.screen-home .resources-panel {
  grid-row: 4;
  padding: 0.45rem;
  min-height: 0;
  align-content: center;
}

.screen-home .resource-row {
  grid-template-columns: 24px minmax(0, 1fr) 16px;
  padding: 0.3rem 0.36rem;
  min-width: 0;
}

.screen-home .resource-row img {
  width: 24px;
  height: 24px;
}

.screen-home .resource-row span {
  font-size: 0.6rem;
}

.screen-home .resource-row b {
  font-size: 0.82rem;
}

.screen-home .resource-plus {
  width: 16px;
  height: 16px;
  font-size: 0.72rem;
}

.screen-home .resource-row span {
  font-size: 0.72rem;
}

.screen-home .resource-row b {
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.protagonist-panel {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(15, 21, 24, 0.42), rgba(8, 13, 16, 0.92)),
    url("./assets/generated/home-bg.webp") center 48% / cover no-repeat;
}

.taoist-portrait {
  position: absolute;
  left: 3%;
  bottom: 1%;
  width: 47%;
  height: 78%;
  min-height: 0;
  border: 0;
  background:
    url("./assets/generated/taoist-hero.webp") center bottom / contain no-repeat;
}

.taoist-portrait::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 14%;
  bottom: 1%;
  height: 14px;
  background: rgba(0, 0, 0, 0.36);
  filter: blur(5px);
}

.hero-stats {
  position: absolute;
  top: clamp(8px, 1.2vh, 12px);
  right: clamp(8px, 1.2vh, 12px);
  width: min(58%, 242px);
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  padding: 0.55rem;
  border: 1px solid rgba(233, 185, 95, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 29, 31, 0.72), rgba(10, 14, 17, 0.76));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(3px);
}

.stat-grid {
  gap: 0.32rem;
  margin: 0;
}

.stat-grid span {
  padding: 0.32rem 0.42rem;
  font-size: 0.76rem;
}

.hero-stats h2 {
  font-size: 0.94rem;
}

.power,
.badge {
  font-size: 0.68rem;
  padding: 0.22rem 0.42rem;
}

#upgradeHeroBtn {
  min-height: 34px;
  padding-block: 0.38rem;
}

#upgradeHint {
  margin-top: -0.12rem;
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.36rem;
  margin-top: 0.45rem;
}

.artifact-card {
  grid-template-columns: 34px 1fr;
  gap: 0.38rem;
  padding: 0.38rem;
  min-width: 0;
}

.artifact-card button {
  grid-column: 1 / -1;
  min-height: 28px;
  padding: 0.2rem;
  font-size: 0.68rem;
}

.artifact-icon {
  width: 32px;
  height: 32px;
}

.artifact-card strong,
.gear-row b,
.achievement-row strong {
  font-size: 0.76rem;
}

.artifact-card p {
  font-size: 0.64rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact-card p:nth-of-type(2) {
  display: none;
}

.progress-block {
  margin-top: 0.45rem;
}

.stage-list {
  grid-template-columns: repeat(6, 1fr);
  gap: 0.26rem;
  margin-top: 0.45rem;
}

.stage-chip {
  min-height: 34px;
  padding: 0.18rem;
}

.stage-chip span {
  display: none;
}

.gear-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.achievement-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.gear-row,
.achievement-row {
  padding: 0.38rem;
}

.achievement-row {
  grid-template-columns: 1fr;
}

.achievement-row p,
.gear-row em {
  font-size: 0.62rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.achievement-row button {
  min-height: 28px;
  padding: 0.2rem;
  font-size: 0.66rem;
}

.reward-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.reward-actions button {
  min-height: 34px;
  padding: 0.35rem 0.2rem;
  font-size: 0.72rem;
}

.rewards-panel h2,
.tab-panel h2 {
  font-size: 0.9rem;
}

.screen-battle {
  display: grid;
  grid-template-rows: 44px 34px minmax(180px, 39vh) 58px minmax(126px, 1fr);
  gap: clamp(5px, 0.9vh, 8px);
}

.battle-topbar {
  margin: 0;
  padding: 0.35rem;
  grid-template-columns: 58px 1fr auto;
  border-radius: 8px;
}

.battle-topbar button,
.battle-actions button {
  min-height: 30px;
}

.battle-topbar span,
.battle-topbar strong {
  font-size: 0.76rem;
}

.run-bars {
  margin-top: 0;
  gap: 0.42rem;
}

.run-bars span {
  margin-bottom: 0.12rem;
  font-size: 0.64rem;
}

#battleCanvas {
  height: 100%;
  width: 100%;
  aspect-ratio: auto;
  margin-top: 0;
}

.battle-info {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
  gap: 0.32rem;
}

.battle-info span,
.battle-info button {
  padding: 0.28rem 0.36rem;
  font-size: 0.68rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merge-panel {
  margin-top: 0;
  padding: 0.5rem;
  overflow: hidden;
}

.merge-panel h2 {
  font-size: 0.88rem;
}

.battle-actions {
  gap: 0.25rem;
}

.battle-actions button {
  font-size: 0.62rem;
  padding: 0.22rem 0.3rem;
}

.merge-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 0.32rem;
  margin-top: 0.42rem;
}

.weapon-cell {
  min-height: 0;
  height: clamp(44px, 8vh, 62px);
}

.weapon-cell .weapon-icon {
  width: 30px;
  height: 30px;
}

.weapon-cell strong {
  font-size: 0.54rem;
}

.weapon-cell .level {
  font-size: 0.58rem;
}

.battle-sheet {
  gap: 0.4rem;
}

.sheet-list {
  gap: 0.28rem;
}

.sheet-list h3 {
  font-size: 0.74rem;
}

.sheet-list div {
  padding: 0.3rem 0.4rem;
  font-size: 0.72rem;
}

.modal {
  overflow: hidden;
}

.result-card,
.choice-card {
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  padding: 0.75rem;
}

.result-summary,
.reward-list {
  gap: 0.32rem;
  margin-top: 0.55rem;
}

.result-summary div {
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
}

.reward-card {
  grid-template-columns: 34px minmax(0, 1fr);
  padding: 0.3rem 0.36rem;
}

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

.reward-card span {
  font-size: 0.68rem;
}

.reward-card b {
  font-size: 0.78rem;
}

.reward-card em {
  font-size: 0.62rem;
}

.result-actions {
  gap: 0.36rem;
  margin-top: 0.6rem;
}

.result-actions button {
  min-height: 34px;
  padding: 0.35rem;
  font-size: 0.72rem;
}

.story-text {
  gap: 0.25rem;
  margin: 0;
  font-size: 0.82rem;
  min-height: 2.6em;
}

.story-text p {
  margin: 0;
  padding: 0.58rem 0.68rem;
  border-radius: 8px;
  background: rgba(12, 15, 18, 0.76);
  color: #f3d88b;
  font-size: clamp(0.68rem, 2.25vw, 0.8rem);
  line-height: 1.38;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comic-card {
  height: calc(100dvh - 20px);
}

.comic-image {
  min-height: 0;
}
