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

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --text3: #86868b;
  --border: #e8e8ed;
  --accent: #007aff;
  --max-w: 780px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ===== Header ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245,245,247,0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px 4px;
  text-align: center;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.header-sub {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
  margin-top: -1px;
}

/* ===== Nav ===== */
.nav-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.nav-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-scroll::-webkit-scrollbar { display: none; }

.nav-primary {
  display: flex;
  gap: 6px;
  padding: 6px 0 0;
}

.nav-primary button {
  padding: 6px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text3);
  position: relative;
  transition: color 0.25s ease;
  font-family: inherit;
  white-space: nowrap;
  border-radius: 6px;
}

.nav-primary button::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 2.5px;
  border-radius: 2.5px 2.5px 0 0;
  background: transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-primary button:hover { color: var(--text); }
.nav-primary button.active { color: var(--accent); }
.nav-primary button.active::after { background: var(--accent); }

/* ===== Secondary Nav ===== */
.nav-secondary-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  padding: 8px 0 10px;
}
.nav-secondary-scroll::-webkit-scrollbar { display: none; }

.nav-gradient {
  position: absolute;
  right: 0;
  top: 8px;
  bottom: 10px;
  width: 40px;
  background: linear-gradient(to right, transparent, rgba(245,245,247,0.9));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.nav-secondary {
  display: flex;
  gap: 6px;
}

.nav-secondary button {
  padding: 3px 12px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text2);
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: 0.2px;
  line-height: 1.6;
}

.nav-secondary button:hover {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}

.nav-secondary button.active {
  background: rgba(29,29,31,0.08);
  color: var(--text);
  border-color: var(--border);
  font-weight: 600;
}

/* ===== Main ===== */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 24px;
}

/* ===== News Cards ===== */
.news-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.news-card {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  cursor: pointer;
  display: block;
  position: relative;
  transition: all 0.2s ease;
}

.news-card:first-child { border-top: 1px solid var(--border); }

.news-card:hover .news-card-title {
  color: var(--accent);
}

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

.news-card { animation: fadeSlideIn 0.25s ease-out both; }

@keyframes fadeSlideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.news-card.switch-in {
  animation: fadeSlideInRight 0.2s ease-out both;
}

/* ===== Card Content ===== */
.news-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.news-card-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.news-card-source {
  font-size: 10.5px;
  color: var(--text3);
}

.news-card-source::before {
  content: '·';
  margin-right: 5px;
}

.news-card-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  transition: color 0.15s;
  letter-spacing: -0.15px;
}

.news-card-summary {
  font-size: 12.5px;
  color: var(--text2);
  margin-top: 5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
}

/* ===== Loading ===== */
.loading-wrap {
  text-align: center;
  padding: 20px;
  color: var(--text3);
  font-size: 11px;
}

.skel { display: flex; flex-direction: column; gap: 0; }

.skel-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.skel-item:first-child { border-top: 1px solid var(--border); }

.skel-item .bar {
  height: 13px;
  border-radius: 4px;
  background: var(--border);
  margin-bottom: 9px;
  animation: pulse 1.5s ease-in-out infinite;
}

.skel-item .bar:first-child { width: 16%; height: 11px; margin-bottom: 10px; }
.skel-item .bar:nth-child(2) { width: 90%; }
.skel-item .bar:nth-child(3) { width: 64%; }
.skel-item .bar:nth-child(4) { width: 20%; height: 11px; }

@keyframes pulse {
  0%, 100% { opacity: 0.06; }
  50% { opacity: 0.18; }
}

/* ===== Empty ===== */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text3);
  font-size: 13px;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 24px 20px 32px;
  color: var(--text3);
  font-size: 10.5px;
  border-top: 1px solid var(--border);
}

footer .name { font-weight: 600; color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px 3px; }
  .logo { font-size: 20px; }
  .nav-wrap { padding: 0 16px; }
  .nav-primary button { padding: 4px 14px; font-size: 12px; }
  .nav-primary button::after { left: 14px; right: 14px; height: 2px; }
  .nav-secondary-scroll { padding: 6px 0 8px; }
  .nav-secondary button { font-size: 11px; padding: 2px 10px; }
  main { padding: 12px 16px; }
  .news-card { padding: 14px 0; }
  .news-card-title { font-size: 15px; }
}
