/* === 宇宙テーマ Morning Briefing === */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1e1e36;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --neon-blue: #00d4ff;
  --neon-pink: #ff2e97;
  --neon-orange: #ff6b35;
  --text-primary: #e0e0e0;
  --text-secondary: #8888aa;
  --text-dim: #555577;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 46, 151, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 107, 53, 0.02) 0%, transparent 40%);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* 星エフェクト */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 50% 40%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 70% 10%, rgba(255,255,255,0.25), transparent),
    radial-gradient(1px 1px at 90% 60%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 15% 90%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 85% 85%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 45% 15%, rgba(255,255,255,0.1), transparent);
  background-size: 200px 200px;
}

/* === Header === */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 24px 0;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo-icon {
  color: var(--neon-blue);
  margin-right: 4px;
}

.meta-info {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Date Navigation */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}
.nav-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--neon-orange);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.nav-btn:hover {
  border-color: var(--neon-orange);
  background: rgba(255, 107, 53, 0.1);
}
.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.current-date {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 140px;
  text-align: center;
}

/* Search Bar */
.search-bar { margin-bottom: 12px; }
.search-bar input {
  width: 100%; padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--border-subtle); background: rgba(255,255,255,0.04);
  color: var(--text-primary); font-size: 0.9rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input::placeholder { color: var(--text-dim); }
.search-bar input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.1);
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 0;
  -webkit-overflow-scrolling: touch;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab:hover {
  color: var(--text-primary);
}
.tab.active {
  color: var(--neon-pink);
  border-bottom-color: var(--neon-pink);
}
.tab-bookmark.active { color: #4ade80; border-bottom-color: #4ade80; }
.tab-bookmark:hover { color: #4ade80; }
.tab-bookmark { position: relative; }
.tab-bookmark svg { width: 12px; height: 12px; fill: currentColor; vertical-align: -1px; }
.bookmark-count {
  font-size: 0.6rem; background: #4ade80; color: #000;
  border-radius: 50%; width: 16px; height: 16px; display: inline-flex;
  align-items: center; justify-content: center; margin-left: 4px;
  font-weight: 700; vertical-align: middle;
}

/* === Main Grid === */
.articles-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Loading */
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* === Article Card === */
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}
.article-card:hover {
  border-color: var(--neon-blue);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.12);
  transform: translateY(-2px);
}

.card-image-wrap { position: relative; }
.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-secondary);
  display: block;
}

.card-body { padding: 16px; }

.card-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--neon-pink);
  background: rgba(255, 46, 151, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-source {
  font-size: 0.75rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Source Badges */
.card-badge {
  flex-shrink: 0; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 2px 6px; border-radius: 4px; text-transform: uppercase;
}
.card-badge-rss {
  color: var(--neon-orange); background: rgba(255, 107, 53, 0.12); border: 1px solid rgba(255, 107, 53, 0.25);
}
.card-badge-x {
  color: var(--neon-blue); background: rgba(0, 212, 255, 0.12); border: 1px solid rgba(0, 212, 255, 0.25);
}

/* Bookmark Button (card) */
.bookmark-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.5); border: none; color: var(--text-dim);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  font-size: 1.1rem; line-height: 1; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.bookmark-btn:hover { background: rgba(0,0,0,0.7); color: #4ade80; }
.bookmark-btn.active { color: #4ade80; filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.5)); }
.bookmark-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.bookmark-btn.active svg { fill: #4ade80; stroke: #4ade80; }

/* Bookmark Button (modal) */
.modal-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.modal-bookmark-btn {
  background: transparent; border: 1px solid var(--border-subtle);
  color: var(--text-dim); padding: 6px 14px; border-radius: 8px;
  cursor: pointer; font-size: 0.85rem; transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.modal-bookmark-btn:hover { border-color: #4ade80; color: #4ade80; }
.modal-bookmark-btn.active {
  border-color: #4ade80; color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}
.modal-bookmark-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; vertical-align: -2px; }
.modal-bookmark-btn.active svg { fill: #4ade80; stroke: #4ade80; }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 1;
  transition: background 0.2s;
}
.modal-close:hover {
  background: rgba(255, 46, 151, 0.3);
}

.modal-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: var(--bg-secondary);
  display: block;
}

.modal-body { padding: 24px; }

.modal-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--neon-pink);
  background: rgba(255, 46, 151, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.modal-source {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.modal-summary {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.modal-link {
  display: inline-block;
  color: var(--neon-blue);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 20px;
  border: 1px solid var(--neon-blue);
  border-radius: 8px;
  transition: all 0.2s;
}
.modal-link:hover {
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

/* === Footer === */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-subtle);
}

/* === Responsive === */
@media (max-width: 640px) {
  header { padding: 12px 16px 0; }
  .articles-grid {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
  .logo { font-size: 1.1rem; }
  .tab { padding: 6px 12px; font-size: 0.8rem; }
  .modal { margin: 12px; }
}
