*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  padding: 2rem;
  max-width: 960px;
  margin: 0 auto;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

/* --- Controls panel --- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #1e293b;
  border-radius: 0.5rem;
}

.control label {
  display: block;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.control input[type="range"] {
  width: 140px;
}

.control output {
  display: inline-block;
  min-width: 3.5ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

button {
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  background: #3b82f6;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover {
  background: #2563eb;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Metrics cards --- */

.metrics {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.metric {
  padding: 0.75rem 1rem;
  background: #1e293b;
  border-radius: 0.375rem;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 0.75rem;
  color: #94a3b8;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.protocol-h2 {
  color: #4ade80;
}

.protocol-h11 {
  color: #fb923c;
}

/* --- Waterfall chart --- */

.waterfall {
  position: relative;
  background: #1e293b;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  min-height: 2rem;
  overflow: hidden;
}

.waterfall-bar {
  position: absolute;
  height: 2px;
  border-radius: 1px;
  opacity: 0.8;
}

.waterfall-placeholder {
  color: #475569;
  font-size: 0.85rem;
}

/* --- Tile grid --- */

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.grid img {
  width: 32px;
  height: 32px;
  border-radius: 2px;
}

/* --- Explanation note --- */

.note {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #1e293b;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.5;
}
