/* ============================================================
   浏览器检测项目 - 样式文件
   暗黑科技风主题
   ============================================================ */

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

:root {
  --bg-primary:    #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #1c2128;
  --border-color:  #30363d;
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;
  --accent-blue:   #58a6ff;
  --accent-green:  #3fb950;
  --accent-yellow: #d29922;
  --accent-red:    #f85149;
  --accent-purple: #bc8cff;
  --accent-cyan:   #39d353;
  --tag-yes-bg:    rgba(63,185,80,.15);
  --tag-yes-color: #3fb950;
  --tag-no-bg:     rgba(248,81,73,.15);
  --tag-no-color:  #f85149;
  --tag-warn-bg:   rgba(210,153,34,.15);
  --tag-warn-color:#d29922;
  --header-h:      58px; /* header 实际高度，与 .header padding/content 对齐 */
}

body[data-theme="light"] {
  --bg-primary:    #f5f7fb;
  --bg-secondary:  #ffffff;
  --bg-card:       #ffffff;
  --border-color:  #d8dee9;
  --text-primary:  #1f2328;
  --text-secondary:#57606a;
  --text-muted:    #6e7781;
  --accent-blue:   #0969da;
  --accent-green:  #1a7f37;
  --accent-yellow: #9a6700;
  --accent-red:    #cf222e;
  --accent-purple: #8250df;
  --accent-cyan:   #0a7ea4;
  --tag-yes-bg:    rgba(26,127,55,.10);
  --tag-yes-color: #1a7f37;
  --tag-no-bg:     rgba(207,34,46,.10);
  --tag-no-color:  #cf222e;
  --tag-warn-bg:   rgba(154,103,0,.10);
  --tag-warn-color:#9a6700;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  color-scheme: dark;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

body[data-theme="light"] {
  color-scheme: light;
}

/* ── 顶部 Header ── */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-text p {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.header-meta-sep {
  opacity: .5;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
  z-index: 110;
}

.mobile-menu-toggle {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(88,166,255,.24);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(88,166,255,.95), rgba(130,80,223,.95));
  box-shadow: 0 14px 36px rgba(0,0,0,.28);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 1201;
}

.mobile-menu-toggle span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  transition: transform .2s ease, opacity .2s ease;
}

body.nav-open .mobile-menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.nav-open .mobile-menu-toggle span:nth-child(2) {
  opacity: 0;
}

body.nav-open .mobile-menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: .2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.nav-footer {
  padding: 10px 12px 6px;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}

.nav-theme-toggle {
  display: none;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
  animation: pulse 2s infinite;
}

.status-dot.offline {
  background: var(--accent-red);
  animation: none;
}

/* 所有端隐藏在线状态 */
#status-dot,
#status-text { display: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(1.3); }
}

/* ── 主内容区 ── */
.main {
  width: 100%;
  padding: 20px;
}

.main-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.content-area {
  min-width: 0;
}

.side-nav {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
}

#ad-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid rgba(88,166,255,.22);
  background: linear-gradient(135deg, rgba(88,166,255,.12), rgba(188,140,255,.12));
  backdrop-filter: blur(8px);
}

#ad-header[hidden] {
  display: none !important;
}

.ad-header-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
}

.ad-header-text {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.side-nav-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: .2s ease;
  font-size: 13px;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(88,166,255,.08);
  border-color: rgba(88,166,255,.15);
}

.nav-link.active {
  color: var(--accent-blue);
  background: rgba(88,166,255,.12);
  border-color: rgba(88,166,255,.22);
}

.nav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* ── 概览统计栏 ── */
.overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
  align-items: stretch;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: border-color .2s, transform .2s;
}

.stat-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.stat-card .stat-num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-num.blue   { color: var(--accent-blue); }
.stat-num.green  { color: var(--accent-green); }
.stat-num.red    { color: var(--accent-red); }
.stat-num.yellow { color: var(--accent-yellow); }
.stat-num.purple { color: var(--accent-purple); }
.stat-num.cyan   { color: var(--accent-cyan); }

/* ── 区块标题 ── */
.section {
  margin-bottom: 32px;
  scroll-margin-top: 110px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.section-icon {
  font-size: 18px;
}

/* ── 检测卡片网格 ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}

.card-full {
  grid-column: 1 / -1;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background .2s;
}

.card:hover {
  border-color: #444c56;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

body[data-theme="light"] .card:hover {
  border-color: #b6c2cf;
  box-shadow: 0 6px 20px rgba(31,35,40,.08);
}

.card:hover::before {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.card-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

/* 版本号专用：字体自适应缩小，防止长版本号溢出卡片 */
.version-value {
  font-size: clamp(10px, 2.2vw, 12px);
  font-weight: 700;
  font-family: 'Consolas', 'SF Mono', 'Monaco', monospace;
  color: var(--accent-purple);
  word-break: break-all;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

.card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── 标签 ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-yes    { background: var(--tag-yes-bg);  color: var(--tag-yes-color); }
.tag-no     { background: var(--tag-no-bg);   color: var(--tag-no-color); }
.tag-warn   { background: var(--tag-warn-bg); color: var(--tag-warn-color); }
.tag-info   { background: rgba(88,166,255,.12); color: var(--accent-blue); }

/* ── 进度条（用于存储配额）── */
.progress-wrap {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  border-radius: 3px;
  transition: width 1s ease;
}

.ua-value {
  font-size: 12px;
  font-weight: 400;
  word-break: break-all;
  color: var(--accent-blue);
  line-height: 1.7;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: 'Consolas', 'SF Mono', 'Monaco', monospace;
  letter-spacing: 0.2px;
  user-select: all;
}

/* ── 插件列表 ── */
.plugin-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.plugin-item {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.plugin-item--empty {
  color: var(--text-muted);
  font-style: italic;
  border-style: dashed;
}

/* ── 媒体格式支持矩阵 ── */
.format-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.format-item {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.format-item.supported    { background: var(--tag-yes-bg);  color: var(--tag-yes-color);  border-color: rgba(63,185,80,.3); }
.format-item.maybe        { background: var(--tag-warn-bg); color: var(--tag-warn-color); border-color: rgba(210,153,34,.3); }
.format-item.unsupported  { background: var(--tag-no-bg);   color: var(--tag-no-color);  border-color: rgba(248,81,73,.3); }

.format-item.supported    { background: var(--tag-yes-bg);  color: var(--tag-yes-color);  border-color: rgba(63,185,80,.3); }
.format-item.maybe        { background: var(--tag-warn-bg); color: var(--tag-warn-color); border-color: rgba(210,153,34,.3); }
.format-item.unsupported  { background: var(--tag-no-bg);   color: var(--tag-no-color);  border-color: rgba(248,81,73,.3); }

/* ── 安全检测 - 信号列表颜色 ── */
.plugin-item--ok {
  color: var(--accent-green);
  border-color: rgba(63,185,80,.3);
}

.plugin-item--bad {
  color: var(--accent-red);
  background: rgba(248,81,73,.08);
  border-color: rgba(248,81,73,.3);
}

/* ── 综合评分区块 ── */
.score-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 32px;
}

.score-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* 圆形仪表盘 */
.score-dial-wrap {
  flex-shrink: 0;
}

.score-dial {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(
    var(--score-color) 0deg var(--score-deg),
    var(--border-color) var(--score-deg) 360deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.score-inner {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.score-num {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.score-total {
  font-size: 13px;
  color: var(--text-muted);
}

.score-label-text {
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
}

/* 右侧详情 */
.score-detail {
  flex: 1;
  min-width: 240px;
}

.score-bar-wrap {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.score-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
}

.score-rules-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.deduct-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.deduct-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid transparent;
}

.deduct-danger {
  background: rgba(248,81,73,.1);
  color: #f85149;
  border-color: rgba(248,81,73,.25);
}

.deduct-warn {
  background: rgba(210,153,34,.1);
  color: #d29922;
  border-color: rgba(210,153,34,.25);
}

.deduct-info {
  background: rgba(88,166,255,.08);
  color: var(--accent-blue);
  border-color: rgba(88,166,255,.2);
}

.deduct-penalty {
  font-weight: 700;
  font-family: monospace;
  flex-shrink: 0;
}

.score-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

/* ── loading 状态 ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 更新时间戳 ── */
.timestamp {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 32px;
  padding-bottom: 32px;
}

/* ── p1 指纹浏览器广告悬浮卡片（左下角）── */
.ad-float {
  position: fixed;
  left: 20px;
  bottom: 10px;
  z-index: 9999;
  width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 14px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: adFloatIn .4s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes adFloatIn {
  from { opacity: 0; transform: translateY(20px) scale(.92); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.ad-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: .6;
  transition: opacity .15s;
}
.ad-close:hover { opacity: 1; }

.ad-float-logo {
  font-size: 28px;
  line-height: 1;
}

.ad-float-mini-link {
  display: none;
}

.ad-float-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.ad-float-desc {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}

.ad-float-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 0;
  border-radius: 8px;
  margin-top: 2px;
  transition: opacity .2s, transform .2s;
  letter-spacing: 0.3px;
}

.ad-float-btn:hover {
  opacity: .88;
  transform: translateY(-1px);
}

body[data-theme="light"] .ad-float {
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

/* ── 顶部广告回退条 ── */
.ad-top {
  display: none !important;
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .header {
    height: auto;
    padding: 8px 16px;
  }

  .header-inner {
    align-items: center;
    flex-wrap: nowrap;
  }

  .logo {
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .logo-text {
    min-width: 0;
  }

  .logo-text h1 {
    font-size: 15px;
    line-height: 1.2;
  }

  .logo-text p {
    font-size: 10px;
  }

  .header-meta {
    display: none;
  }

  .header-meta-sep {
    display: none;
  }

  /* 移动端：头部主题按钮和时间移入抽屉 */
  #theme-toggle,
  #header-time { display: none; }

  .nav-theme-toggle {
    display: flex;
    width: 100%;
    justify-content: center;
  }

  #ad-header {
    margin-left: auto;
    padding: 6px 10px;
  }

  .ad-header-text {
    font-size: 11px;
  }

  .main {
    padding: 16px 16px 120px;
  }

  .main-layout { grid-template-columns: 1fr; }
  .side-nav {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 88px;
    top: auto;
    max-height: min(70vh, 520px);
    z-index: 1200;
    box-shadow: 0 18px 44px rgba(0,0,0,.28);
    transform: translateY(18px) scale(.96);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform .22s ease, opacity .22s ease, visibility .22s ease;
  }

  body.nav-open .side-nav {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .nav-list {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .cards-grid { grid-template-columns: 1fr; }
  .overview   { grid-template-columns: repeat(2, 1fr); }

  .ad-float {
    left: auto;
    right: 16px;
    bottom: 84px;
    width: 62px;
    height: 62px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
  }

  .ad-float-logo {
    font-size: 18px;
    flex-shrink: 0;
  }

  .ad-float-title,
  .ad-float-desc {
    display: none;
  }

  .ad-float-btn {
    position: absolute;
    inset: 0;
    margin: 0;
    border-radius: 50%;
    opacity: 0;
    padding: 0;
    font-size: 0;
  }

  .ad-close {
    top: -4px;
    right: -2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 1;
  }
}

@media (max-width: 1280px) {
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .overview { grid-template-columns: 1fr 1fr; }

  .ad-header-text {
    display: none;
  }
}
