:root {
  --ground: #0a0b0f;
  --panel: #13151b;
  --line: #23262f;
  --line-soft: #1c1f27;
  --text: #f3f4f6;
  --muted: #8b919d;
  --dim: #5f6673;
  --accent: #a78bfa;
  --accent-deep: #7c3aed;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --pad: clamp(16px, 1.7vw, 30px);
  --gap: clamp(10px, 1vw, 18px);
  --radius: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 620px at 12% -12%, #1e1533 0%, transparent 62%),
    radial-gradient(900px 520px at 102% -6%, #0f1b2c 0%, transparent 58%),
    var(--ground);
  color: var(--text);
  font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.booting {
  position: fixed; inset: 0; display: grid; place-items: center;
  font-size: 0; opacity: .8;
}
.booting .mark { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

.wall {
  height: 100dvh;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: var(--gap);
  padding: var(--pad);
}

/* ---------- header ---------- */
.head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 42px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.mark {
  width: clamp(30px, 2.4vw, 38px);
  height: clamp(30px, 2.4vw, 38px);
  border-radius: 11px;
  background: linear-gradient(145deg, #b39dfb, #6d28d9);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: clamp(14px, 1.15vw, 18px);
  box-shadow: 0 0 0 1px #ffffff1a inset, 0 8px 22px #7c3aed33;
  flex: none;
}
.brand .name {
  font-size: clamp(16px, 1.35vw, 21px);
  font-weight: 600;
  letter-spacing: -.02em;
}
.live {
  display: inline-flex; align-items: center; gap: 7px;
  margin-left: 4px;
  font-size: clamp(9px, .68vw, 11px);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
}
.live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px #4ade8022;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

.controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ctl {
  appearance: none;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #14161dcc;
  color: var(--muted);
  font: inherit;
  font-size: clamp(10px, .72vw, 12px);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.ctl:hover { color: var(--text); border-color: #343845; }

.clockwrap { margin-left: clamp(14px, 1.4vw, 26px); text-align: right; }
.clock {
  font-size: clamp(26px, 2.5vw, 44px);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.dateline {
  margin-top: 5px;
  font-size: clamp(9px, .72vw, 12px);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, #ffffff08, #ffffff02), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}

.kpis {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
}
.kpi {
  position: relative;
  overflow: hidden;
  padding: clamp(13px, 1.25vw, 22px) clamp(14px, 1.35vw, 24px) clamp(12px, 1.15vw, 20px);
  display: flex;
  flex-direction: column;
  min-height: clamp(112px, 14vh, 184px);
}
.kpi::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px 150px at 0% 0%, #a78bfa0f, transparent 70%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; }
.kpi .label {
  color: var(--muted);
  font-size: clamp(10px, .82vw, 13px);
  letter-spacing: .11em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi .chip { margin-left: auto; }
.kpi .value {
  position: relative; z-index: 1;
  margin-top: auto;
  padding-top: 10px;
  font-size: clamp(34px, 3.7vw, 68px);
  line-height: .96;
  font-weight: 600;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi .meta {
  position: relative; z-index: 1;
  margin-top: 8px;
  color: var(--dim);
  font-size: clamp(10px, .82vw, 13px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: clamp(9.5px, .7vw, 11.5px);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  color: #86efac; background: #14301f;
  border: 1px solid #1d4a2f;
  white-space: nowrap;
}
.chip.down { color: #fca5a5; background: #3a1717; border-color: #5c2222; }

/* ---------- chart ---------- */
.chartcard {
  grid-column: 1 / 9;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(13px, 1.15vw, 20px) clamp(14px, 1.25vw, 22px) clamp(8px, .8vw, 14px);
}
.cardhead {
  display: flex; align-items: center; gap: 16px;
  min-height: 26px;
}
.cardhead h2 {
  margin: 0;
  font-size: clamp(12px, .9vw, 15px);
  font-weight: 600;
  letter-spacing: .01em;
  color: #e6e8ec;
}
.hint {
  margin-left: auto;
  color: var(--dim);
  font-size: clamp(10px, .72vw, 12px);
  letter-spacing: .04em;
  white-space: nowrap;
}
.legend { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: clamp(10px, .72vw, 12px); margin-left: auto; }
.chartcard .hint { margin-left: 16px; }
.legend i { width: 9px; height: 7px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.legend .purple { background: #a78bfa; }
.legend .green { background: #4ade80; }
.legend .bar { height: 9px; }
.chart { flex: 1; min-height: 0; margin-top: 6px; }
.chart svg { display: block; width: 100%; height: 100%; }

/* ---------- funnel ---------- */
.funnelcard {
  grid-column: 9 / 13;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(13px, 1.15vw, 20px) clamp(14px, 1.25vw, 22px);
}
.funnel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  min-height: 0;
  margin-top: 4px;
}
.fstep { display: flex; flex-direction: column; gap: 5px; }
.frow { display: flex; align-items: baseline; gap: 8px; font-size: clamp(11px, .82vw, 14px); color: #d5d8df; }
.frow b {
  margin-left: auto;
  font-weight: 600;
  font-size: clamp(15px, 1.2vw, 21px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.fpct {
  width: clamp(34px, 2.6vw, 44px);
  text-align: right;
  color: var(--muted);
  font-size: clamp(10px, .75vw, 13px);
  font-variant-numeric: tabular-nums;
}
.fbar { height: 6px; border-radius: 999px; background: #1b1e26; overflow: hidden; }
.fbar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #c4b5fd);
}
.funnel-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  border-top: 1px solid var(--line-soft);
  margin-top: 10px;
  padding-top: 10px;
  color: var(--dim);
  font-size: clamp(9.5px, .7vw, 11.5px);
}
.funnel-foot .dot { opacity: .5; }

/* ---------- bottom row ---------- */
.bottom {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 6fr 3fr 3fr;
  gap: var(--gap);
  height: clamp(200px, 22.5vh, 224px);
  min-height: 0;
}
.bottom .card {
  padding: clamp(10px, .9vw, 14px) clamp(13px, 1.15vw, 20px) clamp(8px, .7vw, 12px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.empty { color: var(--dim); font-size: 11px; text-align: center; padding: 18px 8px; margin: 0; }
.empty.small { text-align: left; padding: 8px 0; }

/* top users */
.tops {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(14px, 1.4vw, 26px);
  margin-top: 6px;
  min-height: 0;
}
.topcol { display: flex; flex-direction: column; min-width: 0; }
.tophead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 5px;
}
.tophead span { color: var(--dim); letter-spacing: .03em; text-transform: none; font-size: 10px; }
.toprow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 2px;
  padding: 4px 0 3px;
}
.topname {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.topname b {
  flex: 0 1 auto;
  max-width: 55%;
  font-size: clamp(10.5px, .76vw, 11.5px);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topname small {
  flex: 1;
  min-width: 0;
  color: var(--dim);
  font-size: clamp(8.5px, .6vw, 9.5px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topval {
  align-self: center;
  font-size: clamp(13px, .95vw, 16px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.topbar { grid-column: 1 / -1; height: 3px; border-radius: 999px; background: #1b1e26; overflow: hidden; }
.topbar i { display: block; height: 100%; border-radius: 999px; background: #a78bfa; }

/* devices */
.devicebar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #1b1e26;
  margin: clamp(8px, 1vh, 13px) 0 4px;
}
.devicebar i { display: block; height: 100%; }
.devrow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: clamp(3px, .4vh, 6px) 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: clamp(10px, .76vw, 12.5px);
  color: #d5d8df;
}
.devrow:last-child { border-bottom: 0; }
.devrow .dot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.devrow b {
  margin-left: auto;
  font-weight: 600;
  font-size: clamp(12px, .9vw, 15px);
  font-variant-numeric: tabular-nums;
}
.devrow .muted { width: 34px; text-align: right; font-size: clamp(9px, .66vw, 11px); }
.footline {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--dim);
  font-size: clamp(8.5px, .62vw, 10px);
  padding-top: 6px;
}
.footline-row { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* tokens */
.token-total {
  margin-top: 6px;
  font-size: clamp(24px, 2.3vw, 36px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.token-split { margin-top: 3px; color: var(--dim); font-size: clamp(9.5px, .7vw, 11.5px); }
.tokencard .rows {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  flex: 1;
  min-height: 0;
}
.row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: clamp(2px, .28vh, 4px) 0;
  border-bottom: 1px solid var(--line-soft);
  color: #cdd1d9;
  font-size: clamp(10px, .74vw, 12px);
}
.row:last-child { border-bottom: 0; }
.row b {
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
  font-size: clamp(11px, .84vw, 14px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- footer ---------- */
.foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dim);
  font-size: clamp(9px, .65vw, 11px);
  letter-spacing: .02em;
  min-height: 14px;
}
.foot .right { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- invalid ---------- */
.invalid {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}
.invalid-card {
  max-width: 430px;
  text-align: center;
  padding: 36px 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff06, #ffffff01), var(--panel);
}
.invalid-card .mark { margin: 0 auto 18px; }
.invalid-card h1 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.invalid-card p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.invalid-card p.muted { color: var(--dim); font-size: 12px; }

/* ---------- share drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; }
.scrim { position: absolute; inset: 0; background: #040509b8; }
.panel {
  position: relative;
  width: min(440px, 100%);
  height: 100%;
  overflow-y: auto;
  background: #101218;
  border-left: 1px solid var(--line);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slide .22s ease;
}
@keyframes slide { from { transform: translateX(18px); opacity: .6; } }
.panel-head { display: flex; align-items: flex-start; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.panel-head p { margin: 5px 0 0; font-size: 12px; line-height: 1.45; }
.panel .muted { color: var(--muted); }
.panel .small { font-size: 11px; line-height: 1.45; }
.x {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 20px; line-height: 1;
  cursor: pointer;
  flex: none;
}
.x:hover { color: var(--text); }
.warn {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #2b2110;
  border: 1px solid #4a3714;
  color: #fcd34d;
  font-size: 11.5px;
  line-height: 1.45;
}
.panel form { display: flex; flex-direction: column; gap: 7px; }
.panel label {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 4px;
}
.panel input, .panel select {
  height: 36px;
  width: 100%;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #191c24;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
}
.panel input:focus, .panel select:focus { border-color: #4c3a7a; outline: none; }
.primary {
  margin-top: 8px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid #8b5cf6;
  background: linear-gradient(180deg, #8b5cf6, #6d28d9);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.primary[disabled] { opacity: .65; cursor: progress; }
.made {
  padding: 12px;
  border-radius: 11px;
  border: 1px solid #2c3a55;
  background: #121a26;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.copyrow { display: flex; gap: 7px; }
.copyrow input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.copyrow .ctl { height: 36px; flex: none; }
.listhead { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.listhead h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.listhead .ctl { margin-left: auto; height: 28px; }
.links { display: flex; flex-direction: column; }
.linkrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.linkrow:last-child { border-bottom: 0; }
.linkrow .who { min-width: 0; }
.linkrow b {
  display: block;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.linkrow small { display: block; color: var(--dim); font-size: 10px; margin-top: 2px; }
.linkrow .end { margin-left: auto; display: flex; align-items: center; gap: 7px; flex: none; }
.linkrow .revoke {
  height: 26px;
  padding: 0 9px;
  font-size: 10px;
  color: #fca5a5;
  border-color: #4a2424;
  background: transparent;
}
.linkrow .revoke:hover { border-color: #7f2d2d; color: #fecaca; }
.tag {
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: #173023;
  color: #86efac;
}
.tag.ended { background: #262a33; color: #a1a8b3; }
.err { margin: 0; color: #fca5a5; font-size: 12px; }

/* ---------- a TV shows no cursor for a while ---------- */
.controls { transition: opacity .35s ease; }
body.idle { cursor: none; }
body.idle .controls { opacity: 0; pointer-events: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  body { overflow: auto; }
  .wall {
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chartcard, .funnelcard, .bottom { grid-column: 1 / -1; }
  .chartcard { height: 320px; }
  .bottom { grid-template-columns: 1fr; height: auto; }
  .bottom .card { min-height: 0; }
  .funnel { gap: 12px; }
  .funnel-foot { margin-top: 14px; }
}
@media (max-height: 780px) and (min-width: 1181px) {
  .bottom { height: 182px; }
  .bottom .card { padding: 9px 13px; }
  .toprow { padding: 3px 0 2px; }
  .cardhead h2 { font-size: 12px; }
  .cardhead { min-height: 20px; }
  .kpi { min-height: 104px; padding-top: 12px; padding-bottom: 10px; }
  .kpi .value { font-size: clamp(30px, 3.4vw, 44px); padding-top: 4px; }
  .kpi .meta { font-size: 10.5px; margin-top: 4px; }
  .chartcard { padding: 10px 16px 6px; }
  .funnelcard { padding: 11px 16px; }
  .funnel { gap: 3px; }
  .fstep { gap: 3px; }
  .frow { font-size: 11px; }
  .frow b { font-size: 14px; }
  .fbar { height: 4px; }
  .funnel-foot { margin-top: 6px; padding-top: 6px; font-size: 9.5px; }
  .row { padding: 2px 0; }
}
@media (max-width: 620px) {
  .wall { padding: 14px; }
  .kpis { grid-template-columns: 1fr; }
  .head { flex-wrap: wrap; }
  .controls { display: none; }
  .clockwrap { margin-left: auto; }
  .brand .name { display: none; }
  .live { display: none; }
  .kpi { min-height: 96px; }
  .kpi .value { padding-top: 6px; }
  .chartcard { height: 260px; }
  .legend { display: none; }
  .tops { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
