:root {
  --canvas: #05070a; --surface: #0c1117; --raised: #121a23; --line: rgba(148, 180, 210, .12); --line-hi: rgba(148, 180, 210, .24);
  --ink: #e6edf5; --ink-soft: #8a9bb0; --ink-faint: #5b6b7f;
  --accent: #ffb547; --accent-ink: #1a1203;
  --up: #22c55e; --down: #f43f5e; --foreign: #60a5fa; --local: #f5d0a9;
  --font: 'Geist', system-ui, sans-serif; --mono: 'Geist Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
/* the page scrolls: the market at the top, the three live columns, then every stock; the columns keep their own scroll */
body { background: var(--canvas); color: var(--ink); font: 14px/1.5 var(--font); display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; min-height: 100dvh; }
.bar { position: sticky; top: 0; }
/* nothing may widen the page: the rolling tape is as wide as its content and would push every column off screen */
body > *, .surface > *, .col, .feed, .item > * { min-width: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.num, .code, kbd, time { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar { position: relative; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0a0f15, var(--canvas)); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand b { font-weight: 700; letter-spacing: -.01em; font-size: 16px; } .brand b span { color: var(--accent); margin-left: 2px; }
.search { position: relative; display: flex; align-items: center; gap: 8px; max-width: 560px; width: 100%; justify-self: center; padding: 7px 10px; border-radius: 10px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .18s var(--ease); }
.search:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px rgba(255, 181, 71, .1); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--ink-soft); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; }
.search input::placeholder { color: var(--ink-faint); }
kbd { font-size: 11px; padding: 1px 6px; border-radius: 5px; color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line-hi); }
.status { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.status small { font-size: 10px; letter-spacing: .08em; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: breathe 2.4s var(--ease) infinite; }
.live.off { background: var(--down); animation: none; }
@keyframes breathe { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.results { position: absolute; z-index: 30; top: calc(100% - 4px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); max-height: 60vh; overflow: auto;
  padding: 6px; border-radius: 12px; background: var(--raised); box-shadow: 0 0 0 1px var(--line-hi), 0 24px 60px -20px #000; }
.results small { display: block; padding: 8px 10px 4px; color: var(--ink-faint); font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.results button { display: flex; width: 100%; gap: 10px; align-items: baseline; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.results button:hover, .results button[aria-selected="true"] { background: rgba(255, 181, 71, .1); }
.results .code { color: var(--accent); min-width: 44px; } .results span { color: var(--ink-soft); font-size: 12px; margin-left: auto; }

/* ---------- tape: yesterday's large-holder moves ---------- */
.tape { height: 30px; overflow: hidden; min-width: 0; contain: paint; border-bottom: 1px solid var(--line); background: #070a0e; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.tape-track { display: flex; gap: 28px; width: max-content; height: 100%; align-items: center; animation: roll var(--dur, 90s) linear infinite; padding-left: 24px; }
.tape:hover .tape-track { animation-play-state: paused; }
@keyframes roll { to { transform: translateX(-50%); } }
.tape a { display: inline-flex; gap: 7px; align-items: baseline; font-size: 12px; text-decoration: none; white-space: nowrap; color: var(--ink-soft); }
.tape a .code { color: var(--ink); font-weight: 600; } .tape a.lit { color: var(--ink); } .tape a.lit .code { color: var(--accent); }

/* ---------- the surface: three live columns ---------- */
.tabs { display: none; }
.surface { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 1px; height: min(82vh, 900px); min-height: 520px; background: var(--line); border-block: 1px solid var(--line); }
.market { border-bottom: 1px solid var(--line); min-height: auto; flex: none; }
.tv { margin: 0 14px 14px; border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.tv-heat { height: min(64vh, 640px); min-height: 420px; }
.tv-screen { height: 760px; }
.tv .tradingview-widget-container, .tv .tradingview-widget-container__widget { height: 100%; }
.col { display: flex; flex-direction: column; min-height: 0; background: var(--canvas); }
.col > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.col h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.count { font: 500 11px var(--mono); color: var(--ink-faint); }
.col select { border: 0; border-radius: 7px; padding: 3px 6px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font: 500 11px var(--mono); }
.hint { margin: 0; padding: 0 14px 8px; font-size: 12px; color: var(--ink-faint); }
.chips { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.chips button { flex: none; border: 0; border-radius: 999px; padding: 4px 10px; font-size: 12px; background: var(--surface); color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: background .16s var(--ease), color .16s var(--ease); }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.feed { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-hi) transparent; }
.item { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; padding: 10px 8px; border-radius: 10px; cursor: pointer; transition: background .16s var(--ease); }
.item + .item { box-shadow: 0 -1px 0 var(--line); }
@media (hover: hover) and (pointer: fine) { .item:hover { background: var(--surface); } }
.item .code { grid-row: 1 / 3; align-self: start; min-width: 50px; padding: 3px 0; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 600; background: rgba(255, 181, 71, .1); color: var(--accent); }
.item .code.none { background: var(--surface); color: var(--ink-faint); }
.item .t { font-size: 13.5px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.item .meta { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 11.5px; color: var(--ink-faint); min-width: 0; }
.item .meta > span { overflow-wrap: anywhere; }
.item time { grid-column: 3; grid-row: 1; font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.tag { display: inline-block; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; background: var(--raised); color: var(--ink-soft); }
.tag.own { color: #fde68a; background: rgba(250, 204, 21, .12); } .tag.fin { color: #93c5fd; background: rgba(96, 165, 250, .12); }
.tag.div { color: #86efac; background: rgba(34, 197, 94, .12); } .tag.sus { color: #fda4af; background: rgba(244, 63, 94, .14); }
.tag.ca { color: #d8b4fe; background: rgba(168, 85, 247, .14); } .tag.uma { color: #fdba74; background: rgba(249, 115, 22, .14); }
.item.fresh { animation: drop .5s var(--ease) both; }
.item.fresh::after { content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(255, 181, 71, .22), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: sweep .9s var(--ease) both; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes sweep { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.move .delta { font-family: var(--mono); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.up { color: var(--up); } .down { color: var(--down); }
.move .who { font-size: 13px; }
.lf { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: var(--local); } .lf.a { background: var(--foreign); }
.more { margin: 0 14px 12px; padding: 8px; border: 0; border-radius: 9px; background: var(--surface); color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.empty { padding: 24px 14px; color: var(--ink-faint); font-size: 13px; }
.lit-row { background: rgba(255, 181, 71, .08) !important; box-shadow: inset 2px 0 0 var(--accent) !important; }

.foot { display: flex; justify-content: space-between; gap: 16px; padding: 6px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-faint); }
.foot a { color: var(--ink-soft); text-decoration: none; }

/* ---------- the sheet: one company or one holder over the surface ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(3, 5, 8, .62); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
.sheet { position: fixed; z-index: 41; top: 56px; bottom: 0; right: 0; width: min(1180px, 100vw); overflow-y: auto; background: var(--canvas); box-shadow: 0 0 0 1px var(--line-hi), -40px 0 80px -30px #000;
  animation: slide .28s var(--ease); scrollbar-width: thin; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.sh-head { position: sticky; top: 0; z-index: 2; display: flex; gap: 14px; align-items: center; padding: 16px 20px; background: linear-gradient(180deg, var(--canvas) 70%, transparent); }
.sh-head .code { font-size: 22px; font-weight: 600; color: var(--accent); }
.sh-head h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; line-height: 1.2; text-wrap: balance; }
.sh-head p { margin: 2px 0 0; color: var(--ink-soft); font-size: 12.5px; }
.sh-head .x { margin-left: auto; flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font-size: 18px; }
.sh-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; padding: 0 20px 28px; }
.card { min-width: 0; padding: 14px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.card h3 { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 8px; }
.card h3 small { font: 500 11px var(--mono); letter-spacing: 0; text-transform: none; color: var(--ink-faint); }
.span2 { grid-column: 1 / -1; }
.chart { height: 420px; border-radius: 10px; overflow: hidden; background: var(--canvas); }
.chart .tradingview-widget-container, .chart .tradingview-widget-container__widget { height: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); padding: 6px 6px; border-bottom: 1px solid var(--line); }
td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; } td.num { white-space: nowrap; }
tr.holder { cursor: pointer; } tr.holder:hover td { background: rgba(255, 255, 255, .02); }
.accts { color: var(--ink-faint); font-size: 11.5px; margin-top: 3px; }
.bar-pct { position: relative; height: 4px; margin-top: 5px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.bar-pct i { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: 2px; transform-origin: left; animation: grow .7s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.web { position: relative; height: 460px; border-radius: 10px; overflow: hidden; background: radial-gradient(80% 70% at 50% 45%, #0f1620, var(--canvas)); }
.web canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.web .tip { position: absolute; pointer-events: none; padding: 6px 9px; border-radius: 8px; font-size: 12px; background: var(--raised); box-shadow: 0 0 0 1px var(--line-hi); white-space: nowrap; transform: translate(-50%, -130%); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11.5px; color: var(--ink-faint); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.mix { display: grid; gap: 7px; }
.mix-row { display: grid; grid-template-columns: 120px 1fr 54px; gap: 8px; align-items: center; font-size: 12px; }
.mix-row .track { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--raised); }
.mix-row .track i { display: block; height: 100%; } .mix-row .num { text-align: right; color: var(--ink-soft); }
.mix-row.cls { grid-template-columns: minmax(0, 170px) 1fr 92px; } .mix-row.cls > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mix-row .num small { font-size: 10.5px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; font-size: 12.5px; }
.facts dt { color: var(--ink-faint); font-size: 11px; } .facts dd { margin: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.list li { padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.list li a { text-decoration: none; } .list li a:hover { color: var(--accent); }
.list li small { display: block; color: var(--ink-faint); font-size: 11px; margin-top: 2px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface), var(--raised), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- phones: one column, tabs; the sheet takes the screen ---------- */
@media (max-width: 860px) {
  .bar { grid-template-columns: auto 1fr auto; gap: 10px; padding: 8px 12px; }
  .brand b { display: none; }
  .search kbd { display: none; }
  .status small, .status #clock { display: none; }
  .tabs { display: flex; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1; min-width: 0; border: 0; border-radius: 9px; padding: 7px 4px; background: none; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
  .tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-hi); }
  .surface { grid-template-columns: 1fr; height: calc(100dvh - 140px); min-height: 0; border: 0; }
  .surface:not(:has(.col.on)) { display: none; }
  .col { display: none; } .col.on { display: flex; }
  .tv { margin: 0 8px 10px; } .tv-heat { height: 62vh; min-height: 380px; } .tv-screen { height: 78vh; }
  .col > header h2 { display: none; }
  .sheet { top: 0; width: 100vw; }
  .sh-grid { grid-template-columns: 1fr; padding: 0 12px 24px; }
  .sh-head { padding: 12px; }
  .chart { height: 340px; } .web { height: 380px; }
  .mix-row { grid-template-columns: 96px 1fr 48px; }
  .foot { flex-direction: column; gap: 2px; padding: 6px 12px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tape-track { animation: none; }
  .item.fresh, .sheet, .bar-pct i { animation: fade .2s linear both; }
  .item.fresh::after { display: none; }
  .live { animation: none; }
}
