/* ============================
   PARLAYIQ — Mobile-First CSS
   ============================ */

:root {
  --bg: #0a0b0f;
  --surface: #13151c;
  --surface2: #1b1e28;
  --surface3: #22263a;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.15);
  --text: #eef0f8;
  --muted: #5e6480;
  --muted2: #8890b0;
  --accent: #00e5a0;
  --accent-dim: rgba(0,229,160,0.12);
  --blue: #3d7aff;
  --blue-dim: rgba(61,122,255,0.12);
  --warn: #ff9f0a;
  --warn-dim: rgba(255,159,10,0.12);
  --danger: #ff4d6a;
  --danger-dim: rgba(255,77,106,0.12);
  --gold: #f5c842;
  --gold-dim: rgba(245,200,66,0.12);
  --safe-color: #00c47a;
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 56px;
  --nav-h: 50px;
  --filter-h: 44px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; scroll-behavior: smooth; }

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

/* ---- NOISE ---- */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ---- INSTALL BANNER ---- */
.install-banner {
  background: var(--blue);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  position: relative;
  z-index: 200;
}
.install-banner button { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; }

/* ---- HEADER ---- */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.header-left, .header-right { display: flex; align-items: center; gap: 10px; }

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 1.5px;
  line-height: 1;
  color: var(--text);
}
.logo span { color: var(--accent); }

.live-chip {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0,229,160,0.25);
  padding: 3px 9px; border-radius: 20px;
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--accent); border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(1.5)} }

.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 20px; padding: 6px; border-radius: 8px;
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--surface2); }

.slip-toggle {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; transition: all 0.2s;
}
.slip-toggle:active { transform: scale(0.96); }
.slip-count {
  background: var(--accent); color: #000;
  font-size: 11px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ---- SPORT NAV ---- */
.sport-nav {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px;
  scrollbar-width: none; -ms-overflow-style: none;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.sport-nav::-webkit-scrollbar { display: none; }

.sport-pill {
  flex-shrink: 0;
  padding: 7px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px; font-weight: 500; color: var(--muted2);
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.sport-pill:active { transform: scale(0.95); }
.sport-pill.active {
  background: var(--accent); color: #000;
  border-color: var(--accent); font-weight: 700;
}

/* ---- FILTER ROW ---- */
.filter-row {
  display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto;
  scrollbar-width: none; background: var(--bg);
}
.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 5px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px; font-weight: 500; color: var(--muted2);
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.filter-chip.active {
  border-color: var(--blue);
  color: #7fa0ff;
  background: var(--blue-dim);
}

/* ---- AI SUGGEST BAR ---- */
.ai-suggest-bar {
  margin: 12px 16px 0;
  background: linear-gradient(135deg, rgba(61,122,255,0.1), rgba(0,229,160,0.06));
  border: 1px solid rgba(61,122,255,0.25);
  border-radius: var(--radius);
  overflow: hidden;
}
.ai-suggest-inner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
}
.ai-avatar {
  width: 36px; height: 36px;
  background: var(--blue-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.ai-suggest-text { flex: 1; min-width: 0; }
.ai-suggest-label { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: var(--blue); text-transform: uppercase; }
.ai-suggest-value { font-size: 13px; color: var(--text); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ai-analyze-mini {
  flex-shrink: 0;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.ai-analyze-mini:active { transform: scale(0.95); }

/* ---- APP SHELL ---- */
.app-shell {
  padding-bottom: 100px;
}

/* ---- SECTION HEADER ---- */
.games-section { padding: 16px 16px 0; }
.sec-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sec-title { font-size: 15px; font-weight: 600; }
.game-count { font-size: 12px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ---- GAME CARDS ---- */
.games-list { display: flex; flex-direction: column; gap: 12px; }

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
  position: relative;
}
.game-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent; transition: background 0.2s;
}
.game-card.has-pick { border-color: rgba(0,229,160,0.3); }
.game-card.has-pick::before { background: var(--accent); }

.card-top {
  padding: 14px 14px 0;
}

.card-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.meta-time {
  font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--muted);
}
.meta-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  padding: 2px 8px; border-radius: 20px;
  background: var(--surface3); color: var(--muted2);
}
.meta-tag.live-tag { background: var(--danger-dim); color: var(--danger); }
.meta-confidence {
  margin-left: auto;
  font-size: 11px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}
.conf-high { color: var(--accent); }
.conf-mid { color: var(--warn); }
.conf-low { color: var(--danger); }

/* MATCHUP */
.matchup {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.team-block { flex: 1; }
.team-block.away-team { text-align: right; }
.team-emoji { font-size: 22px; }
.team-name { font-size: 15px; font-weight: 600; margin-top: 2px; }
.team-record { font-size: 11px; color: var(--muted); margin-top: 1px; }
.vs-block { text-align: center; flex-shrink: 0; }
.vs-text { font-family: 'Bebas Neue', sans-serif; font-size: 22px; color: var(--muted); }
.spread-text { font-size: 10px; font-family: 'JetBrains Mono', monospace; color: var(--muted2); margin-top: -2px; }

/* WIN BAR */
.win-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 0 0; }
.win-pct-left { font-size: 11px; font-weight: 700; font-family: 'JetBrains Mono', monospace; min-width: 32px; }
.win-pct-right { font-size: 11px; font-weight: 700; font-family: 'JetBrains Mono', monospace; min-width: 32px; text-align: right; }
.win-bar-track { flex: 1; height: 5px; background: var(--surface3); border-radius: 3px; overflow: hidden; display: flex; }
.win-bar-home { height: 100%; border-radius: 3px; transition: width 0.5s; }
.win-bar-away { height: 100%; opacity: 0.3; transition: width 0.5s; }

/* BET BUTTONS GRID */
.bet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
}
.bet-btn {
  padding: 11px 6px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  display: flex; flex-direction: column; gap: 3px; align-items: center;
  position: relative;
}
.bet-btn:last-child { border-right: none; }
.bet-btn:active { background: var(--surface2); }
.bet-btn.picked { background: var(--blue-dim); }
.bet-btn.picked::after {
  content: '✓';
  position: absolute; top: 5px; right: 8px;
  font-size: 10px; color: var(--blue); font-weight: 700;
}
.btn-label { font-size: 10px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.btn-line { font-size: 13px; font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.btn-pct { font-size: 11px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* AI INSIGHT STRIP */
.ai-insight-strip {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(61,122,255,0.07), transparent);
  border-top: 1px solid var(--border);
  font-size: 12px; color: #9aadff; line-height: 1.5;
  display: none;
}
.game-card.has-pick .ai-insight-strip { display: block; }
.insight-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--blue); margin-bottom: 3px; }

/* ---- BET SLIP DRAWER ---- */
.slip-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 300; display: none;
  backdrop-filter: blur(4px);
}
.slip-overlay.open { display: block; }

.slip-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 400;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border2);
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-overflow-scrolling: touch;
}
.slip-drawer.open { transform: translateY(0); }

.slip-handle {
  width: 40px; height: 4px; background: var(--border2);
  border-radius: 2px; margin: 12px auto 0;
}
.slip-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.slip-title { font-size: 17px; font-weight: 700; }
.clear-btn {
  background: none; border: none; color: var(--danger);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 8px;
}
.close-slip-btn {
  background: var(--surface2); border: none; color: var(--muted2);
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.slip-empty { padding: 48px 24px; text-align: center; }
.slip-empty-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.slip-empty-sub { font-size: 14px; color: var(--muted2); line-height: 1.5; }

/* PROBABILITY DISPLAY */
.prob-display {
  padding: 24px 20px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.prob-number {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 80px; line-height: 1;
  color: var(--accent);
}
.prob-number.warn { color: var(--warn); }
.prob-number.danger { color: var(--danger); }
.prob-label { font-size: 13px; color: var(--muted2); margin-top: 2px; }
.prob-bar-wrap { margin: 14px 0 10px; }
.prob-bar-track { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.prob-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.5s ease, background 0.3s; }
.bet-type-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  background: var(--surface3); color: var(--muted2);
  padding: 4px 14px; border-radius: 20px;
}

/* LEGS */
.slip-section-label { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; padding: 14px 20px 8px; }
.legs-list { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }

.leg-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.leg-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.leg-info { flex: 1; min-width: 0; }
.leg-pick { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leg-game { font-size: 11px; color: var(--muted2); margin-top: 2px; }
.leg-pct { font-size: 13px; font-weight: 700; font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
.leg-remove {
  background: none; border: none; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 4px; border-radius: 4px; flex-shrink: 0;
  transition: color 0.2s;
}
.leg-remove:hover { color: var(--danger); }

/* PAYOUT CARD */
.payout-card { margin: 12px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stake-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stake-label { font-size: 13px; color: var(--muted2); font-weight: 500; }
.stake-input-wrap { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; padding: 7px 12px; }
.dollar { font-size: 15px; font-weight: 700; color: var(--muted2); }
.stake-input {
  background: none; border: none; color: var(--text);
  font-size: 16px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  width: 80px; outline: none; text-align: right;
}
.odds-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.odds-cell { background: var(--surface); border-radius: 8px; padding: 10px 12px; }
.odds-cell.highlight { background: var(--gold-dim); border: 1px solid rgba(245,200,66,0.2); }
.odds-cell-label { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.5px; margin-bottom: 4px; text-transform: uppercase; }
.odds-cell-val { font-size: 17px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.gold { color: var(--gold); }

/* BEST SINGLE */
.best-single-card {
  margin: 0 16px 12px;
  background: linear-gradient(135deg, rgba(245,200,66,0.1), rgba(245,200,66,0.04));
  border: 1px solid rgba(245,200,66,0.3);
  border-radius: var(--radius); padding: 14px 16px;
}
.best-single-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--gold); margin-bottom: 6px; }
.best-single-pick { font-size: 15px; font-weight: 700; }
.best-single-why { font-size: 12px; color: var(--muted2); margin-top: 4px; line-height: 1.4; }

/* AI PANEL */
.ai-panel { margin: 0 16px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ai-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ai-panel-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.ai-models { font-size: 10px; font-weight: 500; letter-spacing: 1px; color: var(--muted2); background: var(--surface3); padding: 2px 8px; border-radius: 20px; }
.ai-thinking-dots { display: flex; gap: 4px; align-items: center; }
.ai-thinking-dots span { width: 6px; height: 6px; background: var(--blue); border-radius: 50%; animation: blink 1.2s ease-in-out infinite; }
.ai-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,100%{opacity:0.2} 50%{opacity:1} }
.ai-body { padding: 14px; font-size: 13px; line-height: 1.7; color: #b0bbdf; }
.ai-placeholder { color: var(--muted2); font-style: italic; }
.ai-body strong { color: var(--text); font-weight: 600; }
.ai-body .highlight-green { color: var(--accent); font-weight: 600; }
.ai-body .highlight-warn { color: var(--warn); font-weight: 600; }
.ai-body .highlight-danger { color: var(--danger); font-weight: 600; }
.ai-sources { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 6px; flex-wrap: wrap; }
.ai-src { font-size: 10px; font-family: 'JetBrains Mono', monospace; background: var(--blue-dim); border: 1px solid rgba(61,122,255,0.2); border-radius: 20px; padding: 3px 9px; color: #7fa0ff; }

/* ANALYZE BTN */
.analyze-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: calc(100% - 32px); margin: 0 16px;
  padding: 16px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: all 0.2s;
  letter-spacing: 0.3px;
}
.analyze-btn:active { transform: scale(0.97); }
.analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- SETTINGS MODAL ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 500; backdrop-filter: blur(4px); }
.modal { position: fixed; bottom: 0; left: 0; right: 0; z-index: 600; background: var(--surface); border-radius: 20px 20px 0 0; border-top: 1px solid var(--border2); max-height: 85vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.setting-group { display: flex; flex-direction: column; gap: 10px; }
.setting-label { font-size: 13px; font-weight: 700; color: var(--muted2); text-transform: uppercase; letter-spacing: 1px; }
.setting-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.setting-input {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 14px; color: var(--text); outline: none;
  font-family: 'JetBrains Mono', monospace;
  width: 100%;
}
.setting-input:focus { border-color: var(--accent); }
.format-btn {
  padding: 8px 16px; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 8px; font-size: 13px; color: var(--muted2); cursor: pointer;
  transition: all 0.2s;
}
.format-btn.active { background: var(--blue-dim); border-color: var(--blue); color: #7fa0ff; font-weight: 600; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 12px 20px;
  font-size: 13px; color: var(--text);
  z-index: 999; transition: transform 0.3s ease;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- UTILITY ---- */
.hidden { display: none !important; }

/* ---- DESKTOP ADJUSTMENTS ---- */
@media (min-width: 640px) {
  .slip-drawer { max-width: 480px; left: 50%; right: auto; transform: translateX(-50%) translateY(100%); border-radius: 20px 20px 0 0; }
  .slip-drawer.open { transform: translateX(-50%) translateY(0); }
  .modal { max-width: 480px; left: 50%; right: auto; border-radius: 20px 20px 0 0; }
}
@media (min-width: 1024px) {
  .app-shell { max-width: 720px; margin: 0 auto; }
  header { justify-content: center; gap: 0; }
  .header-left { position: absolute; left: 24px; }
  .header-right { position: absolute; right: 24px; }
}
