/* ============================================
 * 可视化大屏样式 - 炫酷深色科技风
 * 布局: 顶部状态栏 + 查询栏 + KPI 4卡 + 主体3×2六卡片
 * 规格对齐自 pm.ecpm.site/screen/screen.css
 * ============================================ */

/* 主容器（内嵌显示，不覆盖全屏） */
/* #screenlog-content 为日志大屏容器, 复用同款深色科技风样式 */
#screen-content,
#screenlog-content {
  width: 100%;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 122, 255, 0.08), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(255, 149, 0, 0.06), transparent 50%),
    #F2F7FC;
  color: #1C1C1E;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  overflow: visible;
  z-index: 1;
  display: flex; flex-direction: column;
  padding: 24px 16px 40px;
  gap: 20px;
  box-sizing: border-box;
  position: relative;
}
/* 科技感网格背景（细微网格 + 中心渐显、边缘渐隐） */
#screen-content::before,
#screenlog-content::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0, 122, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 122, 255, 0.028) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}
/* 扫描线动画 - 已禁用（持续 animation 触发整屏 paint, 是大屏卡顿主因之一） */
#screen-content::after,
#screenlog-content::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 100px;
  background: linear-gradient(to bottom, transparent, rgba(0, 122, 255, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
  top: -100px;
  display: none;
}
/* 主容器子元素层级 */
#screen-content > *,
#screenlog-content > * { position: relative; z-index: 1; }

/* ===== 通用卡片：顶部光带 + 侧边/底部渐变透明边框 ===== */
.scr-card {
  background: #FFFFFF;
  border: none;
  border-radius: 14px;
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(4px);
  isolation: isolate;
  /* 左右边框：顶部亮 → 底部透明 */
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  border-image: linear-gradient(to bottom,
    rgba(0, 122, 255, 0.6) 0%,
    rgba(0, 122, 255, 0.25) 30%,
    rgba(0, 122, 255, 0.08) 70%,
    transparent 100%) 1 stretch;
  border-top: none; border-bottom: none;
}
/* 顶部亮带：中间亮，两端淡 */
.scr-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0, 122, 255, 0.18) 15%,
    rgba(0, 122, 255, 0.55) 50%,
    rgba(0, 122, 255, 0.18) 85%,
    transparent 100%);
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.14);
  z-index: 2; pointer-events: none;
}
/* 底部边框：伪元素做渐变（左淡→中亮→右淡） */
.scr-card::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0, 122, 255, 0.15) 30%,
    rgba(0, 122, 255, 0.4) 50%,
    rgba(0, 122, 255, 0.15) 70%,
    transparent 100%);
  z-index: 2; pointer-events: none;
}
.scr-card-head {
  flex: 0 0 36px; display: flex; align-items: center; justify-content: flex-start;
  padding: 0 14px;
  border-bottom: 1px solid rgba(0, 122, 255, 0.15);
  background: linear-gradient(90deg, rgba(0, 122, 255, 0.08), transparent);
}
.scr-card-title {
  font-size: 12px; color: #007AFF; font-weight: 400; letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(0, 122, 255, 0.5);
}
.scr-card-body { flex: 1; position: relative; overflow: hidden; padding: 4px; }
.scr-chart { width: 100%; height: 100%; }
/* 游戏收益排行：画布高度按名次数量动态设置，垂直居中显示，避免条数少时被摊开留大间隙 */
.scr-card-rank .scr-card-body { display: flex; flex-direction: column; justify-content: center; }

/* ===== 第1行 顶部状态栏 ===== */
.scr-top {
  flex: 0 0 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid #007AFF;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(28, 50, 80, 0.07);
  position: relative;
}
.scr-top::after {
  content: ''; position: absolute; left: 50%; bottom: 0; width: 60%; height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #007AFF, transparent);
  box-shadow: 0 0 12px #007AFF;
}
.scr-top-left { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #34C759; }
.scr-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #34C759; box-shadow: 0 0 10px #34C759, 0 0 20px #34C759;
  animation: scrPulse 1.5s ease-in-out infinite;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  display: inline-block;
}
@keyframes scrPulse { 0%,100%{opacity:1; transform:scale(1);} 50%{opacity:0.5; transform:scale(0.85);} }
.scr-top-title {
  font-size: 23px; font-weight: 700; color: #1C1C1E;
  letter-spacing: 3px;
}
.scr-top-right { display: flex; align-items: center; gap: 16px; }
.scr-time {
  font-size: 14px; color: #007AFF; font-family: 'SF Mono', ui-monospace, Consolas, monospace;
  text-shadow: 0 0 6px rgba(0, 122, 255, 0.5);
}
.scr-btn {
  padding: 7px 18px; border-radius: 3px; cursor: pointer; font-size: 13px;
  border: none; font-weight: 500; transition: all 0.2s;
}
.scr-btn-query {
  background: linear-gradient(135deg, #FF3B30, #D70015);
  color: #fff; box-shadow: 0 0 10px rgba(255, 59, 48, 0.3);
}
.scr-btn-refresh {
  background: linear-gradient(135deg, #FF9500, #C77700);
  color: #FFFFFF; box-shadow: 0 0 10px rgba(255, 149, 0, 0.3);
}
.scr-btn-exit {
  background: transparent; color: #5A6B7D;
  border: 1px solid rgba(90, 107, 125, 0.35);
}
.scr-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.scr-btn-refresh.active {
  background: linear-gradient(135deg, #34C759, #248A3D);
  box-shadow: 0 0 14px rgba(52, 199, 89, 0.35);
  animation: scrBlink 2s ease-in-out infinite;
}
@keyframes scrBlink { 0%,100%{opacity:1;} 50%{opacity:0.7;} }

/* ===== 第2行 查询栏 ===== */
.scr-query {
  flex: 0 0 52px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(232, 242, 255, 0.5));
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 14px;
}
/* 关键: 容器规则 #screen-content > * 是 ID 选择器(特异性1,0,0),
   会把本栏 z-index 压成 1; 普通 .scr-query 类选择器(0,1,0)打不赢它, 故必须用
   "ID+类" 选择器(1,1,0)覆盖, 否则下拉面板会被后面的 KPI/卡片层盖住点不中 */
#screen-content .scr-query,
#screenlog-content .scr-query {
  position: relative;
  z-index: 50;
}
.scr-query-label { font-size: 13px; color: #007AFF; letter-spacing: 1px; }
.scr-query-input {
  background: #F2F7FC; color: #1C1C1E;
  border: 1px solid rgba(0, 122, 255, 0.3);
  border-radius: 3px; padding: 6px 10px;
  font-family: 'SF Mono', ui-monospace, Consolas, monospace; font-size: 13px;
  outline: none; transition: all 0.2s;
}
.scr-query-input:focus {
  border-color: #007AFF;
  box-shadow: 0 0 8px rgba(0, 122, 255, 0.4);
}
.scr-query-sep { color: #5A6B7D; font-size: 13px; }
.scr-query-info { margin-left: auto; font-size: 12px; color: #5A6B7D; }
.scr-query-info b { color: #FF9500; font-family: 'SF Mono', ui-monospace, Consolas, monospace; }

/* 大屏专用开关（显示游戏名 / 隐藏游戏名） */
.scr-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #5A6B7D; cursor: pointer; user-select: none;
}
.scr-toggle input { width: 14px; height: 14px; cursor: pointer; accent-color: #007AFF; }
.scr-toggle:hover { color: #007AFF; }

/* ===== 第3行 KPI 4 联卡 ===== */
.scr-kpi-row {
  flex: 0 0 76px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  column-gap: 10px;
  row-gap: 20px;
}
.scr-kpi {
  position: relative;
  background: #FFFFFF;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 14px;
  padding: 6px 14px 6px 20px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(28, 50, 80, 0.06);
  transition: transform 0.3s, box-shadow 0.3s;
}
.scr-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.14);
}
/* 左侧彩色装饰条 */
.scr-kpi::before {
  content: '';
  position: absolute; top: 10px; bottom: 10px; left: 0;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--kpi-color, #007AFF);
  box-shadow: 0 0 6px var(--kpi-color, #007AFF);
}
/* 右下角发光圆 */
.scr-kpi::after {
  content: ''; position: absolute; right: -20px; bottom: -20px;
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle, var(--kpi-glow, rgba(0, 122, 255, 0.18)), transparent 70%);
  pointer-events: none;
}
.scr-kpi-label {
  font-size: 11px; color: #5A6B7D;
  letter-spacing: 1.2px; text-transform: uppercase;
  line-height: 1;
}
.scr-kpi-val {
  font-size: 25px; font-weight: 700; color: #1C1C1E;
  font-family: 'SF Mono', ui-monospace, Consolas, monospace;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
  line-height: 1;
  display: flex; align-items: baseline; gap: 4px;
}
.scr-kpi-sub {
  font-size: 10px; color: #98A7B8;
  letter-spacing: 0.8px;
  line-height: 1;
  position: relative; z-index: 1;
}

/* ===== 第4行 主体: 3列 × 2行 六卡片 ===== */
.scr-main {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  grid-template-rows: 540px 560px;
  column-gap: 10px;
  row-gap: 20px;
  min-height: 1120px;
  /* contain: 让浏览器将大屏作为独立子树, 减少侧边栏过渡期间对外 reflow 的连锁计算 */
  contain: layout style;
}
.scr-main .scr-card-records { grid-row: 1; grid-column: 1; }
.scr-main .scr-card-map    { grid-row: 1; grid-column: 2; }
.scr-main .scr-card-games  { grid-row: 1; grid-column: 3; }
.scr-main .scr-card-rank   { grid-row: 2; grid-column: 1; }
.scr-main .scr-card-trend  { grid-row: 2; grid-column: 2; }
.scr-main .scr-card-pie    { grid-row: 2; grid-column: 3; }

/* 三列同行高度对齐：表格/地图都填满卡片 */
.scr-main .scr-card-games,
.scr-main .scr-card-records,
.scr-main .scr-card-map,
.scr-main .scr-card-rank,
.scr-main .scr-card-trend,
.scr-main .scr-card-pie { min-height: 0; height: 100%; }
.scr-card-games .scr-card-body,
.scr-card-records .scr-card-body,
.scr-card-map .scr-card-body { height: 100%; padding: 0; }
.scr-card-games .scr-table-wrap,
.scr-card-records .scr-table-wrap { height: 100%; }

/* 地图卡片（中心主体，加粗描边和发光） */
.scr-card-map {
  border-color: rgba(0, 122, 255, 0.28) !important;
  box-shadow: 0 4px 20px rgba(0, 122, 255, 0.1);
}
.scr-card-map .scr-card-head {
  background: linear-gradient(90deg, rgba(0, 122, 255, 0.18), transparent);
  border-bottom-color: rgba(0, 122, 255, 0.35);
}
.scr-card-map #scr-map { width: 100%; height: 100%; }

/* 滚动表格容器 */
.scr-table-wrap {
  width: 100%; height: 100%; overflow: hidden; position: relative;
  /* contain 隔离: 表格滚动重绘不扩散到外层, 大幅减少 paint 区域 */
  contain: strict;
  content-visibility: auto;
}
.scr-table-scroll {
  width: 100%; height: 100%; overflow-y: auto;
  scrollbar-width: none; -ms-overflow-style: none;
  /* 提升为合成层, scrollTop 变化不触发 layout */
  will-change: scroll-position;
  transform: translateZ(0);
}
.scr-table-scroll::-webkit-scrollbar { width: 0; display: none; }
.scr-table-scroll::-webkit-scrollbar-thumb { background: transparent; }
.scr-table-scroll::-webkit-scrollbar-track { background: transparent; }

/* 表格自动滚动动画（数据多时启用） */
.scr-table-auto {
  animation: scrTableScroll 12s linear infinite;
}
@keyframes scrTableScroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

/* 表格样式 */
.scr-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.scr-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: rgba(250, 252, 255, 0.96); color: #007AFF;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 8px 10px; text-align: left; font-weight: 500; font-size: 11px;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(0, 122, 255, 0.4);
  white-space: nowrap;
}
.scr-table tbody td {
  padding: 7px 10px; border-bottom: 1px solid rgba(0, 122, 255, 0.06);
  color: #1C1C1E; white-space: nowrap;
  font-size: 11px;
  /* contain 防止 hover 时整列 reflow */
  contain: layout style paint;
}
.scr-table tbody tr:hover td { background: rgba(0, 122, 255, 0.04); }
.scr-num { color: #FF9500; font-family: 'SF Mono', ui-monospace, Consolas, monospace; font-weight: 500; }
.scr-name { color: #1C1C1E; }
.scr-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 500;
}
.scr-tag-on  { background: rgba(52, 199, 89, 0.14); color: #34C759; border: 1px solid rgba(52, 199, 89, 0.3); }
.scr-tag-off { background: rgba(90, 107, 125, 0.1); color: #5A6B7D; border: 1px solid rgba(90, 107, 125, 0.22); }
.scr-empty-row { text-align: center; color: #5A6B7D; padding: 30px 10px; }

/* 空状态 */
.scr-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: #5A6B7D; font-size: 14px;
}

/* 日志大屏：事件表格单列铺满 */
#screenlog-content .scr-main { grid-template-columns: 1fr; grid-template-rows: auto; min-height: 0; }
#screenlog-content .scr-card { height: auto; min-height: 420px; }

@media (max-width: 1400px) {
  .scr-main { grid-template-columns: 1fr 1.2fr 1fr; }
}
@media (max-width: 1100px) {
  .scr-main { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 460px); min-height: 0; }
  .scr-main .scr-card-records { grid-row: 1; grid-column: 1; }
  .scr-main .scr-card-map     { grid-row: 1; grid-column: 2; }
  .scr-main .scr-card-games   { grid-row: 2; grid-column: 1; }
  .scr-main .scr-card-rank    { grid-row: 2; grid-column: 2; }
  .scr-main .scr-card-trend   { grid-row: 3; grid-column: 1; }
  .scr-main .scr-card-pie     { grid-row: 3; grid-column: 2; }
  .scr-kpi-row { flex: 0 0 auto; grid-template-columns: repeat(2, 1fr); }
  .scr-top-title { font-size: 18px; letter-spacing: 4px; }
}