@font-face {
  font-family: "TwitterChirp";
  src: url("./fonts/Chirp-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "TwitterChirp";
  src: url("./fonts/Chirp-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "TwitterChirp";
  src: url("./fonts/Chirp-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f7f9f9;
  --surface-hover: #f7f9f9;
  --border: #eff3f4;
  --border-strong: #cfd9de;
  --text: #0f1419;
  --muted: #536471;
  --muted-2: #8b98a5;
  --link: #1d9bf0;
  --summary: #0f1419;
  --summary-bg: #f7f9f9;
  --summary-border: #dbe3e7;
  --cn-text: #536471;
  --original-bg: #eef3f4;
  --radius: 16px;
  --shell-width: 1360px;
  --rail-width: 440px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: TwitterChirp, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
}

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

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, var(--rail-width));
  max-width: var(--shell-width);
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
}

.month-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.month-button:hover,
.day-button:hover {
  background: var(--surface-hover);
}
.content-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.content-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.calendar-dropdown {
  position: relative;
  flex: 0 0 auto;
}

.content-header-date-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--link);
  cursor: pointer;
}

.content-header-date-button:hover {
  background: #eef6fd;
}

.content-header-date {
  color: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 32px));
}

.calendar-panel {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(15, 20, 25, 0.12);
}

.month-bar,
.section-title-row,
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.month-label,
.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.month-subtitle,
.section-meta,
.page-summary {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-top: 14px;
}

.weekday {
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

.day-button {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.day-button.has-entry {
  background: rgba(29, 155, 240, 0.12);
  color: var(--link);
  font-weight: 600;
}

.day-button.no-entry {
  background: #f3f5f7;
  color: #b8c2cc;
}

.day-button.selected {
  background: var(--link);
  color: #fff;
  font-weight: 700;
}

.day-button.outside {
  opacity: 1;
  background: #ffffff;
  color: #b8c2cc;
}

.content-shell {
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(29, 155, 240, 0.1);
  color: var(--link);
  font-size: 13px;
  font-weight: 600;
}

.meta-chip.subtle {
  background: var(--surface-alt);
  color: var(--muted);
}

.cards-grid {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.detail-rail {
  height: 100vh;
  padding: 16px;
  background: var(--bg);
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.detail-rail-scroll {
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  padding-bottom: 72px;
}

.detail-rail-scroll .detail-panel {
  flex: 1 0 auto;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}

.detail-panel-secondary {
  margin-top: 16px;
}

.sources-toggle-btn {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 99;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 20, 25, 0.08), 0 1px 3px rgba(15, 20, 25, 0.05);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sources-toggle-btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 20, 25, 0.12), 0 2px 4px rgba(15, 20, 25, 0.06);
  border-color: var(--border-strong);
}

.sources-toggle-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(15, 20, 25, 0.08);
}

.sources-toggle-icon {
  color: var(--muted);
  transition: color 0.2s ease;
}

.sources-toggle-btn:hover .sources-toggle-icon {
  color: var(--link);
}

.sources-popover {
  position: absolute;
  bottom: 76px;
  right: 24px;
  width: 392px;
  max-width: calc(100% - 48px);
  z-index: 100;
  
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              visibility 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sources-popover.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.sources-popover .detail-panel-secondary {
  margin-top: 0;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 12px 36px rgba(15, 20, 25, 0.16), 0 4px 12px rgba(15, 20, 25, 0.08);
  border-color: var(--border-strong);
  scrollbar-width: thin;
}

.detail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.detail-language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.detail-language-button {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
}

.detail-language-button.is-active {
  background: var(--surface-alt);
  color: var(--text);
}

.detail-title {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
}

.detail-summary-card {
  position: relative;
  min-height: 220px;
  padding-bottom: 16px;
  transform-style: preserve-3d;
  transition: transform 240ms ease;
}

.detail-summary-card.is-en {
  transform: rotateY(180deg);
}

.detail-summary-face {
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-summary-face-back {
  transform: rotateY(180deg);
}

/* 当显示中文时，中文面 relative 撑开高度，英文面 absolute */
.detail-summary-card.is-zh .detail-summary-face:not(.detail-summary-face-back) {
  position: relative;
}
.detail-summary-card.is-zh .detail-summary-face-back {
  position: absolute;
  inset: 0;
}

/* 当显示英文时，英文面 relative 撑开高度，中文面 absolute */
.detail-summary-card.is-en .detail-summary-face:not(.detail-summary-face-back) {
  position: absolute;
  inset: 0;
}
.detail-summary-card.is-en .detail-summary-face-back {
  position: relative;
}

.detail-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-bullets {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.detail-bullets-cn {
  color: var(--cn-text);
}

.detail-bullet {
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

.detail-bullets-cn .detail-bullet {
  color: var(--cn-text);
}

.detail-summary-divider {
  height: 1px;
  background: var(--border);
}

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

.detail-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.source-group {
  display: grid;
  gap: 10px;
}

.source-group + .source-group {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.source-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
}

.source-group-count {
  font-size: 10px;
  color: var(--muted);
}

.source-inline-list {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

#sourceXList {
  display: block;
}

.source-inline-link {
  color: inherit;
}

.source-inline-link:hover {
  color: var(--link);
}

.source-inline-separator {
  color: var(--muted-2);
}

.source-more-button {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 11px;
  cursor: pointer;
}

.source-more-button:hover {
  color: var(--link);
}

.detail-source-footnote {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  font-weight: 500;
}

.detail-source-footnote a {
  color: inherit;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: none;
  }

  .content-shell {
    border-right: 0;
  }

  .detail-rail {
    height: auto;
    border-top: 1px solid var(--border);
  }
}

.digest-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.digest-card:hover {
  background: var(--surface-hover);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.avatar {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  background-size: cover;
  background-position: center;
}

.avatar.initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.profile-block {
  min-width: 0;
}

.profile-name {
  display: inline-block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.profile-name:hover,
.card-link:hover {
  color: var(--link);
  text-decoration: underline;
}

.profile-identity,
.profile-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 60px;
}

.card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
}

.card-title-separator {
  color: var(--muted-2);
  font-weight: 400;
}

.card-title-en {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted-2);
}

.x-original-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--original-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.summary-block {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--original-bg);
  color: var(--text);
}

.summary-label {
  margin-bottom: 6px;
  color: var(--summary);
  font-size: 12px;
  font-weight: 600;
}

.summary-text,
.card-copy {
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.translation-copy {
  color: var(--cn-text);
  font-size: 15px;
  font-weight: 400;
}

.original-english-copy {
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 4px;
}

.summary-text {
  color: var(--cn-text);
}

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

.card-media {
  display: grid;
  gap: 10px;
}

.card-previews {
  display: grid;
  gap: 10px;
}

.card-image {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #ffffff;
  justify-self: start;
}

.preview-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-alt);
  color: var(--text);
}

.preview-card:hover {
  background: #f2f5f7;
  text-decoration: none;
}

.preview-card-tweet {
  background: #ffffff;
  border-color: var(--border-strong);
}

.preview-content,
.preview-meta {
  display: grid;
  gap: 6px;
}

.preview-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.preview-image {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.preview-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.preview-author,
.preview-title {
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
}

.preview-handle,
.preview-footer,
.preview-description,
.preview-date,
.preview-dot {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.preview-author,
.preview-handle,
.preview-date {
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-text {
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card-link {
  color: var(--link);
  font-size: 14px;
  font-weight: 500;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-rail {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .content-shell {
    height: auto;
    border-right: 0;
    overflow: visible;
  }

  .cards-grid {
    overflow: visible;
  }

  .detail-rail {
    height: auto;
    overflow: visible;
  }

  .detail-rail-scroll {
    height: auto;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 640px) {
  .content-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-body {
    padding-left: 0;
  }

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