:root {
  --bg-start: #0a0e27;
  --bg-end: #1a0f3d;
  --card-bg: rgba(15, 18, 45, 0.85);
  --text: #f0f4ff;
  --muted: rgba(240, 244, 255, 0.72);
  --accent: #4f7fff;
  --accent-2: #a855ff;
  --accent-3: #ff6b6b;
  --accent-green: #34d399;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  --border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 25%, rgba(79, 127, 255, 0.4), transparent 45%),
    radial-gradient(circle at 80% 35%, rgba(168, 85, 255, 0.35), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(52, 211, 153, 0.15), transparent 50%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  overflow-x: hidden;
}

.page {
  min-height: 100vh;
  width: 100%;
  display: block;
  padding: 0;
}

.scene {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

.glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 35% 40%, rgba(79, 127, 255, 0.3), transparent 50%),
    radial-gradient(circle at 65% 25%, rgba(168, 85, 255, 0.25), transparent 50%),
    radial-gradient(circle at 50% 85%, rgba(52, 211, 153, 0.12), transparent 45%);
  filter: blur(28px);
  animation: drift 20s ease-in-out infinite;
  border-radius: 0;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8px, -14px) scale(1.03); }
}

.card {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 40px;
  border-radius: 0;
  background: var(--card-bg);
  box-shadow: none;
  border: 0;
  backdrop-filter: blur(16px);
  overflow: hidden;
  z-index: 1;
}

.header {
  position: relative;
  margin-bottom: 32px;
  text-align: center;
  min-height: 40px;
}

.back-button {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(79, 127, 255, 0.45);
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.22), rgba(168, 85, 255, 0.16));
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.back-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(79, 127, 255, 0.28);
  border-color: rgba(79, 127, 255, 0.75);
}

.back-button:active {
  transform: translateY(0);
}

.back-icon {
  font-size: 1rem;
}

.title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.5rem);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4f7fff, #a855ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 8px 0 0;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  color: var(--muted);
}

.section {
  margin-bottom: 24px;
}

/* 状态提示 */
.status-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.15), rgba(168, 85, 255, 0.1));
  border: 1px solid rgba(79, 127, 255, 0.3);
}

.status-icon {
  font-size: 1.5rem;
}

.status-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.status-box.error {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 107, 107, 0.1));
  border-color: rgba(255, 107, 107, 0.4);
}

.status-box.success {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(52, 211, 153, 0.08));
  border-color: rgba(52, 211, 153, 0.3);
}

/* 搜索栏 */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(79, 127, 255, 0.3);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.search-input:focus {
  border-color: rgba(79, 127, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 127, 255, 0.15);
}

.search-input::placeholder {
  color: rgba(240, 244, 255, 0.35);
}

.filter-select {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(79, 127, 255, 0.3);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color 200ms ease, box-shadow 200ms ease;
  min-width: 140px;
  appearance: auto;
}

.filter-select:focus {
  border-color: rgba(79, 127, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 127, 255, 0.15);
}

.filter-select option {
  background: #1a1f3a;
  color: var(--text);
}
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(52, 211, 153, 0.1));
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
}

.refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.7);
}

.refresh-btn:active {
  transform: translateY(0);
}

.refresh-icon {
  font-size: 1rem;
}

/* 设备卡片 */
.device-card {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(79, 127, 255, 0.2);
  overflow: hidden;
  margin-bottom: 16px;
  animation: fadeIn 300ms ease;
}

.device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 180ms ease;
}

.device-card-header:hover {
  background: rgba(79, 127, 255, 0.08);
}

.device-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.device-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(79, 127, 255, 0.2);
  border: 1px solid rgba(79, 127, 255, 0.3);
  color: rgba(240, 244, 255, 0.8);
  font-weight: 600;
}

.device-mac {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: 'Courier New', Courier, monospace;
  font-weight: 500;
}

.collapse-icon {
  font-size: 0.9rem;
  color: var(--muted);
  transition: transform 200ms ease;
}

.collapse-icon.collapsed {
  transform: rotate(-90deg);
}

.device-card-body {
  padding: 0 20px 20px;
}

/* 版本集 */
.version-set {
  margin-bottom: 16px;
}

.version-set:last-child {
  margin-bottom: 0;
}

.version-set-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(79, 127, 255, 0.08);
  border: 1px solid rgba(79, 127, 255, 0.15);
}

.version-set-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(240, 244, 255, 0.8);
}

.version-set-count {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: auto;
}

.version-set-body {
  overflow-x: auto;
}

/* 表格 */
.firm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.firm-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(79, 127, 255, 0.2);
  white-space: nowrap;
}

.firm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.firm-table tr:last-child td {
  border-bottom: none;
}

.firm-table tr:hover td {
  background: rgba(79, 127, 255, 0.05);
}

.firm-table .col-version {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 600;
  color: var(--accent-green);
  white-space: nowrap;
}

.firm-table .col-ext {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.firm-table .col-md5 {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  color: rgba(240, 244, 255, 0.55);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 复制按钮 */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(79, 127, 255, 0.3);
  background: rgba(79, 127, 255, 0.12);
  color: rgba(240, 244, 255, 0.7);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.copy-btn:hover {
  background: rgba(79, 127, 255, 0.25);
  border-color: rgba(79, 127, 255, 0.6);
  color: var(--text);
}

.copy-btn.copied {
  background: rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--accent-green);
}

.dl-link {
  color: rgba(79, 127, 255, 0.8);
  text-decoration: none;
  font-size: 0.78rem;
  transition: color 150ms ease;
}

.dl-link:hover {
  color: rgba(79, 127, 255, 1);
  text-decoration: underline;
}

/* 统计 */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(79, 127, 255, 0.12);
  font-size: 0.85rem;
  color: var(--muted);
}

.stat-chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(79, 127, 255, 0.1);
  border: 1px solid rgba(79, 127, 255, 0.15);
  white-space: nowrap;
}

.stat-chip strong {
  color: var(--text);
}

/* 无结果 */
.no-result {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 1rem;
}

.no-result-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

/* loading */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 1.4s ease-in-out infinite;
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 隐私声明 */
.privacy-section {
  margin-top: 8px;
  margin-bottom: 0;
}

.privacy-note {
  margin: 0;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(79, 127, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(240, 244, 255, 0.66);
  font-size: 0.82rem;
  line-height: 1.55;
  text-align: center;
}

/* 滚动条美化 */
.search-input::-webkit-scrollbar,
.version-set-body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.search-input::-webkit-scrollbar-track,
.version-set-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.search-input::-webkit-scrollbar-thumb,
.version-set-body::-webkit-scrollbar-thumb {
  background: rgba(79, 127, 255, 0.3);
  border-radius: 3px;
}

/* 响应式 */
@media (max-width: 500px) {
  .card {
    padding: 32px 24px;
  }

  .header {
    min-height: 36px;
  }

  .back-button {
    padding: 7px 12px;
    font-size: 0.82rem;
  }

  .title {
    font-size: 1.8rem;
  }

  .filter-bar {
    flex-wrap: wrap;
    }
    
    .filter-select {
      flex: 1 1 100%;
      min-width: unset;
  }

  .refresh-btn {
    flex: 1;
    justify-content: center;
  }

  .firm-table {
    font-size: 0.78rem;
  }

  .firm-table .col-md5 {
    max-width: 100px;
  }

  .device-card-header {
    flex-wrap: wrap;
    gap: 8px;
  }
}