:root {
  --bg: #090c12;
  --bg-soft: #0d1119;
  --surface: #111724;
  --surface-2: #161e2e;
  --border: #1f2939;
  --fg: #dde4f0;
  --muted: #7b879c;
  --accent: #4de1c1;
  --accent-dim: rgba(77, 225, 193, 0.14);
  --warn: #ffb454;
  --err: #ff5f6d;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 420px at 15% -10%, rgba(77, 225, 193, 0.07), transparent 70%),
    radial-gradient(700px 400px at 90% 0%, rgba(84, 120, 255, 0.05), transparent 70%);
  background-repeat: no-repeat;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 26px clamp(16px, 4vw, 40px) 18px;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.logo {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.logo::before { content: "❯ "; color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; }

.live { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.live .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgba(255, 180, 84, 0.5);
}
.live.on .dot { background: var(--accent); animation: pulse 2.4s infinite; }
.live.on { color: var(--accent); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(77, 225, 193, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(77, 225, 193, 0); }
  100% { box-shadow: 0 0 0 0 rgba(77, 225, 193, 0); }
}
.clock { color: var(--muted); }

main {
  padding: clamp(16px, 3vw, 28px) clamp(16px, 4vw, 40px) 40px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-areas:
    "stats stats"
    "map feed"
    "chart feed"
    "lists lists";
  max-width: 1500px;
  margin: 0 auto;
}

.stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat b {
  font-family: var(--mono);
  font-size: clamp(20px, 2.4vw, 27px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.stat span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.stat.hot b { color: var(--accent); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  margin: 0; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted);
}
.muted { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }

.map-panel { grid-area: map; }
.map { position: relative; aspect-ratio: 2 / 1; background: radial-gradient(120% 120% at 50% 0%, #0c111b, #080b11); }
.map img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.9; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.map circle.dot { fill: var(--accent); }
.map circle.ping {
  fill: none; stroke: var(--accent); stroke-width: 1.2;
  transform-origin: center;
  animation: ping 1.3s ease-out forwards;
}
@keyframes ping {
  from { r: 2; opacity: 0.9; }
  to { r: 16; opacity: 0; }
}

.tip {
  position: absolute;
  pointer-events: none;
  background: #0b0f17ee;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--fg);
  white-space: nowrap;
  transform: translate(-50%, -130%);
  z-index: 5;
}
.tip b { color: var(--accent); font-weight: 600; }

.feed-panel { grid-area: feed; display: flex; flex-direction: column; max-height: 620px; }
.feed { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.feed li.card {
  padding: 10px 14px;
  border-bottom: 1px solid #151d29;
  animation: slide 0.4s ease-out;
}
@keyframes slide { from { background: var(--accent-dim); } to { background: transparent; } }
.card-head { display: flex; align-items: baseline; gap: 7px; }
.card-head .flag { font-size: 12px; }
.card-head .ip {
  font-family: var(--mono); font-size: 12.5px; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-head .ago { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 10.5px; white-space: nowrap; }
.card-meta {
  margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap;
  color: var(--muted); font-family: var(--mono); font-size: 10.5px;
}
.card-meta .n { color: var(--fg); }
.card-meta .client { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.creds { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.cred {
  display: inline-flex; gap: 4px; align-items: baseline;
  font-family: var(--mono); font-size: 11px;
  background: rgba(77, 225, 193, 0.09);
  border: 1px solid rgba(77, 225, 193, 0.22);
  border-radius: 4px; padding: 1px 6px;
  max-width: 100%; overflow: hidden;
}
.cred .u { color: var(--fg); }
.cred .sep { color: var(--muted); }
.cred .p { color: var(--accent); }
.cred .k { color: var(--muted); font-size: 9.5px; }
.cmds { margin-top: 6px; display: flex; flex-direction: column; gap: 1px; }
.cmd {
  font-family: var(--mono); font-size: 11.5px; color: var(--warn);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmd .n { color: var(--muted); font-size: 9.5px; }
.feed-empty { padding: 28px 16px; color: var(--muted); font-size: 12.5px; text-align: center; }

.ghost {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 5px; padding: 3px 8px; font-size: 11px; font-family: var(--mono);
  cursor: pointer;
}
.ghost:hover { color: var(--fg); border-color: #2c3a50; }

.chart-panel { grid-area: chart; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 96px; padding: 14px 16px 16px; }
.chart .bar { flex: 1; background: #243349; border-radius: 2px 2px 0 0; min-height: 2px; transition: background 0.2s; }
.chart .bar.now { background: var(--accent); }
.chart .bar:hover { background: #2f4763; }
.chart .bar.now:hover { background: var(--accent); }

.lists { grid-area: lists; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.list h3 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.list ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.list li {
  position: relative;
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding-bottom: 6px;
}
.list .label { position: relative; z-index: 1; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .n { position: relative; z-index: 1; color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.list .track {
  position: absolute; left: -6px; right: -6px; bottom: 0; height: 3px;
  background: #182130; border-radius: 2px; overflow: hidden;
}
.list .track i { display: block; height: 100%; background: var(--accent-dim); border-right: 1px solid var(--accent); }

footer {
  padding: 0 clamp(16px, 4vw, 40px) 28px;
  color: #4d5666;
  font-size: 11.5px;
  font-family: var(--mono);
  max-width: 1500px;
  margin: 0 auto;
}

@media (max-width: 1080px) {
  main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stats" "map" "feed" "chart" "lists";
  }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lists { grid-template-columns: minmax(0, 1fr); }
  .feed-panel { max-height: 460px; }
}
