* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e14;
  --bg-surface: #0d1117;
  --border: #21262d;
  --text: #c9d1d9;
  --text-dim: #484f58;
  --green: #3fb950;
  --blue: #58a6ff;
  --yellow: #d29922;
  --red: #f85149;
  --cyan: #39c5cf;
  --font: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  font-size: 13px;
  line-height: 1.6;
}

#terminal {
  width: 100%;
  max-width: 720px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 60px rgba(0,0,0,0.5);
}

.term-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.dots { display: flex; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }

.term-title {
  flex: 1;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

.term-body {
  padding: 16px 20px;
  min-height: 400px;
}

.prompt { color: var(--green); font-weight: 700; }
.cmd { color: var(--text); }
.dim { color: var(--text-dim); font-size: 12px; }
.line { margin: 2px 0; }

/* ── Section Header ─────────────────────────────── */
.section-header {
  color: var(--cyan);
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 8px;
}

/* ── System Row (flexbox aligned) ───────────────── */
.sys-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}

.sys-label {
  width: 4ch;
  color: var(--text-dim);
  font-weight: 600;
  flex-shrink: 0;
}

.sys-pct {
  width: 6ch;
  text-align: right;
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}

.sys-row .bar-track {
  flex: 1;
  min-width: 0;
}

.sys-note {
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Progress Bar ───────────────────────────────── */
.bar-track {
  height: 10px;
  background: #21262d;
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.bar-fill.low { background: var(--green); }
.bar-fill.mid { background: var(--yellow); }
.bar-fill.high { background: var(--red); }

/* ── Traffic Grid ───────────────────────────────── */
.traffic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin-top: 6px;
}

.traffic-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
}

.t-label {
  color: var(--text-dim);
}

.t-val {
  color: var(--text);
  font-weight: 600;
}

.t-unit {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 11px;
  margin-left: 4px;
}

/* ── Footer ─────────────────────────────────────── */
.footer-line {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 12px;
}

/* ── Chart ──────────────────────────────────────── */
.chart-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 16px;
  -webkit-overflow-scrolling: touch;
}

.chart-svg {
  width: 100%;
  height: auto;
  min-width: 600px;
}

#chart-overlay {
  touch-action: none;
}

.chart-info {
  display: flex;
  justify-content: space-around;
  margin-top: 12px;
  padding: 8px;
  background: #161b22;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 4px 12px;
}

.chart-info span {
  white-space: nowrap;
}

/* ── Posts Chart ─────────────────────────────────── */
.posts-chart-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 16px;
  -webkit-overflow-scrolling: touch;
}

.posts-chart-svg {
  width: 100%;
  height: auto;
  min-width: 600px;
}

#posts-overlay {
  touch-action: none;
}

.posts-chart-info {
  display: flex;
  justify-content: space-around;
  margin-top: 12px;
  padding: 8px;
  background: #161b22;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 4px 12px;
}

.posts-chart-info span {
  white-space: nowrap;
}

/* ── Cursor ─────────────────────────────────────── */
.cursor-blink {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--green);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 0; }
  #terminal { border-radius: 0; min-height: 100vh; }

  .sys-row {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .sys-label { width: 4ch; }
  .sys-pct { width: 6ch; }

  .sys-row .bar-track {
    flex: 1 1 100%;
    order: 3;
  }

  .sys-note {
    font-size: 11px;
  }

  .traffic-grid {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
