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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

header {
  background: #16213e;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid #0f3460;
}

header h1 {
  font-size: 1.4rem;
  color: #e94560;
  letter-spacing: 1px;
}

header span {
  font-size: 0.85rem;
  color: #888;
}

#app {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  height: calc(100vh - 54px);
}

/* Upload */
#upload-section {
  padding: 16px 24px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

#drop-zone {
  border: 2px dashed #0f3460;
  border-radius: 8px;
  padding: 12px 24px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
  min-width: 220px;
}

#drop-zone:hover,
#drop-zone.drag-over {
  border-color: #e94560;
  background: rgba(233, 69, 96, 0.07);
}

#drop-zone label {
  cursor: pointer;
  font-size: 0.9rem;
  color: #aaa;
}

#drop-zone label strong {
  color: #e94560;
}

#file-input {
  display: none;
}

#stats-bar {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: #e94560;
}

/* Map */
#map {
  width: 100%;
  height: 100%;
  min-height: 300px;
  z-index: 0;
}

/* Elevation chart */
#elevation-section {
  background: #16213e;
  border-top: 1px solid #0f3460;
  padding: 8px 24px 4px;
  height: 160px;
  position: relative;
  overflow: visible;
}

#elevation-section h3 {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

#elevation-chart {
  width: 100% !important;
  height: 120px !important;
}

/* Controls */
#controls {
  background: #16213e;
  border-top: 2px solid #0f3460;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  background: #0f3460;
  border: none;
  color: #e0e0e0;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn:hover {
  background: #e94560;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn.active {
  background: #e94560;
}

#progress-wrap {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#progress-label {
  font-size: 0.75rem;
  color: #888;
}

#progress-slider {
  width: 100%;
  accent-color: #e94560;
  cursor: pointer;
}

#speed-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #aaa;
}

#speed-slider {
  width: 90px;
  accent-color: #e94560;
  cursor: pointer;
}

#pause-toggle-wrap {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: #aaa;
  cursor: pointer;
}

#pause-toggle-wrap input[type="checkbox"] {
  accent-color: #ff7300;
  cursor: pointer;
}

#point-info {
  font-size: 0.8rem;
  color: #aaa;
  min-width: 160px;
}

#point-info span {
  color: #e94560;
  font-weight: 600;
}

/* STL Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.75);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  padding: 28px 32px;
  min-width: 340px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.modal-box h2 {
  font-size: 1.2rem;
  color: #e94560;
  margin-bottom: 6px;
}

.modal-hint {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 20px;
}

.modal-note {
  font-size: 0.75rem;
  color: #555;
  margin: 16px 0 20px;
  line-height: 1.4;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.form-row label:first-child {
  font-size: 0.85rem;
  color: #aaa;
  white-space: nowrap;
}

.form-row input[type="number"] {
  background: #0f3460;
  border: 1px solid #1a4a80;
  color: #e0e0e0;
  border-radius: 5px;
  padding: 5px 10px;
  width: 90px;
  font-size: 0.9rem;
  text-align: right;
}

.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-group label {
  font-size: 0.85rem;
  color: #aaa;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.radio-group input[type="radio"] {
  accent-color: #e94560;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-primary {
  background: #e94560 !important;
}

.btn-primary:hover {
  background: #c73050 !important;
}

/* Screenshot modal */
.modal-box-wide {
  max-width: 900px;
  width: 92vw;
  padding: 20px 24px 16px;
}

#ss-map {
  width: 100%;
  height: 55vh;
  min-height: 320px;
  border-radius: 6px;
  overflow: hidden;
}

/* Loader */
#loader {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

#loader.visible {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #0f3460;
  border-top-color: #e94560;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error toast */
#error-toast {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #c0392b;
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 9999;
}

#error-toast.visible {
  display: block;
}
