/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 默认浅色 */
:root {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --border: #e5e5e5;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --search-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.06);
}

/* 系统深色自适应 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --border: #2a2a2a;
    --text: #e8e8e8;
    --text-secondary: #888888;
    --text-muted: #555555;
    --search-bg: #1a1a1a;
    --shadow: rgba(0, 0, 0, 0.3);
  }
}

/* 手动切换覆盖 */
[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --border: #e5e5e5;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --search-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  --bg: #111111;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-secondary: #888888;
  --text-muted: #555555;
  --search-bg: #1a1a1a;
  --shadow: rgba(0, 0, 0, 0.3);
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* 背景噪点纹理 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

@media (prefers-color-scheme: light) {
  body::before { opacity: 0.04; }
}
[data-theme="light"] body::before { opacity: 0.04; }
[data-theme="dark"] body::before { opacity: 0.035; }

/* 背景微弱径向渐变 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(100, 100, 140, 0.08) 0%, transparent 70%);
}

@media (prefers-color-scheme: light) {
  body::after {
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(120, 130, 180, 0.06) 0%, transparent 70%);
  }
}
[data-theme="light"] body::after {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(120, 130, 180, 0.06) 0%, transparent 70%);
}
[data-theme="dark"] body::after {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(100, 100, 140, 0.08) 0%, transparent 70%);
}

.header, .main, .footer {
  position: relative;
  z-index: 1;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg);
  transition: background-color 0.3s ease;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background-color: var(--bg-card);
}

/* ===== Main ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 2rem;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Search Section ===== */
.search-section {
  width: 100%;
  margin-top: clamp(3rem, 12vh, 8rem);
  margin-bottom: 3rem;
}

.greeting {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  text-align: center;
  letter-spacing: -0.01em;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  background-color: var(--search-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  outline: none;
  transition: all 0.2s ease;
}

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

.search-input:focus {
  border-color: #555;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

@media (prefers-color-scheme: light) {
  .search-input:focus {
    border-color: #ccc;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
  }
}
[data-theme="light"] .search-input:focus {
  border-color: #ccc;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.search-input:focus ~ .search-icon,
.search-wrapper:focus-within .search-icon {
  color: var(--text-secondary);
}

/* ===== Cards Section ===== */
.cards-section {
  width: 100%;
}

.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* ===== Card ===== */
.card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  cursor: pointer;
}

.card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-muted);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow);
}

.card:active {
  transform: translateY(0);
}

.card.hidden {
  display: none;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  transition: all 0.2s ease;
}

.card:hover .card-icon {
  background-color: color-mix(in srgb, var(--accent) 20%, transparent);
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.125rem;
}

.card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.card-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
  opacity: 0;
  transform: translateX(-4px);
}

.card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.icp-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.icp-link:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ===== Animations ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-section {
  animation: fadeUp 0.5s ease both;
}

.card {
  animation: fadeUp 0.5s ease both;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.18s; }
.card:nth-child(3) { animation-delay: 0.26s; }
.card:nth-child(4) { animation-delay: 0.34s; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .header {
    padding: 1rem 1.25rem;
  }

  .main {
    padding: 0 1.25rem;
  }

  .search-section {
    margin-top: 2.5rem;
    margin-bottom: 2rem;
  }

  .greeting {
    font-size: 1.25rem;
  }

  .card {
    padding: 0.875rem 1rem;
  }

  .card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
}
