* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  background: #0f1117;
  color: #e6e6e6;
  font-family: system-ui, sans-serif;
}

.container {
  display: flex;
  height: 100%;
  width: 100%;
}

/* ===== 左 ===== */
.viz {
  flex: 1;
  position: relative;
  padding: 12px;
  min-width: 0;
}

.viz canvas {
  width: 100%;
  height: 100%;
  background: #0b0d12;
  border-radius: 8px;
}

.formula {
  position: absolute;
  top: 16px;
  left: 20px;
  color: #cfcfcf;
  pointer-events: none;
  line-height: 1.2; /* KaTeXの行間を調整 */
}

/* KaTeXによって生成される数式を左揃えにする */
.formula .katex-display {
  text-align: left;
}


/* ===== 凡例 ===== */
.legend {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  padding: 6px 12px;
  background: rgba(15, 17, 23, 0.8);
  border-radius: 6px;
  font-size: 12px;
  color: #ddd;
  backdrop-filter: blur(4px);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.blue { background: #4aa3ff; }
.dot.purple { background: #b26bff; width: 12px; height: 12px; opacity: 0.85; }
.dot.green { background: #4dff88; }

.line {
  width: 16px;
  height: 2px;
  background: currentColor;
}

.line.blue { color: rgba(120,160,255,0.6); }
.line.purple { color: rgba(200,140,255,0.6); }

/* ===== 右 ===== */
.controls {
  width: 320px;
  min-width: 260px;
  max-width: 40vw;
  background: #141824;
  border-left: 1px solid #222;
  padding: 16px;
  overflow-y: auto;
}

h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

label {
  display: block;
  margin: 6px 0;
  cursor: pointer;
}

button {
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: #2a3350;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: #39406b;
}

.small-canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0b0d12;
  border-radius: 6px;
  margin-bottom: 8px;
}

/* ===== 注記 ===== */
.note {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.5;
  color: #aaa;
}