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

:root {
  --bg: #0f1419;
  --surface: #1a1f2e;
  --surface2: #242a3a;
  --border: #2d3548;
  --text: #e2e8f0;
  --text-dim: #8892a4;
  --accent: #8b5cf6;
  --accent2: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

.hb-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.main-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.controls-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.controls-panel::-webkit-scrollbar {
  width: 4px;
}

.controls-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.control-section h3 {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-row {
  display: flex;
  gap: 6px;
}

.action-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--border);
}

.action-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.action-btn.primary:hover {
  background: #7c3aed;
}

.action-btn.primary.pending {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.28);
  border-color: var(--accent2);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.preset-btn {
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: var(--border);
  color: var(--text);
}

.preset-btn.active {
  background: rgba(139, 92, 246, 0.22);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.2);
}

.control-group {
  margin-bottom: 6px;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.control-group .val {
  color: var(--accent);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stat-item {
  background: var(--surface2);
  padding: 6px;
  border-radius: 6px;
  text-align: center;
}

.stat-item .stat-label {
  display: block;
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat-item .stat-val {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 1px;
}

.stat-val.bad {
  color: var(--red);
}

.stat-val.good {
  color: var(--green);
}

.display-panel {
  min-width: 0;
}

.viz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
}

.canvas-main {
  grid-column: 1 / -1;
}

.canvas-main canvas {
  height: clamp(360px, 50vh, 500px);
}

.canvas-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
  overflow: hidden;
}

.canvas-card h3 {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.canvas-card canvas {
  width: 100%;
  height: 200px;
  display: block;
  border-radius: 6px;
  background: #0d1117;
}

.education {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s;
}

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

.tab-btn.active {
  color: var(--accent);
  background: var(--surface2);
  font-weight: 600;
}

.tab-content {
  min-height: 100px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.edu-card {
  background: var(--surface2);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.edu-card h3 {
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.edu-card p {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.7;
}

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 12px 0;
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

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

  .canvas-main {
    grid-column: 1;
  }

  .controls-panel {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }

  .control-section {
    flex: 1;
    min-width: 200px;
  }
}

@media (max-width: 600px) {
  .hb-container {
    padding: 10px;
  }

  header h1 {
    font-size: 1.2rem;
  }

  .canvas-main canvas {
    height: 300px;
  }
}
