/* ==========================================================================
   阿呆导航 · 科技风样式（深色 HUD 默认，可切浅色）
   ========================================================================== */

:root {
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  /* 深空底色 */
  --bg: #05070d;
  --text: #e8f0ff;
  --muted: #7a8aa8;

  --line: rgba(120, 170, 255, 0.13);
  --line-strong: rgba(120, 200, 255, 0.3);

  --card: rgba(11, 18, 31, 0.55);
  --card-hover: rgba(16, 27, 46, 0.82);
  --card-border: rgba(120, 170, 255, 0.14);

  --shadow-sm: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 12px 26px -20px rgba(0, 0, 0, 1);
  --shadow-md: 0 22px 44px -22px rgba(0, 0, 0, 0.95);

  --brand: #22d3ee;
  --brand2: #a78bfa;
  --accent: #22d3ee;
  --ok: #34d399;

  --pill-bg: rgba(120, 170, 255, 0.05);
  --pill-active: linear-gradient(135deg, #06b6d4, #6366f1);
  --input-bg: rgba(7, 13, 24, 0.78);

  --glow1: rgba(34, 211, 238, 0.16);
  --glow2: rgba(139, 92, 246, 0.16);
  --glow3: rgba(34, 211, 238, 0.07);

  --btn-bg: rgba(120, 170, 255, 0.05);
  --panel: rgba(10, 17, 29, 0.94);
  --grid: rgba(120, 190, 255, 0.055);
  --icon-bg: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] {
  --bg: #eef3fb;
  --text: #08101f;
  --muted: #56657f;

  --line: rgba(16, 48, 96, 0.12);
  --line-strong: rgba(8, 145, 178, 0.35);

  --card: rgba(255, 255, 255, 0.74);
  --card-hover: rgba(255, 255, 255, 0.96);
  --card-border: rgba(16, 48, 96, 0.12);

  --shadow-sm: 0 1px 2px rgba(16, 48, 96, 0.05), 0 10px 24px -18px rgba(16, 48, 96, 0.4);
  --shadow-md: 0 20px 38px -20px rgba(16, 48, 96, 0.4);

  --brand: #0891b2;
  --brand2: #7c3aed;
  --accent: #0891b2;
  --ok: #059669;

  --pill-bg: rgba(255, 255, 255, 0.7);
  --pill-active: linear-gradient(135deg, #0e7490, #4f46e5);
  --input-bg: rgba(255, 255, 255, 0.9);

  --glow1: rgba(14, 165, 233, 0.18);
  --glow2: rgba(139, 92, 246, 0.14);
  --glow3: rgba(14, 165, 233, 0.1);

  --btn-bg: rgba(255, 255, 255, 0.72);
  --panel: #ffffff;
  --grid: rgba(16, 80, 160, 0.07);
  --icon-bg: #ffffff;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(920px 520px at 10% -12%, var(--glow1), transparent 62%),
    radial-gradient(820px 480px at 92% -4%, var(--glow2), transparent 58%),
    radial-gradient(900px 620px at 50% 116%, var(--glow3), transparent 62%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
  position: relative;
}

/* 背景网格 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 85% 65% at 50% 0%, #000 10%, transparent 78%);
  mask-image: radial-gradient(ellipse 85% 65% at 50% 0%, #000 10%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

/* 顶部扫描光 */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 1px;
  background-image: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: topScan 7s linear infinite;
  pointer-events: none;
  z-index: 3;
  opacity: 0.75;
}

@keyframes topScan {
  0% { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}

a { color: inherit; }

.wrap {
  width: min(1140px, calc(100% - 40px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ---------------------------- 顶栏 ---------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 6px;
}

.brand { display: flex; align-items: center; gap: 12px; user-select: none; }

.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #06b6d4, #6366f1 55%, #a855f7);
  color: #04121c;
  font-size: 15px; font-weight: 800;
  letter-spacing: 0.5px;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.5));
}
[data-theme="light"] .brand-mark { color: #ffffff; }

.brand-name {
  font-size: 16px; font-weight: 700;
  letter-spacing: 1.2px;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
}

.actions { display: flex; align-items: center; gap: 9px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(12px);
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease, transform 0.18s ease;
}
.icon-btn:hover {
  color: var(--accent);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12), 0 0 18px -4px rgba(34, 211, 238, 0.5);
  transform: translateY(-1px);
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 16px; height: 16px; }

[data-theme="light"] .svg-moon { display: none; }
[data-theme="dark"] .svg-sun { display: none; }

/* ---------------------------- Hero ---------------------------- */
.hero { text-align: center; padding: 46px 0 4px; }

.hud-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--pill-bg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}
.hud-tag .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse 2s ease-in-out infinite;
}
.hud-tag .sep { opacity: 0.4; }
.hud-tag b { color: var(--text); font-weight: 600; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.greet {
  font-size: clamp(24px, 4vw, 33px);
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 0;
}

.greet em {
  font-style: normal;
  background: linear-gradient(110deg, #22d3ee, #818cf8 50%, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dateline {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1.4px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------- 搜索 ---------------------------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(680px, 100%);
  margin: 26px auto 0;
  padding: 7px;
  border-radius: 13px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(150%);
  transition: border-color 0.28s ease, box-shadow 0.28s ease;
}

.search:focus-within {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow:
    0 0 0 3px rgba(34, 211, 238, 0.1),
    0 0 34px -10px rgba(34, 211, 238, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.search::before {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.search:focus-within::before { opacity: 0.8; }

.engine-wrap { position: relative; flex: none; }

.engine-btn {
  display: flex; align-items: center; gap: 7px;
  height: 38px;
  padding: 0 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.engine-btn:hover { background: rgba(34, 211, 238, 0.1); color: var(--accent); }
.engine-btn svg.chev { width: 11px; height: 11px; opacity: 0.6; }

.engine-logo { width: 17px; height: 17px; border-radius: 4px; object-fit: contain; }

.engine-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 172px;
  padding: 6px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: 0 26px 50px -22px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(34, 211, 238, 0.06);
  z-index: 40;
  display: none;
}
.engine-menu.open { display: block; animation: menuIn 0.16s ease; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-5px); } }

.engine-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.engine-item:hover { background: rgba(34, 211, 238, 0.1); }
.engine-item.active { color: var(--accent); font-weight: 600; }
.engine-item img { width: 15px; height: 15px; border-radius: 4px; }

#searchInput {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  padding: 0 4px;
  letter-spacing: 0.2px;
}
#searchInput::placeholder { color: var(--muted); opacity: 0.75; }

.go-btn {
  flex: none;
  width: 42px; height: 38px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  color: #03121a;
  cursor: pointer;
  display: grid; place-items: center;
  transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.25s ease;
  box-shadow: 0 0 18px -6px rgba(34, 211, 238, 0.85);
}
.go-btn:hover {
  filter: brightness(1.12);
  box-shadow: 0 0 26px -4px rgba(34, 211, 238, 0.9);
}
.go-btn:active { transform: scale(0.95); }
.go-btn svg { width: 16px; height: 16px; stroke-width: 2.6; }

/* ---------------------------- 分类 ---------------------------- */
.cats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 28px 0 22px;
}

.cat {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--pill-bg);
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.22s ease;
}
.cat:hover {
  color: var(--accent);
  border-color: var(--line-strong);
  background: rgba(34, 211, 238, 0.07);
}
.cat.active {
  background: var(--pill-active);
  border-color: transparent;
  color: #041018;
  font-weight: 700;
  box-shadow: 0 0 20px -6px rgba(34, 211, 238, 0.8);
}
[data-theme="light"] .cat.active { color: #ffffff; }

/* ---------------------------- 站点网格 ---------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 11px;
  padding-bottom: 10px;
  min-height: 80px;
}

.site {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 20px 10px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(14px) saturate(140%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), background 0.24s ease,
    box-shadow 0.26s ease, border-color 0.24s ease;
  animation: pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--i, 0) * 16ms);
}

/* HUD 角标 */
.site::before,
.site::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  transition: all 0.26s ease;
  pointer-events: none;
}
.site::before {
  top: 6px; left: 6px;
  border-right: 0; border-bottom: 0;
  border-top-left-radius: 3px;
}
.site::after {
  bottom: 6px; right: 6px;
  border-left: 0; border-top: 0;
  border-bottom-right-radius: 3px;
}

@keyframes pop { from { opacity: 0; transform: translateY(12px); } }

.site:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.14),
    0 0 26px -10px rgba(34, 211, 238, 0.55),
    var(--shadow-md);
}
.site:hover::before,
.site:hover::after {
  width: 13px; height: 13px;
  border-color: rgba(34, 211, 238, 0.95);
}
.site:active { transform: translateY(-1px) scale(0.99); }

.site-icon {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(
    135deg,
    hsl(var(--h, 240) 80% 62%),
    hsl(calc(var(--h, 240) + 42) 78% 54%)
  );
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  flex: none;
  transition: transform 0.24s ease, box-shadow 0.26s ease;
}
.site:hover .site-icon {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 0 20px -4px hsl(var(--h, 240) 85% 60% / 0.75);
}

.site-icon .fb { line-height: 1; }

.site-icon img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px; height: 22px;
  opacity: 0;
  transition: opacity 0.25s ease;
  object-fit: contain;
}
.site-icon.has-img img { opacity: 1; }
.site-icon.has-img .fb { opacity: 0; }
.site-icon.has-img {
  background: var(--icon-bg);
  box-shadow: 0 0 0 1px var(--line);
}

.site-name {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.site-desc {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: -5px;
  letter-spacing: 0.2px;
  opacity: 0.85;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
  padding: 46px 0;
  letter-spacing: 0.5px;
}

/* ---------------------------- 页脚 ---------------------------- */
footer {
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 40px 0 30px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
footer kbd {
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--pill-bg);
  font-size: 10px;
}
footer a { text-decoration: none; border-bottom: 1px solid var(--line); }
footer a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------------------- 移动端 ---------------------------- */
@media (max-width: 620px) {
  .wrap { width: calc(100% - 26px); }
  .hero { padding: 30px 0 0; }
  .hud-tag { font-size: 9px; letter-spacing: 1.2px; padding: 5px 11px; margin-bottom: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; }
  .site { padding: 17px 6px 13px; border-radius: 11px; gap: 8px; }
  .site-icon { width: 38px; height: 38px; font-size: 15px; border-radius: 9px; }
  .site-desc { display: none; }
  .engine-name { display: none; }
  .cats { gap: 6px; margin: 22px 0 17px; }
  .cat { padding: 7px 11px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; opacity: 0; }
  .hud-tag .dot { animation: none; }
  .site { animation: none; }
}
