﻿/* ========== 鍏ㄥ眬閲嶇疆 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  max-width: 100vw;
}
/* 全局防御性规则：防止 flex/grid 子项按内容撑开导致横向溢出 */
.app, .app > *, .topbar, .teams-grid, .team-panel, .team-slots, .action-panel,
.seg-tabs, .seg-btn, .results-section, .results-grid, .analysis-section,
.analysis-grid, .hero-card, .quick-tips, .recommend-btn, .clear-btn,
.modal, .modal-content, .hero-list, .hero-item {
  min-width: 0;
  max-width: 100%;
}

:root {
  /* 涓婚鑹?*/
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* 鏂囧瓧鑹?*/
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* 鍝佺墝鑹?*/
  --brand-orange: #f59e0b;
  --brand-red: #ef4444;
  --brand-pink: #ec4899;
  --brand-purple: #a855f7;
  --brand-blue: #3b82f6;
  --brand-cyan: #06b6d4;
  --brand-green: #10b981;

  /* 闃佃惀鑹?*/
  --enemy-color: #ef4444;
  --enemy-bg: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
  --ally-color: #3b82f6;
  --ally-bg: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);

  /* 闃村奖 */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow-orange: 0 0 30px rgba(245, 158, 11, 0.3);
  --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.3);

  /* 鍦嗚 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* 杩囨浮 */
  --t-fast: 0.15s ease;
  --t-base: 0.25s ease;
  --t-slow: 0.4s ease;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at top left, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, #0f172a 0%, #020617 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

/* ========== 椤堕儴鐘舵€佹爮 ========== */
.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.version {
  font-size: 0.8em;
  color: var(--text-muted);
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-green);
  box-shadow: 0 0 8px var(--brand-green);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-pill.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}
.status-pill.error .dot {
  background: var(--brand-red);
  box-shadow: 0 0 8px var(--brand-red);
}

/* ========== 鏍囬鍖?========== */
.hero-section {
  text-align: center;
  padding: 32px 20px 28px;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 2.4em;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05em;
}

/* ========== 浣嶇疆閫夋嫨鍣紙鍒嗘鎺у埗鍣級============ */
.role-section {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 4px;
  box-shadow: var(--shadow-md);
  gap: 2px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--r-md);
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-base);
  position: relative;
}

.seg-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.seg-btn.active {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-red));
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.seg-icon {
  font-size: 1.1em;
}

/* ========== 鍙屾柟闃靛缃戞牸 ========== */
.teams-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  margin-bottom: 28px;
  align-items: start;
}

/* ========== 闃靛闈㈡澘 ========== */
.team-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.team-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.enemy-panel::before {
  background: linear-gradient(90deg, transparent, var(--enemy-color), transparent);
}

.ally-panel::before {
  background: linear-gradient(90deg, transparent, var(--ally-color), transparent);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.team-header h2 {
  font-size: 1.15em;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-icon {
  font-size: 0.9em;
}

.enemy-panel .team-header h2 {
  color: var(--enemy-color);
}

.ally-panel .team-header h2 {
  color: var(--ally-color);
}

.team-count {
  font-size: 0.85em;
  color: var(--text-muted);
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

/* ========== 妲戒綅 ========== */
.team-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.slot {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-base);
  position: relative;
  text-align: center;
  padding: 6px;
  gap: 2px;
}

.slot:hover {
  background: var(--surface-hover);
  border-color: var(--brand-orange);
  transform: translateY(-2px);
}

.slot.placeholder {
  cursor: default;
  border-style: dotted;
  border-color: rgba(255, 255, 255, 0.08);
  opacity: 0.5;
}

.slot.placeholder:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.slot-icon {
  font-size: 1.2em;
  color: var(--text-dim);
  line-height: 1;
}

.slot-label {
  color: var(--text-dim);
  font-size: 0.7em;
  font-weight: 500;
}

.slot.filled {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 2px solid var(--enemy-color);
  color: white;
  font-weight: 600;
  cursor: pointer;
  border-style: solid;
}

.slot.ally-slot.filled {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
  border-color: var(--ally-color);
}

.slot.filled:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.slot.filled .slot-label,
.slot.filled .slot-icon {
  color: white;
}

.slot.filled .slot-icon {
  display: none; /* 宸查€夋椂涓嶆樉绀?+ */
}

.slot .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75em;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  z-index: 2;
}

.slot.filled:hover .remove-btn {
  display: flex;
}

/* ========== 闃靛鍒嗘瀽鍗＄墖 ========== */
.team-analysis {
  margin-top: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.archetype-badge {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-red));
  color: white;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  margin-bottom: 8px;
}

.arch-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  font-size: 0.8em;
  color: var(--text-secondary);
}

.arch-stat-item {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.arch-stat-value {
  color: var(--brand-orange);
  font-weight: 600;
}

/* ========== 涓棿鎿嶄綔闈㈡澘 ========== */
.action-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 60px;
}

.vs-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
}

.vs-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.vs-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-pink));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9em;
  letter-spacing: 1px;
  box-shadow: var(--shadow-glow-orange);
  flex-shrink: 0;
}

.recommend-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-red));
  color: white;
  border: none;
  border-radius: var(--r-md);
  font-size: 1.05em;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-base);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  white-space: nowrap;
}

.recommend-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.recommend-btn:active {
  transform: translateY(0);
}

.recommend-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-base);
}

.clear-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.quick-tips {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 200px;
  font-size: 0.78em;
  color: var(--text-muted);
}

.tip-title {
  color: var(--brand-orange);
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 1.1em;
}

.tip-item {
  padding: 2px 0;
}

/* ========== 鎺ㄨ崘缁撴灉 ========== */
.results-section,
.analysis-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.results-header h2 {
  font-size: 1.4em;
  font-weight: 700;
}

.results-meta {
  font-size: 0.85em;
  color: var(--text-muted);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

/* ========== 鑻遍泟鍗＄墖锛堥噸鍋氾級============ */
.hero-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: all var(--t-base);
  animation: cardIn 0.4s ease both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero-card:nth-child(1) { animation-delay: 0.05s; }
.hero-card:nth-child(2) { animation-delay: 0.12s; }
.hero-card:nth-child(3) { animation-delay: 0.19s; }
.hero-card:nth-child(4) { animation-delay: 0.26s; }
.hero-card:nth-child(5) { animation-delay: 0.33s; }

.hero-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: var(--shadow-lg);
}

.hero-card.rank-1 {
  border: 2px solid var(--brand-orange);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.04));
  box-shadow: var(--shadow-glow-orange);
}

.hero-card.rank-1::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-orange), transparent);
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.rank-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-red));
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.8em;
  z-index: 1;
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #94a3b8, #475569);
}
.rank-badge.rank-3 {
  background: linear-gradient(135deg, #d97706, #92400e);
}

.hero-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.hero-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  font-size: 1.8em;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, var(--avatar-c1, #475569), var(--avatar-c2, #1e293b));
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "EmojiOne Color", "Twemoji", sans-serif;
  line-height: 1;
  overflow: hidden;
}

.hero-avatar.online img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--r-md) - 2px);
}

.hero-info {
  flex: 1;
  min-width: 0;
}

.hero-name {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 0.8em;
  color: var(--text-muted);
}

/* 鍒嗘暟鐜?*/
.score-ring {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 6;
}

.score-ring-fill {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.score-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--brand-orange);
  font-size: 1.05em;
  line-height: 1;
}

.score-label {
  font-size: 0.5em;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.hero-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tag {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: 500;
  background: var(--surface);
  color: var(--text-secondary);
}

.tag.type { background: var(--brand-purple); color: white; }
.tag.difficulty { background: var(--brand-red); color: white; }
.tag.phase { background: var(--brand-green); color: white; }
.tag.role { background: var(--brand-blue); color: white; }

.score-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin: 10px 0;
  display: flex;
}

.score-bar-segment {
  height: 100%;
  transition: width 0.8s ease;
}

.score-bar-segment.counter { background: linear-gradient(90deg, #10b981, #34d399); }
.score-bar-segment.countered { background: linear-gradient(90deg, #ef4444, #f87171); }
.score-bar-segment.meta { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.score-bar-legend {
  display: flex;
  gap: 10px;
  font-size: 0.7em;
  color: var(--text-muted);
  margin-top: 4px;
}

.score-bar-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.score-bar-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.reasons {
  list-style: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.reasons li {
  font-size: 0.88em;
  padding: 4px 0;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}

.reasons li.positive { color: var(--text-primary); }
.reasons li.warning { color: #fbbf24; }
.reasons li.danger { color: #fca5a5; }
.reasons li.highlight {
  color: #f59e0b;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.08);
  border-left: 2px solid #f59e0b;
  padding-left: 8px;
  border-radius: 4px;
  margin-left: -8px;
}
.reasons li.combo {
  color: #fef3c7;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.12);
  border-left: 2px solid #fbbf24;
  padding-left: 8px;
  border-radius: 4px;
  margin-left: -8px;
}
.reasons li.tips {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.06);
  border-left: 2px solid #10b981;
  padding-left: 8px;
  border-radius: 4px;
  margin-left: -8px;
  font-size: 0.85em;
  line-height: 1.5;
}
.reasons li.gear {
  color: #bfdbfe;
  font-size: 0.85em;
}
.reasons li.strategy {
  color: #e9d5ff;
  font-size: 0.9em;
}
.reasons li.phase {
  color: #fed7aa;
  font-size: 0.9em;
}
.reasons li.summoner {
  color: #94a3b8;
  font-size: 0.85em;
  font-style: italic;
}
.reasons {
  max-height: none;  /* 涓嶉檺鍒堕珮搴︼紝鍏ㄩ儴灞曠ず */
  overflow: visible;
}

.combo {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--r-sm);
  font-size: 0.82em;
  color: var(--text-muted);
  border-left: 3px solid var(--brand-orange);
}

.combo strong {
  color: var(--brand-orange);
}

/* ========== 闃靛鍒嗘瀽璇︽儏 ========== */
.analysis-section h2 {
  font-size: 1.4em;
  font-weight: 700;
  margin-bottom: 16px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.analysis-item {
  background: var(--surface);
  padding: 12px;
  border-radius: var(--r-md);
  border-left: 3px solid var(--brand-orange);
}

.analysis-item.warn {
  border-left-color: var(--brand-red);
}

.analysis-item.good {
  border-left-color: var(--brand-green);
}

.analysis-item .label {
  font-size: 0.8em;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analysis-item .value {
  font-size: 1.2em;
  color: var(--text-primary);
  font-weight: 700;
}

/* ========== 寮圭獥 ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1em;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2em;
  padding: 4px 10px;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.search-wrap {
  position: relative;
  padding: 16px 20px 0;
}

.search-input {
  width: 100%;
  padding: 10px 36px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 0.95em;
  transition: all var(--t-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-orange);
  background: var(--surface-hover);
}

.search-clear {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--text-muted);
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8em;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-clear.visible {
  display: flex;
}

.hero-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: var(--surface);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 0.85em;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
}

.tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--brand-orange);
  color: white;
}

.hero-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.hero-item {
  background: var(--surface);
  padding: 10px 6px;
  border-radius: var(--r-md);
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
}

.hero-item:hover {
  background: var(--surface-hover);
  border-color: var(--brand-orange);
  transform: translateY(-2px);
}

.hero-item.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.hero-avatar.small {
  width: 40px;
  height: 40px;
  font-size: 1.3em;
  border-radius: var(--r-sm);
  margin: 0 auto 6px;
}

.hero-item-name {
  font-size: 0.82em;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== 椤佃剼 ========== */
.footer {
  text-align: center;
  padding: 20px 16px;
  color: var(--text-dim);
  font-size: 0.82em;
  border-top: 1px solid var(--border);
  margin-top: 30px;
}

.footer p {
  margin: 2px 0;
}

/* ========== 鍝嶅簲寮?========== */
@media (max-width: 900px) {
  .teams-grid {
    grid-template-columns: 1fr;
  }

  .action-panel {
    padding-top: 0;
    order: -1;
  }

  .vs-divider {
    margin: 12px 0;
  }

  .quick-tips {
    max-width: 100%;
  }
}

/* 骞虫澘鍙婁互涓?(鈮?68px) */
@media (max-width: 768px) {
  .app {
    padding: 12px 14px 30px;
  }

  .hero-title {
    font-size: 1.8em;
  }

  .hero-subtitle {
    font-size: 0.95em;
  }

  .seg-btn {
    padding: 10px 12px;
    font-size: 0.85em;
  }

  .seg-text {
    display: none;
  }

  .seg-btn.active .seg-text {
    display: inline;
  }

  .team-slots {
    grid-template-columns: repeat(5, 1fr);
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .analysis-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-content {
    max-height: 90vh;
    width: 95%;
  }

  .hero-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 澶ф墜鏈?(鈮?40px) */
@media (max-width: 640px) {
  .app {
    padding: 10px 12px 24px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .logo {
    font-size: 1.1em;
  }

  .hero-section {
    padding: 16px 8px 12px;
  }

  .hero-title {
    font-size: 1.5em;
  }

  .hero-subtitle {
    font-size: 0.85em;
  }

  .team-panel {
    padding: 12px;
  }

  .team-title {
    font-size: 1em;
  }

  .team-slots {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .slot-label {
    font-size: 0.65em;
  }

  .results-section, .analysis-section {
    padding: 14px;
  }

  .hero-card {
    padding: 12px;
  }

  .hero-avatar {
    width: 44px;
    height: 44px;
    font-size: 1.3em;
  }

  .hero-name {
    font-size: 1em;
  }

  .score-ring {
    width: 52px;
    height: 52px;
  }

  .modal-content {
    max-height: 92vh;
  }

  .hero-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 灏忔墜鏈?(鈮?75px) */
@media (max-width: 375px) {
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .app {
    padding: 8px 8px 20px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .topbar {
    padding: 8px 10px;
  }

  .logo {
    font-size: 1em;
  }

  .version {
    font-size: 0.7em;
  }

  .hero-section {
    padding: 10px 4px 8px;
  }

  .hero-title {
    font-size: 1.2em;
    line-height: 1.3;
    word-break: break-word;
  }

  .hero-subtitle {
    font-size: 0.78em;
    line-height: 1.4;
    padding: 0 4px;
    word-break: break-word;
  }

  .segmented-control {
    width: 100%;
    max-width: 100%;
    padding: 3px;
    box-sizing: border-box;
  }

  .seg-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 2px;
    font-size: 0.78em;
    gap: 3px;
    justify-content: center;
    box-sizing: border-box;
  }

  .seg-text {
    display: none !important;
  }

  .seg-btn.active .seg-text {
    display: inline !important;
  }

  .seg-icon {
    font-size: 1.1em;
  }

  .team-panel {
    padding: 10px 6px;
  }

  .team-title {
    font-size: 0.9em;
  }

  .team-slots {
    gap: 3px;
  }

  .slot {
    padding: 4px 1px;
    font-size: 0.72em;
  }

  .slot-label {
    font-size: 0.7em;
    word-break: break-all;
  }

  .vs-circle {
    width: 48px;
    height: 48px;
    font-size: 0.85em;
  }

  .recommend-btn {
    padding: 10px 14px;
    font-size: 0.9em;
    white-space: nowrap;
    width: auto;
    max-width: 100%;
  }

  .action-panel {
    flex-wrap: wrap;
    gap: 8px;
  }

  .clear-btn {
    padding: 7px 14px;
    font-size: 0.85em;
  }

  .results-section, .analysis-section {
    padding: 12px 10px;
  }

  .hero-card {
    padding: 10px;
  }

  .hero-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.1em;
  }

  .hero-name {
    font-size: 0.95em;
  }

  .score-ring {
    width: 46px;
    height: 46px;
  }

  .quick-tips {
    padding: 10px 12px;
    font-size: 0.85em;
  }

  .quick-tips li {
    margin: 4px 0;
  }
}


/* 灏忔墜鏈?鈮?20px) - 缂╁皬鎵€鏈夊厓绱犻伩鍏虫埅鍒?*/
@media (max-width: 360px) {
  /* 中等小手机 / iPhone SE 1代 (320) / 小米 / 华为低端 */
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
    font-size: 13px;
  }
  .app { padding: 4px 4px 16px; }
  .topbar { padding: 6px 8px; margin-bottom: 8px; }
  .logo { font-size: 0.95em; }
  .version { font-size: 0.7em; }
  .hero-section { padding: 10px 4px 8px; }
  .hero-title {
    font-size: 1.05em !important;
    line-height: 1.2;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }
  .hero-subtitle {
    font-size: 0.7em !important;
    line-height: 1.3;
    word-break: break-all;
  }
  /* 位置选择器：2 行布局 */
  .seg-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
  }
  .seg-btn {
    padding: 6px 4px !important;
    font-size: 0.72em !important;
    gap: 2px !important;
  }
  .seg-icon { font-size: 1.1em; }
  .seg-text { display: none !important; }
  .seg-btn.active .seg-text { display: inline !important; font-size: 0.85em; }
  /* 阵容区：单列堆叠 */
  .teams-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
  .teams-grid > .action-panel {
    order: -1;
    padding-top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .team-panel { padding: 8px 6px; }
  .team-title { font-size: 0.85em; }
  .team-slots {
    gap: 4px;
    grid-template-columns: repeat(5, 1fr);
  }
  .slot {
    padding: 4px 1px !important;
    font-size: 0.55em !important;
    aspect-ratio: 1;
  }
  .slot-label {
    font-size: 0.7em;
    word-break: break-all;
    line-height: 1.1;
  }
  .vs-circle {
    width: 38px !important;
    height: 38px !important;
    font-size: 0.7em;
  }
  /* 推荐按钮：缩小让一行装下 */
  .recommend-btn {
    padding: 8px 12px !important;
    font-size: 0.85em !important;
    white-space: nowrap;
    max-width: 100%;
  }
  .clear-btn {
    padding: 6px 12px !important;
    font-size: 0.75em !important;
  }
  .action-panel { gap: 8px; }
  .quick-tips {
    padding: 8px 10px !important;
    font-size: 0.72em !important;
  }
  .quick-tips li { margin: 3px 0; }
  /* 结果区 */
  .results-section, .analysis-section { padding: 10px 6px; }
  .hero-card {
    padding: 10px !important;
    flex-wrap: wrap;
  }
  .hero-avatar {
    width: 36px !important;
    height: 36px !important;
    font-size: 1em;
  }
  .hero-name { font-size: 0.9em; }
  .score-ring {
    width: 42px !important;
    height: 42px !important;
  }
  .score-num { font-size: 0.9em !important; }
  .reasons { font-size: 0.78em !important; }
  /* 英雄选择弹窗 */
  .modal-content {
    width: 98% !important;
    max-height: 92vh;
    padding: 12px !important;
  }
  .hero-list {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px;
  }
  .hero-item {
    padding: 4px !important;
  }
  .hero-item-name { font-size: 0.7em; }
}

@media (max-width: 320px) {
  /* 超小屏特化 */
  .hero-title { font-size: 0.95em !important; }
  .hero-subtitle { font-size: 0.65em !important; }
  .seg-btn { font-size: 0.65em !important; }
  .seg-tabs { gap: 3px !important; }
  .team-slots { gap: 2px !important; }
  .slot { font-size: 0.5em !important; padding: 3px 0px !important; }
  .recommend-btn { font-size: 0.78em !important; padding: 7px 10px !important; }
  .clear-btn { font-size: 0.7em !important; padding: 5px 10px !important; }
  .hero-avatar { width: 32px !important; height: 32px !important; }
  .score-ring { width: 38px !important; height: 38px !important; }
  .vs-circle { width: 34px !important; height: 34px !important; font-size: 0.6em; }
}
/* 闄嶄綆鍔ㄧ敾鍋忓ソ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}


