/* ============ 基础与变量 ============ */
:root {
  --bg: #f6f7fb;
  --bg-card: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.85);
  --text: #1f2430;
  --text-soft: #6b7280;
  --primary: #6c5ce7;
  --primary-strong: #5a4bd1;
  --primary-soft: rgba(108, 92, 231, 0.12);
  --danger: #e0526e;
  --danger-soft: rgba(224, 82, 110, 0.12);
  --border: #e5e7ee;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.08);
  --radius: 16px;
  --transition: 0.25s ease;
}

html[data-theme="dark"] {
  --bg: #0f1116;
  --bg-card: #1a1d26;
  --bg-header: rgba(15, 17, 22, 0.85);
  --text: #eceef4;
  --text-soft: #9aa1b0;
  --primary: #8f7ff2;
  --primary-strong: #a497f5;
  --primary-soft: rgba(143, 127, 242, 0.18);
  --danger: #f0768e;
  --danger-soft: rgba(240, 118, 142, 0.16);
  --border: #2a2e3a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============ 头部 ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-header);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 12px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-soft);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: var(--primary-soft);
}

.nav-link.active {
  color: var(--primary-strong);
  font-weight: 600;
  background: var(--primary-soft);
}

.fav-count {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  margin-left: 2px;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 17px;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}

.theme-toggle:hover {
  transform: rotate(15deg) scale(1.06);
}

/* ============ 主视觉 ============ */
.hero {
  text-align: center;
  padding: 56px 0 30px;
}

.hero h1 {
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  background: linear-gradient(120deg, var(--primary), #e07b8d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-soft);
  font-size: 15px;
}

/* ============ 灵感面板 ============ */
.inspire-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 46px 34px 34px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card.pop {
  animation: pop 0.35s ease;
}

@keyframes pop {
  0% { transform: scale(0.96); opacity: 0.5; }
  60% { transform: scale(1.01); }
  100% { transform: scale(1); opacity: 1; }
}

.card-badge {
  position: absolute;
  top: 18px;
  left: 18px;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}

.card-text {
  font-size: clamp(17px, 3.4vw, 22px);
  font-weight: 500;
  line-height: 1.8;
  max-width: 100%;
  word-break: break-word;
}

.card-id {
  position: absolute;
  bottom: 14px;
  right: 18px;
  font-size: 12px;
  color: var(--text-soft);
  opacity: 0.6;
}

/* ============ 操作按钮 ============ */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(108, 92, 231, 0.35);
}

.btn-primary:hover {
  background: var(--primary-strong);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(108, 92, 231, 0.4);
}

.btn-ghost {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
  transform: translateY(-2px);
}

.btn-ghost.fav-on {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-icon {
  font-size: 18px;
}

/* ============ 提示 ============ */
.hint {
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  padding-bottom: 50px;
}

/* ============ 收藏页 ============ */
.fav-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 18px;
}

.fav-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding-bottom: 50px;
}

.fav-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fav-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fav-item-text {
  font-size: 16px;
  line-height: 1.8;
}

.fav-item-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.empty-state {
  text-align: center;
  padding: 70px 0;
  color: var(--text-soft);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state.show {
  display: flex;
}

.empty-icon {
  font-size: 48px;
}

.empty-state .btn {
  margin-top: 8px;
}

.empty-sub {
  font-size: 14px;
  margin-bottom: 6px;
}

/* ============ 页脚 ============ */
.site-footer {
  margin-top: auto;
  padding: 26px 20px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ============ 提示气泡 ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 99;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ 响应式 ============ */
@media (max-width: 480px) {
  .brand {
    font-size: 15px;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 13px;
  }

  .header-inner {
    height: 58px;
  }

  .hero {
    padding: 40px 0 24px;
  }

  .card {
    padding: 40px 20px 30px;
    min-height: 210px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }
}
