:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-muted: #f0f4f8;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --success: #10b981;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-muted: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1f2937;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

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

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--success));
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.badge-live {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-ghost:hover {
  background: var(--surface-muted);
}

/* Main Layout */
.main-layout {
  padding-top: 28px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}

.hero-content h2 {
  font-size: 1.6rem;
  margin-bottom: 10px;
  line-height: 1.3;
}

.hero-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.select-input {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.88rem;
}

.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.tag.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Summary Card */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header h3 {
  font-size: 1.1rem;
}

.muted {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.summary-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.summary-list strong {
  color: var(--text);
}

code {
  background: var(--surface-muted);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.85em;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.link-card:hover {
  transform: translateY(-2px);
}

.link-card.hidden {
  display: none;
}

.card-thumb {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.thumb-gradient-1 {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.thumb-gradient-2 {
  background: linear-gradient(135deg, #0ea5e9, #10b981);
}

.thumb-gradient-3 {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}

.card-date {
  color: var(--text-muted);
}

.card-tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.card-title {
  font-size: 1rem;
  line-height: 1.4;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  flex: 1;
}

.card-link {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.card-link:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Responsive */
@media (max-width: 900px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
