:root {
  --bg: #0f1720;
  --panel-bg: #16212c;
  --panel-border: #22303c;
  --text: #e7edf3;
  --muted: #93a4b3;
  --accent: #2dd4bf;
  --real: #ef4444;
  --jit: #3b82f6;
  --circle: #38bdf8;
  --bar: #38bdf8;
  --theory: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
}

.topbar-title h1 {
  margin: 0;
  font-size: 1.25rem;
}

.topbar-title span {
  color: var(--muted);
  font-size: 0.85rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  padding: 16px;
  align-items: start;
  max-width: 100vw;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
}

.controls label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.controls input[type="number"] {
  width: 90px;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: #0c141b;
  color: var(--text);
}

button {
  cursor: pointer;
  border: 1px solid var(--panel-border);
  background: #1b2a37;
  color: var(--text);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

button:hover {
  background: #24384a;
}

button.danger {
  border-color: #5c2323;
  color: #ffb4b4;
}

button.danger:hover {
  background: #3a1414;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 6px 0 10px;
}

#map {
  width: 100%;
  height: 420px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  position: relative;
}

#map .mapboxgl-canvas {
  width: 100% !important;
  max-width: none;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 10px 0;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.dot.real { background: var(--real); }
.dot.jit { background: var(--jit); }
.dot.circle { background: transparent; border: 2px solid var(--circle); }
.dot.bar { background: var(--bar); }
.dot.theory { background: var(--theory); }

.table-wrap {
  max-height: 220px;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

thead th {
  position: sticky;
  top: 0;
  background: #1b2a37;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--panel-border);
}

tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid #1c2a35;
  color: var(--muted);
}

tbody tr:hover td {
  color: var(--text);
}

.chart-block {
  margin-top: 14px;
}

.chart-block h3 {
  font-size: 0.9rem;
  margin: 0 0 8px;
  color: var(--muted);
}

.chart-block canvas {
  width: 100%;
  max-width: 420px;
  background: #0c141b;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}
