* { box-sizing: border-box; }

:root {
  --bg: #060912;
  --panel: rgba(16, 24, 44, 0.78);
  --line: rgba(120, 170, 255, 0.16);
  --gold: #ffd479;
  --cyan: #66d9ff;
  --text: #e8eefc;
  --muted: #8ea0c4;
}

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1100px 620px at 12% -8%, #16284f 0%, transparent 60%),
    radial-gradient(900px 560px at 96% 0%, #2a1638 0%, transparent 58%),
    radial-gradient(700px 500px at 50% 110%, #0d2233 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------------- 顶栏 ---------------- */
#topbar {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 212, 121, 0.22), rgba(80, 130, 255, 0.16));
  border: 1px solid rgba(255, 212, 121, 0.35);
  box-shadow: 0 0 26px rgba(255, 190, 90, 0.18) inset, 0 8px 24px rgba(0, 0, 0, 0.4);
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 4px;
  background: linear-gradient(90deg, #fff2c8, #ffd479 45%, #8fd0ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p { margin: 3px 0 0; font-size: 12px; color: var(--muted); letter-spacing: 2px; }

.top-right { display: flex; gap: 12px; }

.coin-box, .stage-box {
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(12, 19, 36, 0.7);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.coin-box b { color: var(--gold); font-size: 17px; margin-left: 6px; }
.stage-box b { color: var(--cyan); font-size: 17px; margin: 0 3px; }

/* ---------------- 大厅布局 ---------------- */
#lobby {
  max-width: 1480px;
  margin: 0 auto;
  padding: 6px 24px 28px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel h2 small { font-size: 11px; color: var(--muted); font-weight: 400; letter-spacing: 1px; }

/* 英雄 */
.hero-list { display: grid; gap: 10px; margin-bottom: 16px; }

.hero-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: 0.18s;
  font-family: inherit;
}

.hero-card:hover { background: rgba(120, 170, 255, 0.1); transform: translateX(3px); }

.hero-card.active {
  border-color: rgba(255, 212, 121, 0.55);
  background: linear-gradient(90deg, rgba(255, 212, 121, 0.14), rgba(120, 170, 255, 0.08));
  box-shadow: 0 0 20px rgba(255, 200, 100, 0.1) inset;
}

.avatar {
  width: 54px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid rgba(120, 170, 255, 0.28);
  background: radial-gradient(120% 100% at 50% 0%, rgba(120, 170, 255, 0.2), rgba(6, 10, 20, 0.65) 72%);
  flex: none;
  overflow: hidden;
  padding: 2px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 16px rgba(120, 180, 255, 0.1) inset;
}

.char-svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

.hero-card .avatar .char-svg { transform: scale(1.08); }

.hmeta { display: flex; flex-direction: column; gap: 2px; }
.hmeta b { font-size: 15px; letter-spacing: 1px; }
.hmeta i { font-style: normal; font-size: 11px; color: var(--muted); }

.hero-detail .detail-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.detail-figure {
  width: 80px;
  height: 100px;
  flex: none;
  border-radius: 14px;
  border: 1px solid rgba(120, 170, 255, 0.22);
  background: radial-gradient(120% 100% at 50% 0%, rgba(120, 170, 255, 0.18), rgba(6, 10, 20, 0.6) 72%);
  padding: 3px;
  overflow: hidden;
}

.detail-text { flex: 1; min-width: 0; }

.hero-detail .detail-head h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: 1px; }
.hero-detail .detail-head h3 span { font-size: 11px; color: var(--gold); margin-left: 8px; font-weight: 400; }
.hero-detail .detail-head p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--muted); }

.stat { display: grid; grid-template-columns: 40px 1fr 34px; align-items: center; gap: 8px; margin-bottom: 8px; }
.stat label { font-size: 11px; color: var(--muted); }
.stat b { font-size: 12px; text-align: right; color: #cfe0ff; }
.bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; transition: width 0.3s; }

.skills { margin-top: 14px; display: grid; gap: 8px; }
.skill {
  display: flex;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(120, 170, 255, 0.06);
  border: 1px solid rgba(120, 170, 255, 0.1);
}
.skill .k {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: 12px; font-weight: 700;
  color: #0b1220;
  background: linear-gradient(145deg, #ffe6a8, #ffd479);
}
.skill b { font-size: 12px; display: block; }
.skill p { margin: 3px 0 0; font-size: 11px; color: var(--muted); line-height: 1.5; }

/* 皮肤 */
.skin-list { display: grid; gap: 8px; margin-bottom: 20px; }

.skin-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 170, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: 0.18s;
  font-family: inherit;
}

.skin-card:hover { border-color: rgba(140, 190, 255, 0.4); background: rgba(120, 170, 255, 0.08); }
.skin-card.active { border-color: rgba(255, 212, 121, 0.6); background: linear-gradient(90deg, rgba(255, 212, 121, 0.12), transparent); }
.skin-card.locked { opacity: 0.82; }

.swatch {
  width: 46px;
  height: 56px;
  border-radius: 10px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: radial-gradient(120% 100% at 50% 0%, rgba(120, 170, 255, 0.16), rgba(6, 10, 20, 0.5) 72%);
  overflow: hidden;
  padding: 2px;
  box-shadow: 0 0 14px rgba(120, 180, 255, 0.14);
}

.smeta { display: flex; flex-direction: column; gap: 1px; }
.smeta b { font-size: 13px; }
.smeta i { font-style: normal; font-size: 11px; color: var(--muted); }
.smeta em { font-style: normal; font-size: 10px; color: #7dffc8; }
.skin-card.locked .smeta em { color: var(--muted); }

/* 武器 */
.weapon-list { display: grid; gap: 8px; }

.weapon-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 170, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: 0.18s;
  font-family: inherit;
}

.weapon-card:hover { border-color: rgba(140, 190, 255, 0.4); background: rgba(120, 170, 255, 0.08); }
.weapon-card.active { border-color: rgba(255, 212, 121, 0.6); background: linear-gradient(90deg, rgba(255, 212, 121, 0.12), transparent); }
.weapon-card.locked { opacity: 0.85; }

.wicon {
  width: 38px; height: 38px;
  flex: none;
  display: grid; place-items: center;
  font-size: 20px;
  border-radius: 10px;
  background: rgba(120, 170, 255, 0.1);
  border: 1px solid rgba(120, 170, 255, 0.18);
}

.wmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wmeta b { font-size: 13px; }
.wmeta b small { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.wmeta i { font-style: normal; font-size: 10px; color: var(--muted); }
.wstate { font-size: 11px; color: var(--gold); white-space: nowrap; }
.weapon-card.active .wstate { color: #7dffc8; }

/* 武器等级/星级 */
.wrow { display: flex; gap: 4px; align-items: baseline; margin-top: 4px; }
.wlv { font-size: 11px; color: var(--gold); }
.wstar { font-size: 10px; color: #e0a833; white-space: nowrap; }

/* 皮肤色点 */
.wskins { display: flex; gap: 4px; margin-top: 4px; }
.wsk { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; border: 1.5px solid var(--muted); cursor: pointer; font-size: 10px; text-align: center; line-height: 20px; }
.wsk.on { border-color: #ffe39a; background: #fff8e8; color: #1d1626; }
.wsk.lock { opacity: 0.5; pointer-events: none; }
.wsk:active { background: #ffe39a; }

/* 升级按钮 */
.wup { padding: 4px 8px; font-size: 10px; color: #1d1626; background: #ffe39a; border: none; border-radius: 6px; cursor: pointer; margin-left: 4px; margin-top: 4px; }
.wup.max { background: #6b5a33; color: #5a4a2a; cursor: default; }
.wup:disabled { opacity: 0.5; }

/* 武器升级栏 */
.wup-bar { display: flex; gap: 6px; margin-top: 6px; justify-content: center; }
.wup.max { background: #6b5a33; color: #5a4a2a; cursor: default; }
.wup:disabled { opacity: 0.5; }

/* 坐骑 */
.mount-list { display: grid; gap: 8px; }

.mount-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 170, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: 0.18s;
  font-family: inherit;
}

.mount-card:hover { border-color: rgba(140, 190, 255, 0.4); background: rgba(120, 170, 255, 0.08); transform: translateY(-1px); }
.mount-card.active { border-color: rgba(255, 212, 121, 0.6); background: linear-gradient(90deg, rgba(255, 212, 121, 0.14), transparent); }
.mount-card.locked { opacity: 0.85; }

.micon {
  width: 40px; height: 40px;
  flex: none;
  display: grid; place-items: center;
  font-size: 22px;
  border-radius: 10px;
  background: rgba(120, 170, 255, 0.1);
  border: 1px solid rgba(120, 170, 255, 0.18);
}
.mount-card.active .micon { background: rgba(255, 212, 121, 0.16); border-color: rgba(255, 212, 121, 0.4); }

.mmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mmeta b { font-size: 13px; }
.mmeta b small { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.mmeta i { font-style: normal; font-size: 10px; color: var(--muted); }
.mstate { font-size: 11px; color: var(--gold); white-space: nowrap; }
.mount-card.active .mstate { color: #7dffc8; }

/* 出战配置 */
.summary-panel { position: sticky; top: 16px; }

.loadout { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.loadout-avatar {
  width: 84px;
  height: 102px;
  border-radius: 16px;
  border: 1px solid rgba(120, 170, 255, 0.28);
  background: radial-gradient(120% 100% at 50% 0%, rgba(120, 170, 255, 0.2), rgba(6, 10, 20, 0.65) 72%);
  box-shadow: 0 0 26px rgba(120, 180, 255, 0.18);
  flex: none;
  padding: 4px;
  overflow: hidden;
}
.loadout h3 { margin: 0; font-size: 18px; letter-spacing: 1px; }
.loadout p { margin: 2px 0 6px; font-size: 11px; color: var(--muted); }
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 11px;
  background: rgba(255, 212, 121, 0.12);
  color: var(--gold);
  border: 1px solid rgba(255, 212, 121, 0.25);
}

.loadout-rows { display: grid; gap: 8px; margin-bottom: 14px; }
.loadout-rows div {
  display: flex; justify-content: space-between;
  font-size: 12px;
  padding-bottom: 7px;
  border-bottom: 1px dashed rgba(120, 170, 255, 0.12);
}
.loadout-rows span { color: var(--muted); }
.loadout-rows b { color: #cfe0ff; }

.progress-line {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(120, 170, 255, 0.07);
  border: 1px solid rgba(120, 170, 255, 0.12);
  margin-bottom: 14px;
}
.progress-line b { color: var(--gold); }

.stage-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stage-pick label { font-size: 12px; color: var(--muted); }
.stage-pick select {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(6, 12, 24, 0.9);
  color: var(--text);
  border: 1px solid rgba(120, 170, 255, 0.25);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.stage-pick select:focus { border-color: rgba(255, 212, 121, 0.6); }

/* 按钮 */
.btn {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 1px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.18s;
  width: 100%;
}

.btn.primary {
  background: linear-gradient(145deg, #ffe6a8, #ffd479 55%, #f0a94a);
  color: #25190a;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(255, 190, 90, 0.22);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(255, 190, 90, 0.32); }
.btn.primary:active { transform: translateY(0); }

.btn.ghost {
  margin-top: 10px;
  background: rgba(120, 170, 255, 0.08);
  color: var(--muted);
  border-color: rgba(120, 170, 255, 0.2);
}
.btn.ghost:hover { color: var(--text); border-color: rgba(140, 190, 255, 0.5); }

.btn.small { font-size: 12px; padding: 9px 14px; }

.hint {
  margin: 14px 0 4px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

/* ---------------- 战斗 ---------------- */
body.battle { overflow: hidden; }
body.battle #topbar, body.battle #lobby { display: none; }

body.battle #app {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

#battleWrap {
  position: fixed; right: 0; top: 0; bottom: 0; width: 70%; z-index: 100;
  .hidden { display: none; }
  /* 新增：始终可见模式 */
  .always-visible { display: block !important; }
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: #05070f;
  cursor: none;
  box-shadow: 0 0 0 1px rgba(120, 170, 255, 0.2), 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* 弹窗 */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(4, 7, 14, 0.7);
  backdrop-filter: blur(6px);
  z-index: 5;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  width: min(460px, 88%);
  padding: 26px 26px 24px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(24, 35, 62, 0.98), rgba(10, 16, 30, 0.98));
  border: 1px solid rgba(255, 212, 121, 0.25);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 200, 100, 0.06) inset;
  text-align: center;
  animation: pop 0.2s ease;
}

@keyframes pop { from { transform: scale(0.94); opacity: 0.6; } to { transform: scale(1); opacity: 1; } }

.dlg-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 3px;
  color: #0d1a12;
  background: linear-gradient(145deg, #8dffcf, #3fd39f);
  margin-bottom: 12px;
}
.dlg-badge.danger {
  color: #2a0a10;
  background: linear-gradient(145deg, #ffb3c0, #ff5f6d);
}

.dialog h2 {
  margin: 0 0 16px;
  font-size: 24px;
  letter-spacing: 2px;
  color: #ffe9b8;
}

.dlg-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.dlg-stats div {
  padding: 12px 6px;
  border-radius: 12px;
  background: rgba(120, 170, 255, 0.07);
  border: 1px solid rgba(120, 170, 255, 0.12);
}
.dlg-stats span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.dlg-stats b { font-size: 18px; color: var(--gold); }

.dlg-tip {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 18px;
}

.dlg-actions { display: grid; gap: 8px; }
.dlg-actions .btn.ghost { margin-top: 0; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(10, 18, 34, 0.95);
  border: 1px solid rgba(255, 212, 121, 0.35);
  color: var(--gold);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 50;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  #lobby { grid-template-columns: 260px minmax(0, 1fr); }
  .summary-panel { grid-column: 1 / -1; position: static; }
  .summary-panel .loadout { flex-direction: row; }
}

@media (max-width: 820px) {
  #lobby { grid-template-columns: 1fr; padding: 6px 14px 24px; }
  #topbar { flex-direction: column; align-items: flex-start; padding: 16px 14px 10px; }
  .brand h1 { font-size: 22px; }
  .panel { padding: 15px; }
  .dialog { padding: 22px 18px; }
  .dlg-stats { grid-template-columns: 1fr 1fr 1fr; }
  #battleWrap { width: 100%; }
}
