:root {
  --paper: #f3efe6;
  --paper-deep: #ece6d9;
  --card: #fbf8f1;
  --ink: #18160f;
  --ink-2: #3f3a2f;
  --body: #4d473b;
  --muted: #7b7363;
  --faint: #a69d8b;
  --line: rgba(24, 22, 15, 0.14);
  --line-soft: rgba(24, 22, 15, 0.08);
  --accent: #9d3626;
  --accent-soft: #f1e2dc;
  --tech: #2f5d50;
  --economy: #8a5a1f;
  --politics: #8c2f1f;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(24, 22, 15, 0.04), 0 24px 50px -36px rgba(24, 22, 15, 0.28);
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 52% -12%, rgba(255, 252, 244, 0.95) 0%, rgba(255, 252, 244, 0) 62%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: #fff8ee;
}

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

button {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.36'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 0 44px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--accent);
  color: #fdf8ee;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  transform: rotate(-2deg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-kicker {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.3em;
}

.brand-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 26px;
}

.top-date {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.top-date #todayWeekday {
  color: var(--faint);
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 19px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fbf6ea;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.refresh-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.refresh-btn:active {
  transform: translateY(0);
}

.refresh-btn:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
}

.refresh-icon {
  width: 15px;
  height: 15px;
}

.refresh-btn.is-loading .refresh-icon {
  animation: spin 1s linear infinite;
}

/* ---------- hero ---------- */

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 48px;
  padding: 62px 0 42px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
}

.eyebrow-rule {
  display: inline-block;
  width: 34px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(64px, 7.4vw, 94px);
  font-weight: 600;
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.hero-sub {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.hero-meta {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding-bottom: 6px;
  text-align: right;
}

.hero-date {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 0.86;
}

.hero-day {
  font-family: Georgia, var(--serif);
  font-size: 58px;
  font-weight: 400;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.hero-month {
  margin-top: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.hero-caption {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.9;
  letter-spacing: 0.03em;
  white-space: pre-line;
}

/* ---------- section nav ---------- */

.section-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -44px;
  padding: 0 44px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(243, 239, 230, 0.9);
  backdrop-filter: blur(14px) saturate(1.2);
}

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 21px 19px 19px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color 0.25s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab::after {
  content: "";
  position: absolute;
  right: 19px;
  bottom: -1px;
  left: 19px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.28s cubic-bezier(0.22, 0.7, 0.24, 1);
}

.tab.is-active {
  color: var(--ink);
  font-weight: 600;
}

.tab.is-active::after {
  transform: scaleX(1);
}

.tab-count {
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.5;
  text-align: center;
}

.tab.is-active .tab-count {
  border-color: rgba(157, 54, 38, 0.3);
  color: var(--accent);
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.nav-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

/* ---------- layout ---------- */

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 352px;
  gap: 62px;
  padding: 46px 0 92px;
}

.feed-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 9px;
}

.section-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.feed-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.section-desc {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.03em;
}

.section-count {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- stories ---------- */

.story-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.story {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 18px;
  padding: 30px 14px 29px;
  margin: 0 -14px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 10px;
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 42ms);
  transition: background 0.3s ease;
}

.story:hover {
  background: rgba(255, 253, 247, 0.52);
}

.rank {
  padding-top: 2px;
  color: #b6ad9b;
  font-family: Georgia, var(--serif);
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.story:nth-child(-n + 3) .rank {
  color: var(--accent);
}

.story:hover .rank {
  color: var(--ink);
}

.story-main {
  min-width: 0;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.story-source {
  color: var(--ink-2);
  font-weight: 600;
}

.story-region {
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(24, 22, 15, 0.045);
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.story-carry {
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(138, 90, 31, 0.1);
  color: var(--economy);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.meta-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.story-title {
  margin: 8px 0 9px;
  padding: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 2.15vw, 25px);
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.012em;
}

.story-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}

.story-toggle:hover > span:first-child {
  color: var(--accent);
}

.story-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.chev {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 7px;
  color: var(--faint);
  transition: transform 0.3s ease, color 0.3s ease;
}

.story-toggle:hover .chev {
  color: var(--accent);
}

.story.is-expanded .chev {
  transform: rotate(180deg);
  color: var(--accent);
}

.story-summary,
.story-impact {
  max-width: 72ch;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  transition: color 0.25s ease;
}

.story-summary {
  color: var(--body);
  font-size: 14px;
  line-height: 1.86;
  letter-spacing: 0.012em;
}

.story-impact {
  margin-top: 11px;
  padding-left: 13px;
  border-left: 2px solid rgba(157, 54, 38, 0.55);
  color: #71503f;
  font-size: 13px;
  line-height: 1.8;
}

.impact-label {
  display: inline-block;
  margin-right: 7px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  vertical-align: 1px;
}

.story.is-expanded .story-summary,
.story.is-expanded .story-impact {
  display: block;
  overflow: visible;
  animation: reveal 0.32s ease both;
}

.story-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 13px;
}

.story-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.like-btn svg {
  width: 13px;
  height: 13px;
}

.like-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.like-btn.is-liked {
  border-color: rgba(157, 54, 38, 0.32);
  background: var(--accent-soft);
  color: var(--accent);
}

.favorite-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.favorite-btn svg {
  width: 12px;
  height: 12px;
}

.favorite-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.favorite-btn.is-favorited {
  border-color: rgba(138, 90, 31, 0.3);
  background: rgba(138, 90, 31, 0.1);
  color: var(--economy);
}

.favorite-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.like-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.region-block + .region-block {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.region-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 2px;
}

.region-head h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.region-head span {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.region-empty {
  margin: 0;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 11px;
}

.region-short {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.source-link:hover {
  border-bottom-color: var(--accent);
}

.source-link .arrow {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.source-link:hover .arrow {
  transform: translate(2px, -2px);
}

.chars {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

/* ---------- rail ---------- */

.rail {
  position: sticky;
  top: 96px;
  align-self: start;
}

.panel {
  padding: 25px 24px 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-kicker {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.26em;
}

.panel h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper-deep);
}

.seg-btn {
  padding: 5px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.seg-btn.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(24, 22, 15, 0.1);
}

.period-caption {
  margin: 14px 0 5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.ai-note {
  display: inline-flex;
  align-items: center;
  margin: 0 0 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(157, 54, 38, 0.08);
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.ai-note[data-method="llm"] {
  background: rgba(47, 93, 80, 0.1);
  color: var(--tech);
}

.period-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.period-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.period-item:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.p-rank {
  padding-top: 1px;
  color: var(--faint);
  font-family: Georgia, var(--serif);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.p-link {
  display: block;
  min-width: 0;
}

.p-title {
  display: block;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  transition: color 0.2s ease;
}

.p-link:hover .p-title {
  color: var(--accent);
}

.p-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.p-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 8.5px;
  font-style: normal;
  letter-spacing: 0.08em;
}

.p-tag.tech {
  background: rgba(47, 93, 80, 0.1);
  color: var(--tech);
}

.p-tag.ai {
  background: rgba(62, 77, 125, 0.11);
  color: #3e4d7d;
}

.p-tag.economy {
  background: rgba(138, 90, 31, 0.1);
  color: var(--economy);
}

.p-tag.politics {
  background: rgba(140, 47, 31, 0.09);
  color: var(--politics);
}

.period-empty {
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.method-panel {
  margin-top: 17px;
  padding-bottom: 20px;
}

.method-copy {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.85;
}

.stats {
  display: grid;
  gap: 0;
  margin: 17px 0 0;
  border-top: 1px solid var(--line-soft);
}

.stats > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.stats dt {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.stats dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 10.5px;
  text-align: right;
}

.status-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--faint);
  vertical-align: 1px;
}

.status-dot.is-ok {
  background: #487a5e;
}

.status-dot.is-stale {
  background: #b0813c;
}

.status-dot.is-error {
  background: var(--accent);
}

.fineprint {
  margin: 13px 0 0;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.75;
}

/* ---------- empty / footer / toast ---------- */

.empty-state {
  padding: 64px 20px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.empty-mark {
  margin: 0 0 8px;
  color: var(--faint);
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
}

.empty-state p {
  margin: 0 auto 18px;
  max-width: 340px;
  color: var(--muted);
  font-size: 12px;
}

.ghost-btn {
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.favorites-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.favorites-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.favorites-btn svg {
  width: 14px;
  height: 14px;
}

.favorites-btn em {
  min-width: 17px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0;
  text-align: center;
}

.settings-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.3s ease;
}

.settings-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(20deg);
}

.settings-btn svg {
  width: 16px;
  height: 16px;
}

.settings-popover {
  position: absolute;
  top: 54px;
  right: 0;
  z-index: 60;
  width: 326px;
  max-height: min(76vh, 640px);
  overflow-y: auto;
  padding: 18px 19px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 1px 3px rgba(24, 22, 15, 0.2);
  transition: transform 0.25s ease;
}

.switch input:checked + i {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + i::after {
  transform: translateX(16px);
}

.setting-hint {
  margin: 11px 0 0;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.7;
}

.settings-divider {
  height: 1px;
  margin: 15px 0 13px;
  background: var(--line-soft);
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10.5px;
}

.account-row strong {
  color: var(--ink);
  font-weight: 600;
}

.account-row button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 9.5px;
  cursor: pointer;
}

.family-list {
  margin-top: 8px;
  max-height: 108px;
  overflow-y: auto;
}

.family-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 25px;
  color: var(--muted);
  font-size: 10.5px;
}

.family-item .role {
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0.05em;
}

.family-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-actions {
  display: inline-flex;
  gap: 7px;
}

.family-actions button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 8.5px;
  cursor: pointer;
}

.family-actions button:hover {
  text-decoration: underline;
}

.family-create {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  margin-top: 9px;
}

.family-create input {
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 10px;
  outline: none;
}

.family-create input:focus {
  border-color: var(--accent);
}

.family-create button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--accent);
  font-size: 9.5px;
  cursor: pointer;
}

.family-create button:hover {
  border-color: var(--accent);
}

.settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.source-tools {
  display: inline-flex;
  gap: 8px;
}

.source-tools button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 9.5px;
  cursor: pointer;
}

.source-tools button:hover {
  text-decoration: underline;
}

.source-list {
  max-height: 262px;
  margin-top: 8px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 27px;
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
}

.source-item:hover {
  color: var(--ink);
}

.source-item input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.source-item .source-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-item .source-lang {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.05em;
}

body.drawer-open {
  overflow: hidden;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(24, 22, 15, 0.28);
  backdrop-filter: blur(3px);
}

.favorites-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(460px, 100vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px -30px rgba(24, 22, 15, 0.45);
  transform: translateX(102%);
  transition: transform 0.38s cubic-bezier(0.22, 0.7, 0.24, 1);
}

.favorites-drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 27px 26px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.drawer-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.drawer-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.drawer-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.favorites-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 26px 34px;
  overscroll-behavior: contain;
}

.favorite-item {
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--line-soft);
}

.favorite-item.is-locked {
  padding-left: 12px;
  border-left: 2px solid var(--accent);
}

.favorite-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.favorite-title {
  display: block;
  margin: 8px 0 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

a.favorite-title:hover {
  color: var(--accent);
}

.favorite-summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.favorite-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
}

.favorite-lock,
.favorite-delete {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.favorite-lock:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.favorite-lock.is-locked {
  border-color: rgba(157, 54, 38, 0.3);
  background: var(--accent-soft);
  color: var(--accent);
}

.favorite-delete:hover:not(:disabled) {
  border-color: #8c2f1f;
  color: #8c2f1f;
}

.favorite-delete:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.favorite-source {
  margin-left: auto;
  color: var(--accent);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.favorites-empty {
  padding: 70px 10px;
  color: var(--muted);
  text-align: center;
}

.favorites-empty p {
  margin: 5px 0;
  font-size: 11px;
  line-height: 1.8;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 20% 15%, rgba(157, 54, 38, 0.08), transparent 32%),
    var(--paper);
}

.auth-card {
  width: min(420px, 100%);
  padding: 34px 32px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: var(--ink);
}

.auth-brand .brand-seal {
  width: 34px;
  height: 34px;
  font-size: 19px;
}

.auth-brand strong {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.auth-eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.auth-card h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.auth-lead {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.auth-field {
  display: block;
  margin-bottom: 14px;
}

.auth-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 10.5px;
  letter-spacing: 0.05em;
}

.auth-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(157, 54, 38, 0.08);
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
}

.auth-remember input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.auth-switch {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.auth-switch:hover {
  text-decoration: underline;
}

.auth-error {
  margin: 4px 0 12px;
  color: var(--accent);
  font-size: 11px;
  line-height: 1.6;
}

.auth-submit {
  width: 100%;
  height: 44px;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fbf6ea;
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.auth-submit:hover {
  background: var(--accent);
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-foot {
  margin: 18px 0 0;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.8;
}

.favorites-empty .empty-mark {
  color: var(--faint);
  font-family: var(--serif);
  font-size: 36px;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 100;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fbf6ea;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
  box-shadow: 0 18px 40px -18px rgba(24, 22, 15, 0.5);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  background: var(--accent);
}

/* ---------- skeleton ---------- */

.story.skeleton {
  animation: none;
}

.sk {
  display: block;
  border-radius: 4px;
  background: linear-gradient(100deg, rgba(24, 22, 15, 0.055) 20%, rgba(24, 22, 15, 0.1) 40%, rgba(24, 22, 15, 0.055) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}

.sk-rank {
  width: 26px;
  height: 22px;
  margin-top: 4px;
}

.sk-meta {
  width: 34%;
  height: 8px;
  margin-bottom: 13px;
}

.sk-title {
  width: 86%;
  height: 20px;
  margin-bottom: 13px;
}

.sk-line {
  width: 94%;
  height: 11px;
  margin-bottom: 7px;
}

.sk-line.short {
  width: 58%;
}

/* ---------- animation ---------- */

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

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -40% 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.feed-panel.is-switching .story-list,
.period-panel.is-switching .period-list {
  animation: fadeSwap 0.28s ease both;
}

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr) 326px;
    gap: 44px;
  }

  .hero h1 {
    letter-spacing: -0.04em;
  }
}

@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .rail {
    position: static;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 18px;
    align-items: start;
  }

  .method-panel {
    margin-top: 0;
  }

  .period-item {
    padding: 11px 0;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 0 22px;
  }

  .section-nav {
    margin: 0 -22px;
    padding: 0 14px;
  }

  .top-date {
    display: none;
  }

  .hero {
    padding: 44px 0 32px;
    gap: 24px;
  }

  .hero h1 {
    font-size: clamp(52px, 12vw, 72px);
  }

  .hero-day {
    font-size: 46px;
  }

  .nav-meta {
    display: none;
  }

  .tab {
    padding: 18px 15px 16px;
  }

  .tab::after {
    right: 15px;
    left: 15px;
  }

  .content-grid {
    padding-top: 34px;
  }

  .rail {
    grid-template-columns: 1fr;
  }

  .method-panel {
    margin-top: 0;
  }

  .story {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    padding: 25px 10px 24px;
    margin: 0 -10px;
  }

  .rank {
    font-size: 22px;
  }

  .story-title {
    font-size: 20px;
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 0 17px;
  }

  .topbar {
    min-height: 76px;
  }

  .top-actions {
    gap: 10px;
  }

  .favorites-btn span {
    display: none;
  }

  .favorites-btn {
    padding: 0 10px;
  }

  .settings-popover {
    right: 0;
    width: 300px;
  }

  .brand-seal {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }

  .brand-kicker {
    font-size: 7.5px;
  }

  .brand-name {
    font-size: 15px;
  }

  .refresh-btn {
    height: 38px;
    padding: 0 15px;
    font-size: 11.5px;
  }

  .section-nav {
    margin: 0 -17px;
    padding: 0 7px;
  }

  .tab {
    padding: 16px 12px 14px;
    font-size: 12.5px;
  }

  .tab::after {
    right: 12px;
    left: 12px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 36px 0 26px;
  }

  .hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    text-align: left;
  }

  .hero-date {
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
  }

  .hero-day {
    font-size: 30px;
  }

  .hero-month {
    margin: 0;
    font-size: 9px;
  }

  .hero-caption {
    font-size: 10px;
    line-height: 1.7;
  }

  .hero-sub {
    margin-top: 14px;
    font-size: 12px;
  }

  .eyebrow {
    margin-bottom: 15px;
    font-size: 8px;
  }

  .feed-head h2 {
    font-size: 23px;
  }

  .story {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
  }

  .rank {
    font-size: 19px;
  }

  .story-title {
    font-size: 18.5px;
  }

  .story-summary {
    font-size: 13.5px;
  }

  .story-impact {
    font-size: 12.5px;
  }

  .panel {
    padding: 22px 20px 18px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-bottom: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body.no-animation *,
body.no-animation *::before,
body.no-animation *::after {
  animation: none !important;
  transition: none !important;
}
