/* ============================================
   Daily News Monitor — Mobile-First RWD Index
   ============================================ */

:root {
  --c-bg: #f8fafc;
  --c-card: #fff;
  --c-text: #0f172a;
  --c-text-soft: #475569;
  --c-text-mute: #94a3b8;
  --c-link: #0ea5e9;
  --c-border: #e5e7eb;
  --c-accent: #fbbf24;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 18px rgba(0,0,0,0.10);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Microsoft JhengHei",
          "PingFang TC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--c-bg) 0%, #e2e8f0 100%);
  margin: 0;
  color: var(--c-text);
  line-height: 1.6;
  font-size: clamp(14px, 2.4vw, 16px);
}

/* ============ Header ============ */
.site-head {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  padding: clamp(28px, 6vw, 44px) clamp(16px, 4vw, 24px);
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.site-head h1 {
  margin: 0 0 6px;
  font-size: clamp(20px, 5vw, 28px);
  letter-spacing: 0.5px;
}
.site-sub {
  font-size: clamp(12px, 2.6vw, 14px);
  opacity: 0.8;
  margin-bottom: 14px;
}
.site-stat {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(12px, 3vw, 22px);
  font-size: clamp(12px, 2.6vw, 14px);
}
.site-stat b {
  font-size: clamp(15px, 3.8vw, 18px);
  color: var(--c-accent);
  padding: 0 4px;
}

/* ============ Container ============ */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 28px) clamp(14px, 4vw, 20px);
}

/* ============ Filter Bar ============ */
.filter-bar {
  background: #fff;
  border-radius: var(--radius);
  padding: clamp(14px, 3vw, 18px) clamp(16px, 4vw, 22px);
  box-shadow: var(--shadow);
  margin-bottom: clamp(20px, 4vw, 28px);
  position: sticky;
  top: 8px;
  z-index: 10;
}
.filter-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}
.filter-bar-head strong {
  color: var(--c-text);
  font-size: clamp(13px, 3vw, 15px);
}
.clear-btn {
  background: #f1f5f9;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--c-text-soft);
  min-height: 32px;
}
.clear-btn:hover { background: #e2e8f0; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: clamp(12px, 2.5vw, 13px);
  transition: all 0.15s;
  min-height: 32px;
  white-space: nowrap;
}
.tag-btn:hover, .tag-btn:focus {
  background: #e0f2fe;
  border-color: var(--c-link);
  color: #0c4a6e;
}
.tag-btn.active {
  background: var(--c-link);
  color: #fff;
  border-color: #0284c7;
  font-weight: 600;
}
.tag-btn small { opacity: 0.7; }

/* ============ Day Block ============ */
.day-block { margin-bottom: clamp(22px, 5vw, 30px); }
.day-head {
  font-size: clamp(15px, 3.6vw, 18px);
  color: var(--c-text);
  border-left: 5px solid var(--c-link);
  padding-left: 12px;
  margin: 0 0 14px;
}

/* ============ Cards Grid ============ */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(10px, 2vw, 14px);
}
@media (min-width: 600px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--c-card);
  border-radius: var(--radius);
  padding: clamp(14px, 3.5vw, 20px);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: block;
  border: 1px solid transparent;
}
.card:hover, .card:focus {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--c-link);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-th { background: #ddd6fe; color: #5b21b6; }
.badge-ln { background: #bae6fd; color: #075985; }
.badge-other { background: #e5e7eb; color: #374151; }
.card-time {
  font-size: 11px;
  color: var(--c-text-mute);
  font-family: monospace;
  white-space: nowrap;
}

.card-title {
  font-size: clamp(14px, 3vw, 15px);
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 10px;
  line-height: 1.45;
}

.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chip {
  background: #f1f5f9;
  color: var(--c-text-soft);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 22px;
  white-space: nowrap;
}
.chip:hover, .chip:focus {
  background: #fef3c7;
  color: #92400e;
}

/* ============ Section Heads ============ */
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.sec-head h2 {
  margin: 0;
  font-size: clamp(16px, 4vw, 20px);
  color: var(--c-text);
}
.sec-sub {
  font-size: 12px;
  color: var(--c-text-mute);
}

/* ============ Category Overview ============ */
.cat-overview {
  margin-bottom: clamp(22px, 4vw, 30px);
}
.cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(10px, 2vw, 14px);
}
@media (min-width: 600px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }

.cat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: clamp(14px, 3vw, 18px);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--cat-color, #64748b);
  cursor: pointer;
  transition: all 0.18s;
}
.cat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.cat-card.active {
  outline: 3px solid var(--cat-color);
  outline-offset: -2px;
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.cat-emoji { font-size: clamp(20px, 4vw, 24px); }
.cat-label {
  font-weight: 700;
  color: var(--c-text);
  font-size: clamp(14px, 3.2vw, 16px);
  flex: 1;
}
.cat-volume {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
  color: var(--cat-color);
  font-variant-numeric: tabular-nums;
}

.cat-bar {
  background: #f1f5f9;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.cat-bar-fill {
  height: 100%;
  background: var(--cat-color);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.cat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--c-text-soft);
  margin-bottom: 10px;
}
.cat-meta-item { white-space: nowrap; }

.cat-tops {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--c-border);
}
.cat-top-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--c-text-soft);
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.12s;
}
.cat-top-chip:hover { background: #f1f5f9; color: var(--c-text); }
.cat-top-cnt {
  background: var(--cat-color, #64748b);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cat-top-tt {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ Region Overview ============ */
.reg-overview { margin-bottom: clamp(22px, 4vw, 30px); }
.reg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 1.5vw, 12px);
}
@media (min-width: 600px) { .reg-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 980px) { .reg-grid { grid-template-columns: repeat(7, 1fr); } }

.reg-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--reg-color, #64748b);
  cursor: pointer;
  transition: all 0.15s;
}
.reg-card[data-region="_other"] { cursor: default; }
.reg-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.reg-card.active {
  outline: 2px solid var(--reg-color);
  outline-offset: -1px;
}
.reg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.reg-label {
  font-weight: 700;
  font-size: clamp(12px, 2.8vw, 14px);
  color: var(--c-text);
}
.reg-vol {
  font-size: clamp(15px, 3.5vw, 18px);
  font-weight: 800;
  color: var(--reg-color);
  font-variant-numeric: tabular-nums;
}
.reg-bar {
  background: #f1f5f9;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.reg-bar-fill {
  height: 100%;
  background: var(--reg-color);
  border-radius: 2px;
}
.reg-meta {
  font-size: 11px;
  color: var(--c-text-mute);
}

/* ============ Region chip in hot rank ============ */
.hot-region {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}
.hot-region-none {
  background: #f1f5f9;
  color: var(--c-text-mute);
  border: 1px dashed #cbd5e1;
}

/* ============ Region filter buttons ============ */
.reg-fbtn {
  background: #fff;
  border: 1.5px solid var(--reg-color);
  color: var(--reg-color);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: clamp(12px, 2.5vw, 13px);
  font-weight: 600;
  transition: all 0.15s;
  min-height: 32px;
  white-space: nowrap;
}
.reg-fbtn:hover {
  background: color-mix(in srgb, var(--reg-color) 12%, white);
}
.reg-fbtn.active {
  background: var(--reg-color);
  color: #fff;
}
.reg-fbtn small {
  font-weight: 400;
  opacity: 0.75;
  margin-left: 2px;
}

/* ============ Trend (Line Charts) ============ */
.trend-section { margin-bottom: clamp(22px, 4vw, 30px); }
.trend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 2vw, 18px);
}
@media (min-width: 900px) { .trend-grid { grid-template-columns: 1fr 1fr; } }

.trend-card {
  background: #fff;
  border-radius: var(--radius);
  padding: clamp(14px, 3vw, 18px);
  box-shadow: var(--shadow);
}
.trend-card h3 {
  margin: 0 0 12px;
  font-size: clamp(13px, 2.8vw, 15px);
  color: var(--c-text);
  font-weight: 700;
}
.chart-box {
  position: relative;
  width: 100%;
  height: clamp(220px, 38vw, 320px);
}
.chart-box canvas { max-width: 100%; }

/* ============ Hot Rank ============ */
.hot-rank { margin-bottom: clamp(22px, 4vw, 30px); }
.hot-list {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hot-item {
  border-bottom: 1px solid var(--c-border);
}
.hot-item:last-child { border-bottom: none; }

.hot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(12px, 3vw, 16px);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.hot-row:hover { background: #f8fafc; }
.hot-item[data-heat~="hot"] .hot-rank-no { background: #dc2626; }
.hot-item[data-heat~="warm"] .hot-rank-no { background: #f59e0b; }
.hot-item[data-heat~="cool"] .hot-rank-no { background: #64748b; }
.hot-item[data-heat~="good"] .hot-rank-no { background: #16a34a; }

/* ----- 熱榜建議處置 ----- */
.hot-action {
  background: #fef9c3;
  border-left: 3px solid #facc15;
  margin: 0 clamp(12px, 3vw, 16px) 12px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: clamp(12px, 2.6vw, 13px);
  line-height: 1.6;
  color: #713f12;
}
.hot-action-head {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  color: #92400e;
  font-size: clamp(11px, 2.4vw, 12px);
  letter-spacing: 0.3px;
}
.hot-action ul {
  margin: 0;
  padding-left: 20px;
}
.hot-action li { margin: 2px 0; }
.hot-action b, .hot-action strong { color: #713f12; font-weight: 700; }
.hot-action i, .hot-action em { color: #854d0e; }

/* 各熱度的處置框配色 */
.hot-item[data-heat~="hot"] .hot-action {
  background: #fee2e2;
  border-left-color: #dc2626;
  color: #7f1d1d;
}
.hot-item[data-heat~="hot"] .hot-action-head { color: #991b1b; }
.hot-item[data-heat~="hot"] .hot-action b,
.hot-item[data-heat~="hot"] .hot-action strong { color: #7f1d1d; }
.hot-item[data-heat~="warm"] .hot-action {
  background: #fef3c7;
  border-left-color: #f59e0b;
  color: #78350f;
}
.hot-item[data-heat~="cool"] .hot-action {
  background: #f1f5f9;
  border-left-color: #64748b;
  color: #334155;
}
.hot-item[data-heat~="cool"] .hot-action-head { color: #475569; }
.hot-item[data-heat~="cool"] .hot-action b,
.hot-item[data-heat~="cool"] .hot-action strong { color: #1e293b; }

.hot-rank-no {
  background: #64748b;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.hot-body { flex: 1; min-width: 0; }
.hot-title {
  font-weight: 600;
  font-size: clamp(13px, 3vw, 15px);
  color: var(--c-text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hot-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--c-text-mute);
  align-items: center;
}
.hot-cat {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}
.hot-date, .hot-type { font-family: monospace; }

.hot-vol {
  text-align: center;
  flex-shrink: 0;
  min-width: 44px;
}
.hot-vol b {
  display: block;
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 800;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hot-vol small {
  font-size: 10px;
  color: var(--c-text-mute);
}

/* ============ Category filter buttons ============ */
.cat-fbtn {
  background: #fff;
  border: 1.5px solid var(--cat-color);
  color: var(--cat-color);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: clamp(12px, 2.5vw, 13px);
  font-weight: 600;
  transition: all 0.15s;
  min-height: 32px;
  white-space: nowrap;
}
.cat-fbtn:hover {
  background: color-mix(in srgb, var(--cat-color) 12%, white);
}
.cat-fbtn.active {
  background: var(--cat-color);
  color: #fff;
}
.cat-fbtn small {
  font-weight: 400;
  opacity: 0.75;
  margin-left: 2px;
}

/* ============ Card issue chips (upgraded) ============ */
.card-vol {
  font-size: 11px;
  color: var(--c-text-mute);
  font-variant-numeric: tabular-nums;
}
.card-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}
.ichip {
  background: #f1f5f9;
  color: var(--c-text-soft);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  min-height: 22px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ichip[data-heat~="hot"] { background: #fee2e2; color: #991b1b; }
.ichip[data-heat~="warm"] { background: #fef3c7; color: #854d0e; }
.ichip[data-heat~="good"] { background: #dcfce7; color: #166534; }
.ichip b {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ============ Footer ============ */
.site-foot {
  text-align: center;
  padding: clamp(20px, 5vw, 28px) 16px;
  color: var(--c-text-soft);
  font-size: 13px;
}
.site-foot a { color: var(--c-link); text-decoration: none; }

/* ============ Mobile-only tweaks ============ */
@media (max-width: 600px) {
  .filter-bar { position: relative; top: 0; }
  .site-stat { gap: 10px; }
}
