/* Сброс стилей */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  position: fixed;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Панель управления */
#control-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25vh;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-top: 2px solid #0f3460;
  padding: 0;
  overflow: hidden;
  z-index: 1000;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  transition: height 0.3s ease;
}

#control-panel.collapsed {
  height: 50px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid rgba(15, 52, 96, 0.3);
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.panel-header h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
}

.toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

#panel-content {
  padding: 15px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: calc(100% - 50px);
}

#control-panel h3 {
  text-align: center;
  margin-bottom: 10px;
  color: #64b5f6;
  font-size: 1.2em;
  text-shadow: 0 0 10px rgba(100, 181, 246, 0.5);
  flex-shrink: 0;
}

.control-group {
  margin-bottom: 8px;
  padding: 8px;
  background: rgba(15, 52, 96, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(100, 181, 246, 0.2);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.control-group h4 {
  color: #90caf9;
  margin-bottom: 8px;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  flex-shrink: 0;
}

.control-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
  gap: 4px;
  flex: 1;
}

.control-item label {
  color: #e3f2fd;
  font-weight: 500;
  font-size: 0.8em;
  text-align: center;
  margin-bottom: 2px;
}

.control-item input[type="range"] {
  width: 100%;
  height: 6px;
  background: #333;
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  touch-action: pan-x;
}

.control-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #64b5f6;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(100, 181, 246, 0.5);
  transition: all 0.3s ease;
  touch-action: pan-x;
}

.control-item input[type="range"]::-webkit-slider-thumb:hover {
  background: #90caf9;
  transform: scale(1.1);
}

.control-item input[type="color"] {
  width: 100%;
  height: 25px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

.control-item span {
  color: #64b5f6;
  font-weight: bold;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 0.7em;
}

/* Кнопки режимов */
.button-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-btn {
  padding: 8px 12px;
  background: linear-gradient(135deg, #0f3460, #1a1a2e);
  color: #e3f2fd;
  border: 1px solid #64b5f6;
  border-radius: 15px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.7em;
  flex: 1;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mode-btn:hover {
  background: linear-gradient(135deg, #64b5f6, #0f3460);
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(100, 181, 246, 0.3);
}

.mode-btn.active {
  background: linear-gradient(135deg, #64b5f6, #90caf9);
  color: #000;
  box-shadow: 0 0 20px rgba(100, 181, 246, 0.6);
}

/* Статистика */
#stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

#stats div {
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(100, 181, 246, 0.3);
  font-family: 'Courier New', monospace;
  font-size: 0.7em;
  flex: 1;
  text-align: center;
}

#stats span {
  color: #64b5f6;
  font-weight: bold;
}

/* Скроллбар */
#control-panel::-webkit-scrollbar {
  width: 8px;
}

#control-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

#control-panel::-webkit-scrollbar-thumb {
  background: #64b5f6;
  border-radius: 4px;
}

#control-panel::-webkit-scrollbar-thumb:hover {
  background: #90caf9;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  #control-panel {
    height: 30vh;
    padding: 10px;
  }

  .control-group {
    margin-bottom: 4px;
    padding: 6px;
  }

  .control-item {
    margin-bottom: 4px;
  }

  .control-item label {
    font-size: 0.7em;
  }

  .control-item span {
    font-size: 0.6em;
  }

  .mode-btn {
    font-size: 0.6em;
    padding: 6px 8px;
    min-height: 40px;
  }

  #stats div {
    font-size: 0.6em;
    padding: 3px 6px;
  }
}

/* Дополнительные стили для мобильных */
@media (max-width: 480px) {
  #control-panel {
    height: 35vh;
    padding: 8px;
  }

  .control-group h4 {
    font-size: 0.8em;
  }

  .control-item label {
    font-size: 0.6em;
  }

  .control-item span {
    font-size: 0.5em;
  }

  .mode-btn {
    font-size: 0.5em;
    padding: 4px 6px;
    min-height: 36px;
  }

  #stats div {
    font-size: 0.5em;
    padding: 2px 4px;
  }
}

/* Предотвращение зума на iOS */
@media screen and (max-width: 768px) {
  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
  }
}
