/* economist.css — 经济学人页，基于 listening.css 的配色与排版 */
.econ { --econ-red: #e3120b; width: min(1120px, 92vw); margin: 0 auto; }

/* ---------- 首屏：本期概览 ---------- */
.econ-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); align-items: center; gap: 40px; padding: 64px 0 48px; }
.econ-hero h1 { margin: 0; font: 700 clamp(36px, 4.6vw, 58px)/1.22 var(--serif, "Noto Serif SC"), serif; letter-spacing: -0.5px; }
.econ-hero .intro-lede { max-width: 560px; margin: 16px 0 26px; font-size: 15px; line-height: 1.85; }
.issue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.issue-actions .primary-link { gap: 10px; border: 0; cursor: pointer; }
.issue-actions .primary-link:disabled { opacity: 0.5; cursor: progress; }
.resume-link { max-width: 100%; overflow: hidden; padding: 11px 16px; border: 1px solid var(--listen-line); border-radius: 8px; color: var(--listen-green); background: var(--listen-glass); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; transition: border-color 0.2s, transform 0.2s; }
.resume-link:hover { border-color: var(--listen-green); transform: translateY(-1px); }
.resume-link[hidden] { display: none; }

.issue-card { position: relative; padding: 22px 22px 18px; border: 1px solid var(--listen-line); border-radius: 22px; background: var(--listen-glass); box-shadow: var(--listen-shadow); backdrop-filter: blur(14px); overflow: hidden; }
.issue-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--econ-red); }
.issue-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.issue-kicker { color: var(--econ-red); font: 700 11px "IBM Plex Mono", monospace; letter-spacing: 0.2em; }
.issue-picker select { max-width: 220px; padding: 7px 30px 7px 12px; border: 1px solid var(--listen-line); border-radius: 999px; color: var(--listen-ink); background: var(--listen-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 12px; font-size: 13px; appearance: none; cursor: pointer; }
.issue-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 16px; }
.issue-stats dt { color: var(--listen-muted); font-size: 11px; }
.issue-stats dd { margin: 3px 0 0; font: 700 19px "Space Grotesk", "Noto Sans SC", sans-serif; }
.issue-progress { height: 5px; border-radius: 5px; background: var(--listen-line); overflow: hidden; }
.issue-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--econ-red), var(--listen-coral)); transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.issue-note { margin: 14px 0 0; color: var(--listen-muted); font-size: 11px; line-height: 1.6; }

/* ---------- 目录 ---------- */
.econ-library { padding: 34px 0 60px; border-top: 1px solid var(--listen-line); scroll-margin-top: 96px; }
.econ-library .section-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.econ-search { flex: 0 1 320px; }
.section-chips { display: flex; gap: 8px; margin: 22px 0 8px; padding-bottom: 6px; overflow-x: auto; scrollbar-width: none; }
.section-chips::-webkit-scrollbar { display: none; }
.section-chip { display: inline-flex; flex: none; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--listen-line); border-radius: 999px; color: var(--listen-muted); background: var(--listen-glass); font-size: 12.5px; transition: color 0.2s, background-color 0.2s, border-color 0.2s; }
.section-chip small { color: var(--listen-muted); font: 10.5px "IBM Plex Mono", monospace; opacity: 0.8; }
.section-chip:hover { color: var(--listen-ink); border-color: var(--listen-blue); }
.section-chip.active { color: #fff; background: var(--listen-ink); border-color: var(--listen-ink); }
.section-chip.active small { color: inherit; }
:root[data-theme="dark"] .section-chip.active { color: var(--listen-bg); }

.toc { display: grid; gap: 8px; }
.toc-group { padding-top: 22px; }
.toc-group-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 10px; border-bottom: 2px solid var(--listen-ink); }
.toc-group-head h3 { margin: 0; font: 700 18px var(--serif, "Noto Serif SC"), serif; }
.toc-group-head span { color: var(--econ-red); font: 600 11px "IBM Plex Mono", monospace; letter-spacing: 0.06em; text-transform: uppercase; }
.toc-group-head small { margin-left: auto; color: var(--listen-muted); font-size: 11.5px; }
.toc-list { margin: 0; padding: 0; list-style: none; }
.toc-item { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--listen-line); }
.toc-row { display: grid; flex: 1; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-width: 0; padding: 14px 10px 14px 6px; border: 0; border-radius: 12px; color: inherit; background: none; text-align: left; transition: background-color 0.2s ease; }
.toc-row:hover { background: color-mix(in srgb, var(--listen-blue) 9%, transparent); }
.toc-row:focus-visible { outline: 2px solid var(--listen-blue); outline-offset: -2px; }
.toc-text { display: grid; gap: 3px; min-width: 0; }
.toc-text strong { font: 600 15px/1.45 "Space Grotesk", "Noto Sans SC", sans-serif; }
.toc-text small { color: var(--listen-muted); font-size: 12.5px; line-height: 1.5; }
.toc-duration { color: var(--listen-muted); font: 12px "IBM Plex Mono", monospace; }
.toc-link { flex: none; padding: 6px 10px; border-radius: 8px; color: var(--listen-muted); font-size: 11.5px; opacity: 0; transition: opacity 0.2s, color 0.2s; }
.toc-item:hover .toc-link, .toc-link:focus-visible { opacity: 1; }
.toc-link:hover { color: var(--econ-red); }
@media (hover: none) { .toc-link { opacity: 1; } }
.toc-status { display: grid; place-items: center; width: 26px; height: 26px; }
.toc-row:hover .toc-status:empty::before { content: ""; border-width: 6px 0 6px 10px; border-style: solid; border-color: transparent transparent transparent var(--listen-green); }
.toc-done { color: #2fae6e; font-weight: 700; }
.toc-partial { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(var(--listen-green) calc(var(--p) * 1%), var(--listen-line) 0); -webkit-mask: radial-gradient(circle, transparent 4.5px, #000 5px); mask: radial-gradient(circle, transparent 4.5px, #000 5px); }
.toc-item.is-played .toc-text strong { color: var(--listen-muted); }
.toc-item.is-playing .toc-row { background: color-mix(in srgb, var(--listen-blue) 13%, transparent); }
.toc-item.is-playing .toc-text strong { color: var(--listen-green); }
.eq { display: inline-flex; align-items: end; gap: 2px; height: 14px; }
.eq i { width: 3px; height: 100%; border-radius: 2px; background: var(--listen-green); transform-origin: bottom; animation: eq-bounce 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
body:not(.is-audio-playing) .eq i { animation-play-state: paused; transform: scaleY(0.4); }
@keyframes eq-bounce { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }

.toc-skeleton { display: grid; gap: 12px; padding-top: 22px; }
.toc-skeleton i { height: 54px; border-radius: 12px; background: linear-gradient(90deg, var(--listen-line), color-mix(in srgb, var(--listen-line) 40%, transparent), var(--listen-line)); background-size: 200% 100%; animation: skeleton 1.4s ease-in-out infinite; }
@keyframes skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.econ .empty-message { padding: 40px 0; color: var(--listen-muted); text-align: center; }
.econ .empty-message a { color: var(--listen-green); text-decoration: underline; }
.econ footer { padding-bottom: 28px; }
body.has-player .econ footer { padding-bottom: 120px; }

/* ---------- 底部播放条 ---------- */
.econ-player { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 40; width: min(980px, calc(100vw - 24px)); border: 1px solid var(--listen-line); border-radius: 20px; background: color-mix(in srgb, var(--listen-bg) 82%, transparent); box-shadow: 0 24px 60px rgba(12, 20, 34, 0.18); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%); transform: translateX(-50%); overflow: hidden; animation: player-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.econ-player[hidden] { display: none; }
@keyframes player-in { from { opacity: 0; transform: translate(-50%, 24px); } }
.econ-seek { --p: 0%; display: block; width: 100%; height: 14px; margin: -5px 0 -5px; background: transparent; appearance: none; cursor: pointer; }
.econ-seek::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, var(--econ-red, #e3120b) var(--p), var(--listen-line) var(--p)); }
.econ-seek::-moz-range-track { height: 4px; background: linear-gradient(90deg, #e3120b var(--p), var(--listen-line) var(--p)); }
.econ-seek::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 50%; background: #e3120b; opacity: 0; appearance: none; transition: opacity 0.2s; }
.econ-seek::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #e3120b; }
.econ-player:hover .econ-seek::-webkit-slider-thumb, .econ-seek:focus-visible::-webkit-slider-thumb { opacity: 1; }
.econ-player-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.6fr); align-items: center; gap: 16px; padding: 10px 16px 12px; }
.econ-player-meta { display: grid; gap: 1px; min-width: 0; }
.econ-player-section { color: #e3120b; font: 700 10.5px "IBM Plex Mono", monospace; letter-spacing: 0.08em; }
.econ-player-meta strong { overflow: hidden; font: 600 14px/1.4 "Space Grotesk", "Noto Sans SC", sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.econ-player-time { color: var(--listen-muted); font: 11px "IBM Plex Mono", monospace; }
.econ-player-controls { display: flex; align-items: center; gap: 6px; }
.econ-player-controls button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; color: var(--listen-ink); background: transparent; transition: background-color 0.2s, transform 0.2s; }
.econ-player-controls button:hover { background: color-mix(in srgb, var(--listen-ink) 8%, transparent); }
.econ-player-controls button:active { transform: scale(0.9); }
.econ-player-controls svg { width: 20px; height: 20px; }
.econ-player-controls .econ-play { width: 48px; height: 48px; color: #fff; background: var(--listen-ink); box-shadow: 0 8px 20px rgba(12, 20, 34, 0.22); }
:root[data-theme="dark"] .econ-player-controls .econ-play { color: var(--listen-bg); }
.econ-player-controls .econ-play:hover { background: var(--listen-ink); transform: scale(1.06); }
.econ-play .i-pause, .econ-player.is-playing .econ-play .i-play { display: none; }
.econ-player.is-playing .econ-play .i-pause { display: block; }
.econ-player-extra { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.econ-rate, .econ-article { padding: 6px 11px; border: 1px solid var(--listen-line); border-radius: 999px; color: var(--listen-muted); background: transparent; font: 600 12px "IBM Plex Mono", "Noto Sans SC", monospace; transition: color 0.2s, border-color 0.2s; }
.econ-rate { min-width: 52px; }
.econ-rate:hover, .econ-article:hover { color: var(--listen-ink); border-color: var(--listen-ink); }

@media (max-width: 900px) {
  .econ-hero { grid-template-columns: 1fr; gap: 26px; padding-top: 44px; }
  .issue-card { max-width: 560px; }
}
@media (max-width: 620px) {
  .econ { width: 90vw; }
  .econ-hero { padding: 32px 0 30px; }
  .econ-search { flex-basis: 100%; }
  .toc-row { grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
  .toc-duration { grid-column: 2; font-size: 11px; }
  .toc-link { display: none; }
  /* 手机上播放条贴在底部导航上方 */
  .econ-player { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 16px); border-radius: 16px; }
  .econ-player-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px 10px 10px; }
  .econ-player-controls [data-prev], .econ-player-controls [data-next] { display: none; }
  .econ-player-controls .econ-play { width: 42px; height: 42px; }
  /* 手机底部有固定导航栏，页脚留出同样的高度，否则最后两行被盖住、链接点不到 */
  .econ footer { padding-bottom: 74px; }
  body.has-player .econ footer { padding-bottom: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  .econ-player, .eq i, .toc-skeleton i { animation: none; }
}

/* ---------- v36：离线下载 ---------- */
.offline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--listen-line); font-size: 12px; }
.offline-row[hidden] { display: none; }
.offline-row span { flex: 1; min-width: 140px; color: var(--listen-muted); }
.offline-row button { padding: 5px 11px; border: 1px solid var(--listen-line); border-radius: 999px; background: transparent; color: var(--listen-ink); font-size: 11.5px; transition: border-color .2s, color .2s; }
.offline-row button:hover:not(:disabled) { border-color: var(--listen-ink); }
.offline-row button:disabled { color: var(--listen-muted); cursor: default; }
.offline-row [data-offline-clear][data-confirm] { color: var(--econ-red, #e3120b); border-color: currentColor; }
.toc-dl { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; color: var(--listen-muted); background: transparent; transition: color .2s, background-color .2s; }
.toc-dl svg { width: 17px; height: 17px; }
.toc-dl:hover { color: var(--listen-ink); background: color-mix(in srgb, var(--listen-ink) 7%, transparent); }
.toc-dl[data-state="idle"] { opacity: .55; }
.toc-item:hover .toc-dl[data-state="idle"], .toc-dl:focus-visible { opacity: 1; }
.toc-dl[data-state="queued"] { color: var(--listen-blue); }
.toc-dl[data-state="done"] { color: #2fae6e; }
.toc-dl[data-confirm] { color: var(--econ-red, #e3120b); background: color-mix(in srgb, #e3120b 10%, transparent); }
.toc-dl[data-confirm] svg { display: none; }
.toc-dl[data-confirm]::before { content: "删"; font-size: 12px; font-weight: 700; }
.dl-ring { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(var(--listen-green) calc(var(--dl, 0) * 1%), var(--listen-line) 0); -webkit-mask: radial-gradient(circle, transparent 5px, #000 5.5px); mask: radial-gradient(circle, transparent 5px, #000 5.5px); }
.toc-dl[data-indeterminate] .dl-ring { background: conic-gradient(var(--listen-green) 25%, var(--listen-line) 0); animation: dlSpin 1s linear infinite; }
@keyframes dlSpin { to { transform: rotate(360deg); } }
.toc-dl-section { margin-left: 10px; padding: 3px 9px; border: 1px solid var(--listen-line); border-radius: 999px; color: var(--listen-muted); background: transparent; font-size: 11px; transition: color .2s, border-color .2s; }
.toc-dl-section:hover { color: var(--listen-ink); border-color: var(--listen-ink); }
@media (hover: none) { .toc-dl[data-state="idle"] { opacity: .8; } }

/* ---------- v36：连播与睡眠定时 ---------- */
.econ-player-extra { flex-wrap: wrap; }
.econ-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border: 1px solid var(--listen-line); border-radius: 999px; color: var(--listen-muted); background: transparent; font: 600 12px "IBM Plex Mono", "Noto Sans SC", monospace; white-space: nowrap; transition: color .2s, border-color .2s, background-color .2s; }
.econ-chip svg { width: 14px; height: 14px; }
.econ-chip:hover { color: var(--listen-ink); border-color: var(--listen-ink); }
.econ-chip.is-on { color: var(--listen-ink); border-color: color-mix(in srgb, var(--listen-blue) 60%, var(--listen-line)); background: color-mix(in srgb, var(--listen-blue) 14%, transparent); }
[data-sleep].is-on { font-variant-numeric: tabular-nums; }
body.has-player .toast-note { bottom: 112px; }
@media (max-width: 620px) {
  /* 手机上把连播、定时、倍速放到第二行，原文链接收起 */
  .econ-player-extra { display: flex; grid-column: 1 / -1; justify-content: flex-start; gap: 6px; padding-top: 2px; }
  .econ-player-extra .econ-article { display: none; }
  .econ-chip, .econ-rate { padding: 4px 10px; font-size: 11px; }
  body.has-player .econ footer { padding-bottom: 230px; }
  body.has-player .toast-note { bottom: calc(190px + env(safe-area-inset-bottom, 0px)); }
  .toc-dl-section { margin-left: 0; }
  .toc-group-head { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .toc-dl .dl-ring { animation: none; } }
/* 对比度：红色栏目名在浅色播放条与深色背景上都要达到 4.5:1 */
.econ-player-section { color: #c40f09; }
:root[data-theme="dark"] .econ { --econ-red: #ff6b61; }
:root[data-theme="dark"] .econ-player-section { color: #ff6b61; }

/* ---------- v37：交互动效 ---------- */
/* 下载进度环平滑走动（注册成数字后渐变才能过渡） */
@property --dl { syntax: "<number>"; inherits: true; initial-value: 0; }
.toc-dl { transition: color .2s, background-color .2s, opacity .2s, --dl .35s linear; }
.toc-dl.just-done svg { animation: dlDone .5s var(--fx-spring, ease) both; }
@keyframes dlDone { from { opacity: 0; transform: scale(.3) rotate(-30deg); } }
.toc-dl[data-state="queued"] svg { animation: fx-fade .3s ease both; }
.toc-dl[data-confirm]::before { animation: dlDone .3s var(--fx-spring, ease) both; }

/* 播放 / 暂停图标互相旋转缩放切换，而不是硬切 */
.econ-player-controls .econ-play svg { grid-area: 1 / 1; display: block; transition: opacity .18s ease, transform .42s var(--fx-spring, ease); }
.econ-play .i-pause, .econ-player.is-playing .econ-play .i-play { display: block; opacity: 0; transform: scale(.4) rotate(-60deg); }
.econ-player.is-playing .econ-play .i-pause { opacity: 1; transform: none; }
.econ-player.is-playing .econ-play { box-shadow: 0 8px 20px rgba(12, 20, 34, .22), 0 0 0 0 color-mix(in srgb, var(--listen-blue) 45%, transparent); animation: playRing 3.2s ease-out infinite; }
@keyframes playRing { 70%, 100% { box-shadow: 0 8px 20px rgba(12, 20, 34, .22), 0 0 0 10px transparent; } }

/* 小按钮：按下回弹，开启时轻轻放大 */
.econ-chip, .econ-rate { transition: color .2s, border-color .2s, background-color .2s, transform .35s var(--fx-spring, ease); }
.econ-chip:active, .econ-rate:active { transform: scale(.92); }
.econ-chip.just-picked { animation: chipOn .4s var(--fx-spring, ease); }
@keyframes chipOn { 40% { transform: scale(1.08); } }
[data-sleep].is-on svg { animation: moonGlow 3.2s ease-in-out infinite; }
@keyframes moonGlow { 50% { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--listen-blue) 80%, transparent)); transform: rotate(-12deg); } }

/* 栏目筛选：当前栏目按钮弹一下 */
.section-chip { transition: color .2s, background-color .2s, border-color .2s, transform .35s var(--fx-spring, ease); }
.section-chip:active { transform: scale(.94); }
.section-chip.active.just-picked { animation: chipOn .4s var(--fx-spring, ease); }

/* 本期进度条与播放进度：用弹簧收尾 */
.toc-item { transition: background-color .25s ease; }
.toc-item.is-playing .toc-row { transition: background-color .35s ease; }

@media (prefers-reduced-motion: reduce) {
  .toc-dl.just-done svg, .toc-dl[data-state="queued"] svg, .toc-dl[data-confirm]::before,
  .econ-player.is-playing .econ-play, .econ-chip.just-picked, [data-sleep].is-on svg, .section-chip.active.just-picked { animation: none; }
  .econ-player-controls .econ-play svg, .toc-dl { transition: none; }
}
