/* ============================================================
   超自然行动组 · 内战赛事平台
   深色电竞质感 · 真实图片视觉
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0f17;
  --bg2: #121826;
  --bg3: #1a2233;
  --card: #151c2b;
  --card-hover: #1b2436;
  --border: #263043;
  --border-soft: #1f2937;
  --text: #e6e9ef;
  --muted: #8b93a7;
  --primary: #2dd4bf;
  --primary-h: #5eead4;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;

  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html { color-scheme: dark; }

body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  /* 全局微纹理，去掉纯色 AI 感 */
  background-image:
    radial-gradient(ellipse at 20% -10%, rgba(45, 212, 191, 0.06), transparent 50%),
    radial-gradient(ellipse at 90% 0%, rgba(245, 158, 11, 0.05), transparent 45%);
  background-attachment: fixed;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

/* ============ 图标（矢量，替代 emoji） ============ */
.icon { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; fill: currentColor; }

/* ============ 整体布局 ============ */
.app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: linear-gradient(180deg, #0e1420, #0b0f17);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #1a2233;
  border: 1px solid #2dd4bf;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #2dd4bf;
  flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 700; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav-menu { flex: 1; padding: 14px 12px; }
.nav-group-title {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 18px 10px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  transition: .16s;
  margin-bottom: 3px;
  text-decoration: none;
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-item.active {
  background: rgba(45, 212, 191, 0.12);
  color: #fff;
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-soft);
}
.side-user { color: var(--muted); font-size: 13px; margin-bottom: 10px; text-align: center; }
.sidebar-footer .btn { margin-bottom: 8px; }

/* 主内容区 */
.main-area {
  flex: 1;
  padding: 24px 28px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* 横幅（真实图片背景） */
.banner {
  border-radius: 16px;
  padding: 40px 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* 默认暗色电竞背景，作为图片加载前的兜底 */
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.12)),
    url('https://images.unsplash.com/photo-1542751371-adc38448a05e?w=1280&q=80') center/cover no-repeat;
}
.banner::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.35), rgba(0,0,0,0.05));
  z-index: 0;
}
.banner > * { position: relative; z-index: 1; }
.banner h2 { font-size: 26px; margin-bottom: 6px; font-weight: 800; letter-spacing: 0.5px; }
.banner p { color: #cbd5e1; font-size: 14px; }

/* 视图容器 */
.view-container { min-height: 400px; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-head h3 { font-size: 18px; font-weight: 700; }

/* 按钮 */
.btn {
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: .16s;
  font-weight: 500;
}
.btn.primary { background: var(--primary); color: #04211c; font-weight: 600; }
.btn.primary:hover { background: var(--primary-h); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn.block { width: 100%; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.success { background: var(--success); color: #052e1b; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.1); }

/* 赛事网格 */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.event-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 16px 52px;
  cursor: pointer;
  transition: .18s;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.event-item:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.event-item .ev-title { font-size: 17px; font-weight: 700; }
.event-item .ev-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 有背景图的卡片：图片铺满 + 底部渐变遮罩 */
.event-item.has-bg {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: none;
  color: #fff;
}
.event-item.has-bg .ev-title,
.event-item.has-bg .ev-meta { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.event-item.has-bg .ev-meta { color: #e2e8f0; }
.event-item.has-bg .ev-actions { z-index: 2; }

/* 无背景图卡片：默认真实图片兜底 + 遮罩 */
.event-item:not(.has-bg) {
  background:
    linear-gradient(rgba(11, 15, 23, 0.82), rgba(11, 15, 23, 0.9)),
    url('https://images.unsplash.com/photo-1511512578047-dfb367046420?w=800&q=80') center/cover no-repeat;
  color: #fff;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.event-item:not(.has-bg) .ev-title { color: #fff; }
.event-item:not(.has-bg) .ev-meta { color: #cbd5e1; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  margin-left: 8px;
  font-weight: 600;
}
.badge.draft { background: #374151; color: #d1d5db; }
.badge.open { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.badge.ongoing { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.badge.finished { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }
.badge.preparing { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }

.empty { color: var(--muted); text-align: center; padding: 40px; }

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-card.wide { max-width: 760px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--card);
}
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-head .close { background: none; border: none; color: var(--muted); font-size: 24px; cursor: pointer; }
.modal-body { padding: 20px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #334155; border-radius: 24px; transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:disabled + .slider { opacity: .4; cursor: not-allowed; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--primary);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.error { color: var(--danger); font-size: 13px; margin-bottom: 10px; min-height: 18px; }

/* 详情页 */
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 15px; margin-bottom: 10px; color: var(--accent); font-weight: 700; }
.match-grid { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--bg2);
}
.match-item .vs { color: var(--accent); font-weight: 700; margin: 0 10px; }
.match-item .winner { color: var(--success); }
.match-item .approve-btns { display: inline-flex; gap: 6px; margin-left: 8px; }
.match-item .match-vs { display: inline-flex; align-items: center; gap: 8px; }
.match-item .match-avatars { display: inline-flex; align-items: center; }
.match-item .match-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-soft); margin-left: -6px; background: var(--bg); }
.match-item .match-avatar:first-child { margin-left: 0; }
.match-item .match-avatar-more { font-size: 11px; color: var(--muted); margin-left: 2px; }
.match-item .match-name { white-space: nowrap; }
.match-item .match-team { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: 6px; }
.match-item .match-team.win { background: rgba(45, 212, 191, 0.15); color: var(--success); }
.match-item .match-team.win .match-name { font-weight: 700; }

/* 编辑对阵 */
.match-editor-row { border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg2); }
.match-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.match-editor-units { display: flex; flex-wrap: wrap; gap: 8px; }
.match-editor-unit { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; }
.match-editor-unit input { cursor: pointer; }

/* 搜索栏 */
.search-bar { display: flex; gap: 10px; margin-bottom: 14px; }
.search-bar input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); color: var(--text); }
.search-bar select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); color: var(--text); }
.search-input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); color: var(--text); font-size: 14px; }
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table th, .rank-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.rank-table th { color: var(--muted); }
.rank-1 { color: var(--accent); font-weight: 700; }
.rank-2 { color: #c0c0c0; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }
.stat-box { padding: 10px 6px; background: var(--bg2); border-radius: 8px; border: 1px solid var(--border-soft); }
.stat-box .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.avatar-upload-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.data-table th { color: var(--muted); font-size: 13px; }

/* 广告 */
.ad-list { display: flex; flex-direction: column; gap: 8px; }
.ad-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--bg2);
}
.ad-image-preview {
  margin-bottom: 8px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ad-image-preview img {
  width: auto;
  max-width: 320px;
  height: 120px;
  object-fit: contain;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
}
.ad-image-preview .btn { margin-top: 0; flex-shrink: 0; }

/* 响应式 */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; min-width: 100%; height: auto; position: static; }
  .main-area { padding: 16px; }
  .event-grid { grid-template-columns: 1fr; }
}

/* ============ 未登录首页（三栏） ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand h1 { font-size: 20px; color: var(--text); font-weight: 800; }
.topbar .brand .sub { color: var(--muted); font-size: 12px; }
.topbar .nav { display: flex; gap: 10px; }

.layout {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .ad-col { display: none; }
}

.ad-col { position: sticky; top: 80px; }
.ad-slot { display: flex; flex-direction: column; gap: 12px; }
.ad-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px;
  overflow: hidden;
  transition: .15s;
}
a.ad-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.ad-card img { width: 100%; border-radius: 8px; margin-bottom: 8px; }
.ad-card .ad-title { font-size: 14px; font-weight: 600; }
.ad-card .ad-content { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ad-empty { color: var(--muted); text-align: center; font-size: 12px; padding: 20px 0; border: 1px dashed var(--border); border-radius: 10px; }
.content { min-width: 0; }

/* ============ 分组管理窗口 ============ */
.group-add-row { display: flex; gap: 8px; margin-bottom: 14px; }
.group-add-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
}
.group-box {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--bg2);
}
.group-box.ungrouped { border-style: dashed; opacity: .85; }
.group-box-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.group-box-head strong { font-size: 15px; }
.group-box-head .muted { color: var(--muted); font-size: 12px; }
.group-box-head .btn { margin-left: auto; }
.group-members { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.group-member-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  font-size: 13px;
}
.group-member-tag a { cursor: pointer; color: var(--danger); font-weight: 700; }
.group-assign {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
}

/* ============ 判定胜负弹窗：多队头像 ============ */
#judgePlayers .player-pick {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  overflow: hidden;
}
#judgePlayers .player-pick .match-avatars {
  display: flex;
  align-items: center;
  justify-content: center;
}
#judgePlayers .player-pick .match-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  margin-left: -8px;
  background: var(--bg);
}
#judgePlayers .player-pick .match-avatar:first-child { margin-left: 0; }
#judgePlayers .player-pick .match-avatar-more { font-size: 11px; color: var(--muted); margin-left: 2px; }
#judgePlayers .player-pick span:last-child {
  font-size: 13px;
  line-height: 1.2;
  word-break: break-all;
  text-align: center;
}
