/* ============================================================
   球球大作战后台 — 现代化 UI (Soybean 风格 + 玻璃拟态)
============================================================ */
:root {
  --primary: #6366f1;
  --primary-2: #818cf8;
  --primary-soft: rgba(99,102,241,.12);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --bg: #f3f5f9;
  --bg-2: #fafbfc;
  --card-bg: #ffffff;
  --card-border: #eef0f5;
  --text: #1f2937;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --border: #e5e7eb;

  --sider-bg: linear-gradient(178deg, #1e293b 0%, #0f172a 100%);
  --sider-text: #cbd5e1;
  --sider-text-active: #ffffff;
  --header-bg: rgba(255,255,255,.85);

  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 2px 8px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 8px 24px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
  --shadow-glow: 0 0 0 4px var(--primary-soft);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
}
.dark {
  --bg: #0a0e16;
  --bg-2: #111827;
  --card-bg: #161b26;
  --card-border: #232938;
  --text: #e5e7eb;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --border: #232938;
  --sider-bg: linear-gradient(178deg, #06080d 0%, #02040a 100%);
  --header-bg: rgba(22,27,38,.85);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 2px 8px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4);
  --primary-soft: rgba(99,102,241,.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
code, .mono { font-family: 'JetBrains Mono', 'Cascadia Mono', 'SF Mono', 'Consolas', monospace; }

/* ============================================================ Layout ============================================================ */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* sider */
.sider {
  width: 220px;
  background: var(--sider-bg);
  color: var(--sider-text);
  display: flex; flex-direction: column;
  transition: width .25s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
  position: relative;
}
.sider.collapsed { width: 64px; }
.sider .logo {
  height: 60px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
  letter-spacing: .5px;
  user-select: none;
}
.sider .logo .ico { font-size: 22px; margin-right: 10px; filter: drop-shadow(0 0 6px rgba(99,102,241,.4)); }
.sider.collapsed .logo .name { display: none; }
.sider.collapsed .logo .ico { margin: 0; }
.sider .menu { flex: 1; overflow-y: auto; padding: 12px 8px; }
.sider .menu-item {
  display: flex; align-items: center;
  padding: 10px 14px;
  color: var(--sider-text);
  cursor: pointer;
  transition: all .18s ease;
  font-size: 14px;
  user-select: none;
  gap: 12px;
  border-radius: var(--radius-sm);
  margin: 2px 0;
  position: relative;
}
.sider .menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sider .menu-item.active {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
.sider .menu-item.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 18px; border-radius: 2px;
  background: #fff;
}
.sider .menu-item .ico { font-size: 18px; flex-shrink: 0; width: 20px; text-align: center; }
.sider.collapsed .menu-item { justify-content: center; padding: 12px 0; }
.sider.collapsed .menu-item .label { display: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* header */
.header {
  height: 60px;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex; align-items: center; padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.header .toggle { cursor: pointer; padding: 8px; border-radius: var(--radius-sm); font-size: 18px; transition: all .15s; }
.header .toggle:hover { background: var(--primary-soft); color: var(--primary); }
.header .breadcrumb { flex: 1; font-size: 14px; color: var(--text-3); margin-left: 16px; }
.header .breadcrumb b { color: var(--text); font-weight: 600; }
.header .actions { display: flex; gap: 8px; align-items: center; }
.header .actions .btn-icon { cursor: pointer; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 18px; transition: all .15s; }
.header .actions .btn-icon:hover { background: var(--primary-soft); }
.header .user { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 14px 6px 6px; border-radius: 30px; transition: all .15s; }
.header .user:hover { background: var(--primary-soft); }
.header .user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  box-shadow: 0 2px 6px rgba(99,102,241,.3);
}
.header .user .name { font-size: 13px; }

.content { flex: 1; padding: 20px 24px; overflow-y: auto; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================ Card ============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-title {
  font-size: 15px; font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title .ico-deco {
  display: inline-block; width: 4px; height: 16px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-radius: 2px; margin-right: 10px; vertical-align: -2px;
}
.card-sub { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: auto; }

/* ============================================================ Stat tiles ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.stat-tile {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex; gap: 14px; align-items: center;
  position: relative; overflow: hidden;
  transition: all .25s cubic-bezier(.4,0,.2,1);
}
.stat-tile::after {
  content: ''; position: absolute; top: -30%; right: -20%;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--tile-glow, var(--primary-soft)) 0%, transparent 70%);
  opacity: .8; pointer-events: none;
}
.stat-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-tile .ico {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.06);
}
.stat-tile .ico.blue   { background: linear-gradient(135deg,#dbeafe,#bfdbfe); color: #1d4ed8; --tile-glow: rgba(59,130,246,.15); }
.stat-tile .ico.green  { background: linear-gradient(135deg,#d1fae5,#a7f3d0); color: #047857; --tile-glow: rgba(16,185,129,.15); }
.stat-tile .ico.orange { background: linear-gradient(135deg,#ffedd5,#fed7aa); color: #c2410c; --tile-glow: rgba(245,158,11,.15); }
.stat-tile .ico.purple { background: linear-gradient(135deg,#ede9fe,#ddd6fe); color: #6d28d9; --tile-glow: rgba(139,92,246,.15); }
.stat-tile .ico.red    { background: linear-gradient(135deg,#fee2e2,#fecaca); color: #b91c1c; --tile-glow: rgba(239,68,68,.15); }
.stat-tile .ico.cyan   { background: linear-gradient(135deg,#cffafe,#a5f3fc); color: #0e7490; --tile-glow: rgba(6,182,212,.15); }
.dark .stat-tile .ico.blue   { background: linear-gradient(135deg,#1e3a8a,#1e40af); color: #93c5fd; }
.dark .stat-tile .ico.green  { background: linear-gradient(135deg,#064e3b,#065f46); color: #6ee7b7; }
.dark .stat-tile .ico.orange { background: linear-gradient(135deg,#7c2d12,#9a3412); color: #fdba74; }
.dark .stat-tile .ico.purple { background: linear-gradient(135deg,#4c1d95,#5b21b6); color: #c4b5fd; }
.dark .stat-tile .ico.red    { background: linear-gradient(135deg,#7f1d1d,#991b1b); color: #fca5a5; }
.dark .stat-tile .ico.cyan   { background: linear-gradient(135deg,#155e75,#0e7490); color: #67e8f9; }
.stat-tile .info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.stat-tile .label { color: var(--text-3); font-size: 12px; margin-bottom: 6px; letter-spacing: .3px; font-weight: 500; }
.stat-tile .value {
  font-size: 26px; font-weight: 700; color: var(--text);
  font-feature-settings: "tnum"; line-height: 1.2;
  font-family: 'JetBrains Mono', monospace;
}
.stat-tile .extra { color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* ============================================================ Login ============================================================ */
.login-bg {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e1b4b 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.login-bg::before, .login-bg::after {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: .35; pointer-events: none;
  animation: float 12s ease-in-out infinite;
}
.login-bg::before { width: 500px; height: 500px; background: #6366f1; top: -150px; left: -100px; }
.login-bg::after { width: 400px; height: 400px; background: #ec4899; bottom: -100px; right: -100px; animation-delay: -6s; }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(40px,-30px); } }
.login-card {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 44px 40px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05) inset;
  width: 400px; max-width: 90vw;
  position: relative; z-index: 1;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
}
.login-title {
  font-size: 26px; font-weight: 700; margin-bottom: 6px;
  background: linear-gradient(90deg, #a5b4fc 0%, #f0abfc 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.login-sub { color: rgba(255,255,255,.6); font-size: 13px; margin-bottom: 32px; }
.login-card .n-input,
.login-card .n-checkbox__label { color: #fff !important; }
.login-card code {
  background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 4px;
  font-size: 11px; color: #fcd34d;
}

/* ============================================================ Chips ============================================================ */
.chip {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; line-height: 18px;
  letter-spacing: .2px;
  white-space: nowrap;
}
.chip.green  { background: #d1fae5; color: #065f46; }
.chip.red    { background: #fee2e2; color: #991b1b; }
.chip.blue   { background: #dbeafe; color: #1e40af; }
.chip.gray   { background: #f3f4f6; color: #4b5563; }
.chip.orange { background: #ffedd5; color: #9a3412; }
.chip.purple { background: #ede9fe; color: #5b21b6; }
.dark .chip.green  { background: rgba(16,185,129,.15); color: #6ee7b7; }
.dark .chip.red    { background: rgba(239,68,68,.15); color: #fca5a5; }
.dark .chip.blue   { background: rgba(59,130,246,.15); color: #93c5fd; }
.dark .chip.gray   { background: rgba(156,163,175,.15); color: #d1d5db; }
.dark .chip.orange { background: rgba(245,158,11,.15); color: #fdba74; }
.dark .chip.purple { background: rgba(139,92,246,.15); color: #c4b5fd; }
.chip-mode { color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ============================================================ Filter bar ============================================================ */
.filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-bar .label { color: var(--text-3); font-size: 13px; font-weight: 500; }
.filter-bar .quick-btn {
  padding: 5px 12px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  font-size: 12px; cursor: pointer; transition: all .15s;
  color: var(--text-2);
}
.filter-bar .quick-btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.filter-bar .quick-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================ Player layout ============================================================ */
.split-pane { display: flex; gap: 16px; height: calc(100vh - 140px); min-height: 600px; }
.split-pane > .left { width: 320px; flex-shrink: 0; }
.split-pane > .right { flex: 1; min-width: 0; }

.device-list { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: 100%; }
.device-list .head { padding: 14px 16px; border-bottom: 1px solid var(--card-border); }
.device-list .body { flex: 1; overflow-y: auto; }
.device-item {
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--card-border);
  transition: all .15s ease; position: relative;
}
.device-item:hover { background: var(--bg); }
.device-item.active {
  background: linear-gradient(90deg, var(--primary-soft), transparent 70%);
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}
.device-item .name { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.device-item .dc { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-3); margin-bottom: 6px; }
.device-item .meta { display: flex; gap: 6px; font-size: 11px; color: var(--text-3); align-items: center; }

.device-pane-right { overflow-y: auto; }

/* device header card */
.device-hero {
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-2) 100%);
  border-radius: var(--radius);
  padding: 20px 24px; color: #fff; margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(99,102,241,.25);
  position: relative; overflow: hidden;
}
.device-hero::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 70%);
}
.device-hero .name { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.device-hero .dc { font-family: 'JetBrains Mono', monospace; font-size: 13px; opacity: .8; margin-bottom: 14px; user-select: all; }
.device-hero .badges { display: flex; gap: 8px; flex-wrap: wrap; }
.device-hero .badge {
  background: rgba(255,255,255,.2); padding: 4px 12px; border-radius: 14px;
  font-size: 12px; backdrop-filter: blur(4px);
}

.device-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 20px;
}
.device-info-grid .item { font-size: 13px; }
.device-info-grid .item .lbl { color: var(--text-3); font-size: 12px; margin-bottom: 2px; }
.device-info-grid .item .val { color: var(--text); font-weight: 500; word-break: break-all; }

/* view tabs (chart switcher) */
.view-tabs {
  display: inline-flex; gap: 4px;
  background: var(--bg);
  padding: 4px; border-radius: 8px;
  border: 1px solid var(--card-border);
}
.view-tabs .tab {
  padding: 5px 14px; border-radius: 6px;
  cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--text-2); transition: all .15s;
  user-select: none;
}
.view-tabs .tab:hover { color: var(--primary); }
.view-tabs .tab.active {
  background: var(--card-bg); color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ============================================================ Misc ============================================================ */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.green { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.18); animation: pulse 2s infinite; }
.dot.red { background: #ef4444; }
.dot.gray { background: #9ca3af; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.4); }
  50% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}

.empty {
  text-align: center; padding: 80px 20px; color: var(--text-3);
}
.empty .ico { font-size: 56px; opacity: .25; margin-bottom: 14px; }
.empty .hint { font-size: 13px; }

/* nice scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,.35); }
.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); }
.dark ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

/* responsive */
@media (max-width: 768px) {
  .sider { position: fixed; height: 100%; z-index: 100; transform: translateX(-100%); }
  .sider.mobile-open { transform: translateX(0); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .split-pane { flex-direction: column; height: auto; }
  .split-pane > .left { width: 100%; max-height: 360px; }
  .header { padding: 0 12px; }
  .content { padding: 12px; }
}

/* table polish */
.n-data-table-th { background: var(--bg-2) !important; }

/* Naive UI overrides for dark mode coherence */
.n-card { background: var(--card-bg) !important; }

/* event flow timeline (vertical) */
.event-flow { position: relative; padding-left: 24px; max-height: 500px; overflow-y: auto; }
.event-flow::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.event-flow .event-row {
  position: relative; padding: 10px 14px 10px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-2);
  border-left: 3px solid var(--evt-color, var(--primary));
  transition: all .15s;
}
.event-flow .event-row:hover { transform: translateX(2px); box-shadow: var(--shadow-sm); }
.event-flow .event-row::before {
  content: ''; position: absolute; left: -20px; top: 14px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--card-bg);
  border: 3px solid var(--evt-color, var(--primary));
  box-shadow: 0 0 0 3px var(--card-bg);
}
.event-flow .event-row .time { font-size: 11px; color: var(--text-3); margin-bottom: 4px; font-family: 'JetBrains Mono', monospace; }
.event-flow .event-row .body { font-size: 13px; color: var(--text); }

/* ============================================================ 360° 档案 (Players 增强) ============================================================ */
/* 通用两列栅格 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* 子标签栏 */
.profile-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.profile-tabs .ptab {
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  background: var(--card-bg); border: 1px solid var(--card-border);
  transition: all .15s ease; user-select: none;
}
.profile-tabs .ptab:hover { color: var(--primary); border-color: var(--primary); }
.profile-tabs .ptab.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}

/* 概览小指标 */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mini-tile {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.mini-tile .k { color: var(--text-3); font-size: 12px; margin-bottom: 6px; }
.mini-tile .v { font-size: 20px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--text); line-height: 1.3; }

/* 名字 chip */
.alias-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.alias {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 6px; border-radius: 9px;
  font-size: 13px; font-weight: 500; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--card-border);
}
.alias .tag { font-size: 10px; padding: 2px 6px; border-radius: 5px; color: #fff; font-weight: 600; }
.alias.acct .tag { background: #3b82f6; }
.alias.game .tag { background: #8b5cf6; }
.alias .cnt { color: var(--text-3); font-size: 11px; font-family: 'JetBrains Mono', monospace; }

/* 关联设备卡 */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.related-card {
  background: var(--bg-2); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 14px; cursor: pointer; transition: all .15s ease;
}
.related-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.related-card .dc { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.related-card .links { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.related-card .detail { font-size: 11px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; word-break: break-all; }

@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }
