body {
    background-color: #111;
    color: rgb(190, 190, 190);
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    padding: 20px;
  }

  .hidden 
    {display: none !important;
    }
  .container {
    max-width: 900px;
    margin: auto;
  }
  
  h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
  }
  
  .card {
    background-color: #1c1c1c;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
  }
  
  .card h2 {
    font-size: 1.8em;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .scroll-box {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #333;
    padding: 15px;
    border-radius: 8px;
    background-color: #222;
  }
  
  button {
    background-color: #333;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
  }
  
  button:hover {
    background-color: #555;
  }
  
  input[type="text"] {
    width: 70%;
    padding: 10px;
    border: 1px solid #555;
    border-radius: 8px;
    background-color: #1c1c1c;
    color: rgb(255, 255, 255);
    margin-right: 10px;
  }
  
  #quoteData,
  #assetSummary {
    margin-top: 15px;
    background-color: #1c1c1c;
    padding: 15px;
    border-radius: 8px;
  }
  .modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
  }
  
  .modal-content {
    background: #1c1c1c;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    color: white;
    text-align: center;
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
  }
  
  .modal-content h3 {
    margin-top: 0;
  }
  
  .modal-content button {
    margin-top: 20px;
    background: #444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
  }

/* Analyst Style */
  .analyst-wrap{
  position:relative; min-height:180px; display:flex; align-items:center; justify-content:center;
  background:#0f0f0f; border:1px dashed var(--card-border); border-radius:12px; padding:16px;
  }
  .analyst-blurred{
    filter: blur(5px);
    opacity:.9;
    user-select:none;
    pointer-events:none;
    max-width: 100%;
    white-space: pre-wrap;
    line-height:1.4;
  }
  .analyst-cta{
    position:absolute; inset:auto auto auto auto;
    /* center the CTA */
    left:50%; top:50%; transform:translate(-50%,-50%);
    background: linear-gradient(90deg, #232526, #414345);
    border: none;
    font-weight: 600;
  }
  
/* 🟢 Mobile adjustments */
@media (max-width: 600px) {
    h1 {
      font-size: 1.8em;
      flex-direction: column;
      align-items: flex-start;
    }
  
    .card h2 {
      font-size: 1.2em;
      flex-direction: column;
      align-items: flex-start;
    }
  
    input[type="text"], button, select {
      width: 100%;
      margin-right: 0;
      margin-bottom: 10px;
    }
  
    .scroll-box {
      max-height: 300px;
    }
  
    .modal-content {
      padding: 15px;
      font-size: 0.9em;
    }
  }
/* === Mobile Header Adjustments === */
@media (max-width: 600px) {
    header {
      text-align: center !important;
    }
  
    header h1 {
      justify-content: center !important;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }
  
    header img {
      width: 70px !important;
      height: 70px !important;
    }
  
    header select {
      margin-top: 10px;
    }
  }

/* === Animations === */
.card {
    /* Existing styles... */
    animation: fadeIn 0.8s ease-in;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  
  .hidden {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, opacity 0.5s ease-out;
    opacity: 0;
  }
  
  .hidden.show {
    max-height: 800px;
    opacity: 1;
  }
  button:hover {
    animation: pulse 0.3s ease;
  }
  
  @keyframes pulse {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.05);
    }
    100% {
      transform: scale(1);
    }
  }
  
  /* Preloader styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease;
    filter: brightness(1.2)
  }
  
  .spinner-logo {
    width: 130px;
    height: 130px;
    animation: spin 1.2s ease-in-out;
  }
  
  @keyframes spin3D {
    from {
      transform: rotateY(0deg);
    }
    to {
      transform: rotateY(360deg);
    }
  }
  
  #preloader img {
    width: 120px;
    height: 120px;
    animation: spin3D 2s linear infinite;
    transform-style: preserve-3d;
  }
  
  .index-card {
    background: #f8f9fa18;
    padding: 12px;
    border-radius: 10px;
    min-width: 185px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    font-size: 14px;
  }
  
  .positive {
    color: green;
  }
  
  .negative {
    color: red;
  }
  
  .neutral {
    color: gray;
  }
  
  .error {
    color: orange;
    font-style: italic;
  }
  
  /* Latest Articles strip (under MinuteBrief) */
.mb-articles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.mb-card, .mb-more {
  position: relative;
  border: 1px solid var(--card-border, #2a2a2a);
  background: #171717;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text, rgb(190,190,190));
  text-decoration: none;
  box-shadow: 0 4px 12px var(--shadow, rgba(255,255,255,0.05));
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
  overflow: hidden;
  min-height: 80px;
}

.mb-card:hover, .mb-more:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(255,255,255,0.08);
  border-color: #3a3a3a;
  background: #1c1c1c;
}

.mb-title {
  font-weight: 700;
  font-size: 0.90rem;
  color: var(--accent, #0a66c2);
  margin: 0 0 4px 0;
  overflow-wrap: anywhere;      /* lets long words break */
  white-space: normal;
}

.mb-dek {
  margin: 0 0 6px 0;
  color: var(--text, rgb(190,190,190));
  opacity: .95;
  font-size: .8rem;
}

/* Hover preview: masked auto-scroll */
.mb-preview {
  max-height: 0;
  overflow: hidden;
  font-size: .8rem;
  line-height: 1.35;
  color: var(--muted, #9aa0a6);
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  transition: max-height .25s ease;
}

/* On hover, reveal and auto-scroll the inner content */
.mb-card:hover .mb-preview {
  max-height: 140px;
}
.mb-preview-inner {
  display: block;
  transform: translateY(0);
  transition: transform 1.6s ease;
}
.mb-card:hover .mb-preview-inner {
  transform: translateY(-18%);
}

.mb-meta {
  margin-top: 4px;
  font-size: .72rem;
  color: var(--muted, #9aa0a6);
}

/* See more tile */
.mb-more {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--accent, #0a66c2);
}

/* Skeleton shimmer */
.skel { background: #151515; }
.skel::after {
  content:""; position:absolute; inset:0;
  background: linear-gradient(90deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.03) 100%);
  animation: shimmer 1.15s infinite;
}
@keyframes shimmer { from{transform:translateX(-100%)} to{transform:translateX(100%)} }

/* === 3-up grid with uniform tiles === */
@media (min-width: 780px) {
  .mb-articles {
    grid-template-columns: repeat(3, 1fr); /* always 3 equal columns */
  }
  .mb-card, .mb-more {
    min-width: 0;   /* ensure they shrink evenly */
    height: 100%;   /* keep consistent height */
  }
  .mb-more {
    grid-column: auto; /* prevent spanning full width */
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* MinuteBrief teaser */
.mb-teaser {
  position: relative;
  border: 1px dashed #2a2a2a;
  border-radius: 12px;
  padding: 16px;
  min-height: 110px;
  background: #0f0f0f;
  overflow: hidden;
}
.mb-teaser-blur {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 30%, #1f1f1f 0%, #0d0d0d 60%);
  filter: blur(6px);
  opacity: .8;
}
.mb-teaser-text {
  position: relative; z-index: 1;
  color: #9aa0a6;
  filter: blur(3px);
  user-select: none;

  display: -webkit-box;
  -webkit-line-clamp: 4;       /* show up to 4 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  max-height: calc(1.4em * 4); /* keep the box tight */
  text-overflow: ellipsis;
}
.mb-teaser-cta {
  position: absolute; right: 12px; bottom: 10px;
  z-index: 1; color: #c3c3c3; font-size: .85rem; opacity: .9;
}
.mb-panel.hidden { display: none; }

/* ===== MinuteBrief Neuro Loader ===== */
.neuro {
  position: relative;
  width: 100%;
  height: 180px;           /* adjust if you want a taller stage */
  border: 1px solid #222; 
  border-radius: 12px;
  background: radial-gradient(120% 120% at 10% 0%, #0e0e0f 0%, #0a0a0a 35%, #080808 100%);
  overflow: hidden;
}
.neuro::before {
  /* faint vignette */
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(60% 60% at 85% 20%, transparent 0%, rgba(0,0,0,.18) 60%, rgba(0,0,0,.36) 100%);
  pointer-events: none;
}
.neuro-canvas {
  position: absolute; inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 2px rgba(255,216,77,.08)); /* tiny glow */
}

@media (prefers-reduced-motion: reduce) {
  .neuro { height: 120px; }
  .neuro-canvas { filter: none; }
}

/* Flipboard text */
.flipboard {
  font-size: 1rem; line-height: 1.55; color: #d9d9d9;
  white-space: pre-wrap;
}
.flip-char {
  display: inline-block; min-width: .6ch;
  will-change: contents, transform, filter;
}
@media (prefers-reduced-motion: reduce) {
  .neuro .beam, .node, .flip-char { animation: none !important; transition: none !important; }
  .mb-teaser-blur, .mb-teaser-text { filter: none !important; }
}
/* MinuteBrief formatted body */
.mb-body { 
  margin-top: 6px; 
  color: #d7d7d7; 
  line-height: 1.45;
  font-size: 0.98rem;
}
.mb-body .mb-lede {
  font-weight: 600;
  color: #eaeaea;
  margin: 4px 0 8px;
}
.mb-body p { margin: 8px 0; }
.mb-body ul.mb-list { 
  margin: 8px 0 8px 18px; 
  padding: 0; 
}
.mb-body li { margin: 4px 0; }

/* Flipboard container (unchanged, but keep spacing consistent) */
.flipboard { 
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: .2px;
  line-height: 1.45;
  white-space: pre-wrap;
}
/* === Sticky top bar (shared across pages) === */
:root {
  --bg:#0b0b0b; --panel:#111; --muted:#9aa0a6; --text:#e9eaee; --neon:#39ff14;
  --brand:#0ea5ff; --card-border: rgba(255,255,255,0.06);
}

html, body {
  background:var(--bg);
  color:var(--text);
}

.topbar {
  position:fixed;
  inset:0 0 auto 0;
  height:64px;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg, rgba(17,17,17,.95), rgba(17,17,17,.80));
  backdrop-filter: blur(6px);
  border-bottom:1px solid var(--card-border);
}

.nav {
  width:100%;
  max-width:1100px;
  display:flex;
  align-items:center;
  gap:18px;
  padding:0 16px;
}

.brand {
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:700;
  letter-spacing:.2px;
}

.brand img {
  vertical-align:middle;
}

.brand .name {
  font-size:1.1rem;
}

.spacer {
  flex:1;
}

.menu {
  display:flex;
  align-items:center;
  gap:18px;
}

.menu a {
  padding:10px 6px;
  border-radius:8px;
  color:var(--text);
  text-decoration:none;
  transition:color .2s ease, text-shadow .2s ease;
}

.menu a:hover {
  color:var(--neon);
  text-shadow:0 0 6px rgba(57,255,20,.55);
}

.menu a.active {
  color:var(--neon);
  text-shadow:0 0 6px rgba(57,255,20,.6);
}

.menu a:focus {
  outline:2px solid var(--neon);
  outline-offset:2px;
}

/* Adjust container so content isn't hidden under fixed top bar */
.container {
  max-width:900px;
  margin:0 auto;
  padding:92px 20px 20px; /* was 20px; now 92px top */
}

.paper {
  background:#0f0f0f;
  border:1px solid var(--card-border);
  border-radius:14px;
  padding:18px;
}

.meta {
  color:var(--muted);
  font-size:.9rem;
  margin-bottom:12px;
}

.back {
  display:inline-block;
  margin-bottom:14px;
}

pre,
.content {
  white-space:pre-wrap;
  line-height:1.5;
}

@media (max-width: 900px) {
  .menu { display:none }
}
/* --- Ensure the topbar brand/menu never get visited/underlined/purple --- */
.topbar a,
.topbar a:link,
.topbar a:visited {
  color: var(--text) !important;
  text-decoration: none !important;
}

.topbar a:hover {
  color: var(--neon) !important;
  text-shadow: 0 0 6px rgba(57,255,20,.55);
}

/* extra safety for any underline/border coming from other stylesheets */
.topbar .brand,
.topbar .brand .name,
.topbar .menu a {
  text-decoration: none !important;
  border-bottom: none !important;
}
/* ==== Namespaced split-flap for the MinuteBrief subtitle ONLY ==== */
.flipboard-sub{
  display:inline-flex;
  gap:2px;
  margin-left:10px;
  color:var(--muted);
  font-size:.95rem;
  line-height:1;
  perspective:700px;
}

.flip-sub-char{
  display:inline-block;
  position:relative;
  transform-style:preserve-3d;
}

.flip-sub-face{
  display:inline-block;
  backface-visibility:hidden;
  transform-origin:center;
  transition:transform .42s cubic-bezier(.22,.61,.36,1), opacity .42s ease;
}

.flip-sub-back{
  position:absolute;
  inset:0;
  transform:rotateX(180deg);
  opacity:0;
}

.flip-sub-char.is-flipping .flip-sub-front{
  transform:rotateX(180deg);
  opacity:0;
}
.flip-sub-char.is-flipping .flip-sub-back{
  transform:rotateX(0deg);
  opacity:1;
}

@media (prefers-reduced-motion: reduce){
  .flip-sub-face{ transition:none }
}

/* ====== MOBILE ORGANIZE PATCH (non-destructive) ====== */

/* 1) Market Snapshot: horizontal rail with snap (iOS friendly) */
#marketSnapshot{
  display:flex;
  gap:12px;
  overflow-x:auto;
  padding:6px 2px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
#marketSnapshot .index-card{ scroll-snap-align: start; }

/* 2) Section headers: prevent overflow and let title/subtitle wrap */
.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-width: 0; /* allows flex children to shrink */
}
.card h2{
  display:flex;
  align-items:center;
  gap:8px;
  flex:1 1 auto;      /* let the heading take available width */
  min-width:0;        /* critical so the subtitle can ellipsize */
}

/* Subtitle line inside h2 (MinuteBrief, Outlook, Analyst) */
.flipboard-sub{
  flex:1 1 auto;      /* use remaining space next to the button */
  min-width:0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* reserve height to avoid animation jump on mobile */
  min-height: 1.6em;
}

/* 3) Buttons on the right: keep inside the card */
.section-head .btn{
  flex: 0 0 auto;     /* fixed width; prevents squeezing subtitle into overflow */
}

/* 4) Mobile tweaks: stack header items when very narrow */
@media (max-width: 520px){
  .section-head{
    flex-wrap: wrap;      /* title/subtitle on line 1, button drops below */
    gap:10px;
  }
  .section-head .btn{
    width:100%;
    order: 2;             /* button under the title block */
  }
  .card h2{
    order:1;
  }
}

/* 5) Hero title spacing on small screens (keep your look, just tidy) */
@media (max-width: 600px){
  h1{ margin-top: 6px; line-height: 1.15; }
}

/* 6) Inputs & actions: tidy stacking on mobile (no design change) */
@media (max-width: 600px){
  .lookup-actions{
    display:grid;
    grid-template-columns: 1fr;
    gap:10px;
  }
  input[type="text"]{
    width:100%;
    margin-right:0;
  }
}

/* 7) Teaser text: allow long lines but never push layout */
.mb-teaser-text{
  word-break: break-word;
}

/* 8) Safety: cards never bleed horizontally on very narrow devices */
.card{ overflow: hidden; }

/* ===== Subtitle responsiveness (fits neatly on mobile) ===== */

/* default: one-line with ellipsis beside the button */
.flipboard-sub{
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(.88rem, 2.8vw, .95rem);
  line-height: 1.25;
  word-break: break-word;
  min-height: 1.6em; /* keeps the row from jumping during flip */
}

/* h2 can wrap subtitle under the title when space is tight */
@media (max-width: 580px){
  .section-head{ gap: 10px; }
  .card h2{
    flex-direction: column;      /* title on line 1, subtitle below */
    align-items: flex-start;
    gap: 4px;
  }
  .flipboard-sub{
    white-space: normal;         /* allow wrapping */
    display: -webkit-box;        /* clamp to 2 lines with a fade */
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.25em * 2);
  }
}

/* slightly tighten at ultra-narrow widths */
@media (max-width: 380px){
  .flipboard-sub{ font-size: .86rem; }
}

/* === Flipboard subtitle spacing fix (keeps animation) === */
.flipboard-sub{
  display: inline-block !important;     /* not flex */
  white-space: normal !important;       /* allow wrapping */
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  letter-spacing: .01em;                /* tiny tracking for readability */
  word-spacing: .22em;                  /* restore space width */
  min-height: 1.6em;                    /* prevent flip jump */
}

/* Each character can be inline (not inline-block) so kerning looks better */
.flip-sub-char{ display: inline; }

/* Give real width to space tiles (we tag them via JS below) */
.flip-sub-char.is-space{
  display: inline-block;
  width: .4em;                          /* adjusts visible space width */
}
.flip-sub-char.is-space .flip-sub-face{ opacity: 0; } /* hide faces for spaces */

/* Stack title over subtitle on small screens, allow 2-line wrap */
@media (max-width: 580px){
  .section-head{ gap: 10px; }
  .card h2{ flex-direction: column; align-items: flex-start; gap: 4px; }
  .flipboard-sub{
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;              /* max 2 lines */
    max-height: calc(1.25em * 2);
    word-spacing: .2em;
  }
}

/* Slightly ease tightness on desktop too */
@media (min-width: 581px){
  .flipboard-sub{ word-spacing: .18em; }
}

/* ===== Hero "neural links" background (subtle, infinite, low-cost CSS) ===== */
.hero{
  position: relative;
  overflow: hidden;           /* keep the glow and lines inside the section */
  z-index: 0;                 /* create a stacking context under children */
}

.hero > *{
  position: relative;
  z-index: 1;
}

/* animated network lines, very light */
.hero::before{
  content:"";
  position:absolute;
  inset:-12% -20%;            /* extend beyond to avoid hard edges during pan */
  pointer-events:none;
  opacity:.24;
  mix-blend-mode: screen;     /* gentle additive glow on dark bg */
  z-index: 0;

  /* two diagonal repeating line fields */
  background:
    repeating-linear-gradient( 60deg, rgba(57,255,20,.12) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(-60deg, rgba(14,165,255,.10) 0 1px, transparent 1px 52px);

  /* smooth mask to fade top/bottom edges */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);

  animation: hero-pan 42s linear infinite;
}

/* soft color blobs for depth */
.hero::after{
  content:"";
  position:absolute;
  inset:-10% -10%;
  pointer-events:none;
  z-index: 0;
  background:
    radial-gradient(60% 40% at 80% 15%, rgba(57,255,20,.08) 0%, transparent 65%),
    radial-gradient(40% 30% at 18% 80%, rgba(14,165,255,.06) 0%, transparent 70%),
    radial-gradient(35% 35% at 40% 40%, rgba(255,255,255,.04) 0%, transparent 80%);
  filter: blur(0.2px) saturate(1.02);
}

/* slow, subtle background drift */
@keyframes hero-pan{
  from { background-position:    0px   0px,    0px   0px; }
  to   { background-position:  420px 180px, -460px -220px; }
}

/* reduce motion preference: keep the look but stop the animation */
@media (prefers-reduced-motion: reduce){
  .hero::before{ animation: none; }
}