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

body {
  font-family: 'Noto Sans', system-ui, sans-serif;
  background: #fff;
  color: #222;
  padding: 20px;
  min-height: 100vh;
}

.container {
  max-width: 100%;
  margin: 0;
  padding: 0 20px;
}

h1 {
  font-size: 24px;
  margin-bottom: 30px;
  text-align: center;
  font-weight: 600;
}

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

input[type="file"] {
  display: none;
}

.upload-btn {
  display: inline-block;
  padding: 12px 30px;
  background: #222;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 16px;
}

.upload-btn:hover {
  background: #444;
}

#previewSection {
  margin-top: 30px;
}

.preview-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.preview-item {
  display: flex;
  flex-direction: column;
}

.preview-item h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

#preview {
  width: 100%;
  max-width: 600px;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}

#viewer3d {
  width: 100%;
  height: 700px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f5f5f5;
  position: relative;
}

.controls {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.control-group {
  margin-bottom: 15px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
}

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

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

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

input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

.generate-btn {
  width: 100%;
  padding: 14px;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.generate-btn:hover {
  background: #444;
}

.generate-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.status {
  margin-top: 20px;
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
}

.status.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.status.error {
  background: #ffebee;
  color: #c62828;
}

.hidden {
  display: none;
}

.update-btn {
  width: 100%;
  padding: 12px;
  background: #555;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 15px;
}

.update-btn:hover {
  background: #666;
}

.update-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.toolbar::-webkit-scrollbar {
  height: 6px;
}

.toolbar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.toolbar::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.toolbar::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.tool-btn {
  width: 40px;
  height: 40px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.tool-btn:hover {
  border-color: #222;
  background: #f5f5f5;
}

.tool-btn.active {
  background: #222;
  color: #fff;
  border-color: #222;
}

.tool-btn.history-btn {
  background: #f0f8ff;
  border-color: #4a90e2;
  color: #4a90e2;
  font-weight: bold;
}

.tool-btn.history-btn:hover:not(:disabled) {
  background: #4a90e2;
  color: #fff;
  border-color: #4a90e2;
}

.tool-btn.history-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f5f5f5;
  border-color: #ddd;
  color: #999;
}

.toolbar-separator {
  width: 2px;
  height: 30px;
  background: #ddd;
  margin: 0 5px;
  align-self: center;
}

.tool-controls {
  margin-top: 10px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-controls label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.tool-controls input[type="range"] {
  flex: 1;
}

.tool-controls span {
  min-width: 40px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
}

.history-info {
  margin-top: 10px;
  padding: 10px 15px;
  background: #f0f8ff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid #e0f0ff;
}

.history-label {
  font-size: 13px;
  font-weight: 600;
  color: #4a90e2;
}

.history-counter {
  font-size: 14px;
  font-weight: 700;
  color: #222;
  background: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid #ddd;
  min-width: 50px;
  text-align: center;
}

/* Botón selector de coordenadas */
.coord-picker-btn {
  background: #fff3cd;
  border-color: #ffc107;
  color: #856404;
  font-weight: bold;
  font-size: 20px;
}

.coord-picker-btn:hover:not(.active) {
  background: #ffc107;
  color: #fff;
  border-color: #ffc107;
}

.coord-picker-btn.active {
  background: #28a745;
  color: #fff;
  border-color: #28a745;
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(40, 167, 69, 0);
  }
}

/* Panel de coordenadas */
.coord-panel {
  margin-top: 10px;
  padding: 15px;
  background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
  border-radius: 8px;
  border: 2px solid #ffc107;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
  transition: all 0.3s ease;
}

.coord-panel.hidden {
  display: none;
}

.coord-panel.show {
  display: block;
  animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.coord-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid #ffc107;
}

.coord-title {
  font-size: 14px;
  font-weight: 700;
  color: #856404;
}

.clear-coord-btn {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 18px;
  cursor: pointer;
  padding: 0 5px;
  transition: transform 0.2s;
}

.clear-coord-btn:hover {
  transform: scale(1.3);
  color: #c82333;
}

.coord-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.coord-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #ffd966;
}

.coord-label {
  font-size: 11px;
  font-weight: 600;
  color: #856404;
  margin-bottom: 4px;
}

.coord-value {
  font-size: 16px;
  font-weight: 700;
  color: #222;
  font-family: 'Courier New', monospace;
}

.coord-unit {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
}

.copy-coord-btn {
  width: 100%;
  padding: 10px;
  background: #ffc107;
  color: #222;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-coord-btn:hover {
  background: #ffca2c;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.copy-coord-btn:active {
  transform: translateY(0);
}

.mobile-view-btn {
  display: inline-block;
  padding: 12px 30px;
  background: #fff;
  color: #222;
  border: 2px solid #222;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
  margin-left: 10px;
}

.mobile-view-btn:hover {
  background: #222;
  color: #fff;
}

.mobile-view-btn.active {
  background: #222;
  color: #fff;
}

.container.mobile-preview {
  max-width: 375px;
  margin: 0 auto;
}

.container.mobile-preview .preview-grid {
  grid-template-columns: 1fr;
  flex-direction: column;
}

.container.mobile-preview #viewer3d {
  height: 500px;
}

.text-controls,
.hole-controls {
  margin-top: 10px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-controls input[type="text"] {
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.text-controls input[type="text"]:focus {
  border-color: #222;
}

.hole-controls label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
}

.hole-controls input[type="number"] {
  flex: 1;
  padding: 8px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.hole-controls input[type="number"]:focus {
  border-color: #222;
}

.apply-text-btn,
.apply-hole-btn {
  padding: 10px 20px;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.apply-text-btn:hover,
.apply-hole-btn:hover {
  background: #444;
}

.help-section {
  margin-top: 30px;
  background: #f9f9f9;
  border-radius: 6px;
  overflow: hidden;
}

.help-section details {
  cursor: pointer;
}

.help-section summary {
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  user-select: none;
  transition: all 0.2s;
}

.help-section summary:hover {
  background: #f5f5f5;
  border-color: #222;
}

.help-section details[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.help-content {
  padding: 20px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-top: none;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.help-category {
  margin-bottom: 20px;
}

.help-category:last-of-type {
  margin-bottom: 15px;
}

.help-category h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #222;
}

.help-category ul {
  list-style: none;
  padding-left: 0;
}

.help-category li {
  font-size: 13px;
  padding: 5px 0;
  padding-left: 20px;
  position: relative;
}

.help-category li:before {
  content: "→";
  position: absolute;
  left: 0;
  color: #666;
}

.help-category li strong {
  color: #222;
}

.help-tip {
  margin-top: 15px;
  padding: 12px;
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 0;
}

@media (max-width: 640px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 0 10px;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    padding: 15px;
  }

  #viewer3d {
    height: 400px;
  }
}