:root {
  --bg: #090a0f;
  --panel: #141723;
  --panel-2: #171a28;
  --ink: #eceff8;
  --muted: #8a91a8;
  --accent: #6d82ff;
  --grid: #262c42;
  --ok: #4ed49f;
  --error: #ff7979;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  background: radial-gradient(1200px 600px at 70% -20%, #28336a33 0%, transparent 65%), var(--bg);
  color: var(--ink);
}

.layout {
  width: min(1220px, 94vw);
  margin: 1.25rem auto 2.5rem;
  display: grid;
  gap: 0.85rem;
}

.topbar {
  min-height: 72px;
  padding: 0.2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1d2234;
}

.brand-wrap h1 {
  margin: 0.18rem 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.2rem, 2.1vw, 1.7rem);
  letter-spacing: -0.03em;
}

.brand-pill {
  margin: 0;
  display: inline-block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #2c3350;
  color: #a8b2e6;
  background: #141930;
}

.meta-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid #242b42;
  border-radius: 10px;
  padding: 1rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 150px;
  gap: 0.6rem;
  align-items: end;
}

.field label {
  display: block;
  margin-bottom: 0.36rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #98a0b8;
  font-weight: 600;
}

select,
button {
  width: 100%;
  padding: 0.58rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #2d3450;
  font: inherit;
  background: #111423;
  color: var(--ink);
}

button {
  background: #1b2140;
  border: 1px solid #2f3865;
  color: #d8ddfb;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #212854;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 0.6rem;
}

.metric-card {
  border: 1px solid #27304a;
  border-radius: 10px;
  padding: 0.74rem 0.82rem;
  background: #121622;
}

.metric-card .k {
  font-size: 0.68rem;
  color: #97a0ba;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
}

.metric-card .v {
  margin: 0.4rem 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.42rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

#trend-chart {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  background: #0f1220;
  border: 1px solid #202843;
}

.chart-wrap {
  position: relative;
}

.chart-crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #8191e54f;
  pointer-events: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  padding: 0.42rem 0.56rem;
  border: 1px solid #374069;
  border-radius: 8px;
  background: #111629;
  color: #d6dbf3;
  font-size: 0.72rem;
  line-height: 1.35;
  pointer-events: none;
  min-width: 140px;
}

.legend-row {
  margin-top: 0.66rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #9ca7c8;
  font-size: 0.72rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6d82ff;
  box-shadow: 0 0 0 3px #6d82ff33;
}

.panel-title {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #adb4cb;
}

.panel-subtitle {
  margin: 0.45rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.panel-chart {
  padding-bottom: 0.9rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.8rem;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(18px, 1fr));
  gap: 5px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid #1c2338;
  transition: transform 120ms ease, border-color 120ms ease;
}

.heatmap-cell:hover {
  transform: translateY(-1px);
  border-color: #8999ef;
}

.heatmap-scale {
  margin-bottom: 0.7rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  color: #8f98b4;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.heatmap-gradient {
  height: 8px;
  border-radius: 999px;
  border: 1px solid #2a3457;
  background: linear-gradient(90deg, #1a2140 0%, #6d82ff 100%);
}

.heatmap-hover {
  margin: 0.72rem 0 0;
  color: #a5afcb;
  font-size: 0.74rem;
}

.status p {
  margin: 0.85rem 0 0;
  color: #a4acc4;
  line-height: 1.45;
  font-size: 0.76rem;
  word-break: break-word;
}

.status-title {
  margin-top: 1.2rem;
}

.warzone-section {
  padding: 0.7rem 0.75rem 0.35rem;
  border: 1px solid #323c62;
  border-radius: 10px;
  background: linear-gradient(180deg, #161c33, #121726);
}

.warzone-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.warzone-empty {
  margin: 0.2rem 0 0;
  color: #97a2c6;
  font-size: 0.76rem;
  line-height: 1.45;
}

.warzone-item {
  padding: 0.55rem 0 0.65rem;
  border-bottom: 1px solid #20263e;
}

.warzone-item:last-child {
  border-bottom: 0;
}

.warzone-rank {
  margin: 0;
  color: #8e97b7;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.warzone-time {
  margin: 0.15rem 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.warzone-window {
  margin: 0.2rem 0 0;
  color: #adb6d7;
  font-size: 0.72rem;
}

.warzone-meta {
  margin: 0.22rem 0 0;
  color: #8693bf;
  font-size: 0.68rem;
}

.warzone-recent {
  margin: 0.45rem 0 0;
  padding-left: 1rem;
  color: #9ea9cc;
  font-size: 0.67rem;
  line-height: 1.4;
}

.status .ok {
  color: var(--ok);
}

.status .error {
  color: var(--error);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .controls,
  .metrics {
    grid-template-columns: 1fr;
  }
}
