/* ===== 龙虾武斗场（/tools/arena/）===== */

.arena-container { max-width: 1080px; }

/* --- 选项卡 --- */
.arena-tabs {
  display: flex; gap: 10px; justify-content: center; margin-bottom: 28px; flex-wrap: wrap;
}
.arena-tab {
  padding: 10px 22px; border-radius: 999px; border: 1px solid var(--border, #e5e7eb);
  background: var(--card-bg, #fff); color: var(--text-secondary, #6b7280);
  font-size: 15px; cursor: pointer; transition: all .15s ease;
}
.arena-tab:hover { border-color: var(--primary, #6366f1); color: var(--primary, #6366f1); }
.arena-tab.active {
  background: var(--primary, #6366f1); border-color: var(--primary, #6366f1); color: #fff; font-weight: 600;
}
.arena-panel { display: none; }
.arena-panel.show { display: block; }

/* --- 规则速览 --- */
.arena-rules {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px; margin-bottom: 28px;
}
.arena-rule {
  padding: 14px 16px; border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  background: var(--card-bg, #fff); font-size: 13px; color: var(--text-secondary, #6b7280);
  line-height: 1.6;
}
.arena-rule strong { color: var(--text-primary, #111827); display: block; margin-bottom: 2px; }
.ar-rule-icon { font-size: 18px; margin-right: 6px; }

/* --- 选手配置卡 --- */
.arena-setup-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px; margin-bottom: 24px;
}
.arena-fighter {
  border: 1px solid var(--border, #e5e7eb); border-radius: 16px;
  background: var(--card-bg, #fff); padding: 20px; border-color: #ef444455;
  transition: border-color .2s ease;
}
.arena-fighter[data-side="blue"] { border-color: #3b82f655; }
.af-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.af-logo {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 24px; background: #f3f4f6;
}
.af-name { font-size: 17px; font-weight: 700; color: var(--text-primary, #111827); }
.af-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-tertiary, #9ca3af);
  margin: 12px 0 6px;
}
.af-select, .af-input {
  width: 100%; box-sizing: border-box; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); font-size: 14px;
  background: var(--bg, #fff); color: var(--text-primary, #111827);
}
.af-select:focus, .af-input:focus { outline: none; border-color: var(--primary, #6366f1); }
.af-check {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--text-secondary, #6b7280); margin-top: 12px; cursor: pointer;
}
.af-test-btn { margin-top: 14px; }
.af-test { font-size: 12.5px; margin-top: 8px; color: var(--text-tertiary, #9ca3af); min-height: 18px; }
.af-test.ok { color: #059669; }
.af-test.fail { color: #dc2626; word-break: break-all; }

/* --- 开战区 --- */
.arena-launch {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 20px; border: 1px solid var(--border, #e5e7eb); border-radius: 16px;
  background: var(--card-bg, #fff); margin-bottom: 16px;
}
.af-rounds { width: 180px; }
.arena-start { padding: 11px 32px; font-size: 16px; }
.arena-note {
  font-size: 12.5px; color: var(--text-tertiary, #9ca3af); line-height: 1.7;
  margin-bottom: 8px;
}

/* --- 通用按钮 --- */
.arena-btn {
  padding: 9px 20px; border-radius: 8px; border: 1px solid var(--border, #e5e7eb);
  background: var(--card-bg, #fff); color: var(--text-primary, #111827);
  font-size: 14px; cursor: pointer; transition: all .15s ease;
}
.arena-btn:hover { border-color: var(--primary, #6366f1); color: var(--primary, #6366f1); }
.arena-btn-main {
  background: var(--primary, #6366f1); border-color: var(--primary, #6366f1); color: #fff;
}
.arena-btn-main:hover { background: #4f46e5; color: #fff; }
.arena-btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- 战斗舞台 --- */
.arena-stage {
  display: grid; grid-template-columns: 1fr 70px 1fr; align-items: center; gap: 8px;
  padding: 24px; border: 1px solid var(--border, #e5e7eb); border-radius: 16px;
  background: var(--card-bg, #fff); margin-bottom: 14px;
}
.as-fighter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.as-logo {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center;
  justify-content: center; font-size: 28px; background: #f3f4f6; flex-shrink: 0;
}
.as-red .as-logo { background: #fef2f2; }
.as-blue .as-logo { background: #eff6ff; }
.as-blue { flex-direction: row-reverse; text-align: right; }
.as-name { font-size: 16px; font-weight: 700; color: var(--text-primary, #111827); }
.as-hp {
  flex: 1 1 140px; height: 14px; border-radius: 999px; background: #f3f4f6;
  overflow: hidden; min-width: 120px;
}
.as-hp-bar {
  height: 100%; width: 100%; border-radius: 999px; background: #ef4444;
  transition: width .5s ease;
}
.as-hp-bar-blue { background: #3b82f6; }
.as-hp-bar.low { background: #f59e0b; }
.as-hp-num { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.as-blue .as-hp-num { order: -1; }
.as-vs {
  text-align: center; font-size: 20px; font-weight: 800; color: var(--text-tertiary, #9ca3af);
}
.arena-status {
  text-align: center; font-size: 14px; color: var(--primary, #6366f1);
  font-weight: 600; margin-bottom: 16px; min-height: 20px;
}

/* --- 回合卡片 --- */
.arena-feed { display: flex; flex-direction: column; gap: 12px; }
.ar-card {
  border: 1px solid var(--border, #e5e7eb); border-radius: 14px;
  background: var(--card-bg, #fff); overflow: hidden; opacity: .6;
}
.ar-card.done { opacity: 1; }
.ar-card-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb); background: #fafafa;
  flex-wrap: wrap;
}
.ar-round-no {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--primary, #6366f1); color: #fff;
}
.ar-round-name { font-size: 14px; font-weight: 700; color: var(--text-primary, #111827); }
.ar-round-sub { font-size: 12px; color: var(--text-tertiary, #9ca3af); }
.ar-card-body { padding: 14px 16px; font-size: 13.5px; line-height: 1.7; color: var(--text-primary, #111827); }
.ar-loading { color: var(--text-tertiary, #9ca3af); }

.ar-q {
  font-weight: 600; padding: 10px 14px; border-left: 3px solid var(--primary, #6366f1);
  background: #f8f8ff; border-radius: 0 8px 8px 0; margin-bottom: 10px;
}
.ar-text {
  padding: 12px 14px; border: 1px dashed var(--border, #e5e7eb); border-radius: 8px;
  background: #fafafa; margin-bottom: 10px; white-space: pre-wrap;
}
.ar-row {
  display: flex; align-items: baseline; gap: 10px; padding: 4px 0; flex-wrap: wrap;
}
.ar-side { font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ar-side-red { color: #dc2626; }
.ar-side-blue { color: #2563eb; }
.ar-ans { color: var(--text-secondary, #6b7280); word-break: break-all; }
.ar-key {
  margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: #ecfdf5;
  color: #065f46; font-size: 12.5px;
}
.ar-badge {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; flex-shrink: 0;
}
.ar-b-ok { background: #dcfce7; color: #15803d; }
.ar-b-no { background: #fee2e2; color: #b91c1c; }
.ar-b-f { background: #f3f4f6; color: #6b7280; }

.ar-verdict {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.ar-v-atk { background: #fef2f2; color: #b91c1c; }
.ar-v-def { background: #eff6ff; color: #1d4ed8; }
.ar-v-recoil { background: #fffbeb; color: #b45309; }
.ar-v-chaos { background: #f3f4f6; color: #6b7280; }

/* --- 战斗结算 --- */
.arena-result {
  margin-top: 18px; padding: 24px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px; background: var(--card-bg, #fff); text-align: center;
  font-size: 20px; font-weight: 800;
}
.arena-result .win { font-size: 24px; }
.ar-elo {
  margin: 14px 0; font-size: 13.5px; font-weight: 400; line-height: 1.9;
  color: var(--text-secondary, #6b7280);
}
.arena-result .arena-btn { margin: 0 6px 0 0; font-size: 14px; }
.arena-actions { text-align: center; margin-top: 14px; }

/* --- 武斗榜 --- */
.arena-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: var(--card-bg, #fff); border-radius: 12px; overflow: hidden;
}
.arena-table th {
  text-align: left; padding: 12px 14px; background: #fafafa; font-size: 12.5px;
  color: var(--text-tertiary, #9ca3af); border-bottom: 1px solid var(--border, #e5e7eb);
}
.arena-table td { padding: 12px 14px; border-bottom: 1px solid var(--border, #e5e7eb); }
.arena-table tr:last-child td { border-bottom: none; }
#tabRank .arena-btn { margin-top: 14px; }
.arena-empty {
  padding: 40px 20px; text-align: center; color: var(--text-tertiary, #9ca3af);
  border: 1px dashed var(--border, #e5e7eb); border-radius: 12px; line-height: 2;
  font-size: 13.5px;
}

/* --- 观战演示 --- */
.demo-battle {
  border: 1px solid var(--border, #e5e7eb); border-radius: 16px;
  background: var(--card-bg, #fff); padding: 20px; margin-bottom: 18px;
}
.demo-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 15px; margin-bottom: 14px;
}
.demo-head strong { color: var(--text-primary, #111827); }
.demo-logo {
  width: 36px; height: 36px; border-radius: 10px; background: #f3f4f6;
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
}
.demo-vs { font-weight: 800; color: var(--text-tertiary, #9ca3af); margin: 0 2px; }
.demo-play { margin-left: auto; }
.demo-rounds { display: flex; flex-direction: column; gap: 12px; }
.demo-end {
  margin-top: 14px; padding: 12px 16px; border-radius: 8px; background: #ecfdf5;
  color: #065f46; font-size: 13.5px; font-weight: 600;
}

/* --- 移动端 --- */
@media (max-width: 640px) {
  .arena-stage { grid-template-columns: 1fr; text-align: center; }
  .as-vs { margin: 4px 0; }
  .as-fighter, .as-blue { flex-direction: column; }
  .demo-play { margin-left: 0; width: 100%; }
}
