.toolbar {
  display: flex;
  gap: 5px;
  margin: 1em 0;
  padding: 10px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.tool-button {
  width: 50px;
  height: 50px;
  border: 2px solid #999;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Gill Sans', sans-serif;
  font-size: 20px;
  border-radius: 4px;
  position: relative;
}

.tool-button:hover {
  background: #f5f5f5;
}

.tool-button.active {
  background: #e0e0ff;
  border-color: #0000ff;
}

.tool-button .tool-icon-box {
  width: 30px;
  height: 30px;
  border: 2px solid black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

.tool-button .tool-icon-line {
  width: 30px;
  height: 2px;
  background: black;
  transform: rotate(-45deg);
}

.tool-button .tool-icon-eraser {
  font-size: 24px;
}

.tool-button .tool-icon-mouse {
  font-size: 24px;
  transform: rotate(-110deg);
  display: inline-block;
}

.tensorizer-container {
  display: flex;
  gap: 20px;
  margin: 2em 0;
}

#tensorCanvas {
  border: 2px solid #333;
  cursor: crosshair;
  background: #fafafa;
}

#tensorCanvas.dragging {
  cursor: move;
}

#tensorCanvas.eraser {
  cursor: not-allowed;
}

.controls-panel {
  min-width: 250px;
  max-width: 500px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-section {
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 4px;
  background: #f9f9f9;
}

.control-section h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-family: 'Gill Sans', sans-serif;
}

.control-section label {
  display: block;
  margin-bottom: 5px;
  font-family: 'Gill Sans', sans-serif;
  font-size: 14px;
}

.control-section input {
  width: 100%;
  padding: 5px;
  font-family: 'Gill Sans', sans-serif;
  font-size: 14px;
  box-sizing: border-box;
}


.simulation-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.sim-button {
  padding: 10px 20px;
  font-size: 16px;
  border: 2px solid #333;
  background: white;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.sim-button:hover {
  background: #f5f5f5;
}

.sim-button:active {
  background: #e0e0e0;
}

.sim-button.running {
  background: #ffe0e0;
  border-color: #cc0000;
}

.loss-plot-container {
  width: 100%;
  height: 300px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  padding: 10px;
  box-sizing: border-box;
}

#additionalSVPlotsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-top: 1em;
}

.sv-plot-item {
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  padding: 10px;
  box-sizing: border-box;
  height: 300px;
}

.sv-plot-item h4 {
  margin: 0 0 10px 0;
  font-family: 'Gill Sans', sans-serif;
  text-align: center;
}

.sv-plot-item canvas {
  width: 100%;
  height: 100%;
}

/* Floating toolbar buttons over canvas */
.floating-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.95);
  padding: 5px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.floating-toolbar .tool-button {
  width: 40px;
  height: 40px;
  border: 2px solid #999;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 4px;
}

.floating-toolbar .tool-button:hover {
  background: #f5f5f5;
}

.floating-toolbar .tool-button.active {
  background: #e0e0ff;
  border-color: #0000ff;
}

.floating-toolbar .tool-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Floating toggles in top-right */
.floating-toggles {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.floating-toggles label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.floating-toggles input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.page-help-button {
  position: absolute;
  top: 0;
  right: 0;
  height: 32px;
  border-radius: 4px;
  border: 2px solid #333;
  background: white;
  color: #333;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  transition: background-color 0.2s, color 0.2s;
}

.page-help-button:hover {
  background: #333;
  color: white;
}

/* Help overlay system */
.help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}

.help-highlight {
  position: relative;
  z-index: 101 !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.6) !important;
}

.help-label {
  position: fixed;
  background: rgba(255, 255, 255, 0.95);
  color: #d32f2f;
  border: 2px solid #d32f2f;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'Gill Sans', sans-serif;
  font-size: 13px;
  font-weight: normal;
  z-index: 102;
  pointer-events: none;
  white-space: nowrap;
}

.help-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

.help-arrow-top {
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 6px 0 6px;
  border-color: #d32f2f transparent transparent transparent;
}

.help-arrow-bottom {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 6px 8px 6px;
  border-color: transparent transparent #d32f2f transparent;
}

.help-arrow-left {
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 8px;
  border-color: transparent transparent transparent #d32f2f;
}

.help-arrow-right {
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 8px 6px 0;
  border-color: transparent #d32f2f transparent transparent;
}

.help-arrow-center {
  display: none;
}

/* Canvas wrapper for relative positioning */
.canvas-wrapper {
  position: relative;
  display: inline-block;
}

/* Floating formula display in bottom-left */
.floating-formula {
  position: absolute;
  bottom: 15px;
  left: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 15px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
  font-size: 32px;
  max-width: 400px;
  overflow-x: auto;
  line-height: 1;
  display: flex;
  align-items: center;
}

.floating-formula mjx-container {
  margin: 0 !important;
}

/* Floating properties panel in bottom-right */
.floating-properties {
  position: absolute;
  bottom: 15px;
  right: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
  min-width: 200px;
}

.floating-properties h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.floating-properties label {
  font-size: 14px;
}

.floating-properties input {
  font-size: 14px;
}
