/* Apple Liquid Glass Design System — Hub */
:root {
  color-scheme: light;
  --bg: #eef2f7;
  --surface: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.56);
  --glass-bg-strong: rgba(255, 255, 255, 0.74);
  --glass-bg-hover: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-edge: rgba(15, 23, 42, 0.08);
  --glass-highlight: inset 0 1.5px 0 rgba(255, 255, 255, 0.92), inset 1px 0 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(255, 255, 255, 0.3);
  --surface-secondary: rgba(255, 255, 255, 0.5);
  --nav-bg: rgba(255, 255, 255, 0.58);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #1d1d1f;
  --text-secondary: #515156;
  --text-tertiary: #7c7c82;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.13);
  --pill-bg: rgba(255, 255, 255, 0.46);
  --card-shadow: var(--glass-highlight), 0 12px 36px rgba(15, 23, 42, 0.07), 0 2px 8px rgba(15, 23, 42, 0.04);
  --card-shadow-hover: var(--glass-highlight), 0 20px 48px rgba(0, 113, 227, 0.12), 0 6px 18px rgba(15, 23, 42, 0.07);
  --ease-apple: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070c;
  --surface: #1c1c1e;
  --glass-bg: rgba(34, 36, 44, 0.52);
  --glass-bg-strong: rgba(44, 46, 56, 0.7);
  --glass-bg-hover: rgba(48, 52, 64, 0.66);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 1px 0 0 rgba(255, 255, 255, 0.14), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  --surface-secondary: rgba(255, 255, 255, 0.08);
  --nav-bg: rgba(22, 24, 30, 0.56);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f5f5f7;
  --text-secondary: #b0b0b8;
  --text-tertiary: #7e7e86;
  --accent: #2997ff;
  --accent-hover: #47a6ff;
  --accent-soft: rgba(41, 151, 255, 0.2);
  --pill-bg: rgba(255, 255, 255, 0.09);
  --card-shadow: var(--glass-highlight), 0 14px 40px rgba(0, 0, 0, 0.52);
  --card-shadow-hover: var(--glass-highlight), 0 22px 54px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(41, 151, 255, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Luminous Ambient Mesh Behind Liquid Glass */
body::before {
  content: "";
  position: fixed;
  inset: -15%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42% 38% at 16% 14%, rgba(56, 189, 248, 0.34), transparent 72%),
    radial-gradient(38% 42% at 84% 18%, rgba(168, 85, 247, 0.26), transparent 72%),
    radial-gradient(44% 40% at 76% 84%, rgba(52, 211, 153, 0.24), transparent 74%),
    radial-gradient(36% 36% at 18% 82%, rgba(251, 146, 60, 0.20), transparent 72%);
  filter: blur(44px);
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(44% 40% at 16% 14%, rgba(0, 113, 227, 0.36), transparent 72%),
    radial-gradient(40% 42% at 86% 18%, rgba(147, 51, 234, 0.30), transparent 72%),
    radial-gradient(44% 42% at 78% 86%, rgba(16, 185, 129, 0.22), transparent 74%),
    radial-gradient(36% 38% at 18% 84%, rgba(59, 130, 246, 0.22), transparent 72%);
}

a { color: inherit; text-decoration: none; }

/* Liquid Glass Top Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 54px;
  background: var(--nav-bg);
  backdrop-filter: blur(26px) saturate(210%);
  -webkit-backdrop-filter: blur(26px) saturate(210%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: inset 0 -1px 0 var(--glass-edge), 0 4px 20px rgba(15, 23, 42, 0.04);
}

.topbar-inner {
  max-width: 1080px;
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, #2997ff 0%, #0071e3 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 4px 12px rgba(0, 113, 227, 0.32);
}

.theme-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  color: var(--text);
  border-radius: 980px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--glass-highlight), 0 2px 8px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s var(--ease-apple), background-color 0.2s ease;
}

.theme-btn:hover {
  background: var(--glass-bg-strong);
  transform: scale(1.03);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 68px) 22px 84px;
}

/* Hero */
.hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto clamp(32px, 5vw, 48px);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 980px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 4px 14px rgba(15, 23, 42, 0.05);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.15rem, 5.4vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--text);
}

.hero p {
  margin: 0 auto 26px;
  max-width: 52ch;
  font-size: clamp(1rem, 2vw, 1.14rem);
  color: var(--text-secondary);
  line-height: 1.54;
}

.stats-strip {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 11px 26px;
  border-radius: 980px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
}

.stat-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.stat-item strong {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
}

.stat-divider {
  width: 1px;
  height: 16px;
  background: var(--border-strong);
}

/* Liquid Glass Segmented Control & Search */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 28px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 980px;
  background: var(--pill-bg);
  backdrop-filter: blur(22px) saturate(200%);
  -webkit-backdrop-filter: blur(22px) saturate(200%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 6px 20px rgba(15, 23, 42, 0.05);
  gap: 2px;
}

.filter-chip {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 980px;
  padding: 7px 17px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.22s var(--ease-apple), color 0.2s ease, box-shadow 0.22s ease;
}

.filter-chip:hover { color: var(--text); }

.filter-chip.active {
  background: var(--glass-bg-strong);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--glass-highlight), 0 3px 10px rgba(15, 23, 42, 0.08);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 360px;
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 38px;
  border-radius: 980px;
  border: 1px solid var(--glass-border);
  background: var(--pill-bg);
  backdrop-filter: blur(22px) saturate(200%);
  -webkit-backdrop-filter: blur(22px) saturate(200%);
  box-shadow: var(--glass-highlight), 0 6px 18px rgba(15, 23, 42, 0.05);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input::placeholder { color: var(--text-tertiary); }

.search-box input:focus {
  background: var(--glass-bg-strong);
  border-color: var(--accent);
  box-shadow: var(--glass-highlight), 0 0 0 4px var(--accent-soft);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  display: grid;
  place-items: center;
}

/* Liquid Glass Bento Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(210%);
  -webkit-backdrop-filter: blur(28px) saturate(210%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform 0.34s var(--ease-apple), box-shadow 0.34s var(--ease-apple), background-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

/* Specular Liquid Glass Sheen */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.08) 38%, rgba(255, 255, 255, 0) 64%);
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}

[data-theme="dark"] .card::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.03) 36%, rgba(255, 255, 255, 0) 62%);
}

.card:hover {
  transform: translateY(-6px) scale(1.008);
  background: var(--glass-bg-hover);
  box-shadow: var(--card-shadow-hover);
}

.card:hover::before { opacity: 1; }

.card > * { position: relative; z-index: 1; }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.card-icon.blue { background: rgba(0, 113, 227, 0.16); color: #0071e3; }
.card-icon.green { background: rgba(52, 199, 89, 0.18); color: #248a3d; }
.card-icon.orange { background: rgba(255, 149, 0, 0.18); color: #c93400; }
.card-icon.purple { background: rgba(175, 82, 222, 0.18); color: #8944ab; }
.card-icon.teal { background: rgba(48, 176, 199, 0.18); color: #0071a4; }
.card-icon.pink { background: rgba(255, 45, 85, 0.16); color: #d70015; }

[data-theme="dark"] .card-icon.blue { background: rgba(41, 151, 255, 0.22); color: #54aeff; }
[data-theme="dark"] .card-icon.green { background: rgba(48, 209, 88, 0.22); color: #4ade80; }
[data-theme="dark"] .card-icon.orange { background: rgba(255, 159, 10, 0.22); color: #fbbf24; }
[data-theme="dark"] .card-icon.purple { background: rgba(191, 90, 242, 0.22); color: #c084fc; }
[data-theme="dark"] .card-icon.teal { background: rgba(100, 210, 255, 0.22); color: #67e8f9; }
[data-theme="dark"] .card-icon.pink { background: rgba(255, 55, 95, 0.22); color: #fb7185; }

.card-meta {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.card p {
  margin: 0 0 18px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.tag {
  font-size: 0.74rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 980px;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.tag.algo {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-weight: 600;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
}

.card-source {
  color: var(--text-tertiary);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 62%;
}

.open-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: transform 0.2s var(--ease-apple);
}

.card:hover .open-link { transform: translateX(3px); }

.empty-state {
  text-align: center;
  padding: 56px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  color: var(--text-secondary);
}

footer {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

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

@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; }
  .container { padding: 28px 16px 64px; }
  .stats-strip { gap: 14px; padding: 9px 16px; }
  .controls { flex-direction: column; align-items: stretch; }
  .segmented { width: 100%; justify-content: space-between; }
  .filter-chip { flex: 1; text-align: center; padding: 7px 10px; }
  .search-box { max-width: none; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .card { padding: 20px; }
}
