:root {
  color-scheme: dark;
  --bg: #0c0f16;
  --panel: #151a24;
  --card: #1a2130;
  --line: #2c3548;
  --text: #e8edf6;
  --muted: #8e99ad;
  --amber: #e0a84a;
  --red: #ef6b57;
  --green: #3dce7a;
  --side: #ff9a3c;
  --blue: #8eb4ff;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 420px at 0% -10%, rgba(61, 206, 122, 0.09), transparent 55%),
    radial-gradient(900px 380px at 100% 0%, rgba(255, 154, 60, 0.08), transparent 50%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
a { color: var(--blue); text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid rgba(142, 180, 255, 0.7);
  outline-offset: 2px;
}

.top {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(12, 15, 22, 0.88);
  backdrop-filter: blur(10px);
  z-index: 2;
}
.brand { display: flex; flex-direction: column; min-width: 120px; }
.mark {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.phase { color: var(--muted); font-size: 12px; }
.lead { flex: 1; margin: 0; color: var(--muted); }
.tools a {
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.tools a:hover { color: var(--text); border-color: #4a5872; }

.shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
}
.feed {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(8, 10, 16, 0.45);
  border-right: 1px solid var(--line);
}
.feed-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.feed-head h2,
.stage h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 700;
}
.desk {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.desk-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(12, 15, 22, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.filters, .tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button, .tabs button, .stage-actions button {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.filters button:hover, .tabs button:hover, .stage-actions button:hover {
  color: var(--text);
  border-color: #4a5872;
}
.filters button[aria-pressed="true"],
.tabs button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.filters button[data-role="side"][aria-pressed="true"] {
  background: rgba(255, 154, 60, 0.18);
  color: #ffc089;
  border-color: rgba(255, 154, 60, 0.85);
}
.filters button[data-role="main"][aria-pressed="true"] {
  background: rgba(61, 206, 122, 0.16);
  color: #9cf0bc;
  border-color: rgba(61, 206, 122, 0.85);
}
input[type="search"] {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 240px;
  margin-right: auto;
  background: #10151e;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
}
.status { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.status.error { color: var(--red); }
.feed-key {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.tape {
  flex: 1;
  overflow: auto;
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}
.book {
  background: transparent;
  border: 0;
  padding: 8px 16px 32px;
}
.empty { color: var(--muted); margin: 12px; }

.role {
  display: inline-flex;
  align-items: center;
  flex: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  vertical-align: middle;
}
.role.side {
  color: #ffc089;
  background: rgba(255, 154, 60, 0.14);
  border-color: rgba(255, 154, 60, 0.78);
}
.role.main {
  color: #9cf0bc;
  background: rgba(61, 206, 122, 0.14);
  border-color: rgba(61, 206, 122, 0.78);
}

.fomo {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}
.fomo.side { border-left-color: var(--side); }
.fomo.main { border-left-color: var(--green); }
.fomo.fresh { animation: entry-flash 1.2s ease; }
.av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #242b3a;
  border: 1px solid #3a455c;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}
.fomo-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.fomo-name {
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fomo-name a { color: var(--text); }
.pill {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  padding: 2px 7px;
  border-radius: 999px;
}
.pill.buy, .pill.entry { background: #1f8a4c; color: #f3fff6; }
.pill.sell { background: #c4492c; color: #fff6f3; }
.ago {
  margin-left: auto;
  flex: none;
  color: #c5cedd;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.fomo-trade {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 4px;
  font-size: 13px;
  flex-wrap: wrap;
}
.tick {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
  background: #2c3548;
  color: var(--text);
  font-size: 9px;
  display: grid;
  place-items: center;
}
.fomo-trade .ticker { color: var(--text); font-weight: 700; }
.fomo-trade .size { color: var(--text); font-variant-numeric: tabular-nums; }
.fomo-trade .at { color: var(--muted); }

.kol-btn, .copy {
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 0;
}
.kol {
  margin: 0 0 8px;
  padding: 8px 10px 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.kol-btn {
  width: 100%;
  text-align: left;
  padding: 6px 2px 8px;
}
.kol-line { display: flex; gap: 10px; align-items: baseline; }
.kol-line .name { flex: 1; font-weight: 650; }
.kol-line .count { color: var(--side); font-size: 12px; font-weight: 650; }
.pnl { display: block; color: var(--muted); font-size: 12px; }
.wallets { padding: 0 0 8px 2px; }
.wallet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 8px 2px;
  border-top: 1px solid #2a3346;
}
.wallet .label { font-weight: 650; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 12px; }
.evidence { color: var(--text); font-size: 12px; }
.new {
  color: var(--amber);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
}
.copy, .wallet a, .stage-ca {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy { color: var(--blue); font-size: 12px; }

.hint { margin: 0; padding: 12px 16px 0; color: var(--muted); font-size: 13px; }
.positions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  padding: 12px 16px 32px;
}
a.pos { text-decoration: none; color: inherit; }
.pos {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  background: linear-gradient(180deg, #1c2433, #151b27);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.pos.live { box-shadow: inset 3px 0 0 var(--green), var(--shadow); }
.pos:hover, .pos:focus-visible { border-color: #5a6d8e; }
.pos-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pos-top .name { min-width: 0; font-weight: 700; }
.pos-top .roles { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.badge {
  color: var(--green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.pline { color: var(--muted); font-size: 12px; }
.pos-mc {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.hold { color: var(--green); }
.out { color: var(--red); }

.stage {
  margin: 0 22px 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.stage-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stage-actions { display: flex; gap: 6px; }
.stage-actions button:disabled { opacity: 0.4; cursor: default; }
.stage-note { margin: 8px 0 0; color: var(--text); }
.stage-links { margin: 4px 0 8px; color: var(--muted); font-size: 12px; }
.chart svg { width: 100%; height: auto; display: block; background: #10141c; border-radius: 10px; }
.chart .line { fill: none; stroke: #e7c27a; stroke-width: 1.8; }
.chart .area { fill: rgba(224, 168, 74, 0.14); stroke: none; }
.chart .grid { stroke: #2a3346; stroke-width: 1; }
.chart .tick { fill: #8e99ad; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chart .entry-line { stroke: var(--amber); stroke-dasharray: 3 4; stroke-width: 1; }
.chart .entry-label { fill: var(--amber); }
.chart .playhead { stroke: var(--text); stroke-width: 1; }
.chart .mark { opacity: 0; transition: opacity 0.18s linear; }
.chart .mark-hit.on .mark { opacity: 0.92; }
.chart .hit { fill: transparent; }
.chart .mark.buy { fill: var(--green); }
.chart .mark.sell { fill: var(--red); }
.chart .mark.main { stroke: #f4efe0; stroke-width: 1.6; }
.chart .mark-hit.hot .mark { stroke: var(--text); }
.chart input[type="range"] { width: 100%; margin-top: 8px; accent-color: var(--amber); }
.legend { margin: 8px 0 0; color: var(--muted); font-size: 12px; display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.legend .key { display: inline-flex; gap: 6px; align-items: center; }
.swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.swatch.buy { background: var(--green); }
.swatch.sell { background: var(--red); }
.swatch.main { box-shadow: 0 0 0 1.5px var(--green); }
.swatch.line { width: 14px; height: 2px; border-radius: 0; background: #e7c27a; }
.token-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font-weight: 650;
}
.token-link:hover { color: var(--blue); }
#stage-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  font-weight: 700;
}
.stage-id { min-width: 0; }
.stage-ca { margin: 4px 0 0; color: var(--muted); font-size: 12px; word-break: break-all; }
.stage-ca .copy { margin-left: 8px; }
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.fact {
  background: #10151e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.fact .k {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fact .v { display: block; margin-top: 6px; font-size: 18px; font-weight: 650; }
.fact .s { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.fact.good .v { color: var(--green); }
.fact.bad .v { color: var(--red); }
.fact.warn .v { color: var(--amber); }
.readout {
  margin: 0 0 8px;
  padding: 10px 12px;
  background: #10151e;
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  min-height: 3.2em;
}
.dossier { margin-top: 8px; }
.kol-block { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.kol-block h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text); }
.story { margin: 0 0 6px; }
.wallet-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(0, 2fr) auto;
  gap: 8px 14px;
  padding: 8px 10px;
  margin: 6px 0;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  background: #121722;
  align-items: start;
}
.wallet-row.side { border-left-color: var(--side); }
.wallet-row.main { border-left-color: var(--green); }
.fill { display: block; color: var(--muted); font-size: 12px; }
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }
.tip { margin: 8px 0 0; font-size: 12px; }
.fills { list-style: none; margin: 0; padding: 0; }
.fills li { padding: 8px 0; border-bottom: 1px solid #2a3346; }
.fills .buy, .fills .entry { color: var(--green); }
.fills .sell { color: var(--red); }
.chart-link {
  background: transparent;
  color: var(--blue);
  border: 0;
  padding: 0;
  font-size: 12px;
}
.act.entry { color: var(--amber); }
@keyframes entry-flash {
  from { background: rgba(142, 180, 255, 0.18); }
  to { background: var(--card); }
}

@media (max-width: 980px) {
  body { height: auto; overflow: auto; }
  .top { flex-wrap: wrap; }
  .lead { flex-basis: 100%; order: 3; }
  .shell { grid-template-columns: 1fr; display: block; }
  .feed {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .tape { max-height: 52vh; }
  .desk { overflow: visible; }
  .desk-bar { position: static; }
  .stage { margin: 0 12px 14px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .wallet-row { grid-template-columns: 1fr; }
  #stage-title { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .fomo.fresh { animation: none; }
  .chart .mark { opacity: 0.92; transition: none; }
}
