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

:root {
  --bg: #0f1117;
  --surface: #161b27;
  --surface2: #1e2438;
  --border: #252d42;
  --text: #e4e8f0;
  --muted: #7a8099;
  --poly: #818cf8;
  --poly-bg: rgba(129,140,248,.15);
  --kalshi: #38bdf8;
  --kalshi-bg: rgba(56,189,248,.15);
}

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,17,23,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.header-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.btn-refresh {
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
.btn-refresh:active { opacity: .6; }
.btn-refresh:disabled { opacity: .4; cursor: default; }

/* ── Feed ── */
#feed {
  padding: 12px 12px 96px;
  max-width: 620px;
  margin: 0 auto;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 10px;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
}
.badge-polymarket { background: var(--poly-bg); color: var(--poly); }
.badge-kalshi     { background: var(--kalshi-bg); color: var(--kalshi); }
.badge-news       { background: rgba(100,200,100,.12); color: #6ec87a; }

.category {
  font-size: 11px;
  color: var(--muted);
}

.question {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.2px;
  margin-bottom: 14px;
}

/* ── Meta row ── */
.meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.meta span::before { content: attr(data-icon) ' '; }

/* ── Summary ── */
.summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ── News ── */
.news { display: flex; flex-direction: column; gap: 7px; }

.news-link {
  display: block;
  text-decoration: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 11px;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s;
}
.news-link:active { opacity: .7; }

.news-headline {
  display: block;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 3px;
}

.news-byline {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.sources-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.market-entry {
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 6px;
}
.market-title { display: block; font-size: 13px; color: var(--text); }
.market-meta  { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.no-news {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

/* ── States ── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 0;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--poly);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ── Responsive ── */
@media (min-width: 500px) {
  header { padding: 14px 20px; }
  #feed  { padding: 16px 16px 96px; }
  .question { font-size: 17px; }
}
