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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #263348;
  --border: #334155;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --radius: 14px;
}

html { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }

body {
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* Header */
header {
  padding: 20px 0 16px;
  text-align: center;
}
.logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="date"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 10px 14px;
  outline: none;
  -webkit-appearance: none;
}
input[type="date"]:focus { border-color: var(--accent); }

.legs-selector {
  display: flex;
  gap: 8px;
}
.leg-btn {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  transition: all 0.15s;
}
.leg-btn:active { transform: scale(0.95); }
.leg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.research-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
  box-shadow: 0 0 20px var(--accent-glow);
}
.research-btn:active { transform: scale(0.98); }
.research-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-icon { font-size: 20px; }

/* Status */
.status {
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.status.loading::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.status.error {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* Results */
.results {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Pick Card */
.pick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeUp 0.3s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.pick-player {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.pick-matchup {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.pick-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.badge-odds {
  font-size: 18px;
  font-weight: 800;
  color: var(--green);
}

.badge-conf {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.conf-low  { background: rgba(239,68,68,0.15);  color: var(--red); }
.conf-mid  { background: rgba(234,179,8,0.15);  color: var(--yellow); }
.conf-high { background: rgba(34,197,94,0.15);  color: var(--green); }

/* Stats row */
.pick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
}
.stat {
  text-align: center;
}
.stat-value {
  font-size: 15px;
  font-weight: 700;
}
.stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
}

/* Reasoning */
.pick-reasoning {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* Notes */
.notes-section {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.notes-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.notes-content {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* Leg number badge on card */
.leg-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin-right: 6px;
  flex-shrink: 0;
}
