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

:root {
  --purple:       #7b1fa2;
  --purple-dark:  #4a148c;
  --purple-mid:   #8e24aa;
  --purple-light: #f3e5f5;
  --bg:           #f8f4ff;
  --card:         #ffffff;
  --text:         #1a1228;
  --text-sub:     #6a5a7e;
  --border:       #e1d0ee;
  --shadow:       0 1px 4px rgba(123,31,162,.1), 0 4px 12px rgba(123,31,162,.06);
  --radius:       10px;
  --gold:             #f5a623;
  --silver:           #9e9e9e;
  --bronze:           #cd7f32;
  --form-accent:      #7b1fa2;
  --form-accent-dark: #4a148c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

.container { max-width: 1440px; margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple) 100%);
  box-shadow: 0 2px 12px rgba(74,20,140,.35);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  height: 56px;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.22);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.header-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }

.header-nav a {
  color: rgba(255,255,255,.78);
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 20px;
  transition: all .15s;
}
.header-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.15);
}

.header-nav a.submit-btn {
  background: #fff;
  color: var(--purple) !important;
  border-radius: 6px;
  font-weight: 700;
  margin-left: 6px;
}
.header-nav a.submit-btn:hover {
  background: var(--purple-light);
  color: var(--purple-dark) !important;
}

/* ── Friend Links ── */
.friend-links { background: #fff; border-top: 1px solid #ead8f4; padding: 18px 0; }
.fl-title { font-size: 12px; font-weight: 700; color: #c0a0d0; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.fl-list { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-item { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: #fbf5ff; border: 1px solid #ddc8ec; border-radius: 20px; font-size: 12px; color: #7a5a9a; transition: all .15s; }
.fl-item:hover { background: var(--purple-light); border-color: var(--purple); color: var(--purple); }
.fl-item img { width: 14px; height: 14px; object-fit: contain; border-radius: 2px; }

/* ── Main ── */
.main { padding: 20px 0 40px; }

/* ── Category Grid ── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1200px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px)  { .cat-grid { grid-template-columns: 1fr; } }

/* ── Cat Card ── */
.cat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .15s;
  border: 1px solid var(--border);
}
.cat-card:hover {
  box-shadow: 0 6px 24px rgba(123,31,162,.16);
  transform: translateY(-2px);
}

.cat-card-header {
  background: linear-gradient(135deg, var(--purple-mid) 0%, var(--purple-dark) 100%);
  color: #fff;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cat-card-header h3 {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-count {
  font-size: 11px;
  opacity: .82;
  background: rgba(255,255,255,.2);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ── Site List ── */
.site-list { list-style: none; flex: 1; }

.site-item {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid #f5effe;
  gap: 7px;
  transition: background .1s;
}
.site-item:last-child { border-bottom: none; }
.site-item:hover { background: #fbf6ff; }

.site-rank { width: 18px; text-align: center; font-size: 12px; font-weight: 700; color: #ccc; flex-shrink: 0; }
.site-rank.r1 { color: var(--gold); }
.site-rank.r2 { color: var(--silver); }
.site-rank.r3 { color: var(--bronze); }

.site-favicon { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; object-fit: contain; }

.site-link {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .1s;
}
.site-link:hover { color: var(--purple); }

.site-clicks {
  font-size: 11px;
  color: #fff;
  background: var(--purple-mid);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.site-clicks.hot { background: #e65100; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.65} }

/* ── Card Footer ── */
.card-footer {
  border-top: 1px solid var(--border);
  padding: 9px 16px;
  text-align: center;
}
.view-all {
  color: var(--purple);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity .15s;
}
.view-all:hover { opacity: .72; }

/* ── Page bar ── */
.page-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.page-bar .container { display: flex; align-items: center; justify-content: space-between; }
.breadcrumb { font-size: 12px; color: var(--text-sub); }
.breadcrumb a { color: var(--purple); }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Full category ── */
.cat-full {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}
.cat-full-header {
  background: linear-gradient(135deg, var(--purple-mid), var(--purple-dark));
  color: #fff;
  padding: 20px 24px;
}
.cat-full-header h2 { font-size: 20px; font-weight: 700; }
.cat-full-header p  { font-size: 13px; opacity: .8; margin-top: 4px; }

.site-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.site-grid .site-item {
  border-right: 1px solid #f5effe;
  border-bottom: 1px solid #f5effe;
  padding: 10px 14px;
}
@media (max-width: 1000px) { .site-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .site-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px)  { .site-grid { grid-template-columns: 1fr; } }

.empty { padding: 60px 20px; text-align: center; color: var(--text-sub); font-size: 15px; }

/* ── Footer ── */
.site-footer {
  background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple) 100%);
  color: rgba(255,255,255,.62);
  padding: 18px 0;
  margin-top: 20px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}
.footer-copy { line-height: 1.8; }
.footer-copy a { color: rgba(255,255,255,.55); }
.footer-copy a:hover { color: #fff; text-decoration: underline; }
.footer-links { display: flex; align-items: center; gap: 10px; }
.footer-links a { color: rgba(255,255,255,.65); font-size: 12px; }
.footer-links a:hover { color: #fff; }
.footer-submit {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  padding: 5px 16px;
  border-radius: 20px;
  font-weight: 700;
  color: #fff !important;
  font-size: 12px;
  transition: background .15s !important;
}
.footer-submit:hover { background: rgba(255,255,255,.3) !important; }

/* ── Mobile: 手机端头部只保留「提交网站」按钮 ── */
@media (max-width: 767px) {
  .header-nav a:not(.submit-btn) { display: none; }
  .header-nav { margin-left: auto; }
}
