/* ==========================================================
   app.css —— 蓝白大厂风（Bootstrap 之外的自有兜底样式）
   ========================================================== */
:root {
  --blue-600: #1677ff;
  --blue-700: #0958d9;
  --blue-50: #e6f4ff;
  --gray-bg: #f0f4f9;
  --card-bg: #ffffff;
  --text: #1f2a3d;
  --text-2: #5b6b82;
  --border: #dde5ef;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(20, 40, 90, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--gray-bg);
  color: var(--text);
}
a { color: var(--blue-600); text-decoration: none; }

/* 顶栏 */
.topbar {
  background: linear-gradient(90deg, #0b3d91, #1677ff 60%, #3b9bff);
  color: #fff;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0, 40, 120, .25);
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: .5px; }
.topbar .sub { opacity: .85; font-size: 12px; }
.topbar .grow { flex: 1; }
.pill {
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
}
.pill b { font-size: 15px; margin-left: 4px; }
.link-btn {
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff; border-radius: 8px;
  padding: 5px 12px; cursor: pointer; font-size: 13px;
}
.link-btn:hover { background: rgba(255,255,255,.28); }

.container { max-width: 1180px; margin: 16px auto; padding: 0 14px; }

/* 面板卡片 */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--blue-700);
  border-left: 4px solid var(--blue-600);
  padding-left: 8px;
}
.card h3 { margin: 10px 0 6px; font-size: 14px; color: var(--text); }

/* 网格 */
.grid { display: grid; gap: 10px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.stages { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }

/* 武将卡 */
.hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 8px 6px;
  cursor: pointer;
  position: relative;
  transition: transform .1s, box-shadow .15s, border-color .15s;
}
.hero:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,40,90,.14); }
.hero.sel {
  box-shadow: 0 0 0 2px var(--blue-600), 0 6px 16px rgba(20,40,90,.14);
}
.hero .in-team {
  position: absolute; top: 6px; right: 6px;
  background: var(--blue-600); color: #fff;
  border-radius: 6px; padding: 1px 7px;
  font-size: 11px; font-weight: 700;
  z-index: 2;
}
/* 稀有度外观：铜卡（描边/底纹/角标；未来银卡、金卡各自扩展） */
.hero.r-copper {
  border: 2px solid #c78f4e;
  box-shadow: 0 1px 6px rgba(150, 90, 30, .22), inset 0 0 0 1px rgba(255, 255, 255, .30);
}
.hero.r-copper::after {
  content: '';
  position: absolute; inset: 2px;
  pointer-events: none; border-radius: 8px;
  background: repeating-linear-gradient(45deg, rgba(199, 143, 78, .07) 0 10px, transparent 10px 20px);
}
.hero.r-copper .frame {
  box-shadow: inset 0 0 0 2px rgba(220, 170, 105, .5);
}
.rtag {
  position: absolute; top: -1px; left: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: #fff; padding: 1px 7px;
  border-radius: 0 0 6px 6px; z-index: 3;
  background: linear-gradient(180deg, #c98d4f, #8a5a28);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
/* 选中（出阵）时保留铜框内圈，叠加蓝色外圈 */
.hero.r-copper.sel {
  box-shadow: 0 0 0 2px var(--blue-600), 0 1px 6px rgba(150, 90, 30, .22), inset 0 0 0 1px rgba(255, 255, 255, .30);
}
/* 底部固定保存栏（后台） */
#savebar {
  position: fixed; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 26px rgba(20, 40, 90, .18);
  padding: 8px 14px; display: flex; gap: 12px; align-items: center;
  z-index: 1200;
}
.login-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 15px; font-family: inherit;
  margin-top: 6px; text-align: center;
}
.login-input:focus { outline: 2px solid var(--blue-600); }

/* 商城商品卡 */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.prod {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 10px; text-align: center;
  background: linear-gradient(180deg, #fff, #f6f9fd);
  position: relative;
}
.prod .ico { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.prod .nm { font-weight: 700; font-size: 14px; }
.prod .desc { font-size: 11px; color: var(--text-2); margin: 4px 0 8px; min-height: 30px; }
.prod .price { font-size: 13px; font-weight: 700; color: #b45309; margin-bottom: 8px; }
.prod.ghost { border-style: dashed; background: #fbfcfe; opacity: .75; }
.prod.ghost .ico { filter: grayscale(.7); }
.hero.disabled { opacity: .55; }
.hero .frame { border-radius: 8px; padding: 6px; color: #fff; text-align: center; }
.hero .nm { font-weight: 700; font-size: 15px; letter-spacing: 1px; }
.hero .meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.hero .stats { font-size: 11px; color: var(--text-2); display: flex; justify-content: space-between; margin-top: 4px; }
.hero .badges { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  font-size: 10px; border-radius: 4px; padding: 1px 6px;
  border: 1px solid #cfd9e6; color: var(--text-2);
}
.chip.v500 { background:#eef1f5; border-color:#c8cfd8; }
.chip.v750 { background:#e7f6ee; border-color:#9fd8b9; color:#17754a; }
.chip.v1000{ background:#e6f1ff; border-color:#9dc6ff; color:#0958d9; }
.chip.v1500{ background:#fff6de; border-color:#ffd66b; color:#ad6800; }
.chip.gold { background:#fff1c2; color:#8a5a00; }
.stars { color: #ffb400; font-size: 12px; letter-spacing: 0; }
.energy {
  margin-top: 5px; display: flex; gap: 2px;
}
.energy i {
  flex: 1; height: 6px; border-radius: 2px;
  background: #d7dfe9;
}
.energy i.on { background: linear-gradient(90deg,#52c41a,#73d13d); }
.energy i.full { background: linear-gradient(90deg,#f0b90b,#ffd666); }

/* 关卡块 */
.stage {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px;
  text-align: center;
  background: #fff;
  cursor: pointer;
  position: relative;
}
.stage.locked { background: #f3f6fa; color: #9aa5b4; cursor: not-allowed; }
.stage.done { border-color: #52c41a; }
.stage .n { font-size: 12px; color: var(--text-2); }
.stage .cost { font-size: 11px; color: var(--blue-700); font-weight: 600; }
.stage .enemies { font-size: 11px; color: var(--text-2); margin-top: 3px; }
.enemy-dot {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  font-size: 10px; line-height: 16px; color: #fff; text-align: center; margin: 0 1px;
}

/* 按钮 */
.btn {
  border: none; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 13px; padding: 8px 16px;
  background: var(--blue-600); color: #fff;
  transition: filter .15s, transform .08s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { background: #b9c6d6; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--blue-600); border: 1px solid var(--blue-600); }
.btn.danger { background: #ff4d4f; }
.btn.green { background: #52c41a; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* 表格（后台） */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td {
  border: 1px solid var(--border);
  padding: 5px 7px;
  text-align: center;
}
table.tbl th { background: #eef4fb; color: var(--blue-700); font-weight: 600; white-space: nowrap; }
table.tbl input, table.tbl select {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 5px; font-size: 13px; font-family: inherit;
}
table.tbl input:focus { outline: 2px solid var(--blue-600); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 3px; }
.field input, .field select {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; font-size: 13px; font-family: inherit;
}

/* Toast / 弹层 */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: rgba(15, 30, 55, .94); color: #fff; padding: 10px 18px;
  border-radius: 10px; font-size: 14px; z-index: 2000; max-width: 80vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.hidden { display: none !important; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 20, 40, .45);
  display: flex; align-items: center; justify-content: center; z-index: 1500;
}
.d-modal {
  background: #fff; border-radius: 12px; max-width: 520px; width: 92vw;
  padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-height: 86vh; overflow: auto;
}
.muted { color: var(--text-2); font-size: 12px; }
.big { font-size: 22px; font-weight: 800; }
.win { color: #389e0d; }
.lose { color: #cf1322; }
pre.dump { background: #f6f8fb; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 12px; max-height: 260px; overflow: auto; }

@media (max-width: 640px) {
  .grid.cards { grid-template-columns: repeat(2, 1fr); }
}
