/* ==========================================================================
   HOTKOREA Material Design 3 Design Tokens (M3 Expressive Tonal Palette)
   Version: 1.5.1
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Light Theme Tokens
   -------------------------------------------------------------------------- */
:root, [data-theme="light"] {
  color-scheme: light;

  /* Primary Tonal Palette */
  --md-sys-color-primary: #ba1a1a;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #ffdad6;
  --md-sys-color-on-primary-container: #410002;
  --md-sys-color-primary-fixed: #ffdad6;
  --md-sys-color-primary-fixed-dim: #ffb4ab;
  --md-sys-color-on-primary-fixed: #410002;

  /* Secondary Tonal Palette */
  --md-sys-color-secondary: #775653;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #ffdad6;
  --md-sys-color-on-secondary-container: #2c1513;

  /* Tertiary Tonal Palette */
  --md-sys-color-tertiary: #006689;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #c2e8ff;
  --md-sys-color-on-tertiary-container: #001e2c;

  /* Error Tonal Palette */
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;

  /* Surface & Background Levels */
  --md-sys-color-surface: #fdf8f8;
  --md-sys-color-surface-dim: #ded8d8;
  --md-sys-color-surface-bright: #fdf8f8;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f8f2f2;
  --md-sys-color-surface-container: #f2ecec;
  --md-sys-color-surface-container-high: #ece6e6;
  --md-sys-color-surface-container-highest: #e6e0e0;
  --md-sys-color-on-surface: #1c1b1f;
  --md-sys-color-on-surface-variant: #49454f;

  /* Outline & Borders */
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;

  /* Inverse */
  --md-sys-color-inverse-surface: #313033;
  --md-sys-color-inverse-on-surface: #f4eff4;
  --md-sys-color-inverse-primary: #ffb4ab;

  /* Shadows & Scrim */
  --md-sys-color-shadow: rgba(0, 0, 0, 0.12);
  --md-sys-color-scrim: rgba(0, 0, 0, 0.38);

  /* PRO / VIP Badges */
  --badge-vip-gold: #735a00;
  --badge-vip-gold-container: #ffe088;
  --badge-vip-gold-on-container: #241a00;
  --badge-vip-gradient: linear-gradient(135deg, #ffe088 0%, #ffc83b 100%);

  /* Top Bar Scrolled Elevation */
  --topbar-scrolled-bg: rgba(242, 236, 236, 0.88);
  --topbar-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);

  /* Korea Media Stance Spectrum Palette */
  --stance-con: #004ea2;     /* 保守派 Conservative (e.g. 朝鲜日报, 中央日报) */
  --stance-prog: #e30613;    /* 进步派 Progressive (e.g. 韩民族日报, 京乡新闻) */
  --stance-pub: #00873c;     /* 公营 Public (e.g. KBS, 韩联社) */
  --stance-biz: #ff9900;     /* 财经 Business/Economy (e.g. 每日经济, 韩国经济) */

  /* Media Classification Badges */
  --media-badge-national-bg: rgba(0, 78, 162, 0.1);
  --media-badge-national-text: #004ea2;
  --media-badge-national-border: rgba(0, 78, 162, 0.25);

  --media-badge-local-bg: rgba(124, 58, 237, 0.1);
  --media-badge-local-text: #6d28d9;
  --media-badge-local-border: rgba(124, 58, 237, 0.25);

  /* Dossier Card Theme Tokens */
  --dossier-card-bg: linear-gradient(180deg, #fff2f1 0%, var(--md-sys-color-surface-container-lowest) 100%);
  --dossier-card-border: rgba(186, 26, 26, 0.28);
  --dossier-card-shadow: 0 4px 20px rgba(186, 26, 26, 0.08);
  --live-dot-color: #ba1a1a;
  --live-dot-pulse: rgba(186, 26, 26, 0.7);

  /* Rank Delta Indicators */
  --rank-up-color: #0f8b44;
  --rank-up-bg: #e6f4ea;
  --rank-down-color: #5f6368;
  --rank-down-bg: #f1f3f4;
  --rank-new-color: #d93025;
  --rank-new-bg: #fce8e6;

  /* Skeleton Loading */
  --skeleton-base: #e0dcdc;
  --skeleton-highlight: #f5f0f0;
}

/* --------------------------------------------------------------------------
   2. Dark Theme Tokens
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  color-scheme: dark;

  /* Primary Tonal Palette */
  --md-sys-color-primary: #ffb4ab;
  --md-sys-color-on-primary: #690005;
  --md-sys-color-primary-container: #93000a;
  --md-sys-color-on-primary-container: #ffdad6;
  --md-sys-color-primary-fixed: #ffdad6;
  --md-sys-color-primary-fixed-dim: #ffb4ab;
  --md-sys-color-on-primary-fixed: #410002;

  /* Secondary Tonal Palette */
  --md-sys-color-secondary: #e7bdb8;
  --md-sys-color-on-secondary: #442927;
  --md-sys-color-secondary-container: #5d3f3c;
  --md-sys-color-on-secondary-container: #ffdad6;

  /* Tertiary Tonal Palette */
  --md-sys-color-tertiary: #7ad0ff;
  --md-sys-color-on-tertiary: #003549;
  --md-sys-color-tertiary-container: #004c68;
  --md-sys-color-on-tertiary-container: #c2e8ff;

  /* Error Tonal Palette */
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-on-error: #690005;
  --md-sys-color-error-container: #93000a;
  --md-sys-color-on-error-container: #ffdad6;

  /* Surface & Background Levels */
  --md-sys-color-surface: #141218;
  --md-sys-color-surface-dim: #141218;
  --md-sys-color-surface-bright: #3b383e;
  --md-sys-color-surface-container-lowest: #0f0d13;
  --md-sys-color-surface-container-low: #1d1b20;
  --md-sys-color-surface-container: #211f26;
  --md-sys-color-surface-container-high: #2b2930;
  --md-sys-color-surface-container-highest: #36343b;
  --md-sys-color-on-surface: #e6e1e5;
  --md-sys-color-on-surface-variant: #cac4d0;

  /* Outline & Borders */
  --md-sys-color-outline: #938f99;
  --md-sys-color-outline-variant: #49454f;

  /* Inverse */
  --md-sys-color-inverse-surface: #e6e1e5;
  --md-sys-color-inverse-on-surface: #313033;
  --md-sys-color-inverse-primary: #ba1a1a;

  /* Shadows & Scrim */
  --md-sys-color-shadow: rgba(0, 0, 0, 0.45);
  --md-sys-color-scrim: rgba(0, 0, 0, 0.65);

  /* PRO / VIP Badges */
  --badge-vip-gold: #ffe088;
  --badge-vip-gold-container: #554200;
  --badge-vip-gold-on-container: #fff1c4;
  --badge-vip-gradient: linear-gradient(135deg, #705800 0%, #a48200 100%);

  /* Top Bar Scrolled Elevation */
  --topbar-scrolled-bg: rgba(33, 31, 38, 0.88);
  --topbar-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);

  /* Korea Media Stance Spectrum Palette */
  --stance-con: #3b82f6;     /* 保守派 */
  --stance-prog: #ef4444;    /* 进步派 */
  --stance-pub: #10b981;     /* 公营 */
  --stance-biz: #f59e0b;     /* 财经 */

  /* Media Classification Badges */
  --media-badge-national-bg: rgba(59, 130, 246, 0.18);
  --media-badge-national-text: #93c5fd;
  --media-badge-national-border: rgba(59, 130, 246, 0.35);

  --media-badge-local-bg: rgba(167, 139, 250, 0.18);
  --media-badge-local-text: #c4b5fd;
  --media-badge-local-border: rgba(167, 139, 250, 0.35);

  /* Dossier Card Theme Tokens */
  --dossier-card-bg: linear-gradient(180deg, rgba(147, 0, 10, 0.28) 0%, var(--md-sys-color-surface-container) 100%);
  --dossier-card-border: rgba(255, 180, 171, 0.25);
  --dossier-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --live-dot-color: #ff5449;
  --live-dot-pulse: rgba(255, 84, 73, 0.7);

  /* Rank Delta Indicators */
  --rank-up-color: #81c995;
  --rank-up-bg: #132d1e;
  --rank-down-color: #9aa0a6;
  --rank-down-bg: #282a2d;
  --rank-new-color: #f28b82;
  --rank-new-bg: #3c1c1b;

  /* Skeleton Loading */
  --skeleton-base: #28262e;
  --skeleton-highlight: #3b3844;
}

/* --------------------------------------------------------------------------
   3. Material Symbols Outlined Icon Specifications
   -------------------------------------------------------------------------- */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  color: inherit;
  fill: currentColor;
  user-select: none;
  flex-shrink: 0;
}

.material-symbols-outlined.icon-filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.material-symbols-outlined.icon-sm {
  font-size: 16px;
}

.material-symbols-outlined.icon-lg {
  font-size: 28px;
}

/* --------------------------------------------------------------------------
   4. Layout & Header Styles
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.top-bar.scrolled {
  background-color: var(--topbar-scrolled-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--topbar-shadow);
  border-bottom-color: transparent;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--md-sys-color-primary);
  text-decoration: none;
  user-select: none;
}

.brand-logo .material-symbols-outlined {
  font-size: 24px;
}

/* Version Chip */
.version-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.3px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  user-select: none;
  vertical-align: middle;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .version-chip {
  background: rgba(255, 180, 171, 0.15);
  color: var(--md-sys-color-primary);
  border-color: rgba(255, 180, 171, 0.3);
}

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

.m3-btn-vip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--badge-vip-gold-container);
  color: var(--badge-vip-gold);
  border: 1px solid var(--badge-vip-gold);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.m3-btn-vip:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.m3-btn-vip:active {
  transform: scale(0.97);
}

.m3-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.m3-icon-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.m3-icon-btn:active {
  transform: scale(0.92);
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}

/* --------------------------------------------------------------------------
   5. Breaking Dossier Section: 突发重大事件时间轴专题卡片 (M3 Standard)
   -------------------------------------------------------------------------- */
.breaking-dossier-section {
  background: var(--dossier-card-bg);
  border: 1px solid var(--dossier-card-border);
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--dossier-card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.breaking-dossier-section:hover {
  box-shadow: 0 8px 24px var(--md-sys-color-shadow);
}

.dossier-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.dossier-badge-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(186, 26, 26, 0.12);
  color: var(--md-sys-color-primary);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border: 1px solid rgba(186, 26, 26, 0.25);
  user-select: none;
}

[data-theme="dark"] .dossier-badge-wrapper {
  background: rgba(255, 180, 171, 0.15);
  color: var(--md-sys-color-primary);
  border-color: rgba(255, 180, 171, 0.3);
}

/* Live Dot 呼吸灯动画 */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live-dot-color);
  display: inline-block;
  animation: pulse-red 1.8s infinite cubic-bezier(0.4, 0, 0.6, 1);
  flex-shrink: 0;
}

@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 var(--live-dot-pulse);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px rgba(186, 26, 26, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(186, 26, 26, 0);
  }
}

.live-badge-text {
  line-height: 1;
}

.dossier-category {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.dossier-actions-inline {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.dossier-title-zh {
  font-size: 19px;
  font-weight: 800;
  color: var(--md-sys-color-on-surface);
  margin: 6px 0 3px 0;
  line-height: 1.35;
  letter-spacing: -0.2px;
}

.dossier-title-ko {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* 核心最新进展提要 (高光高亮展区) */
.dossier-highlight-box {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-left: 4px solid var(--md-sys-color-primary);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.25s ease;
}

.highlight-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--md-sys-color-primary);
  margin-bottom: 4px;
}

.highlight-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

/* 操作区域与展开折叠按钮 */
.dossier-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.m3-btn-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-primary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.2s ease, transform 0.15s ease, color 0.2s ease, border-color 0.2s ease;
}

.m3-btn-text:hover {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: var(--md-sys-color-primary);
}

.m3-btn-text:active {
  transform: scale(0.96);
}

.m3-btn-text .material-symbols-outlined {
  font-size: 18px;
  transition: transform 0.25s ease;
}

/* --------------------------------------------------------------------------
   收起态 (dossier-collapsed) vs 展开态 (dossier-expanded)
   收起时：只展示时间线（时间戳、媒体、阶段、标题、链接），隐藏长篇通报与多行正文
   展开时：展示完整高光通报、韩文副标题与深度摘要
   -------------------------------------------------------------------------- */
.breaking-dossier-section.dossier-collapsed .dossier-highlight-box {
  display: none;
}

.breaking-dossier-section.dossier-collapsed .timeline-summary-zh {
  display: none;
}

.breaking-dossier-section.dossier-collapsed .timeline-title-ko {
  display: none;
}

.breaking-dossier-section.dossier-collapsed .timeline-step-item {
  padding-bottom: 14px;
}

.breaking-dossier-section.dossier-expanded .dossier-highlight-box {
  display: block;
  animation: timeline-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.breaking-dossier-section.dossier-expanded .timeline-summary-zh {
  display: block;
  animation: timeline-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.breaking-dossier-section.dossier-expanded .timeline-title-ko {
  display: block;
  animation: timeline-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   6. Timeline Stepper: 纵向步进全景时间轴
   -------------------------------------------------------------------------- */
.timeline-container {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--md-sys-color-outline-variant);
  animation: timeline-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes timeline-fade-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.timeline-step-item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 22px;
  border-left: 2px solid var(--md-sys-color-outline-variant);
  margin-left: 8px;
}

.timeline-step-item:last-child {
  border-left-color: transparent;
  padding-bottom: 4px;
}

/* 步进节点圆点 */
.timeline-node-dot {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--md-sys-color-outline);
  border: 2px solid var(--md-sys-color-surface);
  transition: all 0.2s ease;
  z-index: 2;
}

/* 首位最新节点 (光晕呼吸红点) */
.timeline-step-item.latest .timeline-node-dot {
  background: #ba1a1a;
  border-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(186, 26, 26, 0.25);
  animation: pulse-node 2s infinite ease-in-out;
}

[data-theme="dark"] .timeline-step-item.latest .timeline-node-dot {
  background: #ff5449;
  border-color: #141218;
  box-shadow: 0 0 0 4px rgba(255, 84, 73, 0.35);
}

@keyframes pulse-node {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.3);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(186, 26, 26, 0.08);
  }
}

/* 时间轴主体内容排版 */
.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.timeline-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface-variant);
}

.timeline-time-badge .material-symbols-outlined {
  font-size: 14px;
}

/* 媒体来源分类徽章 (全国大报 vs 地方台) */
.media-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.2;
}

.media-badge.national {
  background: var(--media-badge-national-bg);
  color: var(--media-badge-national-text);
  border: 1px solid var(--media-badge-national-border);
}

.media-badge.local {
  background: var(--media-badge-local-bg);
  color: var(--media-badge-local-text);
  border: 1px solid var(--media-badge-local-border);
}

/* 阶段进程标签 (如 [紧急逮捕]、[反转自首/识破]) */
.stage-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  letter-spacing: 0.2px;
}

.stage-badge.arrest {
  background: rgba(186, 26, 26, 0.1);
  color: var(--md-sys-color-primary);
  border-color: rgba(186, 26, 26, 0.25);
}

/* 双语标题与摘要排版 */
.timeline-title-zh {
  font-size: 15px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin: 0;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.timeline-title-ko {
  font-size: 12px;
  font-weight: 400;
  color: var(--md-sys-color-outline);
  margin: 0;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.timeline-summary-zh {
  font-size: 13px;
  line-height: 1.55;
  color: var(--md-sys-color-on-surface-variant);
  margin: 2px 0 4px 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 外链直达按钮 */
.timeline-source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--md-sys-color-tertiary);
  text-decoration: none;
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all 0.2s ease;
}

.timeline-source-link:hover {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  border-color: var(--md-sys-color-tertiary);
  text-decoration: none;
}

.timeline-source-link .material-symbols-outlined {
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   7. M3 Segmented Buttons (Rank Tabs)
   -------------------------------------------------------------------------- */
.m3-segmented-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 20px;
  background: var(--md-sys-color-surface-container);
  padding: 4px;
  border-radius: 9999px;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 10px 8px;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.tab-btn:hover:not(.active) {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.tab-btn.active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.tab-btn .material-symbols-outlined {
  font-size: 18px;
}

@media (max-width: 600px) {
  .m3-segmented-tabs {
    padding: 3px;
    gap: 2px;
  }
  .tab-btn {
    font-size: 12px;
    padding: 8px 4px;
    gap: 3px;
  }
  .tab-btn .material-symbols-outlined {
    font-size: 16px;
  }
  .dossier-title-zh {
    font-size: 17px;
  }
  .timeline-step-item {
    padding-left: 22px;
  }
}

/* --------------------------------------------------------------------------
   8. News Cards & Ranking Delta Badges
   -------------------------------------------------------------------------- */
.card {
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--md-sys-color-shadow);
  border-color: var(--md-sys-color-outline);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.badge-heat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--md-sys-color-outline);
}

/* Rank Delta Indicators */
.rank-delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
}

.rank-delta-up {
  color: var(--rank-up-color);
  background-color: var(--rank-up-bg);
}

.rank-delta-down {
  color: var(--rank-down-color);
  background-color: var(--rank-down-bg);
}

.rank-delta-new {
  color: var(--rank-new-color);
  background-color: var(--rank-new-bg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* AI Insight Pill Button in Card Header / Action Bar */
.m3-btn-ai-insight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.m3-btn-ai-insight:hover {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-color: var(--md-sys-color-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px var(--md-sys-color-shadow);
}

.m3-btn-ai-insight:active {
  transform: scale(0.96);
}

.m3-btn-ai-insight .material-symbols-outlined {
  font-size: 15px;
  color: inherit;
}

/* --------------------------------------------------------------------------
   9. Media Stance Spectrum Styles
   -------------------------------------------------------------------------- */
.stance-spectrum-wrapper {
  margin: 12px 0;
  padding: 8px 12px;
  background: var(--md-sys-color-surface-container);
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.stance-spectrum-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 6px;
  font-weight: 500;
}

.stance-spectrum-bar {
  display: flex;
  height: 8px;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--md-sys-color-surface-container-high);
}

.stance-segment {
  height: 100%;
  transition: width 0.3s ease;
  position: relative;
}

.stance-segment.con { background-color: var(--stance-con); }
.stance-segment.prog { background-color: var(--stance-prog); }
.stance-segment.pub { background-color: var(--stance-pub); }
.stance-segment.biz { background-color: var(--stance-biz); }

.stance-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 11px;
}

.stance-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--md-sys-color-on-surface-variant);
}

.stance-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stance-dot.con { background-color: var(--stance-con); }
.stance-dot.prog { background-color: var(--stance-prog); }
.stance-dot.pub { background-color: var(--stance-pub); }
.stance-dot.biz { background-color: var(--stance-biz); }

/* --------------------------------------------------------------------------
   10. Proper Nouns & Floating Tooltip Bubble
   -------------------------------------------------------------------------- */
.proper-noun {
  border-bottom: 1.5px dashed var(--md-sys-color-tertiary);
  cursor: help;
  color: var(--md-sys-color-on-surface);
  transition: color 0.15s ease, border-color 0.15s ease;
  font-weight: 500;
}

.proper-noun:hover {
  color: var(--md-sys-color-tertiary);
  border-bottom-color: var(--md-sys-color-primary);
}

.m3-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 300px;
  padding: 10px 14px;
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 8px 24px var(--md-sys-color-shadow);
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1), transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(4px);
  opacity: 0;
}

.m3-tooltip:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   11. M3 Skeleton Pulsing Animation
   -------------------------------------------------------------------------- */
@keyframes m3-skeleton-pulse {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.skeleton-card {
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
}

.skeleton-box {
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-highlight) 37%, var(--skeleton-base) 63%);
  background-size: 400% 100%;
  animation: m3-skeleton-pulse 1.4s ease infinite;
  border-radius: 6px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-line.title {
  height: 22px;
  width: 85%;
  border-radius: 8px;
  margin-bottom: 12px;
}

.skeleton-line.subtitle {
  height: 18px;
  width: 65%;
  margin-bottom: 16px;
}

.skeleton-badge {
  height: 20px;
  width: 110px;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   12. M3 Native Dialog & Modals
   -------------------------------------------------------------------------- */
.m3-dialog {
  border: none;
  border-radius: 28px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  padding: 24px;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: 0 16px 40px var(--md-sys-color-shadow);
  margin: auto;
}

.m3-dialog::backdrop {
  background: var(--md-sys-color-scrim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.m3-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.m3-dialog-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.m3-dialog-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
}

.m3-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.m3-btn-filled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 9999px;
  border: none;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.m3-btn-filled:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.m3-btn-tonal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 9999px;
  border: none;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.m3-btn-tonal:hover {
  background: var(--md-sys-color-surface-container-highest);
}

/* --------------------------------------------------------------------------
   13. AI Insight Modal & Analytical Framework Styling
   -------------------------------------------------------------------------- */
.ai-insight-dialog {
  max-width: 680px;
  width: calc(100% - 32px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 28px;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  overflow: hidden;
}

.ai-sparkle-icon {
  color: var(--md-sys-color-primary);
  animation: sparkle-glow 2.5s ease-in-out infinite;
}

@keyframes sparkle-glow {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.15) rotate(15deg);
    opacity: 1;
    filter: drop-shadow(0 0 6px var(--md-sys-color-primary));
  }
}

.ai-insight-scroll-area {
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
  overscroll-behavior: contain;
}

.insight-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--md-sys-color-on-surface);
}

.insight-section-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.insight-section-header .material-symbols-outlined {
  color: var(--md-sys-color-primary);
  font-size: 18px;
}

/* 1. Bilingual Comparison Box */
.bilingual-card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bilingual-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lang-tag {
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
}

.bilingual-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  line-height: 1.4;
}

.bilingual-desc {
  font-size: 12.5px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.5;
}

.bilingual-divider {
  height: 1px;
  background: var(--md-sys-color-outline-variant);
  opacity: 0.6;
}

/* 2. Context Deconstruction Card */
.insight-context-card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 16px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
}

.insight-context-card p {
  margin: 0 0 10px 0;
}
.insight-context-card p:last-child {
  margin-bottom: 0;
}

/* 3. Impact Matrix Grid */
.impact-matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.impact-card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.impact-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.impact-card-title .material-symbols-outlined {
  font-size: 16px;
  color: var(--md-sys-color-primary);
}

.impact-card-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--md-sys-color-on-surface-variant);
}

.ai-insight-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  margin-top: auto;
}

/* Mobile Bottom Sheet Drawer adaptation */
@media (max-width: 600px) {
  .ai-insight-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    margin: auto auto 0 auto;
    border-radius: 28px 28px 0 0;
    padding: 20px 16px 16px 16px;
    border-bottom: none;
    animation: m3-drawer-slide-up 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  }
  .impact-matrix-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes m3-drawer-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   14. M3 SnackBar / Toast Notification System
   -------------------------------------------------------------------------- */
.m3-snackbar-container {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.m3-snackbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  border-radius: 16px;
  font-size: 14px;
  box-shadow: 0 4px 16px var(--md-sys-color-shadow);
  pointer-events: auto;
  animation: m3-snackbar-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes m3-snackbar-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
