/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --border: #e5e5ea;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN',
    'Hiragino Sans', Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* === Header === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1a1a2e;
  color: #ffffff;
  padding: 16px 16px 12px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.refresh-btn {
  background: none;
  border: none;
  color: #ffffff;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.refresh-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

.refresh-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

.updated-at {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

/* === Category Chips === */
.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-top: 12px;
  padding-bottom: 4px;
}

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

.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.chip.active {
  background: #ffffff;
  color: #1a1a2e;
  border-color: #ffffff;
}

.chip:active {
  transform: scale(0.95);
}

/* === Articles === */
.articles {
  padding: 12px 16px 32px;
}

/* === Loading === */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

/* === Article Card === */
.card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.source-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.category-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

/* カテゴリ別色分け */
.badge-ai_person_global {
  background: #e8f0fe;
  color: #1a73e8;
}

.badge-ai_person_jp {
  background: #fce8e6;
  color: #d93025;
}

.badge-ai_media {
  background: #e6f4ea;
  color: #137333;
}

.badge-dx_it {
  background: #fef7e0;
  color: #b06000;
}

.badge-business {
  background: #f3e8fd;
  color: #7627bb;
}

.badge-core_tools {
  background: #e0f2f1;
  color: #00695c;
}

.badge-keyword_monitor {
  background: #e8eaed;
  color: #5f6368;
}

.pub-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  color: var(--text);
}

.card-summary {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.7;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-secondary {
  background: #f0f0f5;
  color: var(--text);
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
}

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

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 15px;
  line-height: 1.6;
}

/* === Language Badge === */
.lang-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  background: #e8eaed;
  color: #5f6368;
}

.lang-badge.en {
  background: #e8f0fe;
  color: #1a73e8;
}
