/* Warlord 武將系統 — 迷你 badge + 君主殿 modal 樣式 */

/* ---------- Pixel character sprites ---------- */
.warlord-pixel-svg {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: block;
  animation: warlord-bob 1.4s ease-in-out infinite;
}
@keyframes warlord-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
.warlord-pixel-glow {
  filter: drop-shadow(0 0 4px rgba(244, 199, 74, 0.85))
          drop-shadow(0 0 10px rgba(244, 199, 74, 0.45));
  animation: warlord-bob 1.0s ease-in-out infinite,
             warlord-pixel-aura 2.4s ease-in-out infinite;
}
@keyframes warlord-pixel-aura {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(244,199,74,0.7))
                     drop-shadow(0 0 8px rgba(244,199,74,0.4)); }
  50%      { filter: drop-shadow(0 0 8px rgba(244,199,74,1.0))
                     drop-shadow(0 0 16px rgba(244,199,74,0.65)); }
}
.warlord-sprite-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
}
.warlord-sprite-lord {
  margin-right: 16px;
  padding: 4px 8px 0;
  background: radial-gradient(ellipse at bottom, rgba(244,199,74,0.18), transparent 70%);
  border-radius: 8px;
}
.warlord-sprite-general {
  margin-right: 10px;
  width: 36px;
}

.warlord-badge-mount {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 2px 8px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s;
}
.warlord-badge-mount:hover {
  transform: translateY(-1px);
}

.warlord-rank {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  letter-spacing: 0.5px;
}
.warlord-rank-wu_zhang      { background: #6e7681; }
.warlord-rank-shi_zhang     { background: #8d6e4b; }
.warlord-rank-bai_fu_zhang  { background: #b87333; }
.warlord-rank-qian_fu_zhang { background: #6c7a89; }
.warlord-rank-pi_jiang      { background: #a0a4aa; color: #1a1a1a; }
.warlord-rank-pian_jiang    { background: #c0c0c0; color: #1a1a1a; }
.warlord-rank-da_jiang      { background: linear-gradient(135deg, #f4c74a, #d4a017); color: #1a1a1a; }
.warlord-rank-yuan_shuai    { background: linear-gradient(135deg, #9b59b6, #6a1b9a); }
.warlord-rank-bing_shen     {
  background: linear-gradient(135deg, #f43b47, #f5a623, #43e97b, #38f9d7);
  background-size: 200% 200%;
  animation: warlord-rainbow 4s linear infinite;
}
@keyframes warlord-rainbow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.warlord-lv {
  font-size: 12px;
  font-weight: 600;
  color: #8a8a8a;
}

.warlord-rank-big {
  font-size: 22px;
  padding: 6px 16px;
  border-radius: 14px;
  display: inline-block;
  animation: warlord-rank-glow 2.6s ease-in-out infinite;
  transform-origin: center;
}
@keyframes warlord-rank-glow {
  0%, 100% {
    box-shadow: 0 0 0 rgba(244, 199, 74, 0);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 18px rgba(244, 199, 74, 0.55);
    transform: scale(1.03);
  }
}
.warlord-lv-big {
  font-size: 18px;
  font-weight: 700;
  color: #bbb;
  margin-top: 6px;
}

/* Lord stats grid with count-up effect */
.warlord-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0 18px;
}
.warlord-stat {
  background: #262b38;
  border: 1px solid #343a49;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: warlord-stat-in 0.5s ease-out both;
}
.warlord-stat:nth-child(1) { animation-delay: 0.05s; }
.warlord-stat:nth-child(2) { animation-delay: 0.15s; }
.warlord-stat:nth-child(3) { animation-delay: 0.25s; }
.warlord-stat::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(244,199,74,0.10) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: warlord-shimmer 5s ease-in-out infinite;
}
.warlord-stat-num {
  font-size: 26px;
  font-weight: 800;
  color: #f4c74a;
  font-variant-numeric: tabular-nums;
  display: block;
  letter-spacing: 0.5px;
}
.warlord-stat-label {
  font-size: 11px;
  color: #8a93a3;
  margin-top: 4px;
  letter-spacing: 0.5px;
}
@keyframes warlord-stat-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes warlord-shimmer {
  0%   { transform: translateX(-100%); }
  40%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* Level / XP progress bar */
.warlord-progress {
  margin: 8px 0 4px;
  height: 10px;
  background: #2a2f3c;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #343a49;
}
.warlord-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #43e97b, #38f9d7);
  border-radius: 6px;
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 8px rgba(56, 249, 215, 0.4);
}
.warlord-progress-label {
  font-size: 11px;
  color: #8a93a3;
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}

/* ---------- Modal ---------- */
.warlord-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: warlord-fade 0.2s;
}
@keyframes warlord-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.warlord-modal {
  background: #1f2430;
  color: #e6e6e6;
  width: min(720px, 94vw);
  max-height: 86vh;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  border: 1px solid #3a3f4b;
}

.warlord-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #2e3340;
  gap: 12px;
}
.warlord-title {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.warlord-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
}
.warlord-close:hover { color: #fff; }

.warlord-modal-body {
  overflow-y: auto;
  padding: 16px 24px 24px;
}

.warlord-tab-header {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #2e3340;
}
.warlord-tab-btn {
  background: transparent;
  border: none;
  color: #8a93a3;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}
.warlord-tab-btn.active {
  color: #fff;
  border-bottom-color: #f4c74a;
}

.warlord-tab { display: none; }
.warlord-tab.active { display: block; }

.warlord-row {
  padding: 4px 0;
  font-size: 14px;
}
.warlord-dim {
  color: #8a93a3;
  font-size: 12px;
}
.warlord-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #2e3340;
}
.warlord-section h3 {
  font-size: 13px;
  color: #aaa;
  margin: 0 0 6px;
}

.warlord-empty {
  padding: 40px 0;
  text-align: center;
  color: #8a93a3;
}

.warlord-generals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) {
  .warlord-generals { grid-template-columns: 1fr; }
}
.warlord-general-card {
  background: #262b38;
  border: 1px solid #343a49;
  padding: 12px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  animation: warlord-card-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.warlord-general-info {
  flex: 1;
  min-width: 0;
}
.warlord-general-card:hover {
  transform: translateY(-3px);
  border-color: #4a5468;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.warlord-general-card:nth-child(1) { animation-delay: 0.05s; }
.warlord-general-card:nth-child(2) { animation-delay: 0.10s; }
.warlord-general-card:nth-child(3) { animation-delay: 0.15s; }
.warlord-general-card:nth-child(4) { animation-delay: 0.20s; }
.warlord-general-card:nth-child(5) { animation-delay: 0.25s; }
.warlord-general-card:nth-child(6) { animation-delay: 0.30s; }
.warlord-general-card:nth-child(7) { animation-delay: 0.35s; }
.warlord-general-card:nth-child(8) { animation-delay: 0.40s; }
@keyframes warlord-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.warlord-general-name {
  font-weight: 700;
  margin-bottom: 6px;
}
.warlord-general-meta {
  font-size: 12px;
  color: #9aa3b5;
  margin-top: 2px;
}

/* Category badge — specialist (麾下) vs orchestrator (ccms 指揮) */
.warlord-cat-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.warlord-cat-specialist {
  background: linear-gradient(135deg, #ffb347, #ffcc33);
  color: #3a1d00;
}
.warlord-cat-orchestrator {
  background: linear-gradient(135deg, #6a5af9, #d66efd);
  color: #fff;
}

/* LV badge inside general name */
.warlord-general-lv {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  color: #0a1a14;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* XP bar */
.warlord-xp-wrap {
  margin-top: 6px;
}
.warlord-xp-bar {
  height: 5px;
  background: #1c2029;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #2e3340;
}
.warlord-xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #43e97b, #38f9d7, #4facfe);
  border-radius: 3px;
  transition: width 1.0s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 5px rgba(67, 233, 123, 0.55);
}
.warlord-xp-num {
  font-size: 10px;
  color: #8a93a3;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Power bar inside general card */
.warlord-power-wrap {
  margin-top: 8px;
}
.warlord-power-bar {
  height: 7px;
  background: #1c2029;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #2e3340;
}
.warlord-power-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f5a623, #f43b47);
  border-radius: 4px;
  transition: width 1.0s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 6px rgba(245, 166, 35, 0.4);
}
.warlord-power-fill.high {
  background: linear-gradient(90deg, #f4c74a, #f07c2f, #f43b47);
}
.warlord-power-fill.elite {
  background: linear-gradient(90deg, #a18cd1, #fbc2eb, #f4c74a);
  box-shadow: 0 0 12px rgba(244, 199, 74, 0.6);
}
.warlord-power-num {
  font-size: 11px;
  color: #c8d0e0;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* S-rank ambient halo around the entire card */
.warlord-general-card.warlord-s-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f4c74a, #f07c2f, #f43b47, #f4c74a);
  background-size: 300% 300%;
  animation: warlord-s-aura 3s linear infinite;
  z-index: -1;
  filter: blur(6px);
  opacity: 0.55;
}
@keyframes warlord-s-aura {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
.warlord-general-card.warlord-s-card { z-index: 0; }

.warlord-rarity {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: #fff;
}
.warlord-rarity-C { background: #6e7681; }
.warlord-rarity-B { background: #2d7cf0; }
.warlord-rarity-A { background: #8d43e7; }
.warlord-rarity-S {
  background: linear-gradient(135deg, #f4c74a, #f07c2f);
  color: #1a1a1a;
  animation: warlord-s-pulse 1.6s ease-in-out infinite;
}
@keyframes warlord-s-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(244, 199, 74, 0.5); }
  50%      { box-shadow: 0 0 14px rgba(244, 199, 74, 0.95); }
}

.warlord-rank-list {
  padding-left: 20px;
  font-size: 13px;
}
.warlord-rank-list li {
  margin: 4px 0;
}

/* ---------- Tab 3: 戰力分析 (Phase 2) ---------- */

/* Power bar animation on visibility */
.warlord-power-fill {
  transition: width 0.8s ease-out;
}

/* General selector */
.warlord-general-selector {
  margin-bottom: 16px;
}
.warlord-general-select {
  width: 100%;
  padding: 8px 12px;
  background: #262b38;
  color: #e6e6e6;
  border: 1px solid #343a49;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  margin-bottom: 8px;
}
.warlord-general-select:focus {
  border-color: #f4c74a;
}
.warlord-gen-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.warlord-gen-tab {
  background: #262b38;
  color: #c8d0e0;
  border: 1px solid #343a49;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.warlord-gen-tab:hover {
  border-color: #4a5468;
  background: #2e3440;
}
.warlord-gen-tab.active {
  border-color: #f4c74a;
  background: #2e3440;
  color: #fff;
}

/* Radar chart */
.radar-chart {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}
.radar-chart-svg {
  max-width: 280px;
  width: 100%;
  height: auto;
}
.radar-polygon {
  transition: points 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.radar-dot {
  transition: opacity 0.3s ease-out;
}

/* Radar rarity fills (used via inline style, kept here for reference) */

/* Animate radar polygon on tab switch */
@keyframes warlord-radar-draw {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
.radar-chart-svg {
  animation: warlord-radar-draw 0.5s ease-out;
}

/* Dimension bars */
.dim-bar-container {
  max-width: 360px;
  margin: 0 auto;
  padding: 8px 0 4px;
}
.dim-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.dim-bar-label {
  width: 36px;
  font-size: 13px;
  font-weight: 600;
  color: #c8d0e0;
  text-align: right;
  flex-shrink: 0;
}
.dim-bar-track {
  flex: 1;
  height: 10px;
  background: #1c2029;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #2e3340;
}
.dim-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.dim-bar-value {
  width: 36px;
  font-size: 12px;
  color: #8a93a3;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Power history chart */
.power-chart {
  padding: 8px 0;
}
.power-chart-svg {
  width: 100%;
  max-width: 600px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.power-line {
  stroke-linecap: round;
  stroke-linejoin: round;
}
.power-dot {
  cursor: pointer;
  transition: r 0.15s ease;
}
.power-dot:hover {
  r: 7;
  filter: drop-shadow(0 0 4px rgba(244, 199, 74, 0.7));
}

/* Section title */
.warlord-section-title {
  font-size: 14px;
  color: #c8d0e0;
  margin: 0 0 10px;
  font-weight: 600;
}

/* Responsive: scale radar down on mobile */
@media (max-width: 480px) {
  .radar-chart-svg {
    max-width: 220px;
  }
  .dim-bar-container {
    max-width: 100%;
  }
  .warlord-gen-tabs {
    gap: 4px;
  }
  .warlord-gen-tab {
    padding: 4px 8px;
    font-size: 11px;
  }
}
