html { scroll-behavior: smooth; }
body { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---- Initial-load fade-up stagger ----
 * Each top-level main section fades up with a 60ms-staggered delay so the
 * dashboard 'arrives' instead of popping in. `backwards` fill keeps elements
 * invisible during their pre-delay window. Disabled under
 * prefers-reduced-motion for users who opt out of animation.
 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  main > section, main > a {
    animation: fadeInUp 380ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }
  main > section:nth-child(1),  main > a:nth-child(1)  { animation-delay: 0ms;   }
  main > section:nth-child(2),  main > a:nth-child(2)  { animation-delay: 60ms;  }
  main > section:nth-child(3),  main > a:nth-child(3)  { animation-delay: 120ms; }
  main > section:nth-child(4),  main > a:nth-child(4)  { animation-delay: 180ms; }
  main > section:nth-child(5),  main > a:nth-child(5)  { animation-delay: 240ms; }
  main > section:nth-child(6),  main > a:nth-child(6)  { animation-delay: 300ms; }
  main > section:nth-child(7),  main > a:nth-child(7)  { animation-delay: 360ms; }
  main > section:nth-child(8),  main > a:nth-child(8)  { animation-delay: 420ms; }
  main > section:nth-child(9),  main > a:nth-child(9)  { animation-delay: 480ms; }
  main > section:nth-child(10), main > a:nth-child(10) { animation-delay: 540ms; }
}

/* ---- Mobile tweaks (≤640px) ----
 * Tighten section + main padding so the dashboard fits a 375px viewport
 * without horizontal scroll. Cards already use `rounded-xl p-6` everywhere;
 * we override that consistently rather than editing every HTML file.
 */
@media (max-width: 640px) {
  /* Outer main container: tighter horizontal padding + smaller vertical gaps */
  main.max-w-7xl, main.max-w-5xl, main.max-w-4xl {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  main > section,
  main > div {
    /* If a section has rounded-xl + p-6, tighten it */
  }
  /* Card-style sections: 24px → 16px padding on mobile */
  .rounded-xl.p-6 { padding: 1rem !important; }
  /* Tables get cramped — smaller text + tighter cell padding */
  table.w-full { font-size: 11px; }
  table.w-full th, table.w-full td { padding-left: 0.5rem; padding-right: 0.5rem; }
  /* Compact flow-strip score on small screens */
  #flow-score { font-size: 1.875rem !important; }
  /* Factor cards already grid-cols-1 by default; force 1-col so they stack cleanly */
  #factors { grid-template-columns: 1fr !important; }
  /* Sentiment + signal charts get less tall so they don't dominate */
  .h-64, .h-56 { height: 12rem !important; }
  /* Bell panel: don't run off the right edge */
  .bell-panel { width: calc(100vw - 1.5rem); max-width: 340px; right: -0.25rem; }
  /* Strip + scope bar: allow wrapping when they get tight */
  #scope-bar, #alerts-strip { flex-wrap: wrap; }
}

/* Tablet (641-1024px) — minor padding tweak */
@media (min-width: 641px) and (max-width: 1024px) {
  .rounded-xl.p-6 { padding: 1.25rem; }
}

/* ---- Tag pills ---- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag-exchange-in  { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.tag-exchange-out { background: rgba(74, 222, 128, 0.15); color: #86efac; }
.tag-transfer     { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.tag-exchange     { background: rgba(251, 146, 60, 0.15); color: #fdba74; }
.tag-institution  { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.tag-miner        { background: rgba(234, 179, 8, 0.15); color: #fde047; }
.tag-early-holder { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.tag-unknown-whale{ background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

/* ---- Order-book depth rows ---- */
.depth-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 6px;
}
@media (max-width: 640px) {
  .depth-row { height: 36px; padding: 0 6px; }
  .depth-amount { padding-left: 6px; font-size: 10px !important; }
  .depth-label .text-xs { font-size: 10px; }
}
.depth-row:hover { background: rgba(148, 163, 184, 0.05); }

.depth-bar {
  position: absolute;
  inset: 2px auto 2px 0;
  border-left: 2px solid;
  border-radius: 2px;
  z-index: 0;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.depth-label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.depth-amount {
  position: relative;
  z-index: 1;
  padding-left: 12px;
}

.depth-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(148,163,184,0.25), transparent);
  margin: 8px 0;
}

/* ---- News sentiment dots ---- */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.dot-bullish { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.dot-bearish { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.6); }
.dot-neutral { background: #64748b; }

/* ---- Auth modal tabs ---- */
.auth-tab {
  color: #94a3b8;
}
.auth-tab.active {
  background: rgba(251, 146, 60, 0.15);
  color: #fdba74;
}

/* ---- Scope toggle (global + filter) ---- */
.scope-btn, .filter-btn { color: #94a3b8; }
.scope-btn.active, .filter-btn.active {
  background: rgba(251, 146, 60, 0.15);
  color: #fdba74;
}

/* These bars need both `hidden` and `flex` available — we toggle `hidden` */
#scope-bar:not(.hidden), #alerts-strip:not(.hidden),
#lag-banner:not(.hidden) { display: flex; }

/* ---- Star button ---- */
.star-btn {
  font-size: 16px;
  line-height: 1;
  color: #475569;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
  background: transparent;
  border: 0;
  padding: 2px 4px;
}
.star-btn:hover { color: #cbd5e1; transform: scale(1.15); }
.star-btn.starred { color: #fb923c; }
.star-btn.starred:hover { color: #fdba74; }
/* 'Locked' = anon user. The star IS clickable for them now (opens the
   contextual signup modal), so it must look tappable — just visually
   quieter than the active star. Hover-brightens to invite the click. */
.star-btn.locked { opacity: 0.45; cursor: pointer; }
.star-btn.locked:hover { opacity: 0.85; color: #fb923c; transform: scale(1.15); }

/* ---- Top-level nav ---- */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  position: relative;
}
.nav-link:hover { color: #e2e8f0; background: rgba(148, 163, 184, 0.06); }
.nav-link.active {
  color: #fdba74;
  background: rgba(251, 146, 60, 0.10);
}
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  background: #fb923c;
  border-radius: 1px;
}
.nav-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: #fb923c;
  color: #0f172a;
}

/* ---- Sortable column headers ---- */
.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.sortable:hover { color: #cbd5e1; }
.sort-arrow {
  display: inline-block;
  width: 10px;
  font-size: 9px;
  color: #fb923c;
  margin-left: 2px;
}

/* ---- Whale archetype + credibility ---- */
.archetype {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid;
}
.archetype-bullish { background: rgba(34, 197, 94, 0.12);  color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
.archetype-bearish { background: rgba(239, 68, 68, 0.12);  color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.archetype-neutral { background: rgba(148, 163, 184, 0.1); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.25); }

/* Credibility chip — used inline in feeds */
.cred-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid;
}
.cred-chip-high  { background: rgba(34, 197, 94, 0.1);   color: #86efac; border-color: rgba(34, 197, 94, 0.25); }
.cred-chip-mid   { background: rgba(148, 163, 184, 0.08); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.2); }
.cred-chip-low   { background: rgba(239, 68, 68, 0.1);    color: #fca5a5; border-color: rgba(239, 68, 68, 0.25); }
.cred-chip-none  { color: #475569; font-weight: 400; border: 0; padding: 0; background: transparent; }

/* Hero empty-state CTA buttons — used on /api/hero-signal == null.
   Primary = orange (the "do this" path), secondary = subtle border. */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}
.hero-cta-primary {
  background: #ea580c;        /* orange-600 */
  color: #fff;
}
.hero-cta-primary:hover { background: #f97316; }   /* orange-500 */
.hero-cta-secondary {
  background: transparent;
  color: #cbd5e1;             /* slate-300 */
  border-color: #334155;      /* slate-700 */
}
.hero-cta-secondary:hover {
  color: #f8fafc;
  border-color: #64748b;      /* slate-500 */
  background: rgba(148, 163, 184, 0.05);
}

/* Streak indicator */
.streak {
  font-size: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  padding: 1px 5px;
  border-radius: 3px;
}
.streak-win  { background: rgba(34, 197, 94, 0.12); color: #86efac; }
.streak-lose { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }

/* ---- Bell + notification panel ---- */
.bell-wrap { position: relative; }
.bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid rgb(51 65 85);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.bell-btn:hover { border-color: rgb(100 116 139); background: rgba(148, 163, 184, 0.05); }
.bell-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: #fb923c;
  color: #0f172a;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 9px;
  min-width: 16px;
  text-align: center;
  border: 1px solid #0f172a;
}
/* ---- Rule type picker cards ---- */
.rule-type-card {
  text-align: left;
  padding: 12px;
  border: 1px solid rgb(30 41 59);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.rule-type-card:hover {
  border-color: rgb(100 116 139);
  background: rgba(148, 163, 184, 0.04);
}
.rule-type-card.selected {
  border-color: #fb923c;
  background: rgba(251, 146, 60, 0.08);
}

.bell-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 480px;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgb(30 41 59);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 50;
}

/* ---- Loading shimmer ---- */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.loading { animation: pulse-glow 1.4s ease-in-out infinite; }
