@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@700;800&display=swap');

:root {
  --bg: #0a0c10;
  --panel: rgba(22, 27, 34, 0.7);
  --card-bg: rgba(28, 33, 40, 0.6);
  --ink: #f0f6fc;
  --muted: #8b949e;
  --line: rgba(255, 255, 255, 0.1);
  --accent-low: #00d084;
  --accent-high: #ff4d4d;
  --accent-blue: #58a6ff;
  --accent-purple: #bc8cff;
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --hdr-h: 72px;
  --bar-h: 64px;
  --radius: 20px;
  --radius-sm: 12px;
  
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(88, 166, 255, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(188, 140, 255, 0.05) 0px, transparent 50%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  line-height: 1.5;
}

/* -- SHELL -- */
.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* -- HEADER -- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(var(--hdr-h) + var(--safe-t));
  padding-top: var(--safe-t);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 12, 16, 0.8);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  gap: 1rem;
}

.hdr-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.hdr-icon.lows {
  background: linear-gradient(135deg, var(--accent-low), #00a0e9);
}

.hdr-icon.highs {
  background: linear-gradient(135deg, var(--accent-high), #ff8c00);
}

.hdr-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hdr-sub {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.hdr-right {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
}

.badge-low { background: rgba(0, 208, 132, 0.1); color: var(--accent-low); }
.badge-high { background: rgba(255, 77, 77, 0.1); color: var(--accent-high); }
.badge-blue { background: rgba(88, 166, 255, 0.1); color: var(--accent-blue); }

/* -- TAB NAV -- */
.tab-nav {
  position: sticky;
  top: calc(var(--hdr-h) + var(--safe-t));
  z-index: 90;
  background: rgba(10, 12, 16, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 1rem;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: none;
  padding: 0 1.5rem;
  height: 48px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn.active {
  color: var(--ink);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.lows .tab-btn.active::after { background: var(--accent-low); box-shadow: 0 -4px 12px var(--accent-low); }
.highs .tab-btn.active::after { background: var(--accent-high); box-shadow: 0 -4px 12px var(--accent-high); }

/* -- MAIN -- */
main {
  padding: 1.5rem;
  padding-bottom: calc(var(--bar-h) + var(--safe-b) + 2rem);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.panel {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -- CARDS -- */
.picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.pick-card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.pick-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.card-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.card-top {
  padding: 1.5rem;
}

.ticker-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.ticker {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.rank-pill {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: var(--muted);
}

.co-name {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1rem;
}

.meta-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
}

/* -- PRICE GRID -- */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--glass-border);
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}

.price-item {
  background: var(--card-bg);
  padding: 1rem 1.5rem;
}

.price-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.price-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-display);
}

/* -- SCORES -- */
.score-section {
  padding: 1.5rem;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.score-label {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.score-total {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}

.score-total small {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.score-name {
  font-size: 0.8rem;
  color: var(--muted);
  width: 90px;
  flex-shrink: 0;
}

.bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
}

.score-val {
  font-size: 0.8rem;
  font-weight: 700;
  width: 12px;
  text-align: right;
}

/* -- FOOTER BAR -- */
.app-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--bar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 12, 16, 0.8);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: center;
  gap: 4rem;
  padding-top: 0.75rem;
}

.bar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.bar-btn.active {
  color: var(--ink);
}

.bar-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.bar-btn.active .bar-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px currentColor);
}

/* -- DATE SELECTOR -- */
.date-form { margin: 0; }

.date-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 2rem 0.3rem 0.9rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  transition: border-color 0.2s, color 0.2s;
}

.date-select option { background: #1a1a2e; color: var(--ink); }

/* -- MOBILE ADJUSTMENTS -- */
@media (max-width: 768px) {
  .hdr { padding-left: 1rem; padding-right: 1rem; }
  .hdr-title { font-size: 1.25rem; }
  .app-bar { gap: 2rem; }
  .picks-grid { grid-template-columns: 1fr; }
}

/* -- DISCARDED TAB -- */
:root { --accent-disc: #f0a500; }

.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px; margin-left: 5px;
  border-radius: 9px; background: rgba(240,165,0,0.15);
  color: var(--accent-disc); font-size: 0.65rem; font-weight: 800;
  vertical-align: middle;
}

.discard-summary {
  display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.dsumm-item {
  padding: 0.3rem 0.85rem; border-radius: 99px;
  font-size: 0.75rem; font-weight: 700; border: 1px solid transparent;
}

.reason-avoided   { background: rgba(255,77,77,.08);  color: var(--accent-high); border-color: rgba(255,77,77,.2); }
.reason-trap      { background: rgba(240,165,0,.10);   color: var(--accent-disc); border-color: rgba(240,165,0,.25); }
.reason-watchlist { background: rgba(88,166,255,.08);  color: var(--accent-blue); border-color: rgba(88,166,255,.2); }

.reason-badge {
  font-size: 0.7rem; font-weight: 800; padding: 0.25rem 0.6rem;
  border-radius: 8px; text-transform: uppercase; letter-spacing: .04em;
}

.discard-reason-row {
  padding: 0.75rem 1.5rem 1.25rem;
  border-top: 1px solid var(--glass-border);
}
.discard-why {
  display: block; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 0.4rem;
}
.discard-thesis {
  font-size: 0.85rem; color: var(--muted); line-height: 1.5; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 4rem 2rem; text-align: center; gap: 0.75rem;
}
.empty-icon  { font-size: 2.5rem; opacity: 0.4; }
.empty-title { font-size: 1.1rem; font-weight: 700; color: var(--muted); }
.empty-sub   { font-size: 0.9rem; color: var(--muted); opacity: 0.7; max-width: 300px; }
