/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg:        #0f0f0d;
  --bg2:       #161614;
  --bg3:       #1e1e1b;
  --border:    rgba(255,248,220,0.08);
  --border2:   rgba(255,248,220,0.16);
  --text:      #f0ead8;
  --muted:     #7a7668;
  --muted2:    #5a5650;
  --red:       #e03030;
  --red2:      #ff4444;
  --cream:     #f5e9c8;
  --green:     #4caf7d;
  --radius:    4px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono:    'JetBrains Mono', monospace;
  --font-body:    'Barlow', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scanlines ─────────────────────────────────────────── */
.scanlines {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.06) 2px,
    rgba(0,0,0,0.06) 4px
  );
}

/* ── Vignette ──────────────────────────────────────────── */
.vignette {
  position: fixed; inset: 0; z-index: 99; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}

/* ── Ticker bar ────────────────────────────────────────── */
.ticker-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 0;
  height: 34px;
  background: var(--red);
  border-bottom: 2px solid rgba(0,0,0,0.3);
  overflow: hidden;
}
.ticker-label {
  font-family: var(--font-mono);
  font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.2em;
  background: #0f0f0d;
  color: var(--red2);
  padding: 0 16px;
  height: 100%;
  display: flex; align-items: center;
  flex-shrink: 0;
  border-right: 2px solid rgba(255,255,255,0.1);
}
.ticker-track {
  flex: 1; overflow: hidden; height: 100%;
  display: flex; align-items: center;
}
.ticker-inner {
  display: flex; gap: 48px; align-items: center;
  white-space: nowrap;
  animation: ticker-scroll 40s linear infinite;
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 400;
  color: rgba(255,255,255,0.92);
  letter-spacing: 0.02em;
  padding-left: 100%;
}
.ticker-item::before { content: '▸ '; opacity: 0.6; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.ticker-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(255,255,255,0.7);
  padding: 0 14px;
  flex-shrink: 0;
  border-left: 1px solid rgba(255,255,255,0.2);
  height: 100%; display: flex; align-items: center;
}

/* ── App ───────────────────────────────────────────────── */
.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── Masthead ──────────────────────────────────────────── */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 24px;
  padding: 32px 0 20px;
  border-bottom: 3px double rgba(255,248,220,0.15);
  margin-bottom: 24px;
}
.masthead-left { display: flex; flex-direction: column; gap: 4px; }
.masthead-edition {
  font-family: var(--font-mono);
  font-size: 0.7rem; letter-spacing: 0.1em; color: var(--muted);
}
.masthead-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem; letter-spacing: 0.22em; color: var(--red);
}
.masthead-title { text-align: center; }
.masthead-title h1 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.9;
  color: var(--cream);
  text-shadow: 0 0 60px rgba(224,48,48,0.2);
}
.masthead-rule {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  margin: 10px 0 8px;
}
.masthead-tagline {
  font-family: var(--font-mono);
  font-size: 0.65rem; letter-spacing: 0.18em;
  color: var(--muted); font-style: italic;
}
.masthead-right {
  display: flex; align-items: center; gap: 10px;
  justify-content: flex-end;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red2);
  box-shadow: 0 0 8px var(--red2);
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.masthead-status {
  font-family: var(--font-mono);
  font-size: 0.65rem; letter-spacing: 0.18em; color: var(--muted);
}
.refresh-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--muted); font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.08em;
  padding: 6px 12px; border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s;
}
.refresh-btn:hover { border-color: var(--red); color: var(--text); }
.refresh-btn.spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── API Banner ────────────────────────────────────────── */
.api-banner {
  background: var(--bg2);
  border: 1px solid rgba(224,48,48,0.3);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  animation: fadeUp 0.4s ease both;
}
.api-banner.hidden { display: none; }
.api-banner-inner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.api-banner-icon { font-size: 1.1rem; }
.api-banner-inner > div { flex: 1; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.api-banner-inner a { color: var(--red2); text-decoration: none; }
.api-banner-inner a:hover { text-decoration: underline; }
.api-banner-inner strong { color: var(--text); }
.api-key-input-row {
  display: flex; gap: 8px; align-items: center; width: 100%; margin-top: 10px;
}
.api-key-input-row input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--font-mono); font-size: 0.8rem;
  padding: 8px 12px; border-radius: var(--radius); outline: none;
  transition: border-color 0.15s;
}
.api-key-input-row input:focus { border-color: var(--red); }
.api-key-input-row input::placeholder { color: var(--muted2); }
.api-key-input-row button {
  background: var(--red); color: #fff; border: none;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.08em; padding: 8px 18px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
}
.api-key-input-row button:hover { background: var(--red2); }

/* ── Main grid ─────────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  align-items: start;
}

/* ── Panel base ────────────────────────────────────────── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeUp 0.45s ease both;
}
.panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  flex-wrap: wrap;
}
.panel-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem; letter-spacing: 0.22em;
  background: var(--red); color: #fff;
  padding: 2px 7px; border-radius: 2px;
  flex-shrink: 0;
}
.panel-title {
  font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.1em;
  color: var(--muted); flex-shrink: 0;
}
.panel-controls { margin-left: auto; }
.feed-select {
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--font-mono); font-size: 0.72rem;
  padding: 4px 8px; border-radius: var(--radius); cursor: pointer; outline: none;
  transition: border-color 0.15s;
}
.feed-select:hover { border-color: var(--red); }
.panel-updated {
  font-family: var(--font-mono);
  font-size: 0.62rem; color: var(--muted2); white-space: nowrap;
}

/* ── News feed ─────────────────────────────────────────── */
.news-feed { padding: 0; }

.news-item {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: rgba(255,248,220,0.03); }
.news-item.featured {
  grid-template-columns: 1fr 180px;
  grid-template-rows: 1fr;
}

.news-item-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }

.news-source {
  font-family: var(--font-mono);
  font-size: 0.62rem; letter-spacing: 0.14em;
  color: var(--red); text-transform: uppercase;
}
.news-headline {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700; line-height: 1.3;
  color: var(--cream);
}
.news-item.featured .news-headline { font-size: 1.35rem; }
.news-item.small .news-headline { font-size: 0.92rem; font-weight: 700; font-family: var(--font-body); }

.news-desc {
  font-size: 0.82rem; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-meta {
  font-family: var(--font-mono);
  font-size: 0.62rem; color: var(--muted2); letter-spacing: 0.04em;
}

.news-image-col {
  overflow: hidden; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  border-left: 1px solid var(--border);
  min-height: 120px;
}
.news-image-col img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: transform 0.4s ease;
  filter: brightness(0.85) saturate(0.8);
}
.news-item:hover .news-image-col img { transform: scale(1.04); filter: brightness(0.95) saturate(1); }
.news-image-placeholder {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--muted2); letter-spacing: 0.12em; text-align: center; padding: 12px;
}

/* No-key state */
.no-key-state {
  padding: 48px 24px; text-align: center;
}
.no-key-state p {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted);
  line-height: 1.7; letter-spacing: 0.04em;
}
.no-key-state .arrow { color: var(--red); font-size: 1.2rem; display: block; margin-bottom: 12px; }

/* ── Sports feed ───────────────────────────────────────── */
.sports-feed { padding: 0; }

.sports-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.sports-item:last-child { border-bottom: none; }
.sports-item:hover { background: rgba(255,248,220,0.03); }

.sports-teams {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.sports-team {
  flex: 1; display: flex; flex-direction: column; gap: 3px;
}
.sports-team.away { align-items: flex-end; text-align: right; }
.sports-team-name {
  font-family: var(--font-body);
  font-size: 0.85rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sports-team-score {
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 700; line-height: 1;
  color: var(--cream);
}
.sports-team.winner .sports-team-score { color: var(--cream); }
.sports-team.loser  .sports-team-score { color: var(--muted); }

.sports-vs {
  font-family: var(--font-mono);
  font-size: 0.65rem; letter-spacing: 0.12em; color: var(--muted2);
  flex-shrink: 0; text-align: center;
}

.sports-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-mono); font-size: 0.62rem; color: var(--muted2);
  letter-spacing: 0.04em;
}
.sports-status {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em;
  padding: 2px 7px; border-radius: 2px; text-transform: uppercase;
}
.sports-status.final   { background: rgba(255,248,220,0.07); color: var(--muted); }
.sports-status.live    { background: rgba(224,48,48,0.2); color: var(--red2); }
.sports-status.upcoming { background: rgba(76,175,125,0.15); color: var(--green); }

.sports-no-games {
  padding: 40px 18px; text-align: center;
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--muted); line-height: 1.8; letter-spacing: 0.04em;
}

/* ── Skeletons ─────────────────────────────────────────── */
.skeleton-block {
  height: 100px; margin: 12px 18px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-block.short { height: 64px; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Error state ───────────────────────────────────────── */
.feed-error {
  padding: 24px 18px; text-align: center;
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--muted); line-height: 1.8;
}
.feed-error .err-code { color: var(--red); font-size: 1.1rem; display: block; margin-bottom: 8px; }

/* ── Footer ────────────────────────────────────────────── */
.footer {
  margin-top: 40px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted2);
  letter-spacing: 0.06em;
}
.footer a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.footer a:hover { color: var(--text); }
.footer-dot { color: var(--muted2); }

/* ── Utilities ─────────────────────────────────────────── */
.hidden { display: none !important; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 780px) {
  .main-grid { grid-template-columns: 1fr; }
  .news-item { grid-template-columns: 1fr; }
  .news-item.featured { grid-template-columns: 1fr; }
  .news-image-col { min-height: 160px; border-left: none; border-top: 1px solid var(--border); }
  .masthead { grid-template-columns: 1fr; text-align: center; gap: 16px; }
  .masthead-left { align-items: center; }
  .masthead-right { justify-content: center; }
}
