:root {
  --font-sans: 'Plus Jakarta Sans', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* ダークテーマ（デフォルト） */
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #24344d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  
  --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(59, 130, 246, 0.15);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --card-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

[data-theme="light"] .app-header {
  background-color: rgba(248, 250, 252, 0.85);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

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

.brand-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  display: block;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* ステータスバー */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.agent-badge.purple {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border-color: rgba(139, 92, 246, 0.3);
}

.article-count-badge {
  background: var(--bg-card);
  padding: 2px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-muted);
}

/* 検索バー */
.search-container {
  margin-bottom: 12px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  opacity: 0.6;
}

.search-input-wrapper input {
  width: 100%;
  padding: 10px 36px 10px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input-wrapper input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

/* カテゴリナビゲーション */
.category-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.cat-pill.active {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* 記事グリッド */
.articles-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 記事カード */
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.source-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--text-secondary);
}

.category-tag {
  color: #38bdf8;
  font-weight: 600;
}

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

.bookmark-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
}

.bookmark-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.bookmark-btn.active {
  opacity: 1;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-primary);
}

.card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.card-title a:hover {
  color: #60a5fa;
}

/* 3行要約 */
.card-summary {
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid #3b82f6;
  padding: 10px 14px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme="light"] .card-summary {
  background: #f1f5f9;
}

.summary-item {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  padding-left: 14px;
}

.summary-item::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: #3b82f6;
  font-weight: bold;
}

/* 重要度・解説 */
.card-importance {
  font-size: 12px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c084fc;
  padding: 8px 12px;
  border-radius: 6px;
  line-height: 1.5;
}

[data-theme="light"] .card-importance {
  color: #7c3aed;
  background: #f3e8ff;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
}

.tags-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-badge {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

[data-theme="light"] .tag-badge {
  background: rgba(0, 0, 0, 0.05);
  color: #64748b;
}

.article-link {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

[data-theme="light"] .article-link {
  color: #2563eb;
}

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

/* フッター */
.app-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.footer-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 12px;
}

.footer-copy {
  font-size: 11px;
  color: var(--text-muted);
}

/* ユーティリティ */
.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #f8fafc;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  z-index: 100;
}
