@font-face { font-family: 'Pixelify'; src: url('fonts/pixelify-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Pixelify'; src: url('fonts/pixelify-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Mono'; src: url('fonts/mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --bg: #07060f;
  --panel: #0d0a18;
  --panel2: #121024;
  --line: #29213f;
  --text: #f3f0ff;
  --muted: #9189a8;
  --pink: #ff36ad;
  --violet: #8b63ff;
  --cyan: #5ee7ff;
  --green: #3ddc84;
  --red: #ff5d6c;
  --gold: #ffc94d;
  --pix: 'Pixelify', 'Courier New', monospace;
  --mono: 'Mono', ui-monospace, Menlo, Consolas, monospace;
  --body: 'Pixelify', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 99, 255, 0.18), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(255, 54, 173, 0.1), transparent 60%),
    var(--bg);
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login__card {
  width: min(380px, 100%);
  padding: 28px 26px 24px;
  background: linear-gradient(180deg, #14102c, #0a0818);
  box-shadow: inset 0 0 0 1px #3a2f78, 0 20px 60px #000c, 0 0 40px rgba(139, 99, 255, 0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login__card small { font-size: 10px; letter-spacing: 0.22em; color: #b9a8ff; }
.login__card h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: 0.04em; }
.login__card p { margin: 0; color: var(--muted); font-size: 13px; }
.login__card label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.login__card input {
  padding: 11px 12px; border: 0; background: #14102d; color: #fff; font: inherit; font-size: 15px;
  box-shadow: inset 0 0 0 1px #3a2f78;
}
.login__card input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.login__card button {
  padding: 12px; border: 0; letter-spacing: 0.16em; font-size: 12px; color: #fff;
  background: linear-gradient(#ff4fb8, #c91f86); box-shadow: inset 0 -3px #00000059;
}
.login__err { min-height: 18px; color: var(--red) !important; }

/* ---------- Layout ---------- */
.app { max-width: 1320px; margin: 0 auto; padding: 0 18px 40px; }
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 0; margin-bottom: 8px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.top__brand { display: flex; align-items: baseline; gap: 12px; }
.top__brand b { font-size: 22px; letter-spacing: 0.08em; font-weight: 600; text-shadow: 0 0 18px rgba(255, 54, 173, 0.5); }
.top__brand span { font-size: 10px; letter-spacing: 0.24em; color: var(--muted); }
.top__tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: flex; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 12px; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.seg button.is-on { background: #2a1d5c; color: #fff; box-shadow: inset 0 0 0 1px var(--violet); }
.ghost { padding: 8px 12px; border: 0; background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px var(--line); font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.ghost:hover, .seg button:hover { color: #fff; }
.auto { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }
.auto input { accent-color: var(--pink); }

.notice { margin: 6px 0 14px; padding: 10px 14px; background: rgba(255, 201, 77, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 201, 77, 0.45); color: var(--gold); font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.kpi {
  position: relative; padding: 12px 14px 12px; background: linear-gradient(180deg, #14102c, #0d0a18);
  box-shadow: inset 0 0 0 1px #2a2350;
}
.kpi small { display: block; font-size: 9.5px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.kpi b { display: block; margin: 6px 0 2px; font-family: var(--mono); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.kpi.is-warn b { color: var(--gold); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--violet); }
.kpi.k-pink::before { background: var(--pink); }
.kpi.k-cyan::before { background: var(--cyan); }
.kpi.k-green::before { background: var(--green); }
.kpi.k-gold::before { background: var(--gold); }

.grid { display: grid; gap: 12px; margin-bottom: 12px; grid-template-columns: 1fr; }
.grid--wide { grid-template-columns: 2fr 1fr; }
.grid--two { grid-template-columns: 1fr 1fr; }
.grid--three { grid-template-columns: repeat(3, 1fr); }
.grid--four { grid-template-columns: repeat(4, 1fr); }
.card {
  padding: 14px 16px 16px; min-width: 0;
  background: linear-gradient(180deg, #110e22, #0c0a17);
  box-shadow: inset 0 0 0 1px #261f4a;
}
.card h2 { margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.card h2 small { font-size: 10px; letter-spacing: 0.1em; color: var(--muted); font-weight: 400; text-transform: none; }
.pulse { display: inline-block; width: 8px; height: 8px; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(1.4); } }

/* ---------- Charts and bars ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart--short svg { max-height: 190px; }
.axis text { fill: #7d7699; font-family: var(--mono); font-size: 10px; }
.axis line, .grid-line { stroke: #231c40; stroke-width: 1; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }

.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: minmax(70px, 38%) 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; }
.bar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d9d3f3; }
.bar i { display: block; height: 8px; background: #1b1638; position: relative; }
.bar i u { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--pink)); }
.bar b { font-family: var(--mono); font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
.bar small { color: var(--muted); margin-left: 6px; }
.empty { color: var(--muted); font-size: 12.5px; padding: 6px 0; }

.funnel { display: flex; flex-direction: column; gap: 6px; }
.fstep { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.fstep div { position: relative; height: 34px; background: #17122f; overflow: hidden; }
.fstep div u { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(139, 99, 255, 0.55), rgba(255, 54, 173, 0.55)); }
.fstep div span { position: relative; display: block; padding: 0 10px; line-height: 34px; font-size: 12.5px; }
.fstep b { font-family: var(--mono); font-weight: 500; font-size: 13px; text-align: right; min-width: 92px; }
.fstep b small { display: block; color: var(--muted); font-size: 10.5px; font-weight: 400; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 13px; }
.row span { color: var(--muted); }
.row b { font-family: var(--mono); font-weight: 500; text-align: right; }
.row b.good { color: var(--green); }
.row b.bad { color: var(--red); }
.mini { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.mini b { display: block; font-family: var(--mono); font-weight: 500; color: var(--text); font-size: 16px; }

.donut { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.donut svg { width: 120px; height: 120px; flex: none; }
.donut ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.donut li i { display: inline-block; width: 10px; height: 10px; margin-right: 8px; }
.donut li b { font-family: var(--mono); font-weight: 500; margin-left: 6px; }

.live { display: flex; flex-direction: column; gap: 10px; }
.live__big { font-family: var(--mono); font-size: 44px; line-height: 1; }
.live__big small { display: block; margin-top: 4px; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); font-family: var(--body); }
.live__row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); color: var(--muted); }
.live__row b { color: var(--text); font-family: var(--mono); font-weight: 500; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 10px; letter-spacing: 0.14em; color: var(--muted); font-weight: 400; padding: 6px 10px; border-bottom: 1px solid var(--line); text-transform: uppercase; }
.table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); white-space: nowrap; }
.table td.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table button { border: 0; padding: 4px 8px; background: rgba(255, 93, 108, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 93, 108, 0.5); color: var(--red); font-size: 10px; letter-spacing: 0.1em; }
.table button:hover { background: rgba(255, 93, 108, 0.25); }

.feed { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.feed div { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 12.5px; }
.feed time { font-family: var(--mono); color: var(--muted); font-size: 11.5px; }
.feed em { font-style: normal; color: #d9d3f3; }
.feed small { color: var(--muted); font-family: var(--mono); }
.tag { display: inline-block; padding: 1px 6px; font-size: 10px; letter-spacing: 0.08em; background: rgba(139, 99, 255, 0.18); color: #cdbfff; margin-right: 6px; }
.tag.wallet { background: rgba(255, 201, 77, 0.16); color: var(--gold); }
.tag.err { background: rgba(255, 93, 108, 0.16); color: var(--red); }
.tag.good { background: rgba(61, 220, 132, 0.14); color: var(--green); }

.foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: #7d7699; line-height: 1.5; }

@media (max-width: 1000px) {
  .grid--wide, .grid--two, .grid--three { grid-template-columns: 1fr; }
  .grid--four { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .grid--four { grid-template-columns: 1fr; }
  .app { padding: 0 12px 30px; }
  .kpi b { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

#playerControl{margin:10px 0 15px}#pcEditor{background:#1a1030;padding:18px;margin-top:15px;border:1px solid #8252b8}#pcEditor label{display:inline-block;margin:6px;color:#d7c4ec}#pcEditor input,#pcEditor select{background:#0d0719;border:1px solid #7644a1;color:white;padding:9px;max-width:260px}#pcEditor button,#pcRows button{background:#7439bb;border:1px solid #ad70ef;color:#fff;padding:8px 12px;cursor:pointer}#pcStatus{font-size:12px;color:#aeb0d5}
