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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #ffffff;
  color: #000000;
  min-height: 50vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  display: flex;
  flex-direction: row;
  gap: 20px;
  max-width: 1350px;
  width: 100%;
  height: 90vh;
}

@media (max-width: 900px) {
  .container {
    flex-direction: column;
  }
}

.canvas-section {
  flex: 1;
  min-height: 0;
  background: #f5f5f5;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border: 1px solid #e0e0e0;
}

.canvas-header {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: #000000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grid-toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #000000;
}

.grid-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.grid-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.grid-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 20px;
}

.grid-toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.grid-toggle input:checked + .grid-toggle-slider {
  background-color: #000000;
}

.grid-toggle input:checked + .grid-toggle-slider:before {
  transform: translateX(20px);
}

.grid-toggle-slider:hover {
  background-color: #999;
}

.grid-toggle input:checked + .grid-toggle-slider:hover {
  background-color: #333;
}

#canvas-container {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  border-radius: 12px;
}

#canvas {
  width: 100%;
  height: 100%;
  background: #ffffff;
  cursor: crosshair;
  display: block;
}

.controls-section {
  flex: 0 0 auto;
  width: 320px;
  background: #f5f5f5;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  border: 1px solid #e0e0e0;
  overflow-y: auto;
}

@media (max-width: 1200px) {
  .controls-section {
    width: 300px;
  }
}

@media (max-width: 900px) {
  .controls-section {
    width: 100%;
    max-height: 300px;
  }
}

.controls-header {
  font-size: 1.5rem;
  font-weight: 600;
  color: #000000;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #666666;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-value {
  color: #000000;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

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

input[type="range"]::-webkit-slider-thumb:hover {
  background: #333333;
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #000000;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
  background: #333333;
  transform: scale(1.1);
}

input[type="number"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #000000;
  background: #ffffff;
  outline: none;
}

input[type="number"]:focus {
  border-color: #000000;
}

.button-group {
  display: flex;
  gap: 10px;
}

button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.reset-btn {
  background: #000000;
  color: #ffffff;
}

.reset-btn:hover {
  background: #333333;
}

.separator {
  height: 1px;
  background: #e0e0e0;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #000000;
  margin-top: 5px;
}

.results-section {
  background: #ffffff;
  border-radius: 12px;
  padding: 12px 15px;
  margin-top: 15px;
  border: 1px solid #e0e0e0;
}

.results-header {
  font-size: 1rem;
  font-weight: 600;
  color: #000000;
  margin-bottom: 12px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
}

@media (max-width: 1200px) {
  .results-grid {
    gap: 8px;
  }
}

@media (max-width: 900px) {
  .results-grid {
    gap: 6px;
  }
}

@media (max-width: 600px) {
  .results-grid {
    gap: 4px;
  }
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.result-label {
  font-size: 0.75rem;
  color: #666666;
  font-weight: 500;
}

.result-value {
  font-size: 0.9rem;
  color: #000000;
  font-weight: 600;
}

@media (max-width: 1200px) {
  .result-item {
    gap: 3px;
  }

  .result-label {
    font-size: 0.7rem;
  }

  .result-value {
    font-size: 0.7rem;
  }
}

@media (max-width: 1050px) {
  .result-item {
    gap: 3px;
  }

  .result-label {
    font-size: 0.55rem;
  }

  .result-value {
    font-size: 0.7rem;
  }
}
