html, body, #map { 
  width: 100%; 
  height: 100vh; 
  margin: 0; 
  padding: 0;
}

/* Серьезный профессиональный шрифт */
body, input, button, .control-panel {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.control-panel {
  position: absolute;
  z-index: 9999;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

@media (min-width: 769px) {
  .control-panel {
    left: 12px;
    top: 12px;
    width: 360px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    padding: 16px;
  }
  .mobile-header { display: none; }
}

@media (max-width: 768px) {
  .control-panel {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    overflow-y: auto;
  }
  
  .control-panel.collapsed {
    max-height: 60px;
    overflow: hidden;
  }
  
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    user-select: none;
  }
  
  .mobile-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
  }
  
  .mobile-toggle {
    font-size: 20px;
    transition: transform 0.3s;
  }
  
  .control-panel.collapsed .mobile-toggle {
    transform: rotate(180deg);
  }
  
  .panel-content {
    padding: 0 16px 16px 16px;
  }
  
  .control-panel.collapsed .panel-content {
    display: none;
  }
}

.control-panel h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
  border-bottom: 2px solid #4CAF50;
  padding-bottom: 8px;
}

.section {
  margin-bottom: 16px;
  position: relative;
}

.input-group {
  margin-bottom: 10px;
  position: relative;
}

.input-group label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
  font-weight: 500;
}

.input-group input, .input-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
  transition: all 0.2s;
}

.btn-primary {
  background: #4CAF50;
  color: white;
}

.btn-primary:hover {
  background: #45a049;
}

.btn-secondary {
  background: #f44336;
  color: white;
}

.btn-secondary:hover {
  background: #da190b;
}

.result-box {
  margin-top: 16px;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
  display: none;
}

.result-box.show {
  display: block;
}

.result-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
}

.result-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.result-label {
  color: #666;
  font-size: 12px;
}

.result-value {
  font-weight: 600;
  color: #333;
  text-align: right;
  font-size: 12px;
}

.price-compare {
  margin-top: 12px;
  padding: 12px;
  background: #fff3cd;
  border-radius: 6px;
  border: 1px solid #ffc107;
  font-size: 12px;
}

.price-increase {
  color: #d32f2f;
  font-weight: 600;
  font-size: 13px;
}

.api-counter {
  margin-top: 12px;
  padding: 10px;
  background: #e3f2fd;
  border-radius: 6px;
  border: 1px solid #2196F3;
  font-size: 11px;
  color: #1565C0;
}

.api-counter-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.api-counter-value {
  font-size: 16px;
  font-weight: 700;
  color: #0D47A1;
}

.price-final {
  margin-top: 12px;
  padding: 14px;
  background: #4CAF50;
  color: white;
  border-radius: 8px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.toggle-traffic {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 9999;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-traffic:hover {
  background: #f5f5f5;
}

@media (max-width: 768px) {
  .toggle-traffic {
    top: 12px;
    right: 12px;
    font-size: 12px;
    padding: 8px 12px;
  }
}

.tariff-editor {
  background: #e8f5e9;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.tariff-editor h4 {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #2e7d32;
}

.btn-apply {
  background: #FF9800;
  color: white;
  margin-top: 8px;
  display: none;
}

.btn-apply:hover {
  background: #F57C00;
}

.btn-apply.show {
  display: block;
}

.route-options {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.route-option {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid #ddd;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
}

.route-option.active {
  border-color: #4CAF50;
  background: #e8f5e9;
  font-weight: 600;
}

.route-option:hover {
  border-color: #4CAF50;
}

.section-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-toggle::after {
  content: '▼';
  font-size: 10px;
  transition: transform 0.3s;
}

.section-toggle.collapsed::after {
  transform: rotate(-90deg);
}

.collapsible-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible-content.collapsed {
  max-height: 0;
}

/* Скрыть тип маршрута до построения */
.route-type-section {
  display: none;
}

.route-type-section.visible {
  display: block;
}

/* Мобильная версия - всплывалка результатов поиска на весь экран */
@media (max-width: 768px) {
  body[data-searching="true"] .control-panel {
    max-height: 90vh !important;
  }
  
  /* Свернутый калькулятор выше */
  .control-panel.collapsed {
    max-height: 80px;
    bottom: 20px;
  }
}

/* Telegram - всплывалка на весь экран */
body.telegram-app [id^="suggest-"] {
  max-height: 70vh !important;
}

/* Фиксация поля поиска при фокусе на мобильных */
@media (max-width: 768px) {
  .input-group.search-focused {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 2147483646;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    margin: 0;
  }
  
  .input-group.search-focused input {
    margin: 0;
  }
}

/* Telegram - то же самое */
body.telegram-app .input-group.search-focused {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 2147483646;
  background: white;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  margin: 0;
}