:root {
  /* 更狂野的电竞配色 + 背景图 */

  --bg-image: url('img/背景.jpg');
  --panel: linear-gradient(180deg, rgba(12,6,30,0.9), rgba(6,2,20,0.8));
  --muted: #b6bcd0;
  --accent1: #00f0ff; /* 青 */
  --accent2: #ff00d0; /* 品红 */
  --accent3: #ff7a00; /* 橙 */
  --card: rgba(8,4,18,0.6);
  --glass: rgba(255,255,255,0.03);
  --text: #e6f7ff;
  --neon-glow: rgba(255,0,208,0.14);
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  /* 将背景图片与渐变叠加，确保 var(--bg-image) 可见 */
  background-image:
    radial-gradient(1200px 600px at 10% 10%, rgba(123,97,255,0.06), transparent 8%),
    radial-gradient(900px 400px at 90% 80%, rgba(255,97,200,0.05), transparent 10%),
  linear-gradient(180deg, rgba(3,2,20,0.6) 0%, rgba(7,16,38,0.6) 60%),
    var(--bg-image);
  background-size: cover;
  background-position: center center;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

.header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03)
}

.header h1 {
  margin: 0;
  font-size: 20px
}

.header .sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px
}

.container {
  display: grid;
  grid-template-columns: 320px 1fr 260px;
  gap: 18px;
  padding: 18px;
  align-items: start;
}

.col .panel {
  background: var(--panel);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(5,3,20,0.6), 0 0 30px var(--neon-glow);
  border: 1px solid rgba(255,255,255,0.03);
}

.panel.big {
  padding: 18px
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px
}

/* Prevent panel-head from forcing width overflow: allow children to shrink */
.panel-head { min-width: 0; }
.panel-head > * { min-width: 0; flex-shrink: 1; }

/* For left column panels, place the heading above the controls so "人员" is on top */
.col.left .panel-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(255,97,200,0.06);
}

.small-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap; /* allow wrapping so file button can move above when needed */
}

.small-controls input {
  font-size: 12px
}

/* Ensure flex children can shrink to avoid overflowing parent containers */
.small-controls > * {
  min-width: 0; /* allow shrinking inside flex */
  flex-shrink: 1;
}

/* Limit file input width so it won't push buttons out */
.small-controls input[type="file"] {
  /* hide native file input but keep it accessible for JS and form behavior */
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* visual file button (label) styled like other buttons */
.file-btn { display: inline-flex; align-items: center; justify-content: center; }

/* Ensure controls shrink properly */
.small-controls > * { min-width: 0; flex-shrink: 1 }

/* When width is tight, move the file button above the others within the .small-controls */
@media (max-width: 520px) {
  .col.left .small-controls { flex-direction: column; align-items: stretch; }
  .col.left .file-btn { order: -1; width: 100%; }
  .col.left .small-controls .btn { width: 100%; }
}

.people-list {
  max-height: 64vh;
  overflow: auto;
  padding-right: 6px
}

/* Hide scrollbars but keep scrolling behavior */
.people-list.hide-scrollbar, .people-list {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.people-list.hide-scrollbar::-webkit-scrollbar, .people-list::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
  width: 0;
  height: 0;
}

/* Reusable utility to hide scrollbar on any element */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar { display: none; width:0; height:0; }

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.00));
}

.person img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.03)
}

.person .meta {
  flex: 1
}

.person .meta .name {
  font-weight: 600
}

.person .meta .score {
  color: var(--text);
  font-size: 13px
}

.person .ops {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end
}

.small-btn {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.02);
  cursor: pointer
}

/* Modern button system */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  /* Unified base background for all buttons */
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005));
  color: inherit;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .12s ease, opacity .12s ease;
  box-shadow: 0 6px 16px rgba(2,6,23,0.45);
  backdrop-filter: blur(6px);
  position: relative; /* for shimmer */
  overflow: hidden;
  /* shimmer color variable (can be overridden by variants) */
  --shimmer-color: rgba(255,255,255,0.08);
}

/* Make buttons shrinkable inside flex containers and avoid breaking layout */
.btn {
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 流光 (shimmer) 效果 —— 使用伪元素做移动渐变 */
.btn::before{
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  /* use the variable for mid highlight so variants can change the shimmer color */
  background: linear-gradient(120deg, rgba(255,255,255,0.02) 0%, var(--shimmer-color) 45%, rgba(255,255,255,0.02) 55%, rgba(255,255,255,0.01) 100%);
  transform: translateX(-120%) rotate(12deg);
  transition: transform .6s ease, opacity .25s ease;
  pointer-events: none;
  opacity: 0.7;
}
.btn:hover::before{ transform: translateX(20%) rotate(12deg); transition-duration: .6s; opacity: 1 }

/* 更激进的发光效果 */
.btn::after{
  content: '';
  position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 8px 32px rgba(140,0,255,0.08), 0 0 48px rgba(0,240,255,0.06);
  pointer-events: none;
  opacity: 0.6;
}

.btn:active { transform: translateY(1px) scale(0.998); }
.btn:focus { outline: 2px solid rgba(110,231,183,0.18); outline-offset: 2px; }
.btn:hover { box-shadow: 0 14px 36px rgba(2,6,23,0.65), 0 0 28px var(--neon-glow); transform: translateY(-2px); }

/* Variants */
.btn--primary {
  /* keep base look but give a distinct shimmer on hover */
  color: var(--text);
  border: none;
  box-shadow: 0 10px 40px rgba(123,0,255,0.12), 0 0 56px rgba(255,0,208,0.06);
  --shimmer-color: rgba(0,240,255,0.12); /* cyan-ish shimmer */
}

.btn--primary:hover { --shimmer-color: rgba(0,240,255,0.22); }

.btn--ghost {
  background: linear-gradient(90deg, rgba(255,255,255,0.01), rgba(255,255,255,0.005));
  border: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  --shimmer-color: rgba(255,0,208,0.12); /* magenta shimmer */
}

.btn--ghost:hover { --shimmer-color: rgba(255,0,208,0.22); }

.btn--danger {
  background: linear-gradient(90deg,#ff4b6a,#ff7a00);
  color: var(--text);
  border: none;
  box-shadow: 0 10px 30px rgba(255,90,80,0.12), 0 0 36px rgba(255,122,0,0.06);
  --shimmer-color: rgba(255,122,0,0.12); /* orange shimmer */
}

.btn--danger:hover { --shimmer-color: rgba(255,122,0,0.22); }

.file-btn { display: inline-flex; align-items: center; justify-content: center; }
/* Ensure the visible file label looks like a button */
.file-btn.btn { padding-left:12px; padding-right:12px }
.file-btn::after{ content: '\1F4E5'; margin-left:6px; opacity:0.9 }

/* hide the native file input but keep it focusable/accessable for screen readers */
.hidden-file-input {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

.btn--small { padding: 6px 8px; font-size: 13px; border-radius: 8px }
.btn--pill { border-radius: 999px }

.icon-btn { padding: 8px; width: 40px; height: 40px; justify-content: center }

/* Backwards-compatible mapping: utility class to apply primary styles */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--accent), #4dd9a5);
  color: var(--text);
  border: none;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .12s ease;
  box-shadow: 0 6px 16px rgba(2,6,23,0.45);
}

.result-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.00));
  border-radius: 10px;
}

.group {
  flex: 1;
  min-height: 240px;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(120,90,255,0.06);
}

.group h3 {
  margin: 0 0 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center
}

/* Epic gradient team names */
#teamAName, #teamBName {
  display: inline-block;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.6px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 8px;
  position: relative;
  color: transparent; /* text will be filled by gradient */
  -webkit-background-clip: text;
  background-clip: text;
  text-transform: none;
  text-shadow: 0 6px 30px rgba(0,0,0,0.45);
}

/* Team A: cyan -> lime dramatic gradient + outer neon glow */
#teamAName{
  background-image: linear-gradient(90deg, #00f0ff 0%, #4fffd7 40%, #b7ff6e 100%);
}
/* Team B: magenta -> orange dramatic gradient + outer neon glow */
#teamBName{
  background-image: linear-gradient(90deg, #ff00d0 0%, #ff7a00 55%, #ffd600 100%);
}

/* animate team name gradient gently left->right */
#teamAName, #teamBName{
  background-size: 200% 100%;
  animation: gradientShift 6s linear infinite;
}

@keyframes gradientShift{
  0%{ background-position: 0% 50%; }
  50%{ background-position: 100% 50%; }
  100%{ background-position: 0% 50%; }
}

/* badge float + pulse */
.team-badge{ transform-origin: center; animation: badgeFloat 4s ease-in-out infinite, badgePulse 2.6s ease-in-out infinite; }
@keyframes badgeFloat{
  0%{ transform: translateY(0); }
  50%{ transform: translateY(-6px); }
  100%{ transform: translateY(0); }
}
@keyframes badgePulse{
  0%{ box-shadow: 0 8px 34px rgba(0,0,0,0.0); }
  50%{ box-shadow: 0 12px 48px rgba(255,255,255,0.04); transform: scale(1.02); }
  100%{ box-shadow: 0 8px 34px rgba(0,0,0,0.0); transform: scale(1); }
}

/* group item enter/exit animations */
@keyframes teamEnter {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes teamExit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-12px) scale(0.98); }
}
.group-list li {
  will-change: opacity, transform;
}
.group-item-enter {
  animation: teamEnter .48s cubic-bezier(.2,.9,.2,1) both;
}
.group-item-exit {
  animation: teamExit .36s cubic-bezier(.4,.0,.2,1) both;
}

/* group container subtle pop when new teams appear */
.group.play-enter { animation: groupPop .42s ease both; }
@keyframes groupPop { from { transform: scale(0.995); } 50% { transform: scale(1.01); } to { transform: scale(1); } }

/* extra glowing halo using ::after for stronger presence */
#teamAName::after, #teamBName::after{
  content: '';
  position: absolute;
  left: -6px; right: -6px; top: -6px; bottom: -6px;
  border-radius: 10px;
  z-index: -1;
  pointer-events: none;
  opacity: 0.7;
}
#teamAName::after{ box-shadow: 0 8px 40px rgba(0,240,255,0.12), 0 0 80px rgba(0,240,255,0.08); }
#teamBName::after{ box-shadow: 0 8px 40px rgba(255,0,208,0.12), 0 0 80px rgba(255,122,0,0.08); }

/* Slightly enlarge team name on hover for drama */
#teamAName:hover, #teamBName:hover{ transform: translateY(-2px) scale(1.03); transition: transform .12s ease; }

.group-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px
}

.group-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15)
}

/* 分组中头像更大、更清晰 */
.group-list img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
}

.vs {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.2), 0 0 18px rgba(255,97,200,0.08);
}

.panel-foot {
  margin-top: 12px
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

/* Prefer using .btn classes on control buttons for consistent look
  Allow direct children to shrink so buttons won't overflow */
.controls > * { min-width: 0; flex-shrink: 1; }

.ops p {
  font-size: 13px;
  color: var(--muted)
}

.ops-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px
}

.ops-buttons > * { min-width: 0; flex-shrink: 1; }
.ops-buttons button.btn { display: inline-flex }

.footer {
  text-align: center;
  padding: 12px;
  color: var(--muted);
  font-size: 13px
}

/* Modal (编辑人员) */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[aria-hidden="true"] { display: none }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: 560px; max-width: 94%; background: linear-gradient(180deg, rgba(10,8,20,0.94), rgba(6,4,18,0.96)); border-radius: 12px; padding: 18px; box-shadow: 0 20px 80px rgba(2,2,8,0.8); border: 1px solid rgba(120,90,255,0.08); z-index: 90; color: var(--text); display:flex; flex-direction:column; align-items:center; }
.modal-panel { max-height: calc(100vh - 48px); overflow:auto }
.modal-head { display:flex; align-items:center; justify-content:space-between; width:100%; }
.modal-head h3 { margin:0; font-size:16px }
.modal-close { background: transparent; border: none; color: var(--muted); cursor:pointer; font-size:18px }
.modal-body { display:flex; flex-direction:column; gap:10px; margin-top:12px; width:100%; max-width:520px }
.modal-body label { display:block; font-size:13px }
.modal-body input[type="text"], .modal-body input[type="number"] { width:100%; padding:8px; border-radius:8px; background:transparent; border:1px solid rgba(255,255,255,0.04); color:var(--text) }
.modal-foot { display:flex; gap:8px; align-items:center; margin-top:12px; width:100%; max-width:520px }
.modal-foot > * { flex-shrink:0 }
.modal-foot .spacer { flex:1 }

@media(max-width:980px) {
  .container {
    grid-template-columns: 1fr;
    padding: 12px
  }

  .col.right {
    order: 3
  }

  .col.center {
    order: 2
  }

  .col.left {
    order: 1
  }

  .panel.big {
    margin-bottom: 12px
  }
}

.team-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px; height:28px; border-radius:8px;
  margin-right:8px;
  font-size:16px;
  background: rgba(255,255,255,0.04);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45), 0 0 18px rgba(255,255,255,0.02);
  color: white;
}

.team-badge.glow-cyan{ box-shadow: 0 8px 34px rgba(0,240,255,0.12), 0 0 60px rgba(0,240,255,0.06); background: linear-gradient(90deg, rgba(0,240,255,0.12), rgba(123,255,200,0.06)); }
.team-badge.glow-magenta{ box-shadow: 0 8px 34px rgba(255,0,208,0.12), 0 0 60px rgba(255,0,208,0.06); background: linear-gradient(90deg, rgba(255,0,208,0.12), rgba(255,120,120,0.04)); }
.team-badge.glow-orange{ box-shadow: 0 8px 34px rgba(255,122,0,0.12), 0 0 60px rgba(255,122,0,0.06); background: linear-gradient(90deg, rgba(255,122,0,0.12), rgba(255,216,120,0.04)); }