:root {
  --bg: #1e2235;
  --bg-alt: #262a40;
  --card: #2b2f49;
  --text: #e7e9f3;
  --muted: #a7afc6;
  --primary: #ff9b71;
  --primary-600: #db6d00;
  --border: rgba(255, 255, 255, 0.08);

  --fast: #24c17c;      /* 快速 - 绿色 */
  --medium: #ffb547;    /* 一般 - 橙色 */
  --slow: #ff6b6b;      /* 较慢 - 红色 */
  --timeout: #8c8fa8;   /* 超时/异常 - 灰色 */
  --checking: #6c8cff;  /* 检测中 - 蓝色 */

  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  background: radial-gradient(
    1200px 600px at 30% -10%,
    #1e2235 0%,
    var(--bg) 60%
  );
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Arial,
    sans-serif;
  line-height: 1.55;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  padding: 28px 0 8px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0)
  );
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title {
  margin: 0;
  font-size: 28px;
  color: var(--primary);
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 14px;
}

.noscript {
  margin-top: 8px;
  color: #ffd0d0;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  appearance: none;
  border: none;
  background: var(--primary);
  color: #1b1f2f;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.btn:hover {
  background: var(--primary-600);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.notice {
  margin: 18px 0 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.notice ul {
  margin: 0;
  padding-left: 18px;
}

.notice li {
  margin: 6px 0;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 4px;
  vertical-align: middle;
}

.dot-fast {
  background: var(--fast);
  box-shadow: 0 0 0 3px rgba(36, 193, 124, 0.16);
}

.dot-medium {
  background: var(--medium);
  box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.16);
}

.dot-slow {
  background: var(--slow);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.16);
}

.dot-timeout {
  background: var(--timeout);
  box-shadow: 0 0 0 3px rgba(140, 143, 168, 0.16);
}

.dot-checking {
  background: var(--checking);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.16);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.table-wrap {
  margin-top: 12px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.links-table {
  width: 100%;
  border-collapse: collapse;
}

.links-table thead th {
  text-align: left;
  background: #23273d;
  color: #fff;
  padding: 16px 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 15px;
}

.links-table thead th:first-child {
  border-radius: var(--radius) 0 0 0;
}

.links-table thead th:last-child {
  border-radius: 0 var(--radius) 0 0;
}

.links-table td {
  padding: 16px 16px;
  border-top: 1px solid var(--border);
  color: #dcdff0;
  font-size: 14px;
  vertical-align: middle;
}

.links-table td:first-child {
  width: 30%;
  font-weight: 600;
}

.links-table td:nth-child(2) {
  width: 50%;
}

.links-table td:nth-child(3) {
  width: 20%;
  text-align: left;
  padding-left: 16px;
}

.links-table a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.links-table a:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

.speed-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  margin-right: 4px;
  vertical-align: middle;
}

.speed-badge.testing {
  background: #cdd1e6;
  color: #0e1327;
}

.speed-badge.fast {
  background: rgba(36, 193, 124, 0.18);
  color: #aaf0cf;
  border: 1px solid rgba(36, 193, 124, 0.35);
}

.speed-badge.medium {
  background: rgba(255, 181, 71, 0.18);
  color: #ffe1b3;
  border: 1px solid rgba(255, 181, 71, 0.35);
}

.speed-badge.slow {
  background: rgba(255, 107, 107, 0.18);
  color: #ffd0d0;
  border: 1px solid rgba(255, 107, 107, 0.35);
}

.speed-badge.checking {
  background: rgba(108, 140, 255, 0.18);
  color: #b3c6ff;
  border: 1px solid rgba(108, 140, 255, 0.35);
  animation: pulse 1.5s infinite;
}

.speed-badge.timeout {
  background: rgba(140, 143, 168, 0.15);
  color: #cfd2e6;
  border: 1px solid rgba(140, 143, 168, 0.35);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ccc;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

.muted {
  color: var(--muted);
}

.speed-cell {
  white-space: nowrap;
}

/* 重新测试按钮样式 */
.retest-btn {
  display: inline-block;
  background: rgba(140, 143, 168, 0.2);
  color: #cfd2e6;
  border: 1px solid rgba(140, 143, 168, 0.4);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
}

.retest-btn:hover {
  background: rgba(140, 143, 168, 0.3);
  border-color: rgba(140, 143, 168, 0.6);
  color: #fff;
}

.retest-btn:active {
  transform: translateY(1px);
}

.retest-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.retest-btn.retesting {
  background: rgba(108, 140, 255, 0.2);
  border-color: rgba(108, 140, 255, 0.4);
  color: #b3c6ff;
}

.retest-btn.retesting:hover {
  background: rgba(108, 140, 255, 0.2);
  border-color: rgba(108, 140, 255, 0.4);
  cursor: not-allowed;
}

/* 下载按钮点击反馈样式 */
.btn.clicked {
  transform: scale(0.95);
  opacity: 0.9;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

/* 移动端按钮优化 */
@media (max-width: 768px) {
  .btn {
    /* 确保移动端按钮可点击区域足够大 */
    min-height: 44px; /* iOS推荐的最小点击区域 */
    min-width: 44px;
    padding: 12px 16px;
  }
  
  #client-download-btn {
    /* 确保下载按钮在移动端显示正常 */
    position: relative;
    z-index: 10;
  }
}

.foot-note {
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  margin-top: 40px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 响应式表格布局（移动端优化） */
@media (max-width: 768px) {
  /* 基础字体调整 */
  html {
    font-size: 15px; /* 增加基础字体大小 */
  }
  
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 20px; /* 增加间距 */
  }

  .actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px; /* 增加按钮间距 */
  }

  .title {
    font-size: 26px; /* 增加标题字体 */
    text-align: center;
    line-height: 1.3;
  }

  .subtitle {
    text-align: center;
    font-size: 14px; /* 增加副标题字体 */
    line-height: 1.4;
    margin-top: 10px;
  }

  .container {
    padding: 0 16px; /* 增加内边距 */
  }

  /* 表格字体和间距优化 */
  .links-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    font-size: 14px; /* 增加表格字体 */
  }

  .links-table thead {
    display: table-header-group;
  }

  .links-table thead th {
    padding: 14px 10px; /* 增加表头内边距 */
    font-size: 14px; /* 增加表头字体 */
    white-space: nowrap;
    line-height: 1.4;
  }

  .links-table tr {
    display: table-row;
    background: var(--card);
    border: 1px solid var(--border);
    margin-bottom: 10px; /* 增加行间距 */
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .links-table td {
    display: table-cell;
    padding: 14px 10px; /* 增加单元格内边距 */
    border-top: 1px solid var(--border);
    width: auto !important;
    vertical-align: middle;
    line-height: 1.5; /* 增加行高 */
  }

  .links-table td:first-child {
    width: 25% !important;
    font-weight: 600;
    color: var(--primary);
    font-size: 15px; /* 增加字体 */
    line-height: 1.5;
    border-bottom: none;
    padding-bottom: 14px;
  }

  .links-table td:nth-child(2) {
    width: 50% !important;
    word-break: break-all;
    font-size: 14px; /* 增加字体 */
    line-height: 1.6;
    margin-bottom: 0;
    padding: 14px 10px;
  }

  .links-table td:nth-child(3) {
    width: 25% !important;
    text-align: left !important;
    font-size: 14px; /* 增加字体 */
    padding-left: 10px;
  }

  .speed-cell {
    display: block;
    line-height: 1.5;
    padding-top: 0;
    border-top: none;
    white-space: nowrap !important;
    text-align: left;
  }
  
  .speed-cell .speed-badge,
  .speed-cell .muted {
    display: inline-block;
    vertical-align: middle;
  }
  
  .speed-cell .muted {
    margin-left: 6px; /* 增加间距 */
    font-size: 13px; /* 增加字体 */
  }

  .speed-badge {
    font-size: 12px; /* 增加字体 */
    padding: 4px 8px; /* 增加内边距 */
  }

  .legend {
    flex-wrap: wrap;
    gap: 14px; /* 增加间距 */
    margin: 14px 0 10px;
    font-size: 14px; /* 增加字体 */
    justify-content: center;
  }

  .notice {
    margin: 18px 0 14px;
    padding: 14px; /* 增加内边距 */
    font-size: 14px; /* 增加字体 */
    line-height: 1.6;
  }

  .notice ul {
    padding-left: 18px; /* 增加缩进 */
  }

  .notice li {
    margin: 8px 0; /* 增加列表项间距 */
  }

  .foot-note {
    margin-top: 24px;
    font-size: 14px; /* 增加字体 */
    padding: 0 10px;
    line-height: 1.6;
  }

  .site-footer {
    margin-top: 36px;
    padding: 18px 0;
    font-size: 13px; /* 增加字体 */
    line-height: 1.5;
  }
}

/* 更小的手机屏幕优化 */
@media (max-width: 480px) {
  .title {
    font-size: 22px;
  }

  .subtitle {
    font-size: 12px;
  }

  .btn {
    padding: 10px 12px;
    font-size: 13px;
    flex: 1;
    min-width: 0; /* 移除最小宽度限制，让按钮自适应 */
  }

  .actions {
    gap: 6px;
    justify-content: center;
  }

  /* 调整表格在小屏幕上的显示 */
  .links-table thead th {
    padding: 10px 6px;
    font-size: 12px;
  }

  .links-table td {
    padding: 10px 6px;
    font-size: 12px;
  }

  .links-table td:first-child {
    width: 30% !important;
    font-size: 13px;
  }

  .links-table td:nth-child(2) {
    width: 45% !important;
    font-size: 12px;
  }

  .links-table td:nth-child(3) {
    width: 25% !important;
    font-size: 12px;
  }

  .speed-badge {
    font-size: 10px;
    padding: 2px 5px;
  }

  .legend {
    gap: 10px;
    font-size: 12px;
    justify-content: center;
  }

  .notice {
    padding: 10px;
    font-size: 12px;
  }
}

