/* HN-inspired modern design */
:root {
  --hn-orange: #ff6600;
  --hn-bg: #f6f6ef;
  --hn-border: #e6e6df;
  --card-border: rgba(0, 0, 0, 0.04);
  --card-shadow: 0 6px 18px rgba(0,0,0,0.05);
  --card-radius: 12px;
  --text-primary: #222;
  --text-secondary: #555;
  --text-muted: #7a7a7a;
  --link-color: #111;
  --shadow: 0 2px 4px rgba(0,0,0,0.05);
  --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(240, 243, 255, 0.016));
  --glass-bg-scrolled: linear-gradient(140deg, rgba(255, 255, 255, 0.08), rgba(240, 243, 255, 0.028));
  --glass-border-color: rgba(255, 255, 255, 0.1);
  --glass-border-color-scrolled: rgba(255, 255, 255, 0.32);
  --logo-gradient: linear-gradient(135deg, #ffb066 0%, #ff7200 48%, #d74a00 100%);
  --glow-text-strong: 0 4px 12px rgba(255, 102, 0, 0.35), 0 0 18px rgba(255, 140, 0, 0.25);
  --glow-text-soft: 0 2px 8px rgba(255, 102, 0, 0.32), 0 0 12px rgba(255, 170, 64, 0.2);
  --nav-pill-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  --nav-pill-bg-hover: linear-gradient(135deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.16));
  --nav-pill-bg-active: linear-gradient(135deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.2));
  --nav-pill-border: rgba(255, 102, 0, 0.35);
  --nav-pill-border-hover: rgba(255, 102, 0, 0.55);
  --nav-pill-border-active: rgba(255, 102, 0, 0.65);
  --nav-pill-shadow: 0 0 0 3px rgba(255, 102, 0, 0.08), 0 10px 22px -16px rgba(255, 102, 0, 0.24);
  --nav-pill-shadow-hover: 0 0 0 4px rgba(255, 102, 0, 0.16), 0 14px 30px -16px rgba(255, 102, 0, 0.32);
  --nav-pill-shadow-active: 0 0 0 4px rgba(255, 102, 0, 0.22), 0 16px 32px -16px rgba(255, 102, 0, 0.36);
  --glass-shadow: 0 3px 12px -6px rgba(15, 23, 42, 0.24), 0 10px 28px -14px rgba(15, 23, 42, 0.2), 0 32px 40px -30px rgba(15, 23, 42, 0.16);
  --glass-shadow-scrolled: 0 8px 22px -10px rgba(15, 23, 42, 0.32), 0 22px 48px -18px rgba(15, 23, 42, 0.28), 0 34px 82px -34px rgba(15, 23, 42, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  font-size: 16px;
  background: var(--hn-bg);
  color: var(--text-primary);
  line-height: 1.65;
  letter-spacing: 0.01em;
}

/* Header */
.header {
  --glass-x: 50%;
  --glass-y: 50%;
  --glass-tilt-x: 0deg;
  --glass-tilt-y: 0deg;
  --glass-blur: 4px;
  background: var(--glass-bg);
  color: var(--hn-orange);
  padding: 8px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(var(--glass-blur)) saturate(125%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(125%);
  border-bottom: 1px solid var(--glass-border-color);
  box-shadow: var(--glass-shadow);
  isolation: isolate;
  overflow: hidden;
  transform: perspective(1400px) rotateX(var(--glass-tilt-x)) rotateY(var(--glass-tilt-y));
  transform-style: preserve-3d;
  transition:
    border-bottom-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.2s ease,
    background 0.25s ease;
}

.header::before,
.header::after {
  content: "";
  position: absolute;
  inset: -32px;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.header::before {
  inset: -12px -20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    linear-gradient(180deg, rgba(235, 245, 255, 0.06), rgba(245, 248, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-bottom-color: rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.32);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(255, 255, 255, 0.14),
    0 14px 28px -26px rgba(15, 23, 42, 0.28);
  opacity: 0.7;
  z-index: -2;
  mask-image: radial-gradient(120% 130% at 50% 45%, rgba(0,0,0,1) 0%, rgba(0,0,0,0.8) 55%, rgba(0,0,0,0.2) 80%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: radial-gradient(120% 130% at 50% 45%, rgba(0,0,0,1) 0%, rgba(0,0,0,0.8) 55%, rgba(0,0,0,0.2) 80%, rgba(0,0,0,0) 100%);
}

.header::after {
  inset: -42%;
  background:
    radial-gradient(200px 220px at var(--glass-x) var(--glass-y),
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.12) 28%,
      rgba(255, 255, 255, 0) 68%),
    radial-gradient(260px 280px at calc(var(--glass-x) + 12%) calc(var(--glass-y) + 6%),
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0) 62%),
    linear-gradient(to bottom,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.06) 32%,
      rgba(255, 255, 255, 0) 68%),
    linear-gradient(to top,
      rgba(15, 23, 42, 0.28) 0%,
      rgba(15, 23, 42, 0.14) 30%,
      rgba(15, 23, 42, 0.02) 56%,
      rgba(15, 23, 42, 0) 70%);
  filter: blur(18px) contrast(106%);
  mix-blend-mode: soft-light;
  opacity: 0.55;
  z-index: -1;
  mask-image: radial-gradient(130% 150% at 50% 38%, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.6) 45%, rgba(0,0,0,0.05) 78%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: radial-gradient(130% 150% at 50% 38%, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.6) 45%, rgba(0,0,0,0.05) 78%, rgba(0,0,0,0) 100%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .header {
    background: rgba(255, 255, 255, 0.92);
    color: var(--hn-orange);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transform: none;
    border-bottom-color: rgba(0, 0, 0, 0.06);
  }

  .header::before,
  .header::after {
    content: none;
  }

  .header .nav a,
  .header .nav button {
    color: white;
    background: rgba(255,255,255,0.12);
    border: none;
  }

  .header .nav a:hover,
  .header .nav button:hover {
    background: rgba(255,255,255,0.24);
  }

  .header .nav a.active,
  .header .nav button.active {
    background: rgba(255,255,255,0.3);
  }

  .header .menu-toggle {
    background: rgba(255,255,255,0.12);
    color: white;
    border: none;
  }

  .header .menu-toggle:hover {
    background: rgba(255,255,255,0.24);
  }

  .header .menu-toggle:focus-visible {
    outline: 2px solid rgba(255,255,255,0.6);
  }
}

.header.scrolled {
  box-shadow: var(--glass-shadow-scrolled);
  background: var(--glass-bg-scrolled);
  border-bottom-color: var(--glass-border-color-scrolled);
}

.header.scrolled::before {
  opacity: 1;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.14)),
    linear-gradient(165deg, rgba(235, 245, 255, 0.18), rgba(245, 248, 255, 0.05));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2),
    0 22px 52px -38px rgba(15, 23, 42, 0.42);
}

.header.scrolled::after {
  opacity: 0.62;
  background:
    radial-gradient(210px 230px at var(--glass-x) var(--glass-y),
      rgba(255, 255, 255, 0.42) 0%,
      rgba(255, 255, 255, 0.16) 30%,
      rgba(255, 255, 255, 0) 68%),
    radial-gradient(280px 300px at calc(var(--glass-x) + 14%) calc(var(--glass-y) + 8%),
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0) 64%),
    linear-gradient(to bottom,
      rgba(15, 23, 42, 0.1) 0%,
      rgba(15, 23, 42, 0.16) 34%,
      rgba(15, 23, 42, 0.04) 62%,
      rgba(15, 23, 42, 0) 100%),
    linear-gradient(to top,
      rgba(15, 23, 42, 0.32) 0%,
      rgba(15, 23, 42, 0.18) 30%,
      rgba(15, 23, 42, 0.05) 56%,
      rgba(15, 23, 42, 0) 76%);
}

.header-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-header .header-content {
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: nowrap;
}

.detail-header .site-title {
  order: 0;
  margin-left: 0;
  flex-shrink: 0;
}

.detail-header .nav {
  order: 1;
  margin-left: auto;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  -webkit-overflow-scrolling: touch;
}

.detail-header .nav::-webkit-scrollbar {
  display: none;
}

.site-title {
  font-size: clamp(17px, 2.5vw, 22px);
  font-weight: bold;
  margin: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  color: var(--hn-orange);
  text-shadow: var(--glow-text-strong);
}

.site-title-link,
.site-title-link:visited,
.site-title-link:hover,
.site-title-link:active {
  color: var(--hn-orange);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  text-shadow: var(--glow-text-strong);
}

.header a.site-title-link {
  color: inherit;
}

.site-title-link:hover {
  opacity: 1;
  text-decoration: none;
}

.site-title:hover {
  opacity: 1;
  text-decoration: none;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .site-title,
  .site-title-link,
  .site-title-link:visited,
  .site-title-link:hover,
  .site-title-link:active {
    color: transparent;
    background: var(--logo-gradient);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.nav.nav-return {
  justify-content: flex-start;
  margin-left: 0;
}

.detail-header .nav.nav-return {
  margin-left: auto;
  justify-content: flex-end;
}

.nav a,
.nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--hn-orange);
  font-family: inherit;
  font-size: 14px;
  background: var(--nav-pill-bg);
  border: 1px solid var(--nav-pill-border);
  box-shadow: var(--nav-pill-shadow);
  text-shadow: var(--glow-text-soft);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: var(--hn-orange);
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
}

.menu-toggle:active {
  transform: scale(0.96);
}

.menu-toggle:focus-visible {
  outline: 2px solid rgba(255, 102, 0, 0.65);
  outline-offset: 2px;
}

.menu-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 14px;
}

.menu-icon span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav a:hover,
.nav a:focus-visible,
.nav button:hover,
.nav button:focus-visible {
  background: var(--nav-pill-bg-hover);
  border-color: var(--nav-pill-border-hover);
  box-shadow: var(--nav-pill-shadow-hover);
  text-decoration: none;
}

.nav a.active,
.nav button.active {
  background: var(--nav-pill-bg-active);
  border-color: var(--nav-pill-border-active);
  box-shadow: var(--nav-pill-shadow-active);
  font-weight: bold;
}

/* Container */
.page-container {
  max-width: 960px;
  margin: 8px auto;
  padding: 0;
  background: transparent;
  min-height: calc(100vh - 110px);
}

/* Story Detail Container - 独立白色卡片 */
#story-detail-container {
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.04);
}

/* Controls */
.controls {
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  padding: 6px 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(246,246,239,0.95));
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.035);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

button {
  padding: 4px 9px;
  border: 1px solid rgba(0,0,0,0.08);
  background: white;
  color: var(--text-primary);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  font-family: inherit;
}

button:hover {
  background: rgba(255,102,0,0.1);
  border-color: rgba(255,102,0,0.4);
}

button.active-filter {
  background: var(--hn-orange);
  color: white;
  border-color: var(--hn-orange);
  box-shadow: 0 6px 12px rgba(255,102,0,0.25);
  font-weight: 600;
}

.controls button {
  flex: 0 0 auto;
}

/* More Dropdown Styles */
.more-dropdown {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

.more-btn {
  display: none;
  padding: 4px 12px;
  border: 1px solid rgba(0,0,0,0.08);
  background: white;
  color: var(--text-primary);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.more-btn:hover {
  background: rgba(255,102,0,0.1);
  border-color: rgba(255,102,0,0.4);
}

.more-btn.active-filter {
  background: var(--hn-orange);
  color: white;
  border-color: var(--hn-orange);
  box-shadow: 0 6px 12px rgba(255,102,0,0.25);
  font-weight: 600;
}

.more-menu {
  position: fixed;
  display: none;
  width: max-content;
  max-width: 200px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  background: white;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  padding: 6px;
  z-index: 95;
  flex-direction: column;
  gap: 4px;
  isolation: isolate;
  -webkit-overflow-scrolling: touch;
}

.more-menu.show {
  display: flex;
}

.more-menu button {
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  width: 100%;
  transition: all 0.2s;
}

.more-menu button:hover {
  background: rgba(255,102,0,0.1);
}

.more-menu button.active-filter {
  background: rgba(255,102,0,0.15);
  color: var(--hn-orange);
  font-weight: 600;
  box-shadow: none;
}

/* Stories list */
ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

li {
  margin-bottom: 8px;
}

/* Story Card */
.story-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 6px 12px 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.story-card.similar-card {
  margin-bottom: 14px;
}

.story-card.similar-card:last-child {
  margin-bottom: 0;
}

.story-card.similar-card .card-title {
  margin: 6px 0 10px 0;
}

.story-card.similar-card .card-links {
  gap: 10px;
}

.story-card:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  border-color: rgba(255,102,0,0.28);
}

/* High Score Card (score > 500) */
.story-card.high-score {
  background: linear-gradient(135deg, rgba(255,102,0,0.06), rgba(255,184,109,0.1));
  border-color: rgba(255,102,0,0.24);
}

.story-card.high-score:hover {
  background: linear-gradient(135deg, rgba(255,102,0,0.1), rgba(255,184,109,0.14));
  box-shadow: 0 8px 22px rgba(255,102,0,0.16);
  border-color: rgba(255,102,0,0.4);
}

.story-card.expanded {
  cursor: default;
  box-shadow: 0 14px 32px rgba(255,102,0,0.12);
  border-color: rgba(255,102,0,0.4);
  background: linear-gradient(180deg, #fff, #fff7f0);
  padding: 12px 16px 16px 16px;
}

/* Card Header - 辅助信息 */
.card-header {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  flex-wrap: wrap;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.card-header-item {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-header-score .score-link {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: var(--hn-orange);
  text-decoration: none;
}

.card-header-score .score-link:hover {
  color: #ff7a1a;
  text-decoration: underline;
}

.card-header-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.header-discuss-link {
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

.header-discuss-link:hover {
  color: var(--hn-orange);
  border-bottom-color: rgba(255,102,0,0.5);
}

/* Classification Tags */
.classification-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 9px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,184,109,0.12);
  color: #b85a02;
  border: 1px solid rgba(255,184,109,0.28);
  text-decoration: none;
  flex: 0 0 auto;
  opacity: 0.75;
}

.classification-tag:hover {
  background: rgba(255,184,109,0.26);
  border-color: #ff9800;
  opacity: 1;
}

.classification-tag.classification-topic {
  background: rgba(227,242,253,0.7);
  color: #1c64b7;
  border: 1px solid rgba(144,202,249,0.6);
  opacity: 0.8;
}

.classification-tag.classification-topic:hover {
  background: #bbdefb;
  border-color: #1565c0;
  opacity: 1;
}

.classification-tag.classification-facet {
  background: rgba(243,229,245,0.7);
  color: #71248e;
  border: 1px solid rgba(206,147,216,0.6);
  opacity: 0.8;
}

.classification-tag.classification-facet:hover {
  background: #e1bee7;
  border-color: #6a1b9a;
  opacity: 1;
}

/* Tag 类型（不是 topic 也不是 facet）才有透明度 */
.classification-tag:not(.classification-topic):not(.classification-facet) {
  opacity: 0.7;
}

.classification-tag:not(.classification-topic):not(.classification-facet):hover {
  opacity: 1;
}

.card-header .domain-link {
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.2s;
}

.card-header .domain-link:hover {
  color: var(--hn-orange);
  border-bottom-color: rgba(255,102,0,0.5);
}

/* Card Title - 主视觉焦点 */
.card-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.4;
  margin: 6px 0 4px 0;
}

.story-card.expanded .card-title {
  font-size: 19px;
  line-height: 1.5;
  margin: 8px 0 6px 0;
}

.card-title .emoji {
  margin-right: 3px;
}

.story-title-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
  border-bottom: 1px dashed transparent;
  padding-bottom: 2px;
  display: inline-block;
}

.story-title-link:hover {
  color: var(--hn-orange);
  text-decoration: none;
  border-bottom-color: rgba(255,102,0,0.6);
}

/* Sarcastic Question - 次要吸引点 */
.card-sarcastic {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 6px;
  opacity: 0.9;
  line-height: 1.45;
}

.story-card.expanded .card-sarcastic {
  font-size: 15px;
  line-height: 1.55;
}

.card-sarcastic::before {
  content: "💭 ";
}

/* Card Actions - 底部操作栏 */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.04);
}

.card-links a:hover {
  background: rgba(255,102,0,0.12);
  color: var(--hn-orange);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}

.card-tags-inline {
  flex-wrap: nowrap;
  overflow: hidden;
  margin-top: 6px;
  max-width: 100%;
}

.card-tags-inline .classification-tag {
  opacity: 0.7;
}

.card-actions-bottom {
  padding-top: 0;
  margin-top: 0;
  gap: 14px;
  flex-direction: column;
  align-items: flex-start;
}

.card-actions-bottom .card-links {
  gap: 12px;
}

.card-actions-bottom .card-tags {
  margin-top: 0;
}

@media (min-width: 768px) {
  .card-actions {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-tags {
    justify-content: flex-start;
  }

  .card-actions-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Expanded Content Divider */
.card-divider {
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 10px 0;
}

.card-divider-subtle {
  margin: 20px 0 16px 0;
  background: rgba(0,0,0,0.08);
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* AI Summary Content in Expanded Card */
.ai-summary-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  display: grid;
  gap: 10px;
}

.ai-summary-content strong {
  color: var(--hn-orange);
}

.ai-summary-content h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 12px 0 8px 0;
  color: var(--text-primary);
}

.ai-summary-content h3 {
  font-size: 17px;
  font-weight: 650;
  margin: 6px 0 2px 0;
  color: var(--hn-orange);
}

.ai-summary-content p {
  margin: 4px 0 0 0;
}

/* 讨论背景高亮样式 */
.context-highlight {
  background: rgba(255, 102, 0, 0.08);
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--hn-orange);
  margin: 8px 0 !important;
}

.ai-summary-content blockquote {
  background: #fff3e0;
  padding: 6px 10px;
  border-radius: 3px;
  margin: 6px 0;
  font-style: italic;
  color: #e65100;
  border-left: 2px solid #ff9800;
}

.ai-summary-content hr {
  border: none;
  border-top: 1px dashed var(--hn-border);
  margin: 8px 0;
}

.source-span {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.source-span a {
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s;
}

.source-span a:hover {
  color: var(--hn-orange);
  opacity: 1;
}

/* Comment Cards - 复用 story-card 样式 */
.comment-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 14px 16px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.comment-card:hover {
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
  border-color: rgba(255,102,0,0.3);
}

.comment-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 6px 0;
}

/* Pagination */
.pagination {
  margin-top: 24px;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(246,246,239,0.95));
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

#page-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 10px;
}

/* Search & Archive */
.search-box, .archive-box {
  margin-bottom: 20px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(246,246,239,0.95));
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 6px 18px rgba(0,0,0,0.04);
}

.search-box input[type="text"],
.archive-box input[type="date"] {
  padding: 10px 14px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  font-size: 15px;
  width: 320px;
  max-width: 100%;
}

.search-box input[type="text"]:focus,
.archive-box input[type="date"]:focus {
  outline: none;
  border-color: rgba(255,102,0,0.6);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.18);
}

@media (max-width: 1024px) {
  .controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 12px;
    gap: 8px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
  }

  .controls::-webkit-scrollbar {
    height: 6px;
  }

  .controls::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 999px;
  }

  .controls button {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
}

/* Responsive - Tablet */
@media (max-width: 768px) {
  .header {
    overflow: visible;
  }

  .header::before,
  .header::after {
    display: none;
  }

  .header-content {
    position: relative;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .site-title {
    flex: 1;
    min-width: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav.nav-main {
    position: absolute;
    top: calc(100% + 10px);
    right: 10px;
    margin-left: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(0,0,0,0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    width: min(220px, 70vw);
    z-index: 150;
  }

  .nav.nav-main.open {
    display: flex;
  }

  .nav.nav-main a,
  .nav.nav-main button {
    justify-content: flex-start;
    padding: 10px 16px;
  }

  .page-container {
    padding: 0;
    margin: 12px;
  }

  #story-detail-container {
    padding: 18px 16px;
  }

  .controls {
    padding: 12px 10px;
    gap: 10px;
  }

  .search-box input[type="text"],
  .archive-box input[type="date"] {
    width: 100%;
  }

  /* 卡片式布局移动端优化 */
  .card-title {
    font-size: 17px;
    line-height: 1.5;
  }

  .card-sarcastic {
    font-size: 14px;
  }

  .card-header {
    font-size: 12px;
  }

  .ai-summary-content {
    font-size: 15px;
  }

  /* 增大触摸目标 */
  button {
    padding: 10px 16px;
    min-height: 44px;
  }

  .nav button, .nav a {
    padding: 10px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* 分类标签移动端优化 */
  .classification-tag {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
  }

  /* 卡片操作链接移动端优化 */
  .card-actions {
    gap: 10px;
  }

  .card-links a {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
  }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
  .site-title {
    font-size: clamp(18px, 5vw, 22px);
  }

  .header-content {
    padding: 0 10px;
  }

  .page-container {
    padding: 0;
    margin: 10px;
  }

  #story-detail-container {
    padding: 16px 12px;
  }

  .similar-section-card {
    padding: 12px 16px 16px 16px;
  }

  /* 卡片移动端优化 */
  .story-card {
    padding: 12px;
  }

  .card-title {
    font-size: 15px;
    line-height: 1.4;
  }

  .story-card.expanded .card-title {
    font-size: 18px;
    line-height: 1.48;
    margin: 8px 0 6px 0;
  }

  .card-sarcastic {
    font-size: 12px;
    line-height: 1.4;
  }

  .story-card.expanded .card-sarcastic {
    font-size: 14px;
    line-height: 1.5;
  }

  .card-header {
    font-size: 11px;
    gap: 6px;
  }

  .card-links a {
    font-size: 12px;
    padding: 6px 10px;
    min-height: 36px;
  }

  .ai-summary-content {
    font-size: 15px;
    line-height: 1.7;
  }

  /* 热评卡片移动端优化 */
  .comment-card {
    padding: 14px;
  }

  .comment-text {
    font-size: 15px;
    line-height: 1.7;
  }

  /* 分页按钮更紧凑 */
  .pagination {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    justify-content: center;
  }

  .pagination button {
    flex: 0 1 auto;
    min-width: 70px;
    padding: 10px 12px;
    font-size: 13px;
    min-height: 42px;
  }

  #page-info {
    width: 100%;
    text-align: center;
    font-size: 13px;
    order: -1;
    margin-bottom: 4px;
  }

  /* 搜索和归档表单 */
  .search-box, .archive-box {
    padding: 14px;
  }

  .search-box input[type="text"],
  .archive-box input[type="date"] {
    margin-bottom: 10px;
    width: 100%;
    font-size: 16px;
    padding: 12px;
    min-height: 44px;
  }

  .search-box button,
  .archive-box button {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .search-box label,
  .archive-box label {
    display: block;
    margin: 10px 0;
    font-size: 15px;
  }

  /* 分类标签小屏幕优化 */
  .classification-tag {
    padding: 6px 10px;
    font-size: 10px;
    min-height: 30px;
  }

  /* 控制按钮优化 */
  .controls {
    gap: 6px;
  }

  .controls button {
    font-size: 13px;
    padding: 8px 12px;
    min-height: 36px;
  }
}

/* 触摸优化 */
@media (hover: none) {
  /* 移除 hover 时的下划线，用点击反馈代替 */
  a:hover {
    text-decoration: none;
  }

  .controls button:not(.active-filter):hover {
    background: white;
    border-color: rgba(0,0,0,0.1);
  }

  .controls button:not(.active-filter):active {
    background: var(--hn-bg);
    border-color: var(--hn-orange);
    transform: scale(0.98);
  }

  .controls button.active-filter:hover,
  .controls button.active-filter:active {
    background: var(--hn-orange);
    color: white;
    border-color: var(--hn-orange);
    transform: none;
  }

  .title-clickable:active {
    color: var(--hn-orange);
  }
}

/* Loading state */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 16px;
  margin: 0;
}

/* Footer */
.footer {
  background: var(--hn-bg);
  border-top: 1px solid var(--hn-border);
  padding: 24px 12px;
  margin-top: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-slogan {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
  font-style: italic;
  text-align: center;
}

.footer-info {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

.footer-info a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-info a:hover {
  color: var(--hn-orange);
  text-decoration: underline;
}

/* ==================== 相似内容区域 ==================== */
.similar-section-wrapper {
  margin-top: 24px;
  margin-bottom: 24px;
  background: #ffffff;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.04);
  opacity: 0;
  transition: opacity 400ms ease-out;
}

.similar-section-wrapper.visible {
  opacity: 1;
}

.similar-section-card {
  background: linear-gradient(180deg, #fff, #fff7f0);
  border: 1px solid rgba(255, 102, 0, 0.4);
  border-radius: var(--card-radius);
  padding: 12px 16px 16px 16px;
  box-shadow: 0 14px 32px rgba(255, 102, 0, 0.12);
  cursor: default;
}

.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.empty-state-small {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  font-size: 14px;
}

/* 骨架屏容器 */
.skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 骨架屏卡片 */
.skeleton-card {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.04) 40%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 60%,
    rgba(0, 0, 0, 0.04) 100%
  );
  background-size: 200% 100%;
  border-radius: 12px;
  padding: 12px;
  animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-header {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.skeleton-score,
.skeleton-date,
.skeleton-domain {
  height: 14px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}

.skeleton-score {
  width: 40px;
}

.skeleton-date {
  width: 80px;
}

.skeleton-domain {
  width: 100px;
}

.skeleton-title {
  height: 20px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  width: 85%;
}

/* 真实卡片的逐个淡入动画 */
.story-card.similar-card {
  opacity: 0;
  transform: translateY(20px);
}

.story-card.similar-card.animate-in {
  animation: slideUpFadeIn 500ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 减少动画对性能的影响 */
@media (prefers-reduced-motion: reduce) {
  .similar-section-wrapper,
  .skeleton-card,
  .story-card.similar-card {
    animation: none !important;
    transition: none !important;
  }

  .similar-section-wrapper.visible,
  .story-card.similar-card.animate-in {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 768px) {
  .similar-section-wrapper {
    margin-top: 16px;
    margin-bottom: 16px;
  }

  .section-title {
    font-size: 18px;
  }

  .story-card.similar-card {
    padding: 10px 12px;
  }

  .story-card.similar-card .card-links a {
    font-size: 12px;
  }
}
