/* Tech News Dashboard — dark-mode friendly, system fonts */
:root {
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --bg-card: #1e2a3a;
  --bg-card-hover: #243447;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --text-muted: #9aa8bc;
  --text-dim: #6b7a8f;
  --accent: #5b9fd4;
  --accent-soft: rgba(91, 159, 212, 0.15);
  --chip: #243447;
  --chip-active: #5b9fd4;
  --chip-active-text: #0f1419;
  --metric-bg: linear-gradient(145deg, #1e2a3a 0%, #243447 100%);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "PingFang TC",
    "Hiragino Sans GB", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f4f8;
    --border: #d8e0ea;
    --text: #1a2332;
    --text-muted: #5a6a7e;
    --text-dim: #8a97a8;
    --accent: #2b7bb9;
    --accent-soft: rgba(43, 123, 185, 0.12);
    --chip: #e8eef5;
    --chip-active: #2b7bb9;
    --chip-active-text: #ffffff;
    --metric-bg: linear-gradient(145deg, #ffffff 0%, #eef3f8 100%);
    --shadow: 0 4px 20px rgba(26, 35, 50, 0.08);
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

header.hero {
  margin-bottom: 1.5rem;
}

header.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.45rem, 4.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.as-of {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.as-of time {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--accent-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}


.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
}

.hero-titles { min-width: 0; flex: 1 1 14rem; }

.refresh-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.refresh-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background: linear-gradient(145deg, var(--accent) 0%, #7c6cf0 100%);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(91, 159, 212, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.refresh-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 159, 212, 0.45);
}

.refresh-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, #fff);
  outline-offset: 2px;
}

.refresh-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

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

.refresh-icon { display: block; flex-shrink: 0; }

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

.refresh-note {
  margin: 0;
  max-width: 14rem;
  text-align: right;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-dim);
}

.focus-theme.theme-other { --theme-accent: #94a3b8; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%) translateY(12px);
  z-index: 1000;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: #1f9d6a;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-err {
  background: #c2410c;
}

@media (prefers-color-scheme: light) {
  .refresh-btn {
    box-shadow: 0 4px 14px rgba(43, 123, 185, 0.28);
  }
  .toast {
    box-shadow: 0 8px 24px rgba(26, 35, 50, 0.18);
  }
}

@media (max-width: 640px) {
  .refresh-wrap {
    align-items: stretch;
    width: 100%;
  }
  .refresh-btn {
    justify-content: center;
    width: 100%;
  }
  .refresh-note {
    text-align: center;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .refresh-btn.is-loading .refresh-icon { animation: none; }
  .toast { transition: none; }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
}

.metric {
  background: var(--metric-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.metric .num {
  display: block;
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.metric .label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* —— 今日焦點 hero —— */
.summary-card.summary-hero {
  --focus-apple: #5b9fd4;
  --focus-ai: #a78bfa;
  --focus-sec: #f97316;
  --focus-gadgets: #2dd4bf;
  --focus-other: #94a3b8;
  position: relative;
  background:
    linear-gradient(180deg, rgba(91, 159, 212, 0.12) 0%, transparent 42%),
    var(--bg-elevated);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: calc(var(--radius) + 2px);
  padding: 0;
  margin-bottom: 1.75rem;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent),
    0 8px 32px rgba(91, 159, 212, 0.18),
    var(--shadow);
  overflow: hidden;
}

.summary-card.summary-hero::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--focus-apple) 0%,
    var(--focus-ai) 25%,
    var(--focus-sec) 50%,
    var(--focus-gadgets) 75%,
    var(--focus-other) 100%
  );
}

.summary-head {
  padding: 1.05rem 1.2rem 0.85rem;
}

.summary-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chip-active-text);
  background: linear-gradient(135deg, var(--accent) 0%, #7c6cf0 100%);
  box-shadow: 0 2px 10px rgba(91, 159, 212, 0.35);
}

.kicker-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.85); }
}

.summary-card.summary-hero h2 {
  margin: 0;
  font-size: clamp(1.25rem, 4.2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.summary-sub {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  padding: 0 1.05rem 1.15rem;
}

.focus-theme {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.9rem 0.75rem;
  border-left: 4px solid var(--theme-accent, var(--accent));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.focus-theme.theme-apple { --theme-accent: var(--focus-apple); }
.focus-theme.theme-ai { --theme-accent: var(--focus-ai); }
.focus-theme.theme-sec { --theme-accent: var(--focus-sec); }
.focus-theme.theme-gadgets { --theme-accent: var(--focus-gadgets); }
.focus-theme.theme-other { --theme-accent: var(--focus-other); }

.focus-theme-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.theme-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  color: #0f1419;
  background: var(--theme-accent, var(--accent));
}

.theme-emoji {
  font-size: 1rem;
  line-height: 1;
}

.focus-bullets {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.focus-bullets li {
  position: relative;
  margin: 0;
  padding: 0 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
  border: none;
}

.focus-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--theme-accent, var(--accent));
}

.focus-bullets li strong {
  color: var(--text);
  font-weight: 700;
}

.focus-bullets li a {
  color: var(--theme-accent, var(--accent));
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8em;
  white-space: nowrap;
}
.focus-bullets li a:hover {
  text-decoration: underline;
}


@media (prefers-color-scheme: light) {
  .summary-card.summary-hero {
    background:
      linear-gradient(180deg, rgba(43, 123, 185, 0.1) 0%, transparent 42%),
      var(--bg-elevated);
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent),
      0 8px 28px rgba(43, 123, 185, 0.12),
      var(--shadow);
  }
  .focus-theme {
    box-shadow: 0 2px 8px rgba(26, 35, 50, 0.06);
  }
}

@media (max-width: 640px) {
  .focus-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: 0 0.85rem 1rem;
  }
  .summary-head {
    padding: 0.95rem 0.95rem 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kicker-dot { animation: none; }
}

.filters {
  margin-bottom: 1rem;
}

.filters h2 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip.active {
  background: var(--chip-active);
  border-color: var(--chip-active);
  color: var(--chip-active-text);
  font-weight: 600;
}

.chip .count {
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
  margin-left: 0.2rem;
}

.search-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.search-wrap input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-wrap input::placeholder { color: var(--text-dim); }

.search-wrap .icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 0.95rem;
}

.list-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

#news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  transition: background 0.15s, border-color 0.15s;
}

.item:hover {
  background: var(--bg-card-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.item-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.source {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

.item-date {
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-dim);
  margin-left: auto;
}

.item-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

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

.item-summary {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

footer.site-foot {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

@media (max-width: 480px) {
  .metrics { gap: 0.5rem; }
  .metric { padding: 0.75rem 0.4rem; }
  .metric .label { font-size: 0.72rem; }
  .item-date { margin-left: 0; width: 100%; }
  .summary-card.summary-hero h2 { font-size: 1.2rem; }
  .focus-bullets li { font-size: 0.86rem; }
}
