:root {
  --bg: #12151b;
  --bg-panel: #1a1e26;
  --bg-panel-raised: #20252f;
  --line: #2a3040;
  --text: #e7eaf0;
  --text-muted: #8a93a6;
  --accent: #4fc3b0;
  --accent-dim: #2e5f57;
  --red: #e5484d;
  --amber: #f2a93b;
  --green: #3ecf8e;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.scanline {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
  z-index: 50;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--bg);
  background: var(--accent);
  padding: 6px 10px;
  border-radius: 4px;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-label {
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.select {
  appearance: none;
  background: var(--bg-panel-raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 36px 9px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  min-width: 220px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0L5 6L10 0' fill='none' stroke='%238a93a6' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.15s ease;
}

.select:hover, .select:focus {
  border-color: var(--accent);
  outline: none;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 6px;
  margin-right: 24px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

.tab:hover { color: var(--text); }

.tab.active { color: var(--text); }

.tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent);
}

/* ---------- Main / Panels ---------- */

main {
  flex: 1;
  padding: 28px 32px 40px;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.panel-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.legend-scale {
  width: 90px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
}

.legend-na {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

/* ---------- Heatmap table ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
}

.heatmap-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  font-family: var(--font-mono);
}

.heatmap-table th, .heatmap-table td {
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.heatmap-table thead th {
  background: var(--bg-panel-raised);
  color: var(--text-muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 2;
}

.heatmap-table .th-week {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.heatmap-table .col-param {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg-panel-raised);
  text-align: left;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text);
  min-width: 260px;
  max-width: 320px;
  white-space: normal;
}

.heatmap-table thead .col-param {
  z-index: 4;
}

.heatmap-table .col-no {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg-panel-raised);
  color: var(--text-muted);
  width: 34px;
}

.cell-score {
  font-weight: 500;
  color: #0d1117;
}

.cell-na {
  color: var(--text-muted);
  background: var(--bg-panel) !important;
  font-style: italic;
}

/* ---------- Overview list ---------- */

.overview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
}

.overview-row {
  display: grid;
  grid-template-columns: 28px 1fr 120px 56px;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.overview-no {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 12px;
}

.overview-name {
  font-size: 14px;
  font-weight: 500;
}

.overview-bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-panel-raised);
  overflow: hidden;
}

.overview-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.overview-score {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  font-size: 14px;
}

/* ---------- Footer ---------- */

footer {
  padding: 16px 32px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

footer code {
  color: var(--text);
}

/* ---------- Empty / loading states ---------- */

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

@media (max-width: 720px) {
  .topbar { padding: 16px 18px; }
  .tabs { padding: 0 18px; }
  main { padding: 20px 18px 32px; }
  .select { min-width: 160px; }
}
