:root {
  --bg-main: #0b1120;
  --bg-card: #131d33;
  --bg-card-hover: #192642;
  --border-color: #223254;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #0284c7;
  --accent-blue-hover: #0369a1;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-stack);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
}

/* Nav */
.navbar {
  background-color: rgba(19, 29, 51, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-blue);
  border-radius: 50%;
  display: inline-block;
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-primary { background-color: var(--accent-blue); color: white; }
.btn-primary:hover { background-color: var(--accent-blue-hover); }
.btn-secondary { background-color: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background-color: #2d416b; }
.btn-danger { background-color: var(--accent-red); color: white; }
.btn-danger:hover { background-color: #dc2626; }
.btn-sm { padding: 4px 8px; font-size: 0.75rem; }

/* Install Banner */
.pwa-banner {
  background: linear-gradient(90deg, #0369a1, #0284c7);
  color: white;
  padding: 10px 16px;
  display: none;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

/* Stale Warning Banner */
.stale-warning-banner {
  background-color: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent-amber);
  color: #fde68a;
  padding: 12px 16px;
  margin: 12px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

/* Matchup Hero Header */
.hero-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.matchup-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-bottom: 16px;
}

.team-box h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.team-box .team-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.vs-box {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.odds-bar {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  text-align: center;
}

.odds-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.odds-item .value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.movement-pill {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  display: inline-block;
  margin-top: 4px;
}

.timestamp-row {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* Sections */
.section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.section-card h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

/* Recent Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
}

.team-form-card {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}

.form-stats-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.recent-games-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recent-game-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.02);
}

.outcome-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.pill-hit { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
.pill-miss { background-color: rgba(239, 68, 68, 0.2); color: #f87171; }
.pill-push { background-color: rgba(148, 163, 184, 0.2); color: #94a3b8; }

/* Trends Table */
.trend-item {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.trend-item:hover { border-color: var(--accent-blue); }

.trend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.trend-desc {
  font-weight: 600;
  font-size: 0.95rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-strong { background-color: rgba(16, 185, 129, 0.25); color: #10b981; border: 1px solid #10b981; }
.badge-moderate { background-color: rgba(2, 132, 199, 0.25); color: #38bdf8; border: 1px solid #0284c7; }
.badge-small { background-color: rgba(148, 163, 184, 0.25); color: #cbd5e1; border: 1px solid #64748b; }
.badge-fading { background-color: rgba(245, 158, 11, 0.25); color: #fbbf24; border: 1px solid #f59e0b; }

.trend-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.trend-stats strong { color: var(--text-main); }

/* Conflicting Signals */
.conflict-box {
  background-color: rgba(245, 158, 11, 0.08);
  border-left: 4px solid var(--accent-amber);
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

/* Context Grid */
.context-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .context-grid { grid-template-columns: 1fr 1fr; }
}

.context-box {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
}
.context-box h4 {
  font-size: 0.9rem;
  color: var(--accent-blue);
  margin-bottom: 6px;
}

/* AI Summary */
.ai-summary-card {
  background: linear-gradient(180deg, #162444, #131d33);
  border: 1px solid #2b4170;
}
.summary-sentence {
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 8px;
}
.disclaimer-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

/* Paywall Locked Teaser */
.paywall-locked-card {
  background-color: rgba(19, 29, 51, 0.9);
  border: 2px dashed #334e80;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}
.paywall-locked-card h3 {
  color: #38bdf8;
  margin-bottom: 8px;
}

/* Modal / Slide-up drawer */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

.drilldown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.drilldown-table th {
  text-align: left;
  padding: 8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.drilldown-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.row-hit td { background-color: rgba(16, 185, 129, 0.03); }
.row-miss td { background-color: rgba(239, 68, 68, 0.03); }

/* Table responsive */
.table-responsive {
  overflow-x: auto;
}

/* Research assistant chat */
.research-container { max-width: 760px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; min-height: 200px; }
.chat-empty { padding: 16px; border: 1px dashed var(--border-color); border-radius: 8px; }
.example-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.example-chip {
  background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color);
  border-radius: 16px; padding: 6px 12px; font-size: 0.8rem; cursor: pointer; text-align: left;
}
.example-chip:hover { background: var(--bg-card-hover); }
.chat-msg { padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; max-width: 100%; overflow-wrap: anywhere; }
.chat-msg p + p { margin-top: 6px; }
.chat-msg ul { padding-left: 18px; margin: 6px 0; }
.chat-msg a { color: #38bdf8; }
.chat-user { align-self: flex-end; background: var(--accent-blue); color: white; max-width: 85%; }
.chat-assistant { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border-color); width: 100%; }
.chat-pending { color: var(--text-muted); font-style: italic; }
.chat-status { color: var(--accent-amber); font-size: 0.75rem; margin-top: 6px; }
.chat-queries { margin-top: 8px; font-size: 0.75rem; color: var(--text-muted); }
.chat-queries summary { cursor: pointer; }
.chat-queries ul { padding-left: 16px; }
.chat-queries pre {
  white-space: pre-wrap; background: rgba(0, 0, 0, 0.25); padding: 6px; border-radius: 4px;
  margin: 4px 0 8px; font-size: 0.7rem; overflow-x: auto;
}
.query-meta { color: var(--text-muted); }
.query-error { color: var(--accent-red); }
.chat-form { display: flex; gap: 8px; align-items: stretch; position: sticky; bottom: 0; background: var(--bg-main); padding: 8px 0; }
.chat-form textarea {
  flex: 1; resize: vertical; padding: 10px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-main); font: inherit; font-size: 16px;
}

/* Home: ask box and collapsible weeks */
.ask-box {
  background: var(--bg-card); border: 1px solid var(--accent-blue); border-radius: 10px;
  padding: 14px; margin-bottom: 20px;
}
.ask-label { display: block; font-weight: 700; margin-bottom: 8px; }
.ask-row { display: flex; gap: 8px; }
.ask-row input {
  flex: 1; min-width: 0; padding: 10px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--bg-main); color: var(--text-main); font: inherit; font-size: 16px;
}
.ask-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.week-group { margin-bottom: 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); }
.week-summary {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; cursor: pointer; list-style: none;
}
.week-summary::-webkit-details-marker { display: none; }
.week-summary::before { content: "▸"; margin-right: 8px; color: var(--text-muted); transition: transform 0.15s; }
.week-group[open] > .week-summary::before { transform: rotate(90deg); }
.week-title { font-weight: 800; flex: 1; }
.week-meta { font-size: 0.8rem; color: var(--text-muted); }
.week-games { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 0 12px 12px; }

/* Social card approval queue */
.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.social-card img { width: 100%; border-radius: 8px; display: block; }
.social-caption { white-space: pre-wrap; font-size: 0.75rem; background: rgba(0, 0, 0, 0.25); padding: 8px; border-radius: 6px; margin-top: 6px; }

/* Research assistant spotlight */
.ask-hero {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, rgba(2, 132, 199, 0.35) 0%, rgba(19, 29, 51, 0.95) 55%), var(--bg-card);
  border: 1px solid rgba(56, 189, 248, 0.45); border-radius: 16px;
  padding: 28px 24px; margin-bottom: 28px; box-shadow: 0 10px 40px rgba(2, 132, 199, 0.18);
}
.ask-hero-eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #38bdf8; margin-bottom: 6px; }
.ask-hero-title { font-size: 2rem; font-weight: 800; line-height: 1.15; margin-bottom: 8px; }
.ask-hero-sub { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 16px; max-width: 620px; }
.ask-hero-form { display: flex; gap: 8px; margin-bottom: 14px; }
.ask-hero-form input {
  flex: 1; min-width: 0; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(56, 189, 248, 0.5);
  background: var(--bg-main); color: var(--text-main); font: inherit; font-size: 17px;
}
.ask-hero-form input:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
.ask-hero-btn { padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.ask-hero-chips .example-chip, .ask-panel .example-chip { text-decoration: none; display: inline-block; }
.ask-panel {
  background: var(--bg-card); border: 1px solid rgba(56, 189, 248, 0.45); border-radius: 12px;
  padding: 16px; margin-bottom: 20px;
}
.ask-panel h3 { font-size: 1rem; margin-bottom: 10px; }
.research-head { margin-bottom: 14px; }
.ask-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  display: inline-flex; align-items: center; gap: 6px; padding: 12px 18px;
  background: var(--accent-blue); color: white; font-weight: 700; text-decoration: none;
  border-radius: 999px; box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
}
.ask-fab:hover { background: var(--accent-blue-hover); }
@media (max-width: 480px) {
  .ask-hero { padding: 20px 16px; }
  .ask-hero-title { font-size: 1.6rem; }
  .ask-hero-form { flex-direction: column; }
  .ask-hero-btn { padding: 12px; }
}

/* Free tier */
.free-meter { font-size: 0.85rem; color: #38bdf8; margin-top: 4px; }
.chat-upsell { border-color: rgba(56, 189, 248, 0.6) !important; background: linear-gradient(135deg, rgba(2, 132, 199, 0.18), var(--bg-card)) !important; }
.upsell-sub { color: var(--text-muted); font-size: 0.85rem; }
.upsell-soon { color: var(--text-muted); font-size: 0.75rem; margin-left: 6px; }

/* Accounts, forms, legal, footer */
.stack-form { display: flex; flex-direction: column; gap: 10px; }
.stack-form input[type="email"], .stack-form input[type="password"] {
  padding: 12px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--bg-main); color: var(--text-main); font: inherit; font-size: 16px;
}
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.85rem; line-height: 1.4; }
.check input { margin-top: 3px; }
.check a, .form-note a { color: #38bdf8; }
.form-error { color: #f87171; font-size: 0.85rem; margin-bottom: 8px; }
.form-note { font-size: 0.85rem; color: var(--accent-amber); margin-top: 8px; }
.legal h1 { font-size: 1.6rem; margin: 6px 0; }
.legal h2 { font-size: 1.05rem; margin: 18px 0 6px; }
.legal p, .legal li { font-size: 0.9rem; line-height: 1.6; color: var(--text-main); }
.legal ul { padding-left: 20px; }
.legal-date { color: var(--text-muted); font-size: 0.8rem !important; }
.draft-note { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--accent-amber); color: #fbbf24 !important; padding: 8px 12px; border-radius: 8px; }
.site-footer {
  border-top: 1px solid var(--border-color); margin-top: 40px; padding: 18px 16px 90px;
  font-size: 0.75rem; color: var(--text-muted); text-align: center; line-height: 1.7;
}
.site-footer a { color: var(--text-muted); text-decoration: underline; }
.section-card a:not(.btn) { color: #38bdf8; }
