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

:root {
  --bg:          #0d0d0f;
  --surface:     #16161a;
  --surface2:    #1e1e24;
  --border:      #2a2a33;
  --accent:      #e8ff47;
  --accent2:     #ff6b35;
  --text:        #f0f0f5;
  --muted:       #7a7a8c;
  --card-hover:  #1c1c22;
  --tag-bg:      #22222a;

  --verified:    #4ade80;
  --confirmed:   #facc15;
  --unconfirmed: #fb923c;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(13,13,15,0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.logo-text { white-space: nowrap; }
.logo-text span { color: var(--accent); }

.logo-img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--accent);
  filter: drop-shadow(0 0 6px rgba(232,255,71,0.35));
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.13s, border-color 0.13s;
}
.lang-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.refresh-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.refresh-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* ── Source bar ──────────────────────────────────────────────── */
.source-bar {
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface);
}
.source-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}
.source-btn {
  padding: 5px 13px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.source-btn:hover  { border-color: var(--accent); color: var(--accent); }
.source-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0f;
  font-weight: 700;
}

.topics-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.refresh-row {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.reload-btn {
  padding: 7px 28px;
  border-radius: 100px;
  border: none;
  background: var(--accent2);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.reload-btn:hover    { opacity: 0.85; transform: translateY(-1px); }
.reload-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Feed ────────────────────────────────────────────────────── */
.feed-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  position: relative;
  z-index: 1;
}
.feed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.feed-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.feed-count { font-size: 0.76rem; color: var(--muted); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 8px;
  display: flex;
  gap: 14px;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s, transform 0.13s;
  animation: slide-in 0.32s ease both;
  text-decoration: none;
  color: inherit;
}
.card:hover {
  background: var(--card-hover);
  border-color: #3a3a45;
  transform: translateX(3px);
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Vote column */
.card-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 34px;
  padding-top: 2px;
}
.vote-arrow {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.13s;
  flex-shrink: 0;
}
.vote-arrow:hover         { border-color: var(--accent); color: var(--accent); background: rgba(232,255,71,0.07); }
.vote-arrow.voted         { border-color: var(--accent); color: var(--accent); background: rgba(232,255,71,0.12); }
.vote-count {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

/* Card body */
.card-body { flex: 1; min-width: 0; }

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

/* Reliability badge */
.reliability-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.reliability-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-category {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--accent);
  flex-shrink: 0;
}
.card-source-name {
  font-size: 0.73rem;
  color: var(--muted);
  font-weight: 500;
}
.card-time {
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 5px;
}
.card-summary {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 300;
  margin-bottom: 8px;
}

/* Source pills */
.source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.source-pill {
  font-size: 0.65rem;
  color: var(--muted);
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 14px;
}
.card-action {
  font-size: 0.71rem;
  color: var(--muted);
  font-weight: 500;
  display: flex; align-items: center; gap: 4px;
  transition: color 0.13s;
}
.card-action:hover { color: var(--text); }

/* Veracidad bar */
.veracidad-wrap {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.veracidad-bar-bg {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.veracidad-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.veracidad-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
}

/* ── Skeleton loading ────────────────────────────────────────── */
.skeleton { animation: shimmer 1.4s ease infinite; }
@keyframes shimmer {
  0%,100% { opacity: 0.35; }
  50%      { opacity: 0.12; }
}
.skel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 8px;
  display: flex;
  gap: 14px;
}
.skel-left  { width: 34px; flex-shrink: 0; }
.skel-right { flex: 1; }
.skel-line {
  height: 11px;
  border-radius: 6px;
  background: var(--border);
  margin-bottom: 8px;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .icon { font-size: 2.8rem; margin-bottom: 14px; }
.empty-state p { font-size: 0.88rem; }

/* ── Progress bar ────────────────────────────────────────────── */
.refresh-bar-wrap {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--surface2);
  z-index: 200;
}
.refresh-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 1s linear;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.18s ease;
}
.modal-overlay[hidden] { display: none; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 28px 22px;
  max-width: 620px;
  width: 100%;
  position: relative;
  animation: modal-up 0.22s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modal-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 18px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.13s;
}
.modal-close:hover { border-color: var(--accent); color: var(--accent); }

.modal-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 18px;
  padding-right: 24px;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
  font-weight: 300;
  min-height: 80px;
  margin-bottom: 20px;
}

.modal-ai-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.modal-ai-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* Skeleton inside modal */
.modal-skeleton { }
.mskel-line {
  height: 11px;
  border-radius: 6px;
  background: var(--border);
  margin-bottom: 10px;
  animation: shimmer 1.4s ease infinite;
}

.modal-error {
  color: var(--unconfirmed);
  font-size: 0.85rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.modal-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.modal-read-btn {
  padding: 7px 18px;
  border-radius: 100px;
  border: none;
  background: var(--accent);
  color: #0d0d0f;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.13s;
  flex-shrink: 0;
}
.modal-read-btn:hover { opacity: 0.85; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 14px 16px; }
  .legend { display: none; }
  .source-bar { padding: 12px 16px; }
  .feed-wrap { padding: 16px 10px 80px; }
}
