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

body {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  background: #000;
  color: #fff;
  line-height: 1.6;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: row;
  gap: 2rem;
  padding: 2rem;
}

.app.fullscreen {
  gap: 0;
  padding: 0;
}

.app.fullscreen .controls {
  display: none;
}

.app.fullscreen .canvas-wrap {
  padding-bottom: 0;
}

.app.fullscreen .color-previews-container {
  display: none;
}

.canvas-wrap {
  flex: 1;
  min-width: 0;
  border: 1px solid #333;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  position: relative;
  transition: border-color 0.2s ease;
  padding-bottom: 180px;
}

.canvas-wrap:hover {
  border-color: #555;
}

.canvas-toolbar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

.canvas-wrap:hover .canvas-toolbar {
  opacity: 1;
  pointer-events: all;
}

.toolbar-btn {
  width: 32px;
  height: 32px;
  padding: 0.4rem;
  border: 1px solid #666;
  border-radius: 3px;
  background: #000;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.toolbar-btn:hover {
  background: #1a1a1a;
  border-color: #999;
}

.toolbar-divider {
  width: 1px;
  background: #444;
  margin: 0 0.25rem;
}

.toolbar-btn.active {
  background: #1a1a1a;
  border-color: #fff;
}

.color-previews-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.95);
  border-top: 1px solid #333;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: all;
}

.color-previews-scroll {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: 120px;
}

.color-previews-wrapper {
  display: flex;
  gap: 0.75rem;
}

.preview-button {
  flex-shrink: 0;
  padding: 0.6rem 1rem;
  border: 1px solid #666;
  border-radius: 4px;
  background: #000;
  color: #fff;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.preview-button:hover {
  background: #1a1a1a;
  border-color: #999;
}

.preview-button.active {
  background: #333;
  border-color: #fff;
}

.view-all-btn {
  align-self: flex-start;
  border-color: #666;
}

.view-all-btn:hover {
  background: #1a1a1a;
  border-color: #999;
}

.color-preview-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.color-preview-divider {
  flex-shrink: 0;
  width: 1px;
  background: #333;
  height: 100%;
  align-self: stretch;
}

.color-preview-item:hover {
  border-color: #555;
  background: rgba(255, 255, 255, 0.05);
}

.color-preview-item.active {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.color-preview-canvas {
  width: 80px;
  height: 80px;
  border-radius: 2px;
  display: block;
}

.color-preview-label {
  font-size: 0.75rem;
  color: #888;
  text-align: center;
}

#tooltip {
  position: absolute;
  display: none;
  pointer-events: none;
  z-index: 10;

  background: rgba(10, 10, 10, 0.95);
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;

  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-line;

  max-width: 200px;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.controls {
  width: 340px;
  flex-shrink: 0;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  transition: border-color 0.2s ease;
}

.controls:hover {
  border-color: #555;
}

h1, .home-link {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-align: center;
  color: #fff;
}

.home-link {
  display: block;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.home-link:hover {
  color: #ccc;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #bbb;
  font-weight: 400;
}

input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 4px;
  border: 1px solid #444;
  background: #0f0f0f;
  color: #fff;
  font-size: 0.95rem;
  font-family: 'Times New Roman', Times, serif;
  transition: all 0.2s ease;
}

input:focus {
  outline: none;
  border-color: #666;
  background: #141414;
}

button {
  width: 100%;
  padding: 0.85rem 1.2rem;
  border: 1px solid #666;
  border-radius: 4px;
  background: #000;
  color: #fff;
  font-weight: 400;
  cursor: pointer;
  font-family: Georgia, 'Times New Roman', serif;
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
  font-size: 0.95rem;
}

button:hover {
  background: #1a1a1a;
  border-color: #999;
}

#plotButton {
  margin-top: 0.75rem;
}

#status {
  margin: 0;
  padding: 1rem;
  color: #aaa;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
  background: #050505;
  border-top: 1px solid #333;
  border-radius: 0;
  margin: -2rem -2rem 0 -2rem;
  margin-top: auto;
  text-align: center;
}


button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:disabled:hover {
  background: #000;
  color: #fff;
}

select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 4px;
  border: 1px solid #444;
  background: #0f0f0f;
  color: #fff;
  font-size: 0.9rem;
  font-family: Georgia, 'Times New Roman', serif;
  transition: all 0.2s ease;
}

select:focus {
  outline: none;
  border-color: #666;
  background: #141414;
}

select option {
  padding: 0.35rem;
  text-align: center;
  border-radius: 4px;
}

.label-with-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 0.7rem;
  color: #666;
  cursor: help;
  transition: color 0.2s;
}

.info-icon:hover {
  color: #999;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

input[type="range"] {
  flex: 1;
  width: auto;
  padding: 0;
  height: 4px;
  border-radius: 2px;
  background: #333;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #999;
  cursor: pointer;
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #999;
  cursor: pointer;
  transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

#pointSizeValue {
  font-size: 0.85rem;
  color: #888;
  min-width: 40px;
  text-align: right;
}

#speedValue {
  font-size: 0.85rem;
  color: #888;
  min-width: 40px;
  text-align: right;
}

.playback-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0;
  background: transparent;
  border-radius: 0;
  border: none;
  margin-top: 0.75rem;
}

.playback-controls button {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: #000;
  color: #fff;
  border: 1px solid #666;
  border-radius: 4px;
  font-weight: 400;
  cursor: pointer;
  font-family: Georgia, 'Times New Roman', serif;
  transition: all 0.2s;
  letter-spacing: 0.05em;
  font-size: 0.95rem;
}

.playback-controls button:hover {
  background: #1a1a1a;
  border-color: #999;
}

.playback-controls label {
  margin-bottom: 0;
  gap: 0.5rem;
  color: #bbb;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .controls {
    width: 100%;
  }

  .canvas-wrap {
    min-height: 70vw;
  }
}