/* ===== Base Layout & Shared Styles ===== */

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.85rem;
  text-decoration: none;
}
.skip-link:focus {
  top: 0.5rem;
}

/* Global focus outline */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  font-size: var(--font-size);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
}
[data-mode="dark"] .header {
  background: rgba(15,23,42,0.85);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* Pro badge */
.pro-badge {
  display: inline-block;
  font-size: 0.55em;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.05em 0.4em;
  margin-left: 0.4em;
  vertical-align: middle;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Category nav */
.category-nav {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.category-nav::-webkit-scrollbar {
  display: none;
}
.cat-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 500;
}
.cat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.06);
}
.cat-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Header icon links */
.header-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  text-decoration: none;
  transition: border-color .2s, color .2s, background .2s;
}
.header-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.06);
  text-decoration: none;
}

/* Mode toggle (sun/moon) */
.mode-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mode-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.06);
}
[data-mode="light"] .icon-moon { display: none; }
[data-mode="dark"] .icon-sun { display: none; }

/* Header icon buttons (search, bookmark) — xyz/claud only */
.search-toggle,
.bookmark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
[data-site="xyz"] .search-toggle,
[data-site="xyz"] .bookmark-toggle,
[data-site="claud"] .search-toggle,
[data-site="claud"] .bookmark-toggle {
  display: flex;
}
.search-toggle:hover,
.bookmark-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.06);
}
.search-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.1);
}

/* ===== Search Bar ===== */
.search-bar {
  position: sticky;
  top: 53px;
  z-index: 99;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}
[data-mode="dark"] .search-bar {
  background: rgba(15,23,42,0.85);
}
.search-bar.open {
  max-height: 60px;
  opacity: 1;
  padding: 0.5rem 1rem;
}
.search-bar[hidden] {
  display: block;
  max-height: 0;
  opacity: 0;
  padding: 0;
  border: none;
}
.search-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
}
.search-bar-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-input::placeholder {
  color: var(--muted);
}
.search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.search-clear:hover {
  color: var(--text);
}

/* ===== Bookmark Panel ===== */
.bookmark-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 299;
  opacity: 0;
  transition: opacity 0.2s;
}
.bookmark-overlay.open {
  opacity: 1;
}
.bookmark-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.bookmark-panel.open {
  transform: translateX(0);
}
.bookmark-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.bookmark-panel-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.bookmark-panel-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.bookmark-panel-close:hover {
  color: var(--text);
}
.bookmark-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  -webkit-overflow-scrolling: touch;
}
.bookmark-panel-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.bookmark-clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.bookmark-clear-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}
.bookmark-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  transition: box-shadow 0.15s;
}
.bookmark-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.bookmark-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}
.bookmark-item-title a {
  color: var(--text);
}
.bookmark-item-title a:hover {
  color: var(--accent);
}
.bookmark-item-meta {
  font-size: 0.75rem;
  color: var(--muted);
}
.bookmark-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Chat toggle */
.chat-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}
.chat-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.06);
}

/* Main */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* Articles container - will be styled by theme */
.articles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Article item - base structure */
.article {
  position: relative;
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.3s;
}
.article:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.article-img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  flex-shrink: 0;
}
/* Image placeholder for articles without images */
.article-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.article-img-placeholder[data-category="tech"] { background: linear-gradient(135deg, #667eea, #764ba2); }
.article-img-placeholder[data-category="business"] { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
.article-img-placeholder[data-category="entertainment"] { background: linear-gradient(135deg, #e44d26, #f16529); }
.article-img-placeholder[data-category="sports"] { background: linear-gradient(135deg, #11998e, #38ef7d); }
.article-img-placeholder[data-category="science"] { background: linear-gradient(135deg, #0f2027, #2c5364); }
.article-img-placeholder[data-category="general"] { background: linear-gradient(135deg, #434343, #000000); }
.article-img-placeholder[data-category="podcast"] { background: linear-gradient(135deg, #7b2ff7, #c471f5); }
.article-img-placeholder span {
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.article-body {
  flex: 1;
  min-width: 0;
}
.article-title {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}
.article-title a {
  color: var(--text);
}
.article-title a:hover {
  color: var(--accent);
}
.article-meta {
  font-size: 0.75em;
  color: var(--muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.article-desc {
  font-size: 0.85em;
  color: var(--muted);
  margin-top: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* TTS button */
.tts-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}
.tts-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.article.speaking .tts-btn {
  color: var(--accent);
  border-color: var(--accent);
  animation: tts-pulse 1s ease-in-out infinite;
}
@keyframes tts-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Read articles */
.article.read {
  opacity: 0.7;
}
.article.read .article-title a {
  color: var(--muted);
}
.article.read::after {
  content: '';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

/* Infinite scroll spinner */
#scroll-sentinel {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

/* Load more */
.load-more-wrap {
  text-align: center;
  padding: 1.5rem 0;
}
.load-more-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 2rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
.load-more-btn:hover {
  background: var(--accent-hover);
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

/* Skeleton loading placeholders */
.skeleton {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  gap: 0.75rem;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-img {
  width: 120px;
  height: 80px;
  border-radius: calc(var(--radius) - 4px);
  background: var(--border);
  flex-shrink: 0;
}
.skeleton-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.skeleton-line {
  height: 0.9em;
  border-radius: 4px;
  background: var(--border);
}
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.short { height: 0.7em; width: 30%; }
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Article enter animation */
.article {
  animation: article-enter 0.3s ease-out;
}
@keyframes article-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Infinite scroll spinner */
.scroll-spinner {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.8rem;
  gap: 0.5rem;
  align-items: center;
}
.scroll-spinner::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Article Detail Panel ===== */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 299;
  opacity: 0;
  transition: opacity 0.2s;
}
.detail-overlay.open {
  opacity: 1;
}
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.detail-panel.open {
  transform: translateX(0);
}
.detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.detail-back {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.detail-back:hover { color: var(--accent); }
.detail-header-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}
.detail-external {
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
}
.detail-external:hover { color: var(--accent); }
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  -webkit-overflow-scrolling: touch;
}
.detail-img-wrap img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.detail-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.detail-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1rem;
  display: flex;
  gap: 0.75rem;
}
.detail-desc {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.detail-ai-section {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
.detail-ai-heading {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}
.detail-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}
.detail-q-chip {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
  text-align: left;
}
.detail-q-chip:hover {
  background: var(--accent);
  color: #fff;
}
.detail-q-chip.asked {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
  background: var(--border);
  border-color: var(--border);
  color: var(--muted);
}
.detail-loading {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.5rem 0;
}
.detail-loading::after {
  content: '';
  display: inline-block;
  animation: dots 1.5s steps(4, end) infinite;
}
.detail-answers {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 2rem;
}
.detail-answer-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.detail-answer-q {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.detail-answer-a {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-line;
}
.detail-answer-loading {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}
.detail-answer-loading::after {
  content: '';
  display: inline-block;
  animation: dots 1.5s steps(4, end) infinite;
}

/* Category nav scroll indicator */
.category-nav {
  position: relative;
  -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
  mask-image: linear-gradient(to right, #000 85%, transparent);
}
.category-nav.scrolled-end {
  -webkit-mask-image: none;
  mask-image: none;
}

/* ===== Offline Banner ===== */
.offline-banner {
  display: none;
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.is-offline .offline-banner {
  display: block;
}
.is-offline .header::after {
  content: 'オフライン';
  position: absolute;
  top: 0.35rem;
  right: 0.75rem;
  font-size: 0.6rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  pointer-events: none;
}
/* Hide network-dependent features when offline */
.is-offline .tts-btn,
.is-offline .detail-ai-section {
  display: none !important;
}

/* ===== Eco Token Badge ===== */
.eco-status {
  position: fixed;
  bottom: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.35rem;
  font-size: 0.72rem;
  z-index: 50;
  opacity: 0.8;
  transition: opacity 0.2s;
  font-variant-numeric: tabular-nums;
}
.eco-status:hover {
  opacity: 1;
}
.eco-tokens {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-weight: 700;
  transition: color 0.3s, border-color 0.3s;
}
.eco-tokens small {
  font-weight: 500;
  opacity: 0.6;
  margin-left: 1px;
}
.eco-tokens--low {
  color: #ef4444;
  border-color: #ef4444;
  animation: ecoLowPulse 2s ease-in-out infinite;
}
.eco-tokens--pro {
  color: #f59e0b;
  border-color: #f59e0b;
  background: linear-gradient(135deg, var(--surface), rgba(245, 158, 11, 0.1));
}
.eco-hitrate {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-weight: 600;
}
.eco-hitrate small {
  font-weight: 400;
  opacity: 0.5;
  margin-left: 2px;
  font-size: 0.6rem;
}
/* +/- animation popup */
.eco-popup {
  position: absolute;
  top: -1.5rem;
  right: 0;
  font-weight: 700;
  font-size: 0.8rem;
  pointer-events: none;
  animation: ecoPopup 1.2s ease-out forwards;
}
.eco-popup--earn { color: #22c55e; }
.eco-popup--spend { color: #ef4444; }
@keyframes ecoPopup {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-1.2rem); }
}
@keyframes ecoLowPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* ===== Battery Saving Mode ===== */
.battery-saving .article-img {
  display: none !important;
}
.battery-saving .skeleton-img {
  display: none !important;
}

/* ===== Bookmark Button ===== */
.bookmark-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}
.bookmark-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.bookmark-btn.bookmarked {
  color: var(--accent);
  border-color: var(--accent);
}
.bookmark-btn.bookmarked svg {
  fill: var(--accent);
}

/* ===== Share Button (Detail Panel) ===== */
.detail-share {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.detail-share:hover { color: var(--accent); }

/* ===== Layout Density ===== */
[data-density="compact"] .article {
  padding: 0.4rem 0.5rem;
  gap: 0.5rem;
}
[data-density="compact"] .article-img,
[data-density="compact"] .article-img-placeholder {
  width: 80px;
  height: 54px;
}
[data-density="compact"] .article-desc {
  display: none;
}
[data-density="compact"] .articles {
  gap: 0.25rem;
}

[data-density="spacious"] .article {
  padding: 1.25rem;
  gap: 1.25rem;
}
[data-density="spacious"] .article-img,
[data-density="spacious"] .article-img-placeholder {
  width: 160px;
  height: 107px;
}
[data-density="spacious"] .articles {
  gap: 1rem;
}
[data-density="spacious"] .article-desc {
  -webkit-line-clamp: 4;
}

/* ===== Display Toggle Overrides ===== */
[data-show-images="false"] .article-img,
[data-show-images="false"] .article-img-placeholder {
  display: none !important;
}
[data-show-descriptions="false"] .article-desc {
  display: none !important;
}
[data-animations="false"] .article {
  animation: none !important;
}
[data-animations="false"] .skeleton {
  animation: none !important;
}

/* ===== Cross-Site Navigation Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  text-align: center;
  max-width: 1200px;
  margin: 2rem auto 0;
}
.site-footer-label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}
.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}
.site-footer-link {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer-link:hover {
  color: var(--accent);
  text-decoration: none;
}
.site-footer-brand {
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.6;
  margin-left: 0.2em;
}
/* Hide footer on sites with their own full-page UI */
[data-site="online"] .site-footer,
[data-site="cloud"] .site-footer,
[data-site="chatnews"] .site-footer,
[data-site="yournews"] .site-footer,
[data-site="velo"] .site-footer {
  display: none;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0s !important;
  }
}

/* ===== Responsive — Tablet landscape ===== */
@media (max-width: 1024px) {
  .header-inner {
    gap: 0.75rem;
  }
  .detail-panel {
    width: 480px;
  }
}

/* ===== Responsive — Tablet portrait / Large phone ===== */
@media (max-width: 768px) {
  .header-inner {
    gap: 0.5rem;
  }
  .logo {
    font-size: 1.05rem;
  }
  .cat-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
  }
  .header-link, .mode-toggle, .chat-toggle, .search-toggle, .bookmark-toggle {
    width: 40px;
    height: 40px;
  }
  .article-img {
    width: 100px;
    height: 68px;
  }
  .detail-panel,
  .bookmark-panel {
    width: 100vw;
  }
  .skeleton-img {
    width: 100px;
    height: 68px;
  }
  .main {
    padding: 1rem 0.75rem;
  }
}

/* ===== Responsive — Small phone ===== */
@media (max-width: 480px) {
  .header {
    padding: 0.4rem 0.5rem;
  }
  .header-inner {
    gap: 0.35rem;
  }
  .logo {
    font-size: 0.95rem;
  }
  .cat-btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.75rem;
    min-height: 36px;
  }
  .header-link, .mode-toggle, .chat-toggle, .search-toggle, .bookmark-toggle {
    width: 44px;
    height: 44px;
  }
  .article-img {
    width: 80px;
    height: 60px;
  }
  .article-title {
    font-size: 0.95em;
  }
  .detail-panel {
    width: 100vw;
  }
  .detail-body {
    padding: 1rem;
  }
  .detail-title {
    font-size: 1.15rem;
  }
  .skeleton-img {
    width: 80px;
    height: 60px;
  }
  .main {
    padding: 0.75rem 0.5rem;
  }
}
