:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-dim: #6b7280;
  --brand: #2f5bea;
  --brand-dim: #2447bf;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 10px;
  --font-serif: "Source Serif 4", Georgia, serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--brand); }

input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}

input:focus, select:focus, button:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

/* ---------- App shell ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.app-header .brand {
  font-weight: 700;
  margin-right: auto;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.search-box input {
  width: 100%;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ---------- Welcome remark ---------- */
.welcome-banner {
  margin-bottom: 32px;
}

.welcome-eyebrow {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.welcome-headline {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

@media (max-width: 640px) {
  .welcome-headline { font-size: 24px; }
}

@media (max-width: 420px) {
  .welcome-headline { font-size: 20px; }
}

/* ---------- Hero / featured article carousel ---------- */
.hero-carousel-wrap {
  overflow: hidden;
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

.hero-carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.hero-carousel-track::-webkit-scrollbar {
  display: none;
}

.hero {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  gap: 48px;
  align-items: center;
}

.hero-media {
  flex: none;
  width: 52%;
  aspect-ratio: 10 / 7;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-media svg {
  width: 40%;
  height: 40%;
}

.media-photo {
  padding: 0 !important;
  background: var(--surface-2) !important;
  overflow: hidden;
}

.media-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-source-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--text-dim);
}

.hero-source {
  color: var(--text);
  font-weight: 600;
}

.hero-dot { color: var(--text-dim); }

.hero-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 36px;
  line-height: 1.2;
  margin: 0;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

.hero-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

.hero-category {
  color: var(--brand);
  font-weight: 600;
}

.hero-readtime { color: var(--text-dim); }

.hero-skeleton {
  display: flex;
  gap: 48px;
  align-items: center;
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

.hero-skeleton-media {
  flex: none;
  width: 52%;
  aspect-ratio: 10 / 7;
  border-radius: 0;
}

.hero-skeleton-content {
  flex: 1;
}

@media (max-width: 800px) {
  .hero, .hero-skeleton { flex-direction: column; align-items: stretch; gap: 24px; }
  .hero-media, .hero-skeleton-media { width: 100%; }
  .hero-title { font-size: 26px; }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.chips {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.chip {
  padding: 2px 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.chip:hover {
  color: var(--text);
}

.chip.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.view-tabs {
  display: flex;
  gap: 6px;
}

.view-tab {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
}

.view-tab.active {
  color: var(--brand);
  border-color: var(--brand);
}

.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.status-banner.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.hidden { display: none !important; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  margin: 0;
}

.see-all {
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.see-all:hover { color: var(--brand-dim); }

.carousel-wrap {
  overflow: hidden;
}

.carousel-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 4px 4px 16px;
  margin: -4px -4px 0;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-track .news-card {
  flex: 0 0 auto;
  width: calc(85% - 10px);
  scroll-snap-align: start;
}

@media (min-width: 560px) {
  .carousel-track .news-card { width: calc(50% - 10px); }
}

@media (min-width: 860px) {
  .carousel-track .news-card { width: calc(33.333% - 14px); }
}

@media (min-width: 1150px) {
  .carousel-track .news-card { width: calc(25% - 15px); }
}

.news-card {
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

.news-card:hover {
  transform: translateY(-4px);
}

.card-media {
  aspect-ratio: 4 / 3;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-media svg {
  width: 34%;
  height: 34%;
  transition: transform 0.25s ease;
}

.news-card:hover .card-media svg,
.news-card:hover .card-media img {
  transform: scale(1.08);
}

.card-media.media-photo img {
  transition: transform 0.25s ease;
}

.thumb-world { background: #eaf1ff; }
.thumb-business { background: #f3ecfe; }
.thumb-technology { background: #e6f6f6; }
.thumb-sports { background: #eafaf0; }
.thumb-health { background: #fdecec; }
.thumb-science { background: #eef2ff; }
.thumb-entertainment { background: #fff1e6; }

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}

.card-source-name {
  color: var(--text);
  font-weight: 600;
}

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

.card-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  margin-top: 2px;
}

.card-category {
  color: var(--brand);
  font-weight: 600;
}

.card-readtime {
  color: var(--text-dim);
}

.read-link {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.bookmark-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0;
  transition: color 0.15s ease;
}

.bookmark-btn:hover {
  color: var(--brand);
}

.bookmark-btn.active {
  color: var(--brand);
  animation: bookmarkPop 0.25s ease;
}

@keyframes bookmarkPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ---------- Other news: plain list rows (not cards) ---------- */
.article-list {
  display: flex;
  flex-direction: column;
}

.article-row {
  display: flex;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.article-row:first-child { padding-top: 0; }

.thumb {
  flex: none;
  width: 120px;
  height: 90px;
  border-radius: 0;
  background: var(--surface-2);
  padding: 14px;
}

.thumb svg {
  width: 100%;
  height: 100%;
}

.article-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.article-date {
  font-size: 11px;
  color: var(--text-dim);
}

.article-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.article-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.article-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.article-source {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}

@media (max-width: 560px) {
  .article-row { flex-direction: column; gap: 12px; }
  .thumb { width: 100%; height: 110px; }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}

.empty-hint {
  font-size: 14px;
  margin: 0 0 18px;
}

.load-more-btn {
  display: block;
  margin: 8px auto 32px;
}

.skeleton-thumb {
  background: linear-gradient(90deg, var(--surface-2) 25%, #e6e8ec 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.skeleton-line {
  background: linear-gradient(90deg, var(--surface-2) 25%, #e6e8ec 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  height: 12px;
  border-radius: 4px;
  margin-top: 10px;
}

.skeleton-line.short { width: 60%; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 700px) {
  .toolbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .toolbar-right { margin-left: 0; }
}

@media (max-width: 640px) {
  .app-header { padding: 12px 16px; }
  .container { padding: 16px; }
  .search-box { order: 3; flex-basis: 100%; max-width: none; }
}

@media (max-width: 420px) {
  .hero-title { font-size: 22px; }
  .card-title { font-size: 17px; }
  .section-title { font-size: 22px; }
}

/* ---------- Footer / social links ---------- */
.site-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.footer-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.social-links {
  display: flex;
  gap: 16px;
}

.social-link {
  display: inline-flex;
  color: var(--text-dim);
  transition: color 0.15s ease, transform 0.15s ease;
}

.social-link:hover {
  color: var(--brand);
  transform: translateY(-2px);
}

.social-link svg {
  width: 20px;
  height: 20px;
}
