html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { max-height: 1000000px; }
:root {
  --bg: #000000;
  --bg-alt: #0a0a0a;
  --panel: #1a1a1a;
  --panel-hover: #222222;
  --border: #262626;
  --border-soft: #171717;
  --border-bright: #3a3a3a;
  --text: #ffffff;
  --text-dim: #ffffff;
  --text-faint: #ffffff;
  --white: #ffffff;
  --green: #3F9163;
  --red: #B8413B;
  --yellow: #B8912F;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 6px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(255,255,255,0.16); }

/* ---------- header ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  height: 62px;
  padding: 0 24px;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--border-bright);
  display: grid; place-items: center;
  font-size: 13px; color: var(--white);
  background: var(--panel);
}
.app-badge {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.14em; color: var(--white);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 6px; margin-left: 2px;
}
.appbar-nav { display: flex; gap: 4px; margin-left: 14px; }
.appbar-nav a {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim);
  padding: 7px 12px; border-radius: 5px; transition: all .18s;
}
.appbar-nav a:hover, .appbar-nav a.active { background: var(--panel); color: var(--text); }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 500;
  border-radius: 6px; padding: 8px 15px; cursor: pointer;
  border: 1px solid transparent; transition: all .18s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-ghost { border-color: var(--border-bright); color: var(--text-dim); background: transparent; }
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }
.btn-primary { background: var(--white); color: #000000; font-weight: 600; }
.btn-primary:hover { background: #e8e7e2; }
.btn-connect.connected { background: transparent; border-color: var(--green); color: var(--green); }
.dotmark { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(63,145,99,0.18); }

/* ---------- demo banner ---------- */
.demo-banner {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint);
  text-align: center; padding: 7px 16px;
  background: var(--bg-alt); border-bottom: 1px solid var(--border-soft);
  letter-spacing: 0.03em;
}
.demo-banner strong { color: var(--text-dim); font-weight: 600; }

/* ---------- layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 34px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-mono); font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em;
  color: var(--text-dim); border: 1px solid var(--border); border-radius: 100px;
  padding: 7px 14px; background: var(--panel);
}
.blink { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px;
  background: var(--panel); position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; top: 0; right: 0; width: 40px; height: 40px;
  border-top: 1px solid var(--border-bright); border-right: 1px solid var(--border-bright);
  border-top-right-radius: 10px; opacity: 0.5; }
.stat .label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.stat .value { font-family: var(--font-mono); font-size: 27px; font-weight: 700; margin-top: 10px; line-height: 1; }
.stat .sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-top: 8px; }
.stat .sub.up { color: var(--green); }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.card { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); overflow: hidden; scroll-margin-top: 90px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
}
.card-head h2 { font-family: var(--font-mono); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.card-head .live { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--text-dim); }
.dot-green { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(63,145,99,0.16); }

/* terminal dots */
.tdots { display: flex; gap: 6px; }
.tdots i { width: 8px; height: 8px; border-radius: 50%; }
.tdots i:nth-child(1){ background: var(--red); }
.tdots i:nth-child(2){ background: var(--yellow); }
.tdots i:nth-child(3){ background: var(--green); }

/* ---------- live feed ---------- */
#feed-card { display: flex; flex-direction: column; }
.feed { font-family: var(--font-mono); font-size: 12px; flex: 1; min-height: 0; overflow: hidden; }
.feed-row {
  display: grid; grid-template-columns: 66px 78px 84px 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 18px; border-bottom: 1px solid var(--border-soft);
  animation: slidein .35s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.feed-row:last-child { border-bottom: none; }
.f-time { color: var(--text-faint); }
.f-pair { color: var(--text); font-weight: 700; }
.f-act { color: var(--text-dim); }
.f-conf { color: var(--text-faint); }
.f-proof { color: var(--text-dim); }
.f-status { color: var(--green); font-weight: 600; white-space: nowrap; }

/* ---------- agents ---------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.agent-list { display: flex; flex-direction: column; }
.agent-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.agent-row:last-child { border-bottom: none; }
.agent-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.agent-status.active { background: var(--green); box-shadow: 0 0 0 3px rgba(63,145,99,0.16); animation: blink 1.2s steps(1) infinite; }
.agent-status.paused { background: transparent; border: 1px solid var(--text-faint); }
.agent-meta { display: flex; flex-direction: column; min-width: 0; }
.agent-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; }
.agent-strat { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.agent-earn { margin-left: auto; text-align: right; }
.agent-earn b { display: block; font-family: var(--font-mono); font-size: 12.5px; }
.agent-earn span { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); letter-spacing: 0.08em; }

/* deploy panel */
.deploy { padding: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 7px; }
.field select, .field input {
  width: 100%; font-family: var(--font-mono); font-size: 12.5px;
  background: var(--bg-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
  outline: none; transition: border-color .18s;
}
.field select:focus, .field input:focus { border-color: var(--border-bright); }
.deploy .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }

/* roles earnings mini */
.roles { padding: 6px 18px 14px; }
.role-line { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-family: var(--font-mono); font-size: 12px; }
.role-line:last-child { border-bottom: none; }
.role-line .r-name { color: var(--text-dim); }
.role-line .r-bar { flex: 1; height: 4px; margin: 0 14px; background: var(--bg-alt); border-radius: 3px; overflow: hidden; }
.role-line .r-bar i { display: block; height: 100%; background: var(--text-faint); border-radius: 3px; }
.role-line .r-val { color: var(--text); font-weight: 600; min-width: 42px; text-align: right; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--white); color: #000000; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600;
  padding: 12px 20px; border-radius: 8px; opacity: 0; pointer-events: none;
  transition: all .28s cubic-bezier(.2,.8,.2,1); z-index: 100;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.7);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { border-top: 1px solid var(--border); padding: 26px 24px; text-align: center; color: var(--text-faint); font-family: var(--font-mono); font-size: 11.5px; }
footer a { color: var(--text-dim); }
footer a:hover { color: var(--text); }

/* responsive */
@media (max-width: 599px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .appbar-nav { display: none; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .feed-row { grid-template-columns: 58px 1fr auto; }
  .feed-row .f-act, .feed-row .f-conf { display: none; }
  .page-head h1 { font-size: 21px; }
}
/* roles card fills remaining stack height -> aligns with feed bottom */
.stack > .card:last-child { flex: 1; display: flex; flex-direction: column; }
.stack > .card:last-child .roles { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; }
.roles-note { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); line-height: 1.7; padding-top: 14px; border-top: 1px solid var(--border-soft); }

@media (hover: none) and (pointer: coarse) {
  .feed { font-size: 14px !important; }
  .stat .label { font-size: 12px !important; }
  .stat .value { font-size: 30px !important; }
  .agent-name { font-size: 15px !important; }
  .agent-strat, .stat .sub { font-size: 12.5px !important; }
  .appbar-nav a, .btn { font-size: 14.5px !important; }
  .r-name, .r-val { font-size: 14px !important; }
  .roles-note { font-size: 12.5px !important; }
  .page-head p { font-size: 15.5px !important; }
  .demo-banner { font-size: 13px !important; }
}

@media (hover: none) and (pointer: coarse) {
  .wrap { max-width: 800px; }
}
