/* ---------- Header ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 18px;
  animation: rise 0.8s cubic-bezier(0.22,1,0.36,1) both;
  /* the account dropdown menu is absolutely positioned inside here and
     must paint above the ticker tape below it — the ticker's own
     will-change:transform (for its infinite scroll animation) creates a
     stacking context that would otherwise win on DOM/paint order alone */
  position: relative; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 16px; }

/* ---------- Hamburger nav ---------- */
.nav-menu-wrap { position: relative; }
.hamburger-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  font-size: 16px; color: var(--muted-2); cursor: pointer;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: all 0.22s cubic-bezier(0.22,1,0.36,1);
}
.hamburger-btn:hover { color: var(--accent); border-color: rgba(56,189,248,0.4); }
.nav-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 70;
  min-width: 180px; padding: 6px;
  background: var(--surface-hi);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.nav-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  font: inherit; font-family: var(--font-body); font-size: 12.5px; font-weight: 600;
  color: var(--muted-2); padding: 9px 12px; border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.nav-menu-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.nav-menu-item.active { color: var(--accent); background: rgba(56,189,248,0.08); }

/* ---------- View switching ---------- */
.app-view { animation: rise 0.5s cubic-bezier(0.22,1,0.36,1) both; }
.view-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font: inherit; font-family: var(--font-body); font-size: 12.5px; font-weight: 600;
  color: var(--muted); margin-bottom: 16px;
  transition: color 0.2s;
}
.view-back:hover { color: var(--accent); }
.pulse-mark {
  position: relative; width: 46px; height: 46px; flex-shrink: 0;
  display: grid; place-items: center;
}
.pulse-core {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
}
.pulse-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(56,189,248,0.55);
  animation: ping 2.6s cubic-bezier(0, 0.55, 0.45, 1) infinite;
}
.pulse-ring:nth-child(2) { animation-delay: 1.3s; }
body.scanning .pulse-ring { animation-duration: 0.9s; }
body.scanning .pulse-ring:nth-child(2) { animation-delay: 0.45s; }
@keyframes ping {
  0%   { transform: scale(0.32); opacity: 1; }
  80%, 100% { transform: scale(1.25); opacity: 0; }
}
h1 {
  font-family: var(--font-disp);
  font-size: clamp(2.1rem, 3.4vw, 2.9rem);
  font-weight: 700; letter-spacing: -0.045em; line-height: 1;
  color: var(--text);
}
.tagline { color: var(--muted); font-size: 13.5px; margin-top: 7px; letter-spacing: 0.01em; }
.tagline b { color: var(--muted-2); font-weight: 600; }

@keyframes breathe { 50% { opacity: 0.45; } }

/* ---------- Live ticker tape ---------- */
.ticker-bar {
  overflow: hidden; margin: 0 0 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 10px 0;
  mask-image: linear-gradient(90deg, transparent, black 6%, black 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 6%, black 94%, transparent);
  animation: rise 0.8s 0.05s cubic-bezier(0.22,1,0.36,1) both;
}
.ticker-track { display: inline-flex; white-space: nowrap; animation: tickerScroll 55s linear infinite; will-change: transform; }
.ticker-bar:hover .ticker-track { animation-play-state: paused; }
@keyframes tickerScroll { to { transform: translateX(-50%); } }
.ticker-half { display: inline-flex; gap: 38px; padding-right: 38px; }
.tick {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; cursor: pointer;
  transition: transform 0.2s;
}
.tick:hover { transform: translateY(-1px); }
.tick:hover .tick-sym { color: var(--accent); }
.tick-sym { font-weight: 700; color: var(--muted-2); transition: color 0.2s; }
/* Fixed min-widths matter here, not just cosmetics: the scroll animation
   below targets translateX(-50%), a percentage the browser recomputes
   against the track's live width — live price/change text (updated up to
   ~1/sec per symbol over the WebSocket) changing width mid-scroll was
   making that target shift continuously, which read as the tape
   stuttering/jumping backward. Pinning these widths keeps the track's
   total width stable so the animation has a fixed target again. */
.tick-price { color: var(--text); display: inline-block; min-width: 9ch; text-align: right; }
.tick-chg { font-size: 11px; font-weight: 600; display: inline-block; min-width: 7ch; text-align: right; }
.tick-chg.up { color: var(--bullish); }
.tick-chg.down { color: var(--bearish); }

/* ---------- Command panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin: 0 0 24px;
  box-shadow: var(--shadow);
  animation: rise 0.8s 0.08s cubic-bezier(0.22,1,0.36,1) both;
}
.form-row { display: flex; gap: 26px; align-items: flex-end; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 10px; }
label.field-label {
  font-size: 10.5px; color: var(--muted); font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
}
input[type="text"] {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px; font-weight: 600;
  padding: 13px 15px;
  width: 210px;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus { border-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--muted-2); cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px;
  transition: border-color 0.15s, color 0.15s;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

.tf-group { display: flex; gap: 8px; flex-wrap: wrap; }
.tf-pill {
  position: relative; cursor: pointer;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--muted-2);
  padding: 11px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
}
.tf-pill input { position: absolute; opacity: 0; pointer-events: none; }
.tf-pill:hover { border-color: var(--border-hi); }
.tf-pill.active { color: var(--accent); border-color: var(--accent); background: var(--surface-hi); }

.market-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.market-tab {
  font: inherit; outline: none; cursor: pointer;
  font-family: var(--font-body); font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 18px;
  transition: border-color 0.15s, color 0.15s;
}
.market-tab:hover { color: var(--text); border-color: var(--border-hi); }
.market-tab.active { color: var(--accent); border-color: var(--accent); background: var(--surface-hi); }

button#analyze-btn {
  background: var(--accent);
  border: none; border-radius: var(--radius-sm);
  color: #04121c; cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 700; letter-spacing: 0.01em;
  padding: 14px 34px;
  transition: background 0.15s, opacity 0.15s;
}
button#analyze-btn:hover:not(:disabled) { background: #56c8fb; }
button#analyze-btn:disabled { opacity: 0.5; cursor: wait; }
.scan-dots::after { content: ""; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- Error toast ---------- */
.error-box {
  display: none;
  background: rgba(251,113,133,0.09);
  border: 1px solid rgba(251,113,133,0.35);
  border-radius: var(--radius-sm);
  color: #fda4af;
  padding: 14px 18px;
  font-size: 13px; line-height: 1.6;
  margin-bottom: 20px;
  animation: shake 0.5s cubic-bezier(0.36,0.07,0.19,0.97) both;
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ---------- Consensus banner ---------- */
.consensus {
  display: none;
  align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  animation: rise 0.7s cubic-bezier(0.22,1,0.36,1) both;
}
.consensus-label { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.consensus-verdict {
  font-family: var(--font-disp); font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1;
}
.consensus-verdict.bull { color: var(--bullish); }
.consensus-verdict.bear { color: var(--bearish); }
.consensus-verdict.neut { color: var(--neutral); }
.consensus-meta { font-size: 12.5px; color: var(--muted); margin-top: 7px; }
.consensus-meta b { color: var(--muted-2); font-family: var(--font-mono); }
.consensus-right { text-align: right; }
.consensus-sym { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--muted-2); }
.consensus-time { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ---------- Footer ---------- */
footer {
  margin-top: 34px; font-size: 11.5px; color: var(--muted);
  line-height: 1.7; text-align: center; opacity: 0.8;
}
footer b { color: var(--neutral); font-weight: 600; }
.footer-links {
  margin-top: 10px; display: flex; justify-content: center; gap: 16px;
  font-family: var(--font-mono); font-size: 11px;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
