/* 九渊斩妖录 · 无限阵图 — 国风暗黑志怪霓虹 UI 样式（iPhone 竖屏满屏安全区适配 + 桌面端居中画幅） */

:root {
  --bg: #07070b;
  --panel: rgba(16, 15, 24, 0.92);
  --panel-border: rgba(255, 198, 102, 0.24);
  --crimson: #ff3b2f;
  --gold: #ffd25a;
  --cyan: #2df2d6;
  --purple: #c77dff;
  --text: #f3f1ec;
  --muted: #9a98a8;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030306;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  touch-action: none;
}

#app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 80px rgba(255, 58, 36, 0.14), 0 0 0 1px rgba(255, 200, 100, 0.12);
}

@media (max-width: 560px) {
  #app-shell {
    max-width: 100%;
    box-shadow: none;
  }
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* --- 对局 HUD --- */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.exp-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.exp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2df2d6, #ffd25a, #ff4d2e);
  box-shadow: 0 0 10px rgba(45, 242, 214, 0.8);
  transition: width 0.12s ease-out;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: calc(var(--sat) + 12px) 12px 0;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 120px;
}

.lv-badge {
  background: linear-gradient(135deg, #2a1816, #14121d);
  border: 1px solid rgba(255, 210, 90, 0.55);
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(255, 180, 60, 0.2);
}

.hp-wrap {
  width: 82px;
}

.hp-track {
  position: relative;
  height: 9px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 99px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e62645, #ff6347);
  transition: width 0.12s linear;
}

.shield-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(66, 245, 155, 0.72);
}

.hp-text {
  margin-top: 2px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-variant-numeric: tabular-nums;
}

.hud-center {
  text-align: center;
}

.time-pill {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff6df;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
}

.mini-stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  color: #d6d4e0;
  margin-top: 2px;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.crit-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 99px;
  background: rgba(20, 14, 24, 0.78);
  border: 1px solid rgba(255, 208, 90, 0.4);
  color: var(--gold);
  white-space: nowrap;
}

.crit-pill.overcrit {
  background: linear-gradient(135deg, rgba(255, 62, 32, 0.9), rgba(255, 178, 42, 0.9));
  color: #160705;
  border-color: #fff0a8;
  box-shadow: 0 0 14px rgba(255, 92, 32, 0.65);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 210, 110, 0.35);
  background: rgba(16, 15, 24, 0.8);
  color: var(--gold);
  font-size: 16px;
  cursor: pointer;
}

/* Boss 血条 */
.boss-bar {
  margin: 10px 16px 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(34, 8, 16, 0.86);
  border: 1px solid rgba(255, 64, 92, 0.65);
  box-shadow: 0 0 20px rgba(255, 36, 72, 0.35);
}

.boss-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: #ffd6a5;
  margin-bottom: 4px;
}

.boss-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff1e4d, #ff7b29, #ffd25a);
  transition: width 0.1s linear;
}

.hud-subrow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 12px 0;
}

.build-pills {
  display: flex;
  gap: 5px;
}

.bpill {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(12, 13, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d0cedc;
}

.bpill.mythic { border-color: rgba(255, 210, 77, 0.5); color: var(--gold); }
.bpill.epic { border-color: rgba(199, 125, 255, 0.5); color: var(--purple); }

.combo-box {
  text-align: right;
  line-height: 1;
}

.combo-box span {
  display: block;
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  background: linear-gradient(180deg, #fff4b8, #ff562e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(255, 62, 32, 0.6));
}

.combo-box small {
  font-size: 11px;
  font-weight: 800;
  color: #ffcf70;
  letter-spacing: 2px;
}

.move-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 128px);
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(10, 10, 18, 0.72);
  border: 1px solid rgba(255, 210, 110, 0.25);
  color: rgba(255, 240, 200, 0.88);
  font-size: 12px;
  white-space: nowrap;
  transition: opacity 0.6s ease;
}

.move-hint.fade {
  opacity: 0;
}

/* 右下冲刺 & 大招键 */
.action-pad {
  position: absolute;
  right: 16px;
  bottom: calc(var(--sab) + 26px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}

.act-btn {
  position: relative;
  border-radius: 50%;
  border: 2px solid rgba(255, 210, 110, 0.52);
  background: radial-gradient(circle at 35% 30%, rgba(45, 22, 28, 0.9), rgba(10, 10, 16, 0.92));
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  transition: transform 0.08s ease;
}

.act-btn:active {
  transform: scale(0.92);
}

.dash-btn {
  width: 62px;
  height: 62px;
  border-color: rgba(45, 242, 214, 0.65);
}

.ult-btn {
  width: 76px;
  height: 76px;
  border-color: rgba(255, 198, 74, 0.45);
}

.ult-btn.ready {
  border-color: #ffe37d;
  background: radial-gradient(circle at 35% 30%, #ff4e26, #7a101b);
  box-shadow: 0 0 26px rgba(255, 86, 36, 0.85), inset 0 0 16px rgba(255, 224, 120, 0.55);
  animation: pulseUlt 1.15s infinite ease-in-out;
}

@keyframes pulseUlt {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

.act-icon {
  font-size: 20px;
  line-height: 1;
}

.act-label {
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
}

.ult-pct {
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
}

.cd-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.cd-mask.on {
  opacity: 1;
}

/* --- 主启动页 --- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--sat) + 14px) 16px calc(var(--sab) + 18px);
}

.title-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 58, 36, 0.25), transparent 52%),
    radial-gradient(circle at 20% 70%, rgba(45, 242, 214, 0.16), transparent 46%),
    url('./assets/title-bg.jpg') center/cover no-repeat,
    linear-gradient(180deg, #100914 0%, #07070b 100%);
  z-index: -2;
}

.title-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 7, 11, 0.72) 0%, rgba(7, 7, 11, 0.42) 40%, rgba(7, 7, 11, 0.92) 76%, #07070b 100%);
  z-index: -1;
}

.title-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.soul-wallet {
  background: rgba(18, 15, 26, 0.84);
  border: 1px solid rgba(255, 210, 90, 0.45);
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.chip-btn {
  background: rgba(18, 17, 28, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.title-hero {
  text-align: center;
  margin-top: 6px;
}

.seal-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffcf7a;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(168, 24, 24, 0.45);
  border: 1px solid rgba(255, 112, 72, 0.5);
  margin-bottom: 8px;
}

.game-logo {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(180deg, #fff9db 0%, #ffd06b 52%, #ff542e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 18px rgba(255, 58, 28, 0.55));
}

.game-sub {
  font-size: 12px;
  color: #d8d2cb;
  margin-top: 6px;
  letter-spacing: 0.5px;
}

.record-row {
  display: inline-flex;
  gap: 14px;
  margin-top: 10px;
  padding: 5px 14px;
  border-radius: 99px;
  background: rgba(10, 10, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: var(--muted);
}

.record-row b {
  color: #ffe299;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  color: #cfcad8;
  margin-bottom: 8px;
}

.hero-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.hero-list::-webkit-scrollbar {
  display: none;
}

.hero-card {
  flex: 0 0 78%;
  scroll-snap-align: center;
  padding: 12px;
  border-radius: 16px;
  background: rgba(16, 15, 24, 0.86);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.hero-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(255, 195, 72, 0.28);
  transform: translateY(-2px);
}

.hero-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.hero-name {
  font-size: 15px;
  font-weight: 900;
}

.hero-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-tag {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.hero-desc {
  font-size: 11px;
  line-height: 1.45;
  color: #bcb9ca;
  margin-bottom: 8px;
}

.hero-ult {
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #f0e6cc;
}

.unlock-btn {
  margin-top: 8px;
  width: 100%;
  padding: 7px;
  border-radius: 10px;
  border: 1px solid var(--gold);
  background: linear-gradient(135deg, #a65c12, #ff9924);
  color: #160a02;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.title-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.primary-btn {
  width: 100%;
  padding: 15px 18px;
  border-radius: 14px;
  border: 1px solid #ffe08a;
  background: linear-gradient(135deg, #c9211d 0%, #ff5426 55%, #ff9924 100%);
  color: #fffdf5;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 8px 26px rgba(255, 68, 34, 0.45);
  cursor: pointer;
}

.primary-btn:active { transform: scale(0.98); }

.secondary-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 208, 102, 0.35);
  background: rgba(22, 19, 32, 0.9);
  color: #f3e4c3;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-btn.small-btn {
  padding: 10px 14px;
  font-size: 13px;
}

.secondary-btn.danger-btn {
  border-color: rgba(255, 70, 90, 0.5);
  color: #ff94a2;
}

.secondary-btn:disabled {
  opacity: 0.45;
}

/* --- 弹层系统 --- */
.modal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sat) + 14px) 14px calc(var(--sab) + 14px);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 9, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px;
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(24, 20, 34, 0.98), rgba(12, 11, 18, 0.98));
  border: 1.5px solid rgba(255, 202, 92, 0.32);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

.modal-title {
  font-size: 19px;
  font-weight: 900;
  color: #ffe394;
  text-align: center;
}

.modal-sub {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 4px 0 14px;
}

/* 升级三选一卡片 */
.draft-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.draft-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-radius: 14px;
  background: rgba(24, 23, 36, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s;
}

.draft-card:active { transform: scale(0.97); }
.draft-card.rare { border-color: rgba(45, 242, 214, 0.55); }
.draft-card.epic { border-color: rgba(199, 125, 255, 0.72); background: linear-gradient(135deg, rgba(44, 22, 64, 0.92), rgba(20, 17, 32, 0.95)); }
.draft-card.legendary { border-color: rgba(255, 168, 52, 0.8); background: linear-gradient(135deg, rgba(64, 34, 14, 0.94), rgba(22, 16, 28, 0.95)); }
.draft-card.mythic {
  border: 2px solid #ffe066;
  background: linear-gradient(135deg, rgba(132, 26, 20, 0.95), rgba(68, 34, 12, 0.96));
  box-shadow: 0 0 26px rgba(255, 190, 48, 0.45);
}

.card-ico {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
}

.card-body { flex: 1; min-width: 0; }

.card-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold);
  margin-bottom: 4px;
}

.card-name {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 3px;
}

.card-desc {
  font-size: 11.5px;
  line-height: 1.42;
  color: #ccc7d8;
  white-space: pre-line;
}

.draft-footer {
  margin-top: 12px;
}

/* 秘宝箱 */
.chest-flare {
  text-align: center;
  font-size: 46px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 20px rgba(255, 206, 70, 0.8));
}

.chest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

/* 构筑详情 / 暂停 */
.stats-grid, .result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.stat-tile, .res-box {
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.stat-tile b, .res-box b {
  color: var(--gold);
  font-size: 14px;
}

.build-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 36vh;
  overflow-y: auto;
}

.build-group-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--cyan);
  margin-top: 4px;
}

.build-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bchip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.bchip.mythic { border-color: var(--gold); color: var(--gold); }
.bchip.epic { border-color: var(--purple); color: #e2b8ff; }

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* 炼丹炉 */
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.sheet-head .modal-title, .sheet-head .modal-sub {
  text-align: left;
  margin: 0;
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-info { flex: 1; min-width: 0; }
.meta-name { font-size: 13px; font-weight: 800; }
.meta-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

.meta-buy {
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--gold);
  background: linear-gradient(135deg, #c96c14, #ffb033);
  color: #1a0c02;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.meta-buy:disabled {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #888;
}

/* 结算排行 */
.result-souls {
  text-align: center;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 900;
  color: var(--gold);
}

.dps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.dps-row {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
}

/* iOS 安装指引 */
.ios-desc { font-size: 13px; color: #d6d2de; line-height: 1.5; margin: 10px 0; }
.ios-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.55; color: #f3eedd; margin-bottom: 14px; }
.ios-tip { font-size: 12px; color: var(--cyan); background: rgba(45, 242, 214, 0.08); padding: 9px 10px; border-radius: 10px; margin-bottom: 14px; line-height: 1.5; }
