:root {
  --bg: #0a0f14;
  --surface: #121a22;
  --surface2: #182230;
  --border: #1e2a36;
  --text: #e8eef4;
  --muted: #8b9cb0;
  --green: #10b981;
  --red: #ef4444;
  --gold: #f59e0b;
  --accent: #3b82f6;
  --radius: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* Header */
.header {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border);
  background: rgba(18,26,34,0.92); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 50;
}
.logo { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; }
.logo span { color: var(--gold); }
.topnav { display: flex; gap: 0.35rem; }
.topnav a { color: var(--muted); font-size: 0.92rem; font-weight: 600; padding: 0.4rem 0.7rem; border-radius: 8px; }
.topnav a:hover, .topnav a.active { color: var(--text); background: var(--surface2); }

.search-wrap { margin-left: auto; position: relative; }
#search {
  padding: 0.55rem 1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); min-width: 230px; font-size: 0.9rem;
}
#search:focus { outline: none; border-color: var(--accent); }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 320px; max-height: 360px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; z-index: 60;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.search-results .sr-item { padding: 0.6rem 0.9rem; cursor: pointer; display: flex; justify-content: space-between; gap: 0.5rem; border-bottom: 1px solid var(--border); }
.search-results .sr-item:last-child { border-bottom: none; }
.search-results .sr-item:hover { background: var(--surface2); }
.search-results .sr-co { color: var(--muted); font-size: 0.78rem; }

/* Ticker */
.ticker { display: flex; gap: 1.5rem; overflow-x: auto; padding: 0.55rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface); font-size: 0.82rem; scrollbar-width: none; }
.ticker::-webkit-scrollbar { display: none; }
.ticker .ti { display: flex; gap: 0.45rem; white-space: nowrap; align-items: baseline; }
.ticker .ti b { font-weight: 600; }

/* Layout */
main { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }
.loading-screen { display: flex; justify-content: center; padding: 5rem 0; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; margin: 0.5rem 0; }
@keyframes sk { to { background-position: -200% 0; } }

.hero { padding: 1rem 0 1.5rem; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -0.02em; }
.hero h1 em { color: var(--gold); font-style: normal; }
.hero .sub { color: var(--muted); margin-top: 0.4rem; }

.section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.5rem 0 0.75rem; font-weight: 700; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.index-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; }
.index-card .name { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.index-card .price { font-size: 1.15rem; font-weight: 700; margin: 0.2rem 0; }
.up { color: var(--green); } .down { color: var(--red); }
.chip-pct { font-weight: 600; font-size: 0.85rem; }

/* Index strip with day-range + breadth visualisation */
.index-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.idx-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; }
.idx-name { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.idx-price { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; margin: 0.15rem 0; }
.idx-chg { font-size: 0.82rem; display: flex; gap: 0.4rem; align-items: baseline; }
.range-bar { position: relative; height: 4px; border-radius: 4px; background: var(--surface2); margin-top: 0.75rem; }
.range-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--gold)); }
.range-dot { position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--text); transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--surface); }
.breadth { margin-top: 0.7rem; }
.breadth-track { height: 6px; border-radius: 4px; background: var(--red); overflow: hidden; }
.breadth-adv { display: block; height: 100%; background: var(--green); }
.breadth-lbl { display: flex; justify-content: space-between; font-size: 0.7rem; margin-top: 0.25rem; }

/* Mover list with magnitude bars */
.mover-list { display: flex; flex-direction: column; gap: 0.15rem; }
.mover { padding: 0.5rem 0.25rem; border-radius: 8px; cursor: pointer; }
.mover:hover { background: var(--surface2); }
.mover-top { display: flex; justify-content: space-between; align-items: baseline; }
.mover-sym { font-weight: 600; font-size: 0.92rem; }
.mover-px { font-size: 0.85rem; color: var(--muted); }
.mover-bar-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.3rem; }
.mover-bar { flex: 1; height: 6px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.mover-fill { display: block; height: 100%; border-radius: 4px; }
.mover-fill.up { background: var(--green); }
.mover-fill.down { background: var(--red); }
.mover-pct { font-size: 0.82rem; font-weight: 700; min-width: 58px; text-align: right; }

/* Compact quote chips (commodities / FX) */
.chip-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.quote-chip { display: flex; align-items: baseline; gap: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.quote-chip .qc-name { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.02em; }
.quote-chip .qc-px { font-weight: 700; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.panel > h2 { font-size: 0.95rem; margin-bottom: 0.75rem; display: flex; align-items: center; justify-content: space-between; }
.panel .more { font-size: 0.78rem; color: var(--accent); }

.stock-row { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.stock-row:last-child { border-bottom: none; }
.stock-row:hover { background: rgba(255,255,255,0.03); }
.stock-row .sym { font-weight: 600; }
.stock-row .co { font-size: 0.78rem; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-row .r { text-align: right; }

/* Screener */
.toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.chip { padding: 0.4rem 0.85rem; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 0.85rem; font-weight: 600; }
.chip.active { background: var(--gold); color: #0a0f14; border-color: var(--gold); }

table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td { padding: 0.6rem 0.7rem; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; position: sticky; top: 0; background: var(--surface); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--surface2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

/* Discover grid */
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.85rem; }
.disc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.disc-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.disc-card .ic { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 0.75rem; }
.disc-card h3 { font-size: 0.98rem; }
.disc-card p { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

/* Stock detail */
.crumbs { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.75rem; }
.crumbs a { color: var(--accent); }
.stock-head { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-end; justify-content: space-between; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stock-head .nm { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.stock-head .meta { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }
.stock-head .px { font-size: 2rem; font-weight: 800; }
.stock-head .px-row { text-align: right; }
.stock-head .pill { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.pill.buy { background: rgba(16,185,129,0.15); color: var(--green); }
.pill.sell { background: rgba(239,68,68,0.15); color: var(--red); }
.pill.hold { background: rgba(245,158,11,0.15); color: var(--gold); }

.tabs { display: flex; gap: 0.25rem; overflow-x: auto; margin: 1rem 0; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 0.6rem 0.9rem; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 0.9rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--gold); }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem 1rem; }
.metric .k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.metric .v { font-size: 1.15rem; font-weight: 700; margin-top: 0.2rem; }

.returns-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.returns-row .rt { flex: 1; min-width: 80px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.65rem; }
.returns-row .rt .k { font-size: 0.72rem; color: var(--muted); }
.returns-row .rt .v { font-weight: 700; margin-top: 0.2rem; }

.ai-box { background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(59,130,246,0.06)); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.ai-box h3 { font-size: 0.95rem; margin-bottom: 0.6rem; color: var(--gold); }
.ai-box p { white-space: pre-wrap; }
.ai-cta { margin-top: 1rem; display: inline-block; background: var(--gold); color: #0a0f14; padding: 0.55rem 1rem; border-radius: 8px; font-weight: 700; cursor: pointer; }

.empty { color: var(--muted); padding: 2rem; text-align: center; }
.tag { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 5px; font-size: 0.72rem; font-weight: 600; background: var(--surface2); color: var(--muted); margin-left: 0.4rem; }
.tag.green { background: rgba(16,185,129,0.15); color: var(--green); }
.tag.red { background: rgba(239,68,68,0.15); color: var(--red); }
.tag.gold { background: rgba(245,158,11,0.15); color: var(--gold); }

.footer { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--border); margin-top: 2rem; }
.footer .disclaimer { font-size: 0.75rem; margin-top: 0.4rem; opacity: 0.8; }
/* In-page install banner */
.install-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.9rem; max-width: 720px; margin: 0 auto 0.6rem;
  border-radius: 14px; border: 1px solid var(--border);
  background: rgba(17, 24, 28, 0.96); backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
  animation: ib-in 0.35s ease;
}
@keyframes ib-in { from { transform: translateY(120%); opacity: 0; } to { transform: none; opacity: 1; } }
.install-banner .ib-icon { font-size: 1.4rem; line-height: 1; }
.install-banner .ib-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.install-banner .ib-text strong { font-size: 0.9rem; color: #fff; }
.install-banner .ib-text span { font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-banner .ib-cta {
  flex-shrink: 0; padding: 0.5rem 1.05rem; border-radius: 9px; font-weight: 700; font-size: 0.84rem;
  color: #fff; text-decoration: none; background: linear-gradient(135deg, #10b981, #059669);
}
.install-banner .ib-cta:hover { filter: brightness(1.06); }
.install-banner .ib-close {
  flex-shrink: 0; background: none; border: none; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 0.2rem;
}
.install-banner .ib-close:hover { color: #fff; }
@media (max-width: 520px) {
  .install-banner { left: 0.5rem; right: 0.5rem; margin-bottom: 0.5rem; }
}

.app-cta { margin: 0 0 0.9rem; }
.play-btn { display: inline-block; padding: 0.7rem 1.3rem; border-radius: 10px; font-weight: 700; font-size: 0.9rem; color: #fff; background: linear-gradient(135deg, #10b981, #059669); text-decoration: none; box-shadow: 0 4px 14px rgba(16,185,129,0.25); }
.play-btn:hover { filter: brightness(1.06); }
.hidden { display: none !important; }
#seo-content { display: none; }

.news-feed { display: flex; flex-direction: column; gap: 0.65rem; }
.news-item {
  display: block; padding: 0.85rem 1rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel); text-decoration: none; color: inherit;
}
.news-item:hover { border-color: var(--accent); }
.news-title { font-weight: 600; font-size: 0.95rem; line-height: 1.35; margin-bottom: 0.25rem; }
.news-meta { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }

/* Ad slots */
.mkt-slot { display: block; margin: 1.25rem auto; max-width: 1180px; text-align: center; min-height: 1px; overflow: hidden; }
.mkt-slot--banner { margin: 0.75rem auto; padding: 0 1.25rem; }
.mkt-slot--inline { margin: 1.25rem 0; }
.mkt-slot--multiplex { margin: 1.5rem auto; padding: 0 1.25rem; }
.mkt-slot .adsbygoogle { display: block; }
