body {
  font-family: Arial, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f5f5f5;
}

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

/* Mode Switching */
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.mode-button {
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.mode-button:hover {
  border-color: #2196f3;
  background: #f0f8ff;
}

.mode-button.active {
  background: #2196f3;
  color: white;
  border-color: #2196f3;
}

/* Canvas Mode */
.canvas-container {
  margin-bottom: 30px;
}

.canvas-instructions {
  background: #e8f5e8;
  border: 2px solid #4caf50;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.canvas-instructions h3 {
  margin-top: 0;
  color: #2e7d32;
}

.canvas-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-group {
  display: flex;
  gap: 2px;
  border: 2px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.tool-button {
  background: white;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  border-right: 1px solid #ddd;
}

.tool-button:last-child {
  border-right: none;
}

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

.tool-button.active {
  background: #2196f3;
  color: white;
}

.control-button {
  background: #ff5722;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.control-button:hover {
  background: #e64a19;
  transform: translateY(-1px);
}

.pen-size-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  color: #333;
}

.pen-size-slider {
  width: 100px;
}

.canvas-status {
  background: #e8f5e8;
  color: #2e7d32;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  border: 1px solid #4caf50;
}

.read-button {
  background: #4caf50;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  margin-left: auto;
}

.read-button:hover {
  background: #45a049;
  transform: translateY(-1px);
}

.read-button:disabled {
  background: #cccccc;
  cursor: not-allowed;
  transform: none;
}

.canvas-wrapper {
  display: flex;
  justify-content: center;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#drawingCanvas {
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: crosshair;
  background: white;
}

#drawingCanvas.eraser-mode {
  cursor: url("data:image/svg+xml,%3csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='18' height='18' x='1' y='1' fill='%23ff69b4' stroke='%23333' stroke-width='1' rx='2'/%3e%3c/svg%3e")
      10 10,
    auto;
}

/* Upload Mode inherits existing styles */

/* Mobile Optimizations */
@media (max-width: 768px) {
  .canvas-controls {
    flex-wrap: wrap;
    gap: 15px;
    padding: 12px;
  }

  .tool-group {
    order: -1; /* Put tools first on mobile */
    width: 100%;
    justify-content: center;
  }

  .tool-button {
    padding: 12px 20px;
    font-size: 16px;
    flex: 1;
  }

  .control-button {
    padding: 12px 16px;
    font-size: 16px;
  }

  .read-button {
    padding: 14px 20px;
    font-size: 16px;
  }

  .pen-size-label {
    flex: 1;
    justify-content: center;
  }

  .canvas-wrapper {
    padding: 10px;
  }

  #drawingCanvas {
    max-width: 100%;
    height: auto;
  }

  .canvas-status {
    font-size: 13px;
    padding: 8px 12px;
    text-align: center;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .canvas-controls {
    gap: 10px;
    padding: 10px;
  }

  .tool-button {
    padding: 10px 16px;
    font-size: 15px;
  }

  body {
    padding: 10px;
  }

  .header h1 {
    font-size: 24px;
  }

  .mode-button {
    padding: 10px 16px;
    font-size: 15px;
  }
}

.instructions {
  background: #e8f4fd;
  border: 2px solid #2196f3;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.instructions h3 {
  margin-top: 0;
  color: #1976d2;
}

.drop-zone {
  border: 3px dashed #ccc;
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  margin: 20px 0;
  background: white;
  transition: all 0.3s ease;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: #2196f3;
  background-color: #e8f4fd;
}

.drop-zone-text {
  color: #666;
  font-size: 18px;
  margin-bottom: 10px;
}

.sample-section {
  margin: 30px 0;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sample-image {
  max-width: 300px;
  height: auto;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: grab;
  transition: transform 0.2s ease;
}

.sample-image:hover {
  transform: scale(1.02);
}

.sample-image:active {
  cursor: grabbing;
}

.results {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 30px;
}

.result-panel {
  flex: 1;
  min-width: 300px;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-panel h3 {
  margin-top: 0;
  color: #333;
}

#imgPreview {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#parsedContent {
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  min-height: 100px;
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
}

#loading {
  display: block;
  margin: 20px auto;
}

.hidden {
  display: none !important;
}

.file-input {
  display: none;
}

.play-button {
  background: #4caf50;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.play-button:hover {
  background: #45a049;
  transform: translateY(-1px);
}

.play-button:active {
  transform: translateY(0);
}

.play-button:disabled {
  background: #cccccc;
  cursor: not-allowed;
  transform: none;
}

.play-button.playing {
  background: #ff5722;
}

.play-button.playing:hover {
  background: #e64a19;
}
