:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-sub: #6b7280;

  --accent-primary: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-secondary: #38bdf8;
  --tag-bg: rgba(99, 102, 241, 0.15);
  
  --font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-height: 180px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ヘッダー・ナビゲーション */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem 0.5rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .tagline {
  font-size: 0.75rem;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  transform: rotate(45deg);
}

/* 検索バー */
.search-container {
  max-width: 1200px;
  margin: 0.75rem auto 0.5rem;
}

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

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-sub);
  pointer-events: none;
}

#search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.6rem 2.5rem 0.6rem 2.75rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

#search-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.clear-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

/* タブバー（横スクロール対応） */
.tabs-nav {
  max-width: 1200px;
  margin: 0.5rem auto 0;
  overflow: hidden;
}

.tabs-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none; /* Firefox */
  -webkit-overflow-scrolling: touch;
}

.tabs-scroll::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.tab-item {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-item.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* メインコンテンツ */
.main-content {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
  flex: 1;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.active-category-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.active-category-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.count-badge {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  color: var(--text-muted);
}

.time-filter {
  font-size: 0.8rem;
  color: var(--text-sub);
}

/* ニュースグリッド */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

/* ニュースカード */
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.news-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.card-top {
  margin-bottom: 0.75rem;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.category-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-secondary);
  background: var(--tag-bg);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.date-text {
  font-size: 0.75rem;
  color: var(--text-sub);
}

.news-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.summary-box {
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--accent-primary);
  border-radius: 4px 8px 8px 4px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 1rem;
}

.summary-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-secondary);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
}

.summary-text {
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.6;
  white-space: pre-line;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
}

.source-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-secondary);
  text-decoration: none;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.source-link-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-secondary);
  color: #fff;
  transform: translateX(2px);
}

/* ローディング & エラー表示 */
.loading-state, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* フッター */
.app-footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-sub);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* レスポンシブ */
@media (max-width: 640px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
  .brand-text h1 {
    font-size: 1.1rem;
  }
  .status-indicator span:last-child {
    display: none; /* スマホではランプのみ */
  }
  .app-header {
    padding: 0.75rem 1rem 0.4rem;
  }
}
